Announcements
The Spotify Stars Program: Celebrating Values Week!

Help Wizard

Step 1

NEXT STEP

Ubuntu How to change Offline songs storage folder to another directory on a mounted device.

Ubuntu How to change Offline songs storage folder to another directory on a mounted device.

I'm Trying to change the offline songs storage folder to one on a mounted device. But when I'm trying to do it it says:

cannot read the contents of media

error opening directory '/media': Permission denied

I also tried to use a symbolic link, but that also didn't work (same problem).

I installed spotify with Ubuntu Software Center, and would prefer to keep it that way.

 

Does anyone have a solution or an idea that could help?

 

Reply
8 Replies

All the directories in "root" ('/') belong to root and require admin privileges to access them. It should be this way. Spotify most likely does not have permission to read from directories that belong to root. I don't recommend storing your local media files anywhere in '/' also not on '/media'. The

exception is '/home/<your_username>/' - that's the best place where to create new directories and store your personal stuff.

I understand that in most cases it wouldn't be smart to store personal data outside my home directory, but I have dual booted my laptop with Ubuntu 16.04.03 and Windows 10, and I want to use spotify on both OS's but I don't want to save all my music twice. So I created a partition which they can both access and know I want both spotify's to use that partition for their offline songs storage. In that way I have to store my offline songs only once instead of twice, and both OS's have the same music stored in that way.

 

Do you maybe know how I can give spotify the needed privileges to access my other partition. Running sudo spotify in the terminal doesn't work. When I run it it gives the following response:

mkdir: cannot create directory '/run/user/0': Permission denied

No protocol specified

(Spotify:5863 Gtk-WARNING **: cannot open display: :0

Hi daniel_vos,

have you tried to change the permissions of /media?

Try 'sudo chmod -R 777 /media'.

Also you shouldn't mount something directly in /media, because Ubuntu uses /media/username/* to mount your devices like flash drives.

I actually have a really similar setup to yours with Linux and Windows.

I solved the problem of data exchange by mounting the Windows C:// drive in /media/boot with a fstab rule (in case you don't know what this is just ask).

Gedobbles

Hi Viktors_Te,

because /media is there for mounting storage devices it is really appreciated to have access to it for the user. Also normally under Ubuntu devices are mounted under /media/username/* which the user has access to.

 

Gedobbles

Hi,

At first I didn't realise this was a case of 2 OS`s on one machine. Then it makes sense to make /media/username accessible to the user.

If 'sudo chmod ...' doesn't solve this issue then maybe try 'sudo chown -R username:root /media/username/'.

A regular snap is normally constrained and can't even access your home directory. There are two interfaces snap available to help with this. home and removable-media

 

Spotify has the home interface because we wanted people to be able to access their local files. Maybe we should add removable-media too.

 

I haven't been able to test these, but you should be able to work around it right now.

 

1. Mount the directory somewhere in $HOME either directly or a bind mount, like:

mkdir -p $HOME/media
sudo mount --bind /media $HOME/media

 

2. Reinstall spotify in classic mode, which I think should be able to access /media. 

snap remove spotify
snap install --classic spotify

Reinstall via terminal for Debian package, I just faced this issue and now I am able to open files from /media

 

# 1. Add the Spotify repository signing keys to be able to verify downloaded packages
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 0DF731E45CE24F27EEEB1450EFDC8610341D9410

# 2. Add the Spotify repository
echo deb http://repository.spotify.com stable non-free | sudo tee /etc/apt/sources.list.d/spotify.list

# 3. Update list of available packages
sudo apt-get update

# 4. Install Spotify
sudo apt-get install spotify-client

Thanks man, it worked

Suggested posts