在 Ubuntu 19.04 上取消 root 屏蔽(“-.mount”)是不合理的

wil*_*ill 5 usb-drive mount systemd

最近更新后,我在使用 Ubuntu 19.04 的不同机器上遇到了这个问题,并且在我的 DVD 和 USB 驱动器开始安装时出现问题后,我变得非常好奇。

\n\n

在处理过程中apt我看到:

\n\n
   GDBus.Error:org.freedesktop.systemd1.UnitMasked: Unit -.mount is masked.\n
Run Code Online (Sandbox Code Playgroud)\n\n

此消息会在不同时间出现。我担心这与最近可移动媒体自动安装失败有关。例如:

\n\n
 $ sudo apt update\n Hit:1 http://au.archive.ubuntu.com/ubuntu disco InRelease\n Get:2 http://au.archive.ubuntu.com/ubuntu disco-updates InRelease [97.5 kB]                                                              \n Get:3 http://au.archive.ubuntu.com/ubuntu disco-backports InRelease [88.8 kB]                                                            \n Hit:4 https://dl.yarnpkg.com/debian stable InRelease                                                                                     \n Ign:5 http://dl.google.com/linux/chrome/deb stable InRelease                                                                             \n Get:6 http://security.ubuntu.com/ubuntu disco-security InRelease [97.5 kB]                                                               \n Hit:7 http://ppa.launchpad.net/danielrichter2007/grub-customizer/ubuntu disco InRelease                                              \n Hit:8 http://dl.google.com/linux/chrome/deb stable Release                                                                               \n Hit:10 https://packages.microsoft.com/repos/vscode stable InRelease                                                                      \n Hit:11 http://ppa.launchpad.net/teejee2008/ppa/ubuntu disco InRelease                                      \n Fetched 284 kB in 2s (168 kB/s)                           \n Error: GDBus.Error:org.freedesktop.systemd1.UnitMasked: Unit -.mount is masked.\n Reading package lists... Done\n Building dependency tree       \n Reading state information... Done\n All packages are up to date.\n
Run Code Online (Sandbox Code Playgroud)\n\n

发出...后

\n\n
 $ sudo apt upgrade \n
Run Code Online (Sandbox Code Playgroud)\n\n

...今天早上命令,当我的 USB 驱动器插入我的笔记本电脑时,它们都没有自动安装。昨天我的桌面上有这个(再次在最近的apt upgrade- ing之后)。我闻到了一股鱼腥味。

\n\n

另一个可能相关的问题是(只读)DVD 无法正确读取。首先,除非我使用Disks(GUI)安装它们,否则它们不会安装,然后 VLC 和 dvd-backup 似乎找不到标题等。

\n\n

一切都回到:“ Unit -.mount is masked.”(见下文)。

\n\n

我对世间万物的理解systemd是“-.mount”就是root(/)。我正在寻找信息来帮助我找到比unmask-ing root 更好的解决方案。

\n\n

有没有办法让事情重新回到正轨?

\n\n

相关问题

\n\n\n\n

调查

\n\n

我正在记录到目前为止我已经查看过的此问题的故障排除,然后在先检查之前重新启用某些内容?

\n\n

我做了一些挖掘,因为我很惊讶我竟然拥有“ UnitMasked”东西……什么是“蒙面”?man页面来看——

\n\n
$ man systemctrl \n\n  :\nmask UNIT...\n       Mask one or more units, as specified on the command line. This will link these unit files to /dev/null, making it\n       impossible to start them. This is a stronger version of disable, since it prohibits all kinds of activation of the unit,\n       including enablement and manual activation. Use this option with care. \n : \n
Run Code Online (Sandbox Code Playgroud)\n\n

哪个包裹或东西让我烦恼?

\n\n

这不是一个容易回答的问题——据我了解,我在控制台上看到的消息是:

\n\n
  GDBus.Error:org.freedesktop.systemd1.UnitMasked: Unit -.mount is masked.\n
Run Code Online (Sandbox Code Playgroud)\n\n

这就引出了一个问题,什么是:\'-.mount在这种情况下,什么是:\'\'?

\n\n

到目前为止,我在查询中查看的信息是,SystemD“包”使用的“单元”遇到了名为“-.mount”的问题。我想考虑的第一件事是确定哪个包有问题,而这绝对是用我必须手头的(或我所知道的)工具来完成的事情要简单得多。请建议更好的管理和故障排除工具systemd,您有一些建议。

\n\n

对我来说,我决定查看所有活动服务,看看哪些服务产生了该问题。我会制作一个简短的 bash 脚本,xargs可以调用它来戳service {} status并添加一些格式:

