Skip to content
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

Spotify flatpak fix #112

Open
pizzadude opened this issue Jul 1, 2022 · 15 comments · May be fixed by #184
Open

Spotify flatpak fix #112

pizzadude opened this issue Jul 1, 2022 · 15 comments · May be fixed by #184

Comments

@pizzadude
Copy link

pizzadude commented Jul 1, 2022

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

@nullndvoid
Copy link

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

@1RandomDev
Copy link

1RandomDev commented Sep 17, 2022

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.

@pizzadude
Copy link
Author

pizzadude commented Sep 24, 2022

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.

@abba23
Copy link
Owner

abba23 commented Apr 9, 2023

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)?

@Rand-o
Copy link

Rand-o commented Apr 25, 2023

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

@alsoGAMER
Copy link

alsoGAMER commented Apr 25, 2023

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.

@pizzadude
Copy link
Author

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

@alsoGAMER
Copy link

@pizzadude thanks! seems to be working fine now

@Rand-o
Copy link

Rand-o commented Apr 27, 2023

@pizzadude that was it :) thanks!

@axelsimon
Copy link

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.

@Motzumoto
Copy link

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.

@axelsimon
Copy link

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.

@Motzumoto
Copy link

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

I greatly appreciate it!

@pyro12
Copy link

pyro12 commented Apr 10, 2024

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
Copy link

pyro12 commented Apr 30, 2024

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.

@guihkx guihkx linked a pull request Sep 15, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants