Librespot 'Illegal instruction' on 4.9.113-45-osmc on Vero 4K+

I updated my Vero 4K+ device to the August update with the new 4.9 kernel and unfortunately librespot doesn’t work anymore (I use it with the raspotify wrapper). Any execution of the librespot binary results in ‘Illegal instruction’.

Link to full logs (grab-logs -A after reboot): https://paste.osmc.tv/ehepudunan

I also made a core dump, which I can upload if necessary. Some basic output as I have no idea what is useful to debug this:

osmc@osmc0:~$ gdb /usr/bin/librespot core
GNU gdb (Debian 8.2.1-2+b3) 8.2.1
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "arm-linux-gnueabihf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/bin/librespot...done.
[New LWP 9376]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".
Core was generated by `/usr/bin/librespot'.
Program terminated with signal SIGILL, Illegal instruction.
#0  0xab0911d0 in num_cpus::linux::get_num_cpus ()
(gdb) where
#0  0xab0911d0 in num_cpus::linux::get_num_cpus ()
#1  0xab067a48 in tokio::runtime::threadpool::builder::Builder::new ()
#2  0xab06370c in tokio::runtime::threadpool::Runtime::new ()
#3  0xab05444c in tokio_core::reactor::Core::new ()
#4  0xaac9c480 in librespot::main ()
#5  0xab1e98f4 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb) list +
1       library/std/src/lib.rs: No such file or directory.

Hi,

Does running echo 2 | sudo tee /proc/sys/abi/cp15_barrier before starting LibreSpot help?

Thanks

Sam

I’m afraid not:

osmc@osmc0:~$ echo 2 | sudo tee /proc/sys/abi/cp15_barrier
tee: /proc/sys/abi/cp15_barrier: No such file or directory

I only have swp in that directory:

osmc@osmc0:~$ ls /proc/sys/abi
swp

I see why. Leave it with me. It might be a few days before I get back to you on this.

Is there a trivial way for me to grab this binary as a test so I can reproduce the issue?

Thanks

Sam

Thanks for your effort Sam. The librespot binary I’m using is bundled with raspotify. You could install the deb as described here:

wget https://dtcooper.github.io/raspotify/raspotify-latest.deb
sudo dpkg -i raspotify-latest.deb

It will be installed in /usr/bin/librespot.

I’ve been running in the same issue. Did not yet manage to solve it. Got Spotify running via an older threat. But raspotify was running smoother.

Interested to see if it will be solved.

The same thing happened to me when I tried to exec this file.

$ ./spotty-hf
Illegal instruction

@sam_nazarko I have the same problem with veracrypt after update.
Looks strongly related. Thus writing it here.
After update the verarcypt started to fail on start with

Illegal instruction

I have updated veracrypt with the latest version:
https://launchpad.net/veracrypt/trunk/1.24-update7/+download/veracrypt-console-1.24-Update7-Debian-10-armhf.deb

Still the same thing.
osmc@osmc:~$ gdb veracrypt
GNU gdb (Debian 8.2.1-2+b3) 8.2.1
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type “show copying” and “show warranty” for details.
This GDB was configured as “arm-linux-gnueabihf”.
Type “show configuration” for configuration details.
For bug reporting instructions, please see:
http://www.gnu.org/software/gdb/bugs/.
Find the GDB manual and other documentation resources online at:
http://www.gnu.org/software/gdb/documentation/.

For help, type “help”.
Type “apropos word” to search for commands related to “word”…
Reading symbols from veracrypt…(no debugging symbols found)…done.
(gdb) run
Starting program: /usr/bin/veracrypt
[Thread debugging using libthread_db enabled]
Using host libthread_db library “/lib/arm-linux-gnueabihf/libthread_db.so.1”.

Program received signal SIGILL, Illegal instruction.
0xaab1ea98 in ?? ()
(gdb) bt
#0 0xaab1ea98 in ?? ()
#1 0xaab221e0 in ?? ()
#2 0x00000000 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb)

Will gladly run some tests if needed.
Would be nice to understand what is this about.

@sam_nazarko you indicated you know what the issue is. Could you please share it with us? Maybe it could help us to at least find a workaround until this issue is fixed.

SIGILL error with librespot was reported previously for 4.9 kernel testing thread in January, but it was considered not important then. Hope that there will be solution this time. For now, it is easier get an old raspberry pi for Spotify Connect and not hack around on the platform that has excellent video support but was not meant to be an audiophile player (Vero 4K)

Please be patient - there are a number of issues that need to be addressed, not just this.

I completely understand that this issue gets a lower priority than others more directly related to core functionality of OSMC and the Vero. However, I would really appreciate it if you could share the few more details that you apparently know about this bug. It could help me and others to find a workaround while we wait for a solution.

Kernel configuration needs updating – you can build one yourself or wait for an update.

Hi

Hopefully the issue is now addressed with the following commit:

I’d appreciate it if you could test this and provide feedback before we potentially release this as an update to other users. To test this update:

  1. Login via the command line
  2. Edit the file /etc/apt/sources.list
  3. Add the following line: deb http://apt.osmc.tv buster-devel main
  4. Run the following commands to update: sudo apt-get update && sudo apt-get dist-upgrade && reboot
  5. Your system should have have received the update.

Please see if the issue is resolved.

I also recommend you edit /etc/apt/sources.list again and remove the line that you added after updating. This will return you to the normal update channel.

1 Like

Hi Sam,

Thanks for the update, I can start the service again now showing me it’s running again:

osmc@osmc:~$ sudo systemctl status raspotify

  • raspotify.service - Raspotify
    Loaded: loaded (/lib/systemd/system/raspotify.service; enabled; vendor preset: enabled)
    Active: active (running) since Sat 2021-08-21 07:58:12 CEST; 12s ago
    Process: 4746 ExecStartPre=/bin/mkdir -m 0755 -p /var/cache/raspotify (code=exited, status=0/SUCCESS)
    Process: 4748 ExecStartPre=/bin/chown raspotify:raspotify /var/cache/raspotify (code=exited, status=0/SUCCESS)
    Main PID: 4749 (librespot)
    Tasks: 6 (limit: 1620)
    Memory: 852.0K

now it’s only failing to register an ipv6 address for some reason. i don’t use ipv6 in my home so might still be a switch in application.

libmdns] Failed to register IPv6 receiver: Os { code: 19, kind: Other, message: “No such device” }

at least thanks for now, 1 step closer.

Also l tried to install 0.14 version.

It does not have the IPv6 error, however still not visible in Spotify App.

Link to .deb https://github.com/dtcooper/raspotify/releases/download/0.14.0/raspotify_0.14.0.librespot.20200130T014147Z.3672214_armhf.deb

I needed one extra step to get this working:

as root:

echo 2 >/proc/sys/abi/cp15_barrier

and restart the raspotify service:

systemctl restart raspotify

You could modify the raspotify unitfile to do that before it starts.
Copy the unitfile to /etc/systemd/system and edit it there:

cp /lib/systemd/system/raspotify.service /etc/systemd/system/raspotify.service

And add the line ExecStartPre=/bin/sh -c "echo 2 >/proc/sys/abi/cp15_barrier":

[Unit]
Description=Raspotify
After=network.target

[Service]
User=raspotify
Group=raspotify
Restart=always
RestartSec=10
PermissionsStartOnly=true
ExecStartPre=/bin/sh -c "echo 2 >/proc/sys/abi/cp15_barrier"
ExecStartPre=/bin/mkdir -m 0755 -p /var/cache/raspotify ; /bin/chown raspotify:raspotify /var/cache/raspotify
Environment="DEVICE_NAME=raspotify (%H)"
Environment="BITRATE=160"
Environment="CACHE_ARGS=--disable-audio-cache"
Environment="VOLUME_ARGS=--enable-volume-normalisation --volume-ctrl linear --initial-volume 100"
Environment="BACKEND_ARGS=--backend alsa"
Environment="DEVICE_TYPE=speaker"
EnvironmentFile=-/etc/default/raspotify
ExecStart=/usr/bin/librespot --name ${DEVICE_NAME} --device-type ${DEVICE_TYPE} $BACKEND_ARGS --bitrate ${BITRATE} $CACHE_ARGS $VOLUME_ARGS $OPTIONS

[Install]
WantedBy=multi-user.target

@bvdf0251 perhaps there’s a solution for you here: mdns: Failed to register IPv6 receiver · Issue #67 · librespot-org/librespot · GitHub

I see the same message, but Spotify Connect is working for me now! Thanks @sam_nazarko!

I haven’t looked into this in great detail, but I would have thought that placing the line

abi.cp15_barrier = 2

in /etc/sysctl.conf would be enough.

Yes, I can confirm that works as well.

Thanks, Will check on this later.