-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mopidy: Rewrite installer to use venv. #105
base: master
Are you sure you want to change the base?
Conversation
Require less sudo filesystem savagery.
I have pivoted the service to a user service, so you will need to start/stop/status with:
This allows the user Mopidy session to access the default user pipewire audio sink without any additional configuration fiddling. The downside, aiui, is that you need an active user session. Config files have also been moved to |
@Gadgetoid so if an active user session is needed for a user service, does this mean we need to auto log in the user for non-interactive use? |
mopidy/install.sh
Outdated
rm $MOPIDY_CONFIG | ||
rm $MOPIDY_DEFAULT_CONFIG |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we call rm $MOPIDY_CONFIG
but there is no file at that path, it will error out. We should either perform a file exists check before calling each of these or use -f
.
rm -f $MOPIDY_CONFIG
rm -f $MOPIDY_DEFAULT_CONFIG
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might need to add sudo raspi-config nonint do_boot_behaviour B2
to the script to auto-log in the user. I haven't yet tried it but from what I understand, user services won't be launched until the user logs in.
mopidy/install.sh
Outdated
apt update | ||
apt install -y python3-rpi.gpio python3-spidev python3-pip python3-pil python3-numpy libopenjp2-7 | ||
sudo apt update | ||
sudo apt install -y python3-spidev python3-pip python3-pil python3-numpy python3-lgpio python3-virtualenvwrapper virtualenvwrapper libopenjp2-7 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ran sudo apt-get update && sudo apt-get upgrade -y
before running install.sh
so maybe this is why I get an error: ModuleNotFoundError: No module named 'gi'
.
sudo apt install -y python3-spidev python3-pip python3-pil python3-numpy python3-lgpio python3-virtualenvwrapper virtualenvwrapper libopenjp2-7 python3-gi
However, after doing that, I received an error saying ValueError: Namespace Gst not available
. Perhaps this is because I installed a raspberry pi lite version instead of the desktop?
So I added some packages to get:
sudo apt install -y \
python3-spidev \
python3-pip \
python3-pil \
python3-numpy \
python3-lgpio \
python3-virtualenvwrapper \
virtualenvwrapper \
libopenjp2-7 \
python3-gi \
gstreamer1.0-plugins-base \
gstreamer1.0-plugins-good \
gstreamer1.0-plugins-bad \
gstreamer1.0-plugins-ugly \
gstreamer1.0-tools \
gstreamer1.0-gl \
gstreamer1.0-gtk3
@@ -193,11 +188,40 @@ echo | |||
# MAYBE?: Remove the sources.list to avoid any future issues with apt.mopidy.com failing | |||
# rm -f /etc/apt/sources.list.d/mopidy.list | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see some things in the service's logs. Mainly:
Ignoring config section 'spotify' because no matching extension was found
- Suggestion: remove the
spotify
section inmopidy.conf
and the messaging about Spotify account details at the end of the script
- Suggestion: remove the
Ignoring config section 'mpd' because no matching extension was found
- Suggestion: remove the
mpd
section frommopidy.conf
- Suggestion: remove the
/home/pi/Music is not a directory. Please create the directory or update the file/media_dirs config value.
- I think we should
mkdir -p /home/$MOPIDY_USER/Music
somewhere in the install script
- I think we should
Ok - so it was easier to just make changes and put them in a gist: https://gist.github.com/vinnybad/52aa2339c444000aa3b5e10595a15ad8 Also - I dug a bit and found that these lines were missing in
Once I did this and restarted the device (something we should consider adding into the script, or at least adding output asking the user to restart), audio started flowing. I still see errors like this in the mopidy user service though:
Not sure what that's about...but it plays 🎉 |
@vinnybad thanks for an amazingly thorough review on this. I was also seeing those "blah" "is a directory" errors, looks like a red herring but coincided with my playback not only not working but hanging mopidy 🤦 Do you mind if I grab your changes into a new commit on this branch and set you as the author? |
Yeah, I'm not super happy about this, but the alternative was making configuration changes to Pipewire that I didn't understand, and which might have knock-on effects. These changes, in fact, absolutely hosed my audio and caused the Mopidy lockups. I'm very much inclined to believe that the less config we mess with, the better. |
|
Fix errors when removing old configs. Add more required packages (and additional packages for Raspberry Pi OS lite) Fix Music directory to /home/$MOPIDY_USER/Music Add groups to $MOPIDY_USER
4634f17
to
5511baa
Compare
HI @Gadgetoid , if you want a user to be able to run their "--user" systemctl services without logging in, do: |
./install.sh
and notsudo ./install.sh
With a "mopidy" user configured I would get permissions denied errors trying to start the systemd unit, I couldn't find a workaround to this with a half hour of prodding. If anyone's got some ideas I'm all ears.
I have split out the Pirate Audio specific config using
/usr/share/mopidy/conf.d/pirate-audio.conf
, I'm not actually sure this is working yet!