How to place your snaps elsewhere than /var/lib/snapd

Hi There.

I struggled with this myself, as i could not find any one clear guide with the requisite steps, so I thought I’d just show everyone exactly what I did to make it work.

I want mine to be in /opt/snapd

Please note, this was on Manjaro, but i see no reason it should not function elsewhere: (given the proper install command, of course)

First, install snapd

sudo pacman -Sy snapd

Then disable snapd and snapd.socket services:

sudo systemctl stop snapd
sudo systemctl disable --now snapd.socket

Then move the snapd folder to the desired location, for me that was in opt

sudo mv /var/lib/snapd /opt/snapd

Then create a new snapd folder in /var/lib/snapd

sudo mkdir /var/lib/snapd

We then mount the dir containing the actual files into the original snapd path, using mount --bind like so:

sudo mount --bind /opt/snapd /var/lib/snapd

Then, to use apps with classic confinement, we need to symlink snap to the root, it’s important though that it’s linked from /var/lib/snapd, this will do the trick:

sudo ln -s /var/lib/snapd/snap /snap

Now we should be good to actually start the snapd service

sudo systemctl enable --now snapd.socket

and finally we need to make certain that the dir mount is performed at every startup, elsewise whatever you install in this session will not work after next reboot. First open fstab (i used nano for this):

(warning though: messing this file up can break your system, so do not touch the existing lines!)

sudo nano /etc/fstab 

we add the following line to the end of the /etc/fstab

/opt/snapd /var/lib/snapd none bind 0 0

Reenable snapd services:

sudo systemctl enable --now snapd.socket
sudo systemctl start snapd

And that’s that. To verify that everything works, login to the snap store:

snap login youremail@address.domain

and install some app, since we wish to verify that everything works, including classic confinement, lets go for Visual Studio Code:

snap install vscode --classic

Run the app to make sure it can start:

snap run vscode

Once it has, i advice rebooting and try starting it again. If it worked before reboot, but not after, go back and verify that the line you added to /etc/fstab was correct.

I hope this helps someone. Cheers! :slight_smile:


you definitely want to use systemctl to stop the snapd and the snapd.socket sevices before doing your first mv command above, to not pull out the carpet underneath the running snapd !


Thanks for this, very helpful. However, I think in your line:

sudo ln -s /var/lib/snapd/snap /snap

the order of the args is wrong as this creates a link in /snap? It suggests that this step is not necessary, I created a backup of my snapd dir and I don’t see snap in there?



Would there be any different commands for a debian based system?