\n\n
 #!/bin/bash\n #   file: tmp.bash\n ################################\n\n svice="${1}"\n\n echo "------[${svice}]-----"\n service "${svice}"  status\n echo "        ======"\n echo\n
Run Code Online (Sandbox Code Playgroud)\n\n

并为每个活动服务调用此方法systemd...

\n\n
 service  --status-all | fgrep "[ + ]" | awk -e \'{ print $4 }\' | xargs -i  ./tmp/tmp.bash "{}"  \\; | less\n
Run Code Online (Sandbox Code Playgroud)\n\n

我需要添加less到末尾以避免 22 个自动分页status

\n\n

扫描此输出中的“-.mount”的结果是:

\n\n
 ------[dbus]-----\n \xe2\x97\x8f dbus.service - D-Bus System Message Bus\n    Loaded: loaded (/lib/systemd/system/dbus.service; static; vendor preset: enabled)\n    Active: active (running) since Wed 2019-09-11 17:32:39 AEST; 1 weeks 1 days ago\n      Docs: man:dbus-daemon(1)\n  Main PID: 1011 (dbus-daemon)\n     Tasks: 1 (limit: 4915)\n    Memory: 5.7M\n    CGroup: /system.slice/dbus.service\n            \xe2\x94\x94\xe2\x94\x801011 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only\n\n Sep 20 10:32:50 4TELLT70 dbus-daemon[1011]: [system] Activating via systemd: service name=\'org.freedesktop.PackageKit\' unit=\'packagekit.service\' requested by \':1.6013\' (uid=0 pid=23179 comm="/usr/bin/gdbus call --system --dest org.freedeskto" label="kernel")\n Sep 20 10:32:50 4TELLT70 dbus-daemon[1011]: [system] Activation via systemd failed for unit \'packagekit.service\': Unit -.mount is masked.\n Sep 20 10:32:53 4TELLT70 dbus-daemon[1011]: [system] Activating via systemd: service name=\'org.freedesktop.fwupd\' unit=\'fwupd.service\' requested by \':1.367\' (uid=1000 pid=9453 comm="/usr/bin/gnome-software --gapplication-service " label="kernel")\n Sep 20 10:32:53 4TELLT70 dbus-daemon[1011]: [system] Activation via systemd failed for unit \'fwupd.service\': Unit -.mount is masked.\n Sep 20 10:36:08 4TELLT70 dbus-daemon[1011]: [system] Activating via systemd: service name=\'org.freedesktop.PackageKit\' unit=\'packagekit.service\' requested by \':1.6057\' (uid=0 pid=24456 comm="/usr/bin/gdbus call --system --dest org.freedeskto" label="kernel")\n Sep 20 10:36:08 4TELLT70 dbus-daemon[1011]: [system] Activation via systemd failed for unit \'packagekit.service\': Unit -.mount is masked.\n Sep 20 10:36:08 4TELLT70 dbus-daemon[1011]: [system] Activating via systemd: service name=\'org.freedesktop.PackageKit\' unit=\'packagekit.service\' requested by \':1.6057\' (uid=0 pid=24456 comm="/usr/bin/gdbus call --system --dest org.freedeskto" label="kernel")\n Sep 20 10:36:08 4TELLT70 dbus-daemon[1011]: [system] Activation via systemd failed for unit \'packagekit.service\': Unit -.mount is masked.\n Sep 20 10:36:14 4TELLT70 dbus-daemon[1011]: [system] Activating via systemd: service name=\'org.freedesktop.fwupd\' unit=\'fwupd.service\' requested by \':1.367\' (uid=1000 pid=9453 comm="/usr/bin/gnome-software --gapplication-service " label="kernel")\n Sep 20 10:36:14 4TELLT70 dbus-daemon[1011]: [system] Activation via systemd failed for unit \'fwupd.service\': Unit -.mount is masked.\n         ======\n
Run Code Online (Sandbox Code Playgroud)\n\n

可以概括为以下几个包:

\n\n
    \n
  • 包服务
  • \n
  • fwupd服务
  • \n
\n\n

接下来我发现了这个漂亮的小命令:

\n\n
 systemctl list-unit-files\n
Run Code Online (Sandbox Code Playgroud)\n\n

其中提供了大量的单位和状态列表。寻找未蒙面的单位似乎是一个公平的问题......

\n\n
 $ systemctl list-unit-files | fgrep "masked"\n -.mount                                    masked-runtime \n boot-efi.mount                             masked-runtime \n boot.mount                                 masked-runtime \n       :\n     56 results\n       :\n umountroot.service                         masked         \n x11-common.service                         masked   \n\n $ systemctl list-unit-files | fgrep masked | fgrep fwupd\n $ systemctl list-unit-files | fgrep masked | fgrep package\n
