Snap 无法使用

Snap 无法使用

由于(很可能 - 因为上次我特意检查时它在 18.10 上运行良好)更新到 Ubuntu 19.04 后,我无法让 snap 运行。我的一些软件通过 snap 自动更新,但现在不再如此。

每当我尝试在 Ubuntu 软件中运行更新软件时,它都会提示错误消息

error: system does not fully support snapd: cannot mount squashfs image using "squashfs": exec:
    "mount": executable file not found in $PATH

当我在命令行中运行时,弹出相同的消息snap refresh。我尝试添加/snap/bin到路径,但无济于事。

更多信息:我正在运行 oh-my-zsh 终端,并且路径当前配置在 中/etc/environment

编辑:重新安装 snapd:

apt install snapd
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
gyp javascript-common libjs-inherits libjs-is-typedarray libnode-dev libssl-dev libuv1-dev
Use 'sudo apt autoremove' to remove them.
The following NEW packages will be installed:
snapd
0 upgraded, 1 newly installed, 0 to remove and 3 not upgraded.
Need to get 13,4 MB of archives.
After this operation, 65,5 MB of additional disk space will be used.
Get:1 http://at.archive.ubuntu.com/ubuntu disco/main amd64 snapd amd64 2.38+19.04 [13,4 MB]
Fetched 13,4 MB in 0s (47,1 MB/s)
Selecting previously unselected package snapd.
(Reading database ... 175145 files and directories currently installed.)
Preparing to unpack .../snapd_2.38+19.04_amd64.deb ...
Unpacking snapd (2.38+19.04) ...
Setting up snapd (2.38+19.04) ...
md5sum: /etc/apparmor.d/usr.lib.snapd.snap-confine: No such file or directory
snapd.failure.service is a disabled or a static unit, not starting it.
snapd.snap-repair.service is a disabled or a static unit, not starting it.
Processing triggers for desktop-file-utils (0.23-4ubuntu1) ...
Processing triggers for mime-support (3.60ubuntu1) ...
Processing triggers for gnome-menus (3.32.0-1ubuntu1) ...
Processing triggers for man-db (2.8.5-2) ...
Processing triggers for bamfdaemon (0.5.3+18.04.20180207.2-0ubuntu1) ...
Rebuilding /usr/share/applications/bamf-2.index...

我想这些No such file or directory信息对于我的情况并没有什么帮助。

答案1

TLDR; 要修复,请创建 /etc/environment.d/,在那里的配置文件中设置路径,然后重新启动:

sudo mkdir /etc/environment.d
sudo echo -e "PATH="/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:/snap/bin"\nXDG_DATA_DIRS="/usr/local/share:/usr/share:/var/lib/snapd/desktop"" > /etc/environment.d/60-snap-icons-and-bin.conf
sudo reboot now 

我在 Ubuntu 18.04.02 LTS 又名 bionic,内核 4.15.0-50 上遇到了同样的问题。我的 snap 可以运行,但我无法查看日志、切换频道、保存快照或管理服务:

error: system does not fully support snapd: cannot mount squashfs image using "squashfs": exec:
   "mount": executable file not found in $PATH

事实证明,该问题与 squashfs 无关;我最终找到证据表明,这肯定是环境问题:

error: cannot get logs: exec: "journalctl": executable file not found in $PATH

squashfs 挂载点如下:

/var/lib/snapd/snaps/core_0000.snap on /snap/core/0000 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/nextcloud_11111.snap on /snap/nextcloud/11111 type squashfs (ro,nodev,relatime,x-gdu.hide)

我已经这样设置了 /etc/environment:

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap:/snap/bin"

看不出这是怎么回事,所以我排除了 seccomp 或 apparmor、模块、缺少的包或 snap 配置文件的问题。


当我几乎得出结论说,世界上只有两个人有这个问题时,我偶然发现了一个关于 snap 桌面应用程序的旧帖子;我修改了解决方案以适应。可能还有其他方法可以使环境正常工作 -参见 environment.d 手册.系统从以下位置获取环境变量非常不同的文件取决于你处于哪种 shell 中,或者你是否处于 shell 中。

sudo mkdir /etc/environment.d
sudo echo -e "PATH="/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:/snap/bin"\nXDG_DATA_DIRS="/usr/local/share:/usr/share:/var/lib/snapd/desktop"" > /etc/environment.d/60-snap-icons-and-bin.conf
sudo reboot now

答案2

就我而言,将具有 xz 压缩支持和循环设备的 squash fs 驱动程序编译到内核中解决了该错误。

相关内容