Get librespot working again

Hey guys,
A few months ago i noted that librespot didn’t work for me using a X96 Max Plus powered by a S905X3 SOC.
The Coreelec box simply didn’t show up in the Spotify-Connect device list, even without the discovery mode.
Back then i didn’t really care and simply used the great Spotify addon by marcelveldt, but the Spotify connect feature is quite unstable.

So I gave the updated version of librespot a try again, but without success.
The creator of the librespot addon awiouy seems to be quite active on the Libreelec forums, so i reached out for his help.
I showed him the logs, and this is what he answered to me:


Your log contains a lot of such lines:
Code

CoreELEC kernel: "librespot" (4646) uses deprecated CP15 Barrier instruction at 0xab353840

According to this, people aren’t / won’t be able to use Rust on Linux with CP15_BARRIER_EMULATION=y & abi.cp15_barrier=1 (emulation, default value) & arm-unknown-linux-gnueabihf toolchain.

This could be the case for CoreELEC.


So I ask the Coreelec devs know if this is a problem that could probably fixed by i don’t know maybe improving the toolchain? Or do you see the problem elsewhere?
He answered that he is willing to cooperate with you guys to fix this problem, that was already reported by other users here.

Thanks and have a nice evening :slight_smile:

Can you try this command before running librespot?

echo 2 >/proc/sys/abi/cp15_barrier

How to actually start it? I don’t have any username/password to test.

Line like this in service works

ExecStartPre=/bin/sh -c "echo 2 >/proc/sys/abi/cp15_barrier"

Well that was easy, it actually works again :joy: :ok_hand:
This issue has been there for months lol. Thank you very much.

So i don’t have to add this line to my autostart but instead edit the addon settings …?

Edit: Yeah i think you mean this file service.librespot-alsa.service right?

Cool.

Yes, put ExecStartPre line in file service.librespot-alsa.service.

No this didn’t work, only if i execute the line manually via SSH it works

How do you run librespot? I’m not familiar with this addon and don’t know how it is started. Maybe this service file must be copied to /storage/.config/system.d folder? Then edit file there.

I just enabled the addon from the Coreelec addon repository.

Then put line

echo 2 >/proc/sys/abi/cp15_barrier

in file /storage/.config/autostart.sh

Jup i think this will do it for now.
I tried copying the file to the system.d directory and changed the file permissions to 777 but i didn’t work unfortunatly.
Thank you anyway :slight_smile:

Don’t copy file service.librespot-alsa.service if you didn’t do it already before. Remove it from system.d folder and only add line in autostart.sh file. After reboot everything should be good.

1 Like

Hello,

I am glad to see that a solution was found.
Thank you @vpeter

Since revision 121 of Librespot, the addon is a pure Kodi service which does not rely on system.d anymore.
Therefore, the best way to fix the problem for all variants of librespot (pre 121, post 121, alsa custom) may be to add @vpeter’s echo command in autostart.sh.

1 Like

But that’s more like a workaround isn’t it?
I mean the autostart.sh file didn’t even exist on my coreelec in the first place.

Nice to see you here on the coreelec forums btw :smirk:

True. This echo call could be executed from python code but atm I don’t have much time to look where to add.

@vpeter you could add it here.

However, I ask myself why CoreELEC is built with CP15 barrier, if CP15 barrier can be so easily unset system wide. Does the workaround not break other parts of CoreELEC?

Do you know how to disable this feature? I don’t even know what it does.

And no, there are no other issues with this barrier.

There is this.
Not sure if it is relevant though.

I’m trying to get spotify/librespot to work, but at least on the recent nightlies, /proc/sys/abi/cp15_barrier doesn’t exist anymore. Trying to execute librespot, even as root, just returns “Illegal instruction”

Any ideas?

Hey!
How can I make librespot working again? Tried to execute this line:
echo 2 >/proc/sys/abi/cp15_barrier
unfortunately it does not works :frowning:

Which CE version? 9.2.7 or 19? It works on CE 19.

19.1-Matrix_rc1
Hmm… I should try it again but last time I tried it failed. Let me check. Maybe I did it something wrong :confused:

btw. do I have to execute that command on 19.1 or it should works out of the box?