Run Code Online (Sandbox Code Playgroud)\n\n

这给了我 56 个要扫描的单位。没有一个是:packagekit也没有fwupd

\n\n

单位语法:-.mount让我困惑,直到我看到下面链接的文章[ 1 ]中的“将斜线改为破折号” :.mount

\n\n
    \n
  • mount:该单元定义系统上由 systemd 管理的挂载点。它们以安装路径命名,斜线改为破折号。/etc/fstab 中的条目可以自动创建单元。
  • \n
  • automount:.automount 单元配置将自动安装的安装点。它们必须以它们引用的安装点命名,并且必须有一个匹配的 .mount 单元来定义安装的细节。
  • \n
\n\n

对我来说,关键的一点是破折号(“-”)据说代表路径中的斜杠(/)——使其成为root

\n\n

据我了解,那么:“ -.mount”是:“/ ”(根)。不是这样吗?

\n\n

有了这些知识,我尝试unmaskrestart活动

\n\n
  $ sudo systemctl unmask packagekit.service\n  $ sudo service packagekit restart\n Failed to restart packagekit.service: Unit -.mount is masked.\n  $ sudo systemctl restart packagekit.service\n Failed to restart packagekit.service: Unit -.mount is masked.\n
Run Code Online (Sandbox Code Playgroud)\n\n
\n\n

更新

\n\n

今天 Ubuntu 有一个更新。问题仍然存在。我之前发现 DVD 问题与编解码器有关,并且已解决。

\n\n

我还显示了所请求的列表

\n\n
    \n
  • lsblk -f
  • \n
  • cat /etc/fstab
  • \n
\n\n

升级快结束时,再次出现与以下内容相关的错误:umount问题相关的错误。

