spotifyd
spotifyd copied to clipboard
does not start on raspberry pi 3 b+ with latest raspberry pi os 64 bit
using systemctl --user start spotifyd.service does nothing
starting spotifyd with ./spotifyd --no-daemon I get ./spotifyd: error while loading shared libraries: libsystemd.so.0: cannot open shared object file: No such file or directory
checking to see if that file exists says the one for aarch64 is there but the one for armhf is missing
pi@raspberry-pi:~ $ ls -l /lib/aarch64-linux-gnu/libsystemd.so.0* lrwxrwxrwx 1 root root 20 Jul 13 2021 /lib/aarch64-linux-gnu/libsystemd.so.0 -> libsystemd.so.0.30.0 -rw-r--r-- 1 root root 742816 Jul 13 2021 /lib/aarch64-linux-gnu/libsystemd.so.0.30.0 pi@raspberry-pi:~ $ ls -l /lib/arm-linux-gnueabihf/libsystemd.so.0* ls: cannot access '/lib/arm-linux-gnueabihf/libsystemd.so.0*': No such file or directory
trying to install the armhf version of systemd fails because it wants to remove the 64 bit version and can't
a fix for this is to have precompiled binaries for armhf and aarch64
Hi!
I have not much experience in this matter, but I found out that only the -default
and -full
releases are linking to libsystemd
(AFAICT). So you might get further by trying the -slim
version.
Apart from that, I don't know how feasible it is in general to execute binaries compiled for armhf
on aarch64
. However, you can of course build spotifyd
yourself directly on the platform.
Hope this helps!
Hello, here i found the same problem, i wasn't able to do so, downloaded spotifyd but "nothing" happens when running: spotifyd --no-daemon
I "solved" this by doing the following:
Compiled it with aarch64 (arm64v8), in a RPI 3 model B, OS release Debian GNU/Linux 11 (bullseye).
If need to, you may try the following: Before compile: installation of linux dependencies/libraries; increase swap from 100mb to 1024mb.
Important notes: It takes some time to compile
and raspberry pi may get warm
. Here, beyond the mini cooler, it was added a "table fan", just under precaution.
Installation of dependecies / libraries
sudo apt install build-essential libasound2-dev libssl-dev libpulse-dev libdbus-1-dev -y
sudo apt install cargo -y
Increase for Swap Memory, needs to reboot after done
sudo dphys-swapfile swapoff
sudo sed -i 's/CONF_SWAPSIZE=100/CONF_SWAPSIZE=1024/g' /etc/dphys-swapfile
sudo dphys-swapfile swapon
To compile
Inside source folder, it was used the following command, not checked about PKG_CONFIG_PATH, but it was compiling:
sudo bash -c 'PKG_CONFIG_PATH=/usr/lib/aarch64-linux-gnu/pkgconfig PKG_CONFIG_ALLOW_CROSS=1 cargo build --target=aarch64-unknown-linux-gnu --release > log.txt 2>&1 & disown'
To follow the log output
The process may get some time to be done, it can be checked log.txt, inside source folder, to know what is happening, using: tail -f log.txt
After compiled
Executable can be found on: ./target/aarch64-unknown-linux-gnu/release/spotifyd
It was used this following links to specify the configuration on "/home/pi/.config/spotifyd/spotifyd.conf", of how it should start, and audio device to play sound: https://github.com/Spotifyd/spotifyd/wiki/Installing-on-a-Raspberry-Pi https://spotifyd.github.io/spotifyd/config/File.html
Others informations
It was used the following url to get some ideas of how do some parts: https://github.com/Spotifyd/spotifyd/wiki/Cross-Compiling-on-Ubuntu
Good lucky.
Thanks @waldeckmatheus, I'll have to try that. I'd been hoping that by the time I moved to Bullseye, there'd be AArch64 binaries available. But I forgot to check before I upgraded yesterday.
I also haven't had any luck with cross-compiling. Spotifyd does have a cross-compilation guide, but to be honest it's really just a generic Rust cross-compilation guide.
Hi @waldeckmatheus
Tried following your inctructions on my RPi4 running Ubuntu 22.04 but ended up with this:
error[E0658]: use of unstable library feature 'bool_to_option'
--> src/config.rs:636:57
|
636 | .map(|path| Cache::new(Some(&path), audio_cache.then_some(&path), size_limit))
| ^^^^^^^^^
|
= note: see issue #80967 <https://github.com/rust-lang/rust/issues/80967> for more information
For more information about this error, try `rustc --explain E0658`.
error: could not compile `spotifyd` due to previous error
I'm not competent to take this further I think
@HonestJohn61, see #1123 for this problem and a workaround.
Hi @georgefst @HonestJohn61 @eladyn
I saw today the message and tried to compile again, after a long time since my last try to compile it by raspberry pi (without cross compiling).
Some points.
1. The version of rustc has updated over time, since last try
- I used "rustup" tool to set up rustc 1.62.1 (e092d0b6b 2022-07-16). Doing this we got this version of cargo 1.62.1 (a748cf5a3 2022-06-08) too. Following ideas on https://github.com/Spotifyd/spotifyd/issues/1123
2. It's too slow to compile it from my RPI 3 model B
- So i tried to study cross compiling today (following citation up here of @georgefst) about https://spotifyd.github.io/spotifyd/installation/Cross-Compiling-on-Ubuntu.html
- And started to adapt to my container context.
3. Compiling in container (docker)
- It was able to finish the process of building, resulting in a binary spotifyd, using docker image "debian:latest", Debian GNU/Linux 11 (bullseye), with rustc 1.62.1 and cargo 1.62.1 (cross compiling, using container). I tested right now and it's working.
- I will make some revisions (a lot of commands trying to adapt to got it, located in bash history) and try to share here the docker container image and Dockerfile source.
- In this way, we can compile it in a isolated container without installing a lot of stuffs in our host machine, and targeting to aarch64/arm64v8.
@HonestJohn61, see #1123 for this problem and a workaround.
Thanks @eladyn - that resolved the issue for me.
Hi @georgefst @HonestJohn61 @eladyn
I saw today the message and tried to compile again, after a long time since my last try to compile it by raspberry pi (without cross compiling).
Some points.
1. The version of rustc has updated over time, since last try
- I used "rustup" tool to set up rustc 1.62.1 (e092d0b6b 2022-07-16). Doing this we got this version of cargo 1.62.1 (a748cf5a3 2022-06-08) too. Following ideas on Error "use of unstable library feature" while building #1123
2. It's too slow to compile it from my RPI 3 model B
- So i tried to study cross compiling today (following citation up here of @georgefst) about https://spotifyd.github.io/spotifyd/installation/Cross-Compiling-on-Ubuntu.html
- And started to adapt to my container context.
3. Compiling in container (docker)
- It was able to finish the process of building, resulting in a binary spotifyd, using docker image "debian:latest", Debian GNU/Linux 11 (bullseye), with rustc 1.62.1 and cargo 1.62.1 (cross compiling, using container). I tested right now and it's working.
- I will make some revisions (a lot of commands trying to adapt to got it, located in bash history) and try to share here the docker container image and Dockerfile source.
- In this way, we can compile it in a isolated container without installing a lot of stuffs in our host machine, and targeting to aarch64/arm64v8.
Thanks for the reply @waldeckmatheus. I'd already successfully compiled following your original post with the workaround suggested by @eladyn. BTW the compiling process didn't take too long or overheat my RPi4 (passively cooled in an aluminium heatsink case).
1. Compiling into docker container
FROM debian:latest
#if you run it on host, make a backup to restore later.
RUN cat /dev/null > /etc/apt/sources.list
RUN echo 'deb [arch=amd64,arm64] http://deb.debian.org/debian bullseye main' >> /etc/apt/sources.list
RUN echo 'deb [arch=amd64,arm64] http://deb.debian.org/debian-security bullseye-security main' >> /etc/apt/sources.list
RUN echo 'deb [arch=amd64,arm64] http://deb.debian.org/debian bullseye-updates main' >> /etc/apt/sources.list
RUN apt update
RUN apt install gcc make gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu git curl pkg-config -y
RUN apt purge rustc -y
RUN echo "(curl https://sh.rustup.rs -sSf | sh -s -- -y --no-modify-path)" > /install-rust.sh && \
chmod 755 /install-rust.sh && \
/install-rust.sh
RUN chmod a+x /root/.cargo/env && \
/bin/sh -c /root/.cargo/env && \
/root/.cargo/bin/rustup default 1.62.1
RUN /root/.cargo/bin/rustup target add aarch64-unknown-linux-gnu
RUN echo '[target.aarch64-unknown-linux-gnu]' >> /root/.cargo/config
RUN echo 'linker="aarch64-linux-gnu-gcc"' >> /root/.cargo/config
RUN dpkg --add-architecture arm64
#RUN apt install crossbuild-essential-arm64 -y
RUN apt install libasound2-dev:arm64 libssl-dev:arm64 libpulse-dev:arm64 libdbus-1-dev:arm64 -y
RUN apt install libasound2-dev portaudio19-dev build-essential libpulse-dev libdbus-1-dev libssl-dev libudev-dev -y
RUN cd /root/ && git clone https://github.com/Spotifyd/spotifyd.git
RUN /bin/bash -c "source /root/.cargo/env \
&& cd /root/spotifyd/ \
&& PKG_CONFIG_PATH=/usr/lib/aarch64-linux-gnu/pkgconfig PKG_CONFIG_ALLOW_CROSS=1 cargo build --target=aarch64-unknown-linux-gnu --release "
Hi, As I mentioned above, spotifyd is now running fine thanks to @waldeckmatheus and @eladyn. However, spotifyd doesn't register with playerctl, and I understand this may be to do with the dbus_mpris flag not being set when the binary was compiled. Does that sound right? How would I change the instructions I followed to address this issue? From what I've read I may also need dbus_keyring too, despite running spotifyd without credentials so as to allow guest users. I should also mention that it runs headless. Thanks
@HonestJohn61 You're right that you'll need to enable the dbus_mpris
feature flag at the compile step. Just add a --features "dbus_mpris"
behind --release
.
Getting MPRIS to work on a headless system is not that easy, however.
If you need playerctl
to work, you'd probably have to launch a session for spotifyd
(e.g. via dbus-launch
) and somehow get access to that from playerctl
.
If you're happy with implementing your own solution and want to use the system bus (which is always there), you can use the newly introduced configuration option (dbus_type
, #954) and tell spotifyd
to connect to the system bus. You'll also need policies correctly set up, some examples can be found in this issue.
I should probably add a documentation page for that sometime. :sweat_smile: Hope you get it to work with that configuration!
@waldeckmatheus Thanks! That worked for me (~~except MPRIS play/pause/next/previous is erroring out for some reason~~ EDIT: this is fine - there's been a documented breaking change in the latest version).
I put that in to a file called Dockerfile
then did the following from the same directory (I have no idea how to use Docker, so it's possible there's a much better way):
sudo docker build -t spotifyd-pi-aarch64 .
sudo docker save spotifyd-pi-aarch64 -o dist.tar
sudo chown gthomas dist.tar
tar xf dist.tar
cd a30c4ac40e5a5bfee7cce225b2f25edc20d660a8469035ac5c4c9d316342409e # found by searching the JSON files for "spotifyd"
tar xf layer.tar
scp root/spotifyd/target/aarch64-unknown-linux-gnu/release/spotifyd pi:.
@georgefst Hi. Thank you for your reply. Here i found another way, may it apply.
1. About command docker build and copy of file to host machine
- 1.1 When we use docker build (example "docker build -t spotifyd-pi-aarch64 ."), it's creating an image (like a screenshot) after all instructions executed we putted on "Dockerfile".
- 1.2. We can run this image in a "isolated" container and pass some instruction to be executed, to rebuild, to copy, to install another package.
- 1.3. docker run -v $(pwd):/mountedfolder -it spotifyd-pi-aarch64:latest /bin/cp /root/spotifyd/target/aarch64-unknown-linux-gnu/release/spotifyd /mountedfolder
2. About point 1.3
- 2.1 In point 1.3, we are running this image in a container with shared volume like "pwd" (current directory) that will be used in copy of file "spotifyd" which exists into container to shared/mounted folder.
- 2.2 it will execute command "cp" (copy) and put "spotifyd" binary into "mountedfolder" (host pwd directory).
- 2.3 Later, will be stopped the container, because the only instruction was "copy file to" and it will finish.
- 2.4 After done, spotifyd will be located in your current folder.
3. Others instructions
-
- docker container ls
-
- docker container rm <name_or_containerid>
-
- docker image ls
-
- docker image rm <name_or_imageid>
It's an awesome tool: https://docs.docker.com/get-started/
The Dockerfile above worked for me for Spotifyd 0.3.4. I added && cd spotifyd && git checkout v0.3.4
to the penultimate RUN
command to pin the version, and --features dbus_mpris
to the final RUN
command to get play/pause working. Unfortunately, I can't work out how to adapt this for 0.3.5. I bump the tag in the above argument to git checkout
, one of the Rust dependencies complains about needing a newer rustc
, so I try modifying 1.62.1
to 1.64.0
, then weirdly end up with 404 errors from apt
.
So I've taken a totally different path for now. Since I already had Nix installed on my RPi, I just ran ln -s $(nix --extra-experimental-features flakes --extra-experimental-features nix-command build nixpkgs#spotifyd --print-out-paths --no-link)/bin/spotifyd
. This currently produces 0.3.4, but should pick up 0.3.5 once https://github.com/NixOS/nixpkgs/pull/227382 is merged (the latest stable Nixpkgs set, which can be used by replacing nixpkgs#spotifyd
with nixpkgs/22.11#spotifyd
, ships 0.3.3).
Hi @georgefst
- Until last contact on Oct 10, 2022, may some packages had upgraded.
- I checked new compilation some minutes ago and found some errors like about rustc version.
- error: package
time v0.3.20
cannot be built because it requires rustc 1.63.0 or newer, while the currently active rustc version is 1.62.1
- It was upgraded locally from 1.62.1 to 1.63 and a new error was found:
- error: package
spotifyd v0.3.5 (/root/spotifyd)
cannot be built because it requires rustc 1.64 or newer, while the currently active rustc version is 1.63.0
- So, i changed rustc to 1.64 version and it was compiling successfully.
- It was added your suggest of "--features dbus_mpris" at end of latest RUN command.
- I'm happy that you found a new path too, i will check package manager Nix and learn about it.
- New dockerfile compiling spotifyd v0.3.5 is shared below.
FROM debian:latest
#if you run it on host, make a backup to restore later.
RUN cat /dev/null > /etc/apt/sources.list
RUN echo 'deb [arch=amd64,arm64] http://deb.debian.org/debian bullseye main' >> /etc/apt/sources.list
RUN echo 'deb [arch=amd64,arm64] http://deb.debian.org/debian-security bullseye-security main' >> /etc/apt/sources.list
RUN echo 'deb [arch=amd64,arm64] http://deb.debian.org/debian bullseye-updates main' >> /etc/apt/sources.list
RUN apt update
RUN apt install gcc make gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu git curl pkg-config -y
RUN apt purge rustc -y
RUN echo "(curl https://sh.rustup.rs -sSf | sh -s -- -y --no-modify-path)" > /install-rust.sh && \
chmod 755 /install-rust.sh && \
/install-rust.sh
#v0.3.3 and v0.3.4: rustc 1.62.1
#v0.3.5: rustc 1.64.0
RUN chmod a+x /root/.cargo/env && \
/bin/sh -c /root/.cargo/env && \
/root/.cargo/bin/rustup default 1.64.0
RUN /root/.cargo/bin/rustup target add aarch64-unknown-linux-gnu
RUN echo '[target.aarch64-unknown-linux-gnu]' >> /root/.cargo/config
RUN echo 'linker="aarch64-linux-gnu-gcc"' >> /root/.cargo/config
RUN dpkg --add-architecture arm64
#RUN apt install crossbuild-essential-arm64 -y
RUN apt install libasound2-dev:arm64 libssl-dev:arm64 libpulse-dev:arm64 libdbus-1-dev:arm64 -y
RUN apt install libasound2-dev portaudio19-dev build-essential libpulse-dev libdbus-1-dev libssl-dev libudev-dev -y
RUN cd /root/ && git clone https://github.com/Spotifyd/spotifyd.git
RUN /bin/bash -c "source /root/.cargo/env \
&& cd /root/spotifyd/ \
&& PKG_CONFIG_PATH=/usr/lib/aarch64-linux-gnu/pkgconfig PKG_CONFIG_ALLOW_CROSS=1 cargo build --target=aarch64-unknown-linux-gnu --release --features dbus_mpris"
Unfortunately those are the same modifications I made, and I hit:
Err:28 http://deb.debian.org/debian bullseye/main amd64 krb5-locales all 1.18.3-6+deb11u2
404 Not Found [IP: 199.232.58.132 80]
Fetched 24.7 MB in 9s (2902 kB/s)
E: Failed to fetch http://deb.debian.org/debian/pool/main/g/glibc/libc6_2.31-13%2bdeb11u4_arm64.deb 404 Not Found [IP: 199.232.58.132 80]
E: Failed to fetch http://deb.debian.org/debian/pool/main/k/krb5/krb5-locales_1.18.3-6%2bdeb11u2_all.deb 404 Not Found [IP: 199.232.58.132 80]
E: Failed to fetch http://deb.debian.org/debian/pool/main/l/linux/linux-libc-dev_5.10.140-1_arm64.deb 404 Not Found [IP: 199.232.58.132 80]
E: Failed to fetch http://deb.debian.org/debian/pool/main/k/krb5/libkrb5support0_1.18.3-6%2bdeb11u2_arm64.deb 404 Not Found [IP: 199.232.58.132 80]
E: Failed to fetch http://deb.debian.org/debian/pool/main/k/krb5/libk5crypto3_1.18.3-6%2bdeb11u2_arm64.deb 404 Not Found [IP: 199.232.58.132 80]
E: Failed to fetch http://deb.debian.org/debian/pool/main/k/krb5/libkrb5-3_1.18.3-6%2bdeb11u2_arm64.deb 404 Not Found [IP: 199.232.58.132 80]
E: Failed to fetch http://deb.debian.org/debian/pool/main/k/krb5/libgssapi-krb5-2_1.18.3-6%2bdeb11u2_arm64.deb 404 Not Found [IP: 199.232.58.132 80]
E: Failed to fetch http://deb.debian.org/debian/pool/main/g/glibc/libc6-dev_2.31-13%2bdeb11u4_arm64.deb 404 Not Found [IP: 199.232.58.132 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
The command '/bin/sh -c apt install libasound2-dev:arm64 libssl-dev:arm64 libpulse-dev:arm64 libdbus-1-dev:arm64 -y' returned a non-zero code: 100
I have no idea what's causing that.
This imperfect reproducibility is one of the major reasons I prefer Nix over Docker for this sort of thing.
@waldeckmatheus used your latest docker build script and the compiled image resulted in the following error when executing on a Raspberry Pi Zero 2 W
with the latest Raspberry PI OS Lite (64-bit)
:
Running ./spotifyd --no-daemon
results in:
./spotifyd: /lib/aarch64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by ./spotifyd)
./spotifyd: /lib/aarch64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by ./spotifyd)
./spotifyd: /lib/aarch64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by ./spotifyd)
Running: sudo apt install libc6
results in:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
libc6 is already the newest version (2.31-13+rpt2+rpi1+deb11u5).
Any idea how to fix this to use the libc6
version that is already shipped with the OS?
Got it working by changing the Dockerfile like this:
FROM debian:latest
-> FROM debian:bullseye
since bullseye has the correct GLIBC which it's linking against
FROM debian:latest
#if you run it on host, make a backup to restore later.
RUN cat /dev/null > /etc/apt/sources.list
RUN echo 'deb [arch=amd64,arm64] http://deb.debian.org/debian bullseye main' >> /etc/apt/sources.list
RUN echo 'deb [arch=amd64,arm64] http://deb.debian.org/debian-security bullseye-security main' >> /etc/apt/sources.list
RUN echo 'deb [arch=amd64,arm64] http://deb.debian.org/debian bullseye-updates main' >> /etc/apt/sources.list
RUN apt update
RUN apt install gcc make gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu git curl pkg-config -y
RUN apt purge rustc -y
RUN echo "(curl https://sh.rustup.rs -sSf | sh -s -- -y --no-modify-path)" > /install-rust.sh && \
chmod 755 /install-rust.sh && \
/install-rust.sh
#v0.3.3 and v0.3.4: rustc 1.62.1
#v0.3.5: rustc 1.64.0
RUN chmod a+x /root/.cargo/env && \
/bin/sh -c /root/.cargo/env && \
/root/.cargo/bin/rustup default 1.64.0
RUN /root/.cargo/bin/rustup target add aarch64-unknown-linux-gnu
RUN echo '[target.aarch64-unknown-linux-gnu]' >> /root/.cargo/config
RUN echo 'linker="aarch64-linux-gnu-gcc"' >> /root/.cargo/config
RUN dpkg --add-architecture arm64
#RUN apt install crossbuild-essential-arm64 -y
RUN apt install libasound2-dev:arm64 libssl-dev:arm64 libpulse-dev:arm64 libdbus-1-dev:arm64 -y
RUN apt install libasound2-dev portaudio19-dev build-essential libpulse-dev libdbus-1-dev libssl-dev libudev-dev -y
RUN cd /root/ && git clone https://github.com/Spotifyd/spotifyd.git
RUN /bin/bash -c "source /root/.cargo/env \
&& cd /root/spotifyd/ \
&& PKG_CONFIG_PATH=/usr/lib/aarch64-linux-gnu/pkgconfig PKG_CONFIG_ALLOW_CROSS=1 cargo build --target=aarch64-unknown-linux-gnu --release --features dbus_mpris"