Polish snap-update-ns related error messages

While doing some unrelated testing, I noticed that going from edge back to beta fails for me:

17-06-21T16:38:28+02:00 ERROR cannot update mount namespace of snap "core": cannot update preserved namespace of snap "core": cannot update snap namespace: cannot switch mount namespace: invalid argument

After talking with @zyga-snapd it appears that there is a bug in cmd.go that runs the wrong snap-update-ns helper. It always uses “current”.

Uh oh…

As a side note, this error message really needs some love.

I think I found the problem, our code in cmd.go:InternalToolPath() assumes that there is always a /snap/core/current symlink. However that is not the case when we refresh core for example.

This PR: https://github.com/snapcore/snapd/pull/3512 should fix it. It simply takes filepath.Dir(os.ReadLink("/proc/self/exec")) as the base-dir for the InternalTools (like snap-seccomp or snap-update-ns).

ah, yes there’s no current if the core snap is inactive like during the first part of a refresh

Now that the main issue has been sorted, reassigning to @zyga-snapd for the secondary issue which is polishing that error message.

1 Like