\n\n
$ sudo apt upgrade -y\nReading package lists... Done\nBuilding dependency tree       \nReading state information... Done\nCalculating upgrade... Done\nThe following packages will be upgraded:\nbluez bluez-cups bluez-obexd e2fsprogs libbluetooth3 libcom-err2 libext2fs2 libsdl2-2.0-0 libss2 libssl1.1 netplan.io openssl\nqemu-block-extra qemu-kvm qemu-system-common qemu-system-data qemu-system-gui qemu-system-x86 qemu-utils tzdata yarn\n21 to upgrade, 0 to newly install, 0 to remove and 0 not to upgrade.\nNeed to get 13.2 MB of archives.\nAfter this operation, 66.6 kB of additional disk space will be used.\nGet:1 http://au.archive.ubuntu.com/ubuntu disco-updates/main amd64 libext2fs2 amd64 1.44.6-1ubuntu0.1 [160 kB]\nGet:2 https://dl.yarnpkg.com/debian stable/main amd64 yarn all 1.19.0-1 [890 kB]  \n\nCurrent default time zone: \'Australia/Sydney\'\nLocal time is now:      Fri  4 Oct 00:04:06 AEST 2019.\nUniversal Time is now:  Thu Oct  3 14:04:06 UTC 2019.\nRun \'dpkg-reconfigure tzdata\' if you wish to change it.\n\nSetting up bluez (5.50-0ubuntu2.1) ...\nFailed to restart bluetooth.service: Unit -.mount is masked.\ninvoke-rc.d: initscript bluetooth, action "restart" failed.\n\xe2\x97\x8f bluetooth.service - Bluetooth service\nLoaded: loaded (/lib/systemd/system/bluetooth.service; enabled; vendor preset: enabled)\nActive: active (running) since Thu 2019-09-19 08:26:47 AEST; 2 weeks 0 days ago\n    Docs: man:bluetoothd(8)\nMain PID: 1451 (bluetoothd)\nStatus: "Running"\n    Tasks: 1 (limit: 4915)\nMemory: 2.8M\nCGroup: /system.slice/bluetooth.service\n        \xe2\x94\x94\xe2\x94\x801451 /usr/lib/bluetooth/bluetoothd\n\nOct 03 07:29:21 woodypear bluetoothd[1451]: Endpoint unregistered: sender=:1.15593 path=/MediaEndpoint/A2DPSource\nOct 03 07:29:21 woodypear bluetoothd[1451]: Endpoint unregistered: sender=:1.15593 path=/MediaEndpoint/A2DPSink\nOct 03 07:29:25 woodypear bluetoothd[1451]: Loading LTKs timed out for hci0\nOct 03 07:29:25 woodypear bluetoothd[1451]: Endpoint registered: sender=:1.15593 path=/MediaEndpoint/A2DPSource\nOct 03 07:29:25 woodypear bluetoothd[1451]: Endpoint registered: sender=:1.15593 path=/MediaEndpoint/A2DPSink\nOct 03 20:36:54 woodypear bluetoothd[1451]: Endpoint unregistered: sender=:1.15593 path=/MediaEndpoint/A2DPSource\nOct 03 20:36:54 woodypear bluetoothd[1451]: Endpoint unregistered: sender=:1.15593 path=/MediaEndpoint/A2DPSink\nOct 03 20:36:58 woodypear bluetoothd[1451]: Loading LTKs timed out for hci0\nOct 03 20:36:58 woodypear bluetoothd[1451]: Endpoint registered: sender=:1.15593 path=/MediaEndpoint/A2DPSource\nOct 03 20:36:58 woodypear bluetoothd[1451]: Endpoint registered: sender=:1.15593 path=/MediaEndpoint/A2DPSink\ndpkg: error processing package bluez (--configure):\ninstalled bluez package post-installation script subprocess returned error exit status 1\nSetting up libss2:amd64 (1.44.6-1ubuntu0.1) ...\nSetting up qemu-system-data (1:3.1+dfsg-2ubuntu3.5) ...\nSetting up bluez-cups (5.50-0ubuntu2.1) ...\nSetting up libbluetooth3:amd64 (5.50-0ubuntu2.1) ...\nSetting up yarn (1.19.0-1) ...\nSetting up libsdl2-2.0-0:amd64 (2.0.9+dfsg1-1ubuntu1.19.04.1) ...\nSetting up openssl (1.1.1b-1ubuntu2.4) ...\nSetting up qemu-block-extra:amd64 (1:3.1+dfsg-2ubuntu3.5) ...\nSetting up qemu-system-common (1:3.1+dfsg-2ubuntu3.5) ...\nFailed to restart qemu-kvm.service: Unit -.mount is masked.\nFailed to try-restart qemu-kvm.service: Unit -.mount is masked.\nSetting up qemu-system-x86 (1:3.1+dfsg-2ubuntu3.5) ...\nSetting up e2fsprogs (1.44.6-1ubuntu0.1) ...\nupdate-initramfs: deferring update (trigger activated)\nSetting up qemu-utils (1:3.1+dfsg-2ubuntu3.5) ...\nSetting up qemu-kvm (1:3.1+dfsg-2ubuntu3.5) ...\nProcessing triggers for man-db (2.8.5-2) ...\nProcessing triggers for dbus (1.12.12-1ubuntu1.1) ...\nProcessing triggers for libc-bin (2.29-0ubuntu2) ...\nProcessing triggers for systemd (240-6ubuntu5.7) ...\nProcessing triggers for initramfs-tools (0.131ubuntu19.1) ...\nupdate-initramfs: Generating /boot/initrd.img-5.2.9-050209-generic\nErrors were encountered while processing:\nbluez\nError: GDBus.Error:org.freedesktop.systemd1.UnitMasked: Unit -.mount is masked.\nE: Sub-process /usr/bin/dpkg returned an error code (1)\n
Run Code Online (Sandbox Code Playgroud)\n\n

块设备/lsblk -f

\n\n

我会删除snap相关的安装座,除非这实际上可能是相关的。我无法使用lxd,唯一可用的安装似乎是snap.

