. Advertisement .
..3..
. Advertisement .
..4..
The error: “cannot update snap namespace: cannot create symlink in “/etc/docker”: existing file in the way snap-update-ns failed with code 1” is a common error that can show up in many ways. In this blog, we will go through some of the ways you can fix this issue. Read on.
What is “cannot update snap namespace: cannot create symlink in “/etc/docker”: existing file in the way snap-update-ns failed with code 1”?
The program will give an error like below when you want to run the docker-help commands:
cannot update snap namespace: cannot create symlink in "/etc/docker": existing file in the way
snap-update-ns failed with code 1
Cause of error
This problem appears that the problem is due to Snap. Most likely the symlink isn’t in that directory of yours.
How to fix it?
Here are some ways you can refer.
Approach 1:
Simply delete the key.json file, as well as the directory /etc/docker and run the following command on your Ubuntu server to resolve this issue:
sudo rm -rf /etc/docker
sudo snap refresh
Approach 2: Follow this steps below
These steps are dependent on the current /var/lib/docker to be an actual directories (not simply a symlink that points to another directory).
- Use command to determine no docker is running :
service docker stop
- check the current docker directory again and make a backup by:
tar -zcC /var/lib docker > /mnt/pd0/var_lib_docker-backup-$(date +%s).tar.gz
- Transfer the
documenter /var/lib/docker
directory to the next partition.mv /var/lib/docker/mnt/pd
- Create a symlink by:
ln -s /mnt/pd0/docker /
Conclusion
We hope you enjoyed our article about the error. With this knowledge, we know that you can fix your issue: “cannot update snap namespace: cannot create symlink in “/etc/docker”: existing file in the way snap-update-ns failed with code 1” quickly by following these steps! If you still have any other questions about fixing this syntax error, please leave a comment below. Thank you for reading!
Leave a comment