spotify-adblock icon indicating copy to clipboard operation
spotify-adblock copied to clipboard

Spotify flatpak fix

Open pizzadude opened this issue 2 years ago • 15 comments

The actual spotify binary is in a different folder, so people may need to run spotify flatpak with something like this:

flatpak run --command=/app/extra/share/spotify/spotify --env="LD_PRELOAD=/home/user/.spotify-adblock/spotify-adblock.so" com.spotify.Client

pizzadude avatar Jul 01 '22 05:07 pizzadude

--env="LD_PRELOAD=/path/to/adblock.so" might work also?

nullndvoid avatar Sep 08 '22 16:09 nullndvoid

This doesn't load the adblocker since you set the command directly to the spotify binary. --command has to be set to sh in order for the -c '...' in the end to be executed. And if set correctly it still can't start.

For me the fix was to download the prebuilt binary instead of building it myself.

1RandomDev avatar Sep 17 '22 13:09 1RandomDev

Yeah, maybe I got it wrong.

flatpak run --command=/app/extra/share/spotify/spotify --env="LD_PRELOAD=/home/user/.spotify-adblock/spotify-adblock.so" com.spotify.Client seems to work, but I built the library in an Ubuntu distrobox container.

pizzadude avatar Sep 24 '22 17:09 pizzadude

I don't use Flatpak, so I can't test this. Can someone confirm that the path has changed, the current instructions in the README are broken and

flatpak run --command=/app/extra/share/spotify/spotify --env="LD_PRELOAD=/home/user/.spotify-adblock/spotify-adblock.so" com.spotify.Client

definitely works without breaking anything else (e.g. by overriding LD_PRELOAD like that)?

abba23 avatar Apr 09 '23 21:04 abba23

@abba23 Hey I did test it out on 2 of my Fedora computers running flatpak and it runs fine but doesnt block ads

Rand-o avatar Apr 25 '23 04:04 Rand-o

same here on archlinux

commandline: flatpak run --command=/app/extra/share/spotify/spotify --file-forwarding --env="LD_PRELOAD=/home/alsog/.spotify-adblock/spotify-adblock.so" com.spotify.Client --no-sandbox --no-zygote

ERROR: ld.so: object '/home/alsog/.spotify-adblock/spotify-adblock.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.

alsoGAMER avatar Apr 25 '23 11:04 alsoGAMER

You need to whitelist ~/.spotify-adblock with flatseal

pizzadude avatar Apr 25 '23 11:04 pizzadude

@pizzadude thanks! seems to be working fine now

alsoGAMER avatar Apr 25 '23 13:04 alsoGAMER

@pizzadude that was it :) thanks!

Rand-o avatar Apr 27 '23 04:04 Rand-o

I'm only managing to start from the command line (flatpak run --command=sh com.spotify.Client -c 'eval "$(sed s#LD_PRELOAD=#LD_PRELOAD=$HOME/.spotify-adblock/spotify-adblock.so:#g /app/bin/spotify)"') and not from the GNOME integrated .desktop file.

As Spotify is installed as a system-wide flatpak, I've tried patching both /var/lib/flatpak/app/com.spotify.Client/x86_64/stable/active/export/share/applications/com.spotify.Client.desktop and /var/lib/flatpak/app/com.spotify.Client/x86_64/stable/active/files/share/applications/com.spotify.Client.desktop but no luck.

So which even is the right .desktop file to patch? And are the instructions on the README still valid?

Regarding this:

You need to whitelist ~/.spotify-adblock with flatseal

you can also use the commands mentioned in the README if you don't want to bother with Flatseal (which is a great app, in any case): flatpak override --user --filesystem="~/.spotify-adblock/spotify-adblock.so" --filesystem="~/.config/spotify-adblock/config.toml" com.spotify.Client

They do the same thing.

axelsimon avatar Sep 25 '23 14:09 axelsimon

You need to whitelist ~/.spotify-adblock with flatseal

Hey can you go into further details as to how to do this? This is what i see with flatseal image

I'm not sure how to whitelist a specific path, if thats possible.

Motzumoto avatar Mar 15 '24 02:03 Motzumoto

It would look like this in Flatseal: image

then enter the path: image

Done.

Otherwise open a terminal and run: flatpak override --user --filesystem="~/.spotify-adblock/spotify-adblock.so" --filesystem="~/.config/spotify-adblock/config.toml" com.spotify.Client which does the same thing, it allows the flatpak to access the two files in ~/.config/spotify-adblock. In the above screenshots you can see that those two files are already visible in Flatseal, because i ran that command.

axelsimon avatar Mar 15 '24 09:03 axelsimon

It would look like this in Flatseal: ![image](https://private-user-images.githubusercontent.com/

I greatly appreciate it!

Motzumoto avatar Mar 16 '24 01:03 Motzumoto

I don't use Flatpak, so I can't test this. Can someone confirm that the path has changed, the current instructions in the README are broken and

flatpak run --command=/app/extra/share/spotify/spotify --env="LD_PRELOAD=/home/user/.spotify-adblock/spotify-adblock.so" com.spotify.Client

definitely works without breaking anything else (e.g. by overriding LD_PRELOAD like that)?

One year after you asked, on a fresh Arch install, this command is working for me while the one in the readme gave "command not found". Unlike the other poster, I am not seeing ads.

pyro12 avatar Apr 10 '24 22:04 pyro12

Don't know what happened, but I had to change it to

flatpak run --command=/app/extra/share/spotify/spotify --env="LD_PRELOAD=/home/$USER/.spotify-adblock/spotify-adblock.so" com.spotify.Client

to get it working again. Haven't used it in a couple weeks so I can't say when the issue first occurred. Other than a couple system updates (pacman -Syu), I haven't changed anything. I guess I did install STEAM flatpak which is currently running if that matters.

I was getting the same error as @alsoGAMER and also running Arch.

pyro12 avatar Apr 30 '24 03:04 pyro12