\n\n
 $ sudo lsblk -f\nNAME        FSTYPE   LABEL    UUID                                 FSAVAIL FSUSE% MOUNTPOINT\nloop0       squashfs                                                     0   100% /snap/lxd/11985\nloop1       squashfs                                                     0   100% /snap/core/7396\nloop2       squashfs                                                     0   100% /snap/fwupd/880\nloop3       squashfs                                                     0   100% /snap/gnome-system-monitor/100\nloop5       squashfs                                                     0   100% /snap/core18/1098\nloop6       squashfs                                                     0   100% /snap/gnome-characters/296\nloop7       squashfs                                                     0   100% /snap/gnome-3-26-1604/92\nloop8       squashfs                                                     0   100% /snap/gnome-logs/73\nloop9       squashfs                                                     0   100% /snap/gnome-3-28-1804/67\nloop10      squashfs                                                     0   100% /snap/gnome-characters/317\nloop11      squashfs                                                     0   100% /snap/gnome-calculator/406\nloop12      squashfs                                                     0   100% /snap/gtk-common-themes/1313\nloop13      squashfs                                                     0   100% /snap/gtk-common-themes/1198\nloop15      squashfs                                                     0   100% /snap/gnome-3-26-1604/90\nloop16      squashfs                                                     0   100% /snap/core/7713\nloop17      squashfs                                                              \nloop18      squashfs                                                     0   100% /snap/gnome-system-monitor/95\nloop19      squashfs                                                     0   100% /snap/core18/1144\nloop20      squashfs                                                     0   100% /snap/gnome-3-28-1804/71\nloop21      squashfs                                                     0   100% /snap/gnome-calculator/501\nloop22      btrfs    default  ea3db848-1e70-4c8a-b602-66f3efXXXX                \nloop23      squashfs                                                     0   100% /snap/fwupd/1023\nloop24      squashfs                                                     0   100% /snap/lxd/11964\nloop25      squashfs                                                     0   100% /snap/gnome-logs/81\nsda                                                                               \n\xe2\x94\x9c\xe2\x94\x80sda1      vfat              5888-2C75                            1013.2M     1% /boot/efi\n\xe2\x94\x9c\xe2\x94\x80sda2      ext4              fa69a588-5a3c-4f5d-beff-d5c5f7XXXX     30.5G    46% /\n\xe2\x94\x9c\xe2\x94\x80sda3      ext4     Backup   81b6a1e3-0674-4c8c-b5ff-80010fXXXX    104.8G    46% /Backup\n\xe2\x94\x94\xe2\x94\x80sda5      ext4     Moort    c88ac1c9-9c80-4d56-9faf-5a3210XXXX    115.6G    87% /Moort\nsdb                                                                               \n\xe2\x94\x94\xe2\x94\x80sdb1      btrfs    zpanda   353f4608-a9be-464e-b9e5-6e53771XXX    779.3G    79% /mnt/Zpanda\nsdc                                                                               \n\xe2\x94\x94\xe2\x94\x80sdc1      ntfs     Xpanda   7CF02B31F02AXXX                        1.5T    17% /mnt/Xpanda\nsdd                                                                               \n\xe2\x94\x94\xe2\x94\x80sdd1      vfat     ALEX-06  38BF-XXX                               8.2G    86% /media/username/AAAAA\nsde                                                                               \n\xe2\x94\x94\xe2\x94\x80sde1      exfat    GGGGGG    C3EC-XXX                             117.2G     2% /media/username/GGGGGG\nsr0                                                                               \n
Run Code Online (Sandbox Code Playgroud)\n\n

标有“GGGGGG”的 USB 未自动安装。这样就不一致了。有时它会自动安装,有时则不会。exfat它是用随带提供的 Ubutnu 进行格式化的drives

\n\n

坐骑/cat /etc/fstab

\n\n

我相信安装错误是指systemd模块而不是驱动器(但是我可以发现我没有走在正确的轨道上)。

\n\n
 $ cat /etc/fstab \n# /etc/fstab: static file system information.\n#\n# Use \'blkid\' to print the universally unique identifier for a\n# device; this may be used with UUID= as a more robust way to name devices\n# that works even if disks are added and removed. See fstab(5).\n#\n#   <file system>                        <mount point>        <type>    <options>           <dump>  <pass>\n#\n#   / was on /dev/sda2 during installation\n#\n    UUID=fa69a588-5a3c-4f5d-beff-d5c5f70XXXX    /               ext4    errors=remount-ro   0       1\n\n##\n#   /boot/efi was on /dev/sda1 during installation\n#\n    UUID=5888-XXXX                              /boot/efi       vfat    umask=0077          0       1\n\n##\n#   /Moort partition\n#\n    UUID=c88ac1c9-9c80-4d56-9faf-5a3210XXXX     /Moort          ext4    defaults            0       1\n    /Moort/work                                 /work           none    bind\n\n##\n#   /Backup partition\n#\n    UUID=81b6a1e3-0674-4c8c-b5ff-80010XXXX      /Backup         ext4    defaults            0       2\n\n##\n#   /mnt/Xpanda partition\n#\n    UUID=7CF02B31F0XXXX                         /mnt/Xpanda     ntfs   umask=007,fmask=137,dmask=027,uid=XXXX,gid=XXXXX,nls=utf8,utf8      0       2\n\n##\n#   /mnt/Zpanda partition\n#\n    UUID=353f4608-a9be-464e-b9e5-6e53771XXXX    /mnt/Zpanda     btrfs   defaults            0       1\n\n##\n#\n    /swapfile                                   none            swap    sw                  0       0\n
Run Code Online (Sandbox Code Playgroud)\n\n
\n\n

参考

\n\n