installing snaps fails with mount error

Asked by Carl Friedrich Bolz-Tereick

Installing snaps fails for me with the following error:

$ sudo snap install firefox
[sudo] password for cfbolz:
error: cannot perform the following tasks:
- Run configure hook of "firefox" snap if present (run hook "configure": cannot perform operation: mount --make-rprivate /var/lib/snapd/hostfs/writable: No such file or directory)

The same thing happens with other snaps I've tried, eg inkscape.

I've updated from 21.10 to 22.04 yesterday. I think the error was there before, but now I need to fix this since firefox is now a snap only.

How would I start debugging this?

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu snapd Edit question
Assignee:
No assignee Edit question
Solved by:
Carl Friedrich Bolz-Tereick
Solved:
Last query:
Last reply:
Revision history for this message
Manfred Hampl (m-hampl) said :
#1

For diagnostic purposes please provide the output that you receive for the following commands:

uname -a
lsb_release -crid
apt policy snapd
ls -ld /var/lib/snapd/hostfs/wr*

Revision history for this message
Manfred Hampl (m-hampl) said :
#2

... and also the output of

snap list

Revision history for this message
Samuele Pedroni (pedronis) said :
#3

does the system by chance have a /writable dir at all?

could there be reason why on the system https://github.com/snapcore/snapd/blob/master/cmd/libsnap-confine-private/classic.c#L15 would not return SC_DISTRO_CLASSIC?

Revision history for this message
Carl Friedrich Bolz-Tereick (cfbolz) said :
#4

sure:

$ uname -a
Linux drais 5.15.0-27-generic #28-Ubuntu SMP Thu Apr 14 04:55:28 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

$ lsb_release -crid
Distributor ID: Ubuntu
Description: Ubuntu 22.04 LTS
Release: 22.04
Codename: jammy

$ apt policy snapd
snapd:
  Installed: 2.54.3+21.10.1ubuntu0.3
  Candidate: 2.55.3+22.04ubuntu1
  Version table:
     2.55.3+22.04ubuntu1 500
        500 http://de.archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages
     2.55.3+22.04 500
        500 http://de.archive.ubuntu.com/ubuntu jammy/main amd64 Packages
 *** 2.54.3+21.10.1ubuntu0.3 100
        100 /var/lib/dpkg/status

$ ls -ld /var/lib/snapd/hostfs/wr*
ls: cannot access '/var/lib/snapd/hostfs/wr*': No such file or directory

$ snap list
Name Version Rev Tracking Publisher Notes
bare 1.0 5 latest/stable canonical✓ base
core18 20220309 2344 latest/stable canonical✓ base
core20 20220329 1434 latest/stable canonical✓ base
gnome-3-28-1804 3.28.0-19-g98f9e67.98f9e67 161 latest/stable canonical✓ -
gnome-3-34-1804 0+git.3556cb3 77 latest/stable/… canonical✓ -
gnome-3-38-2004 0+git.1f9014a 99 latest/stable canonical✓ -
gtk-common-themes 0.1-59-g7bca6ae 1519 latest/stable canonical✓ -
josm r18427 109 latest/stable mvo -
rustup 1.24.3 1027 latest/stable dsilvers classic
snapd 2.55.3 15534 latest/stable canonical✓ snapd

@pedronis: no, the directory is not there:

$ ls -l /var/lib/snapd/hostfs/
total 0

Revision history for this message
Carl Friedrich Bolz-Tereick (cfbolz) said :
#5

@pedronis: re sc_classify_distro: I looked at that logic and this is what /etc/os-release looks like:

$ cat /etc/os-release
PRETTY_NAME="Ubuntu 22.04 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04 (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy

so none of the core-indicating strings are found there.

/meta/snap.yaml also exists.

Revision history for this message
Manfred Hampl (m-hampl) said :
#6

  Installed: 2.54.3+21.10.1ubuntu0.3
  Candidate: 2.55.3+22.04ubuntu1

You have an outdated version of the snapd package installed.
Please install all updates

sudo apt update
sudo apt full-upgrade

and copy/paste all output if there are errors reported.

Revision history for this message
Carl Friedrich Bolz-Tereick (cfbolz) said :
#7

I got this error:

The following packages have unmet dependencies:
 firefox-locale-de : Depends: firefox (>= 1:1snap1-0ubuntu2) but it is not installed
 firefox-locale-en : Depends: firefox (>= 1:1snap1-0ubuntu2) but it is not installed

obviously, since the snap install failed. I removed them, which let the full-upgrade continue

Afterwards I have this:

$ apt policy snapd
snapd:
  Installed: 2.55.3+22.04ubuntu1
  Candidate: 2.55.3+22.04ubuntu1
  Version table:
 *** 2.55.3+22.04ubuntu1 500
        500 http://de.archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages
        100 /var/lib/dpkg/status
     2.55.3+22.04 500
        500 http://de.archive.ubuntu.com/ubuntu jammy/main amd64 Packages

$ snap version
snap 2.55.3+22.04ubuntu1
snapd 2.55.3+22.04ubuntu1
series 16
ubuntu 22.04
kernel 5.15.0-27-generic

unfortunately the error persist:

$ snap install firefox
error: cannot perform the following tasks:
- Run configure hook of "firefox" snap if present (run hook "configure": cannot perform operation: mount --make-rprivate /var/lib/snapd/hostfs/writable: No such file or directory)

Revision history for this message
Samuele Pedroni (pedronis) said :
#8

> /meta/snap.yaml also exists (https://paste.ubuntu.com/p/4qpDTMsNmh/)

that shouldn't be there, snapd itself wouldn't unpack/write something like that in the root directory, unless it's a subtle bug but we didn't hear such reports so far, because snapd in general doesn't unpack snaps for its operations and only reads meta/snap.yaml, doesn't write it AFAIR.

It could be the outcome of some miscommand or something done as root? it's hard to know if it happend a while ago.

The immediate fix is to rm -rf /meta

but double checking if there is no other unexpected top level dirs, data from an unpacked audicity sprinkled across the system could be good.

Revision history for this message
Manfred Hampl (m-hampl) said :
#9

Is there anything in the system logs with respect to snap?

sudo dmesg | grep snap

Revision history for this message
Samuele Pedroni (pedronis) said :
#10

> but double checking if there is no other unexpected top level dirs, data from an unpacked audicity sprinkled across the system could be good.

I suggested looking for dirs/file with the same/close mod time as the unexpected meta/snap.yaml.

Revision history for this message
Carl Friedrich Bolz-Tereick (cfbolz) said :
#11

Thank you very much Samuele and Manfred! deleting /meta made the installation of firefox work.

here's the list of files with the same mod date owned by root are here:

https://paste.ubuntu.com/p/pvQkb8wXCv/