在最近的更新之后,我在使用 Ubuntu 19.04 的不同机器上遇到了这个问题,当我的 DVD 和 USB 驱动器开始出现安装困难时,我变得非常好奇。
在apt
处理过程中我看到:
GDBus.Error:org.freedesktop.systemd1.UnitMasked: Unit -.mount is masked.
此消息在不同时间出现。我担心这与最近可移动媒体自动挂载失败有关。例如:
$ sudo apt update
Hit:1 http://au.archive.ubuntu.com/ubuntu disco InRelease
Get:2 http://au.archive.ubuntu.com/ubuntu disco-updates InRelease [97.5 kB]
Get:3 http://au.archive.ubuntu.com/ubuntu disco-backports InRelease [88.8 kB]
Hit:4 https://dl.yarnpkg.com/debian stable InRelease
Ign:5 http://dl.google.com/linux/chrome/deb stable InRelease
Get:6 http://security.ubuntu.com/ubuntu disco-security InRelease [97.5 kB]
Hit:7 http://ppa.launchpad.net/danielrichter2007/grub-customizer/ubuntu disco InRelease
Hit:8 http://dl.google.com/linux/chrome/deb stable Release
Hit:10 https://packages.microsoft.com/repos/vscode stable InRelease
Hit:11 http://ppa.launchpad.net/teejee2008/ppa/ubuntu disco InRelease
Fetched 284 kB in 2s (168 kB/s)
Error: GDBus.Error:org.freedesktop.systemd1.UnitMasked: Unit -.mount is masked.
Reading package lists... Done
Building dependency tree
Reading state information... Done
All packages are up to date.
在发出...之后
$ sudo apt upgrade
... 命令今天早上,当我将 USB 驱动器插入笔记本电脑时,它们都没有自动安装。我昨天在台式机上也遇到了这种情况(再次是最近apt upgrade
-英)我感觉有些事情不太对劲。
另一个可能相关的问题是无法正确读取(只读)DVD。首先,除非我使用Disks
(GUI)安装它们,否则它们不会安装,然后 VLC 和 dvd-backup 似乎找不到标题,等等。
一切又回到:“”Unit -.mount is masked.
“(见下文)。
我对世间万物的理解systemd
是“-.mount”是 root(/)。我正在寻找信息来帮助我找到比unmask
-ing root 更好的解决方案。
有没有什么办法可以让事情再次好起来?
相关问题:
- 单元 packagekit.service 被屏蔽
- 在这种情况下,仅
packagekit.service
报告被掩盖。
- 在这种情况下,仅
- https://stackoverflow.com/questions/57778341/error-gdbus-errororg-freedesktop-systemd1-unitmasked-unit-mount-is-masked
- 也存在问题:“
Unit -.mount is masked.
” - 目前还没有答案——因此我又做了一些调查。
- 也存在问题:“
调查:
我正在记录到目前为止针对此问题所进行的故障排除,然后再重新启用它,然后再进行检查?
我进行了一些挖掘,因为令我惊讶的是,我UnitMasked
竟然有“ ”东西......何谓“蒙面”? 从页面man
--
$ man systemctrl
:
mask UNIT...
Mask one or more units, as specified on the command line. This will link these unit files to /dev/null, making it
impossible to start them. This is a stronger version of disable, since it prohibits all kinds of activation of the unit,
including enablement and manual activation. Use this option with care.
:
哪个包裹或物品令我烦恼?
这不是一个可以简单回答的问题——据我了解,我在控制台上看到的消息是:
GDBus.Error:org.freedesktop.systemd1.UnitMasked: Unit -.mount is masked.
这就引出了一个问题:-.mount
在这种情况下,“ ”是什么?
到目前为止,我查询的信息是 SystemD“包”使用的“单元”在名为“-.mount”的命令上遇到了问题。我首先想到的是确定哪个包出现了问题,而使用我手头上的工具(或我所知道的工具)来解决这个问题绝对不是件容易的事情。请推荐一些更好的工具来管理和排除故障,systemd
您有什么建议吗?
对我来说,我决定查看所有活动服务,看看哪些服务会产生该问题。我会制作一个简短的 bash 脚本,xargs
可以调用该脚本来戳一下service {} status
并添加一些格式:
#!/bin/bash
# file: tmp.bash
################################
svice="${1}"
echo "------[${svice}]-----"
service "${svice}" status
echo " ======"
echo
并为每个活动服务调用此函数systemd
...
service --status-all | fgrep "[ + ]" | awk -e '{ print $4 }' | xargs -i ./tmp/tmp.bash "{}" \; | less
我需要将其添加到末尾以避免该命令默认提供的less
22 个自动分页。status
扫描此输出中的“-.mount”的结果是:
------[dbus]-----
● dbus.service - D-Bus System Message Bus
Loaded: loaded (/lib/systemd/system/dbus.service; static; vendor preset: enabled)
Active: active (running) since Wed 2019-09-11 17:32:39 AEST; 1 weeks 1 days ago
Docs: man:dbus-daemon(1)
Main PID: 1011 (dbus-daemon)
Tasks: 1 (limit: 4915)
Memory: 5.7M
CGroup: /system.slice/dbus.service
└─1011 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only
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")
Sep 20 10:32:50 4TELLT70 dbus-daemon[1011]: [system] Activation via systemd failed for unit 'packagekit.service': Unit -.mount is masked.
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")
Sep 20 10:32:53 4TELLT70 dbus-daemon[1011]: [system] Activation via systemd failed for unit 'fwupd.service': Unit -.mount is masked.
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")
Sep 20 10:36:08 4TELLT70 dbus-daemon[1011]: [system] Activation via systemd failed for unit 'packagekit.service': Unit -.mount is masked.
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")
Sep 20 10:36:08 4TELLT70 dbus-daemon[1011]: [system] Activation via systemd failed for unit 'packagekit.service': Unit -.mount is masked.
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")
Sep 20 10:36:14 4TELLT70 dbus-daemon[1011]: [system] Activation via systemd failed for unit 'fwupd.service': Unit -.mount is masked.
======
可以概括为以下几个包:
- 软件包工具包.服务
- fwupd.服务
接下来我发现了这个巧妙的小命令:
systemctl list-unit-files
它给出了一个巨大的单位和状态列表。寻找未屏蔽的单位似乎是一个合理的问题...
$ systemctl list-unit-files | fgrep "masked"
-.mount masked-runtime
boot-efi.mount masked-runtime
boot.mount masked-runtime
:
56 results
:
umountroot.service masked
x11-common.service masked
$ systemctl list-unit-files | fgrep masked | fgrep fwupd
$ systemctl list-unit-files | fgrep masked | fgrep package
这样我就有 56 个单元需要扫描。没有:packagekit
也没有fwupd
。
单位语法:-.mount
让我困惑,直到我看到这个:“将斜线改为破折号“.mount
在文章中[1]链接如下:
- 。山:此单元定义系统上由 systemd 管理的挂载点。这些单元以挂载路径命名,并将斜线改为破折号。/etc/fstab 中的条目可以自动创建单元。
- 。自动挂载:.automount 单元配置将自动挂载的挂载点。这些必须以其引用的挂载点命名,并且必须具有匹配的 .mount 单元来定义挂载的具体细节。
对我来说,关键的是短跑(“-”)代表削减路径中的 (/)——这使得根。
据我理解,那么:“ -.mount
” 就是:“/
“(root)。不是这样吗?
有了这些知识,我尝试了unmask
和restart
活动
$ sudo systemctl unmask packagekit.service
$ sudo service packagekit restart
Failed to restart packagekit.service: Unit -.mount is masked.
$ sudo systemctl restart packagekit.service
Failed to restart packagekit.service: Unit -.mount is masked.
更新一
今天更新了 Ubuntu。问题仍然存在。我之前发现 DVD 问题与编解码器有关,现在这个问题已经解决了。
我也正在显示请求的列表
lsblk -f
cat /etc/fstab
升级即将结束时,再次出现与以下相关的错误:umount
问题。
$ sudo apt upgrade -y
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
bluez bluez-cups bluez-obexd e2fsprogs libbluetooth3 libcom-err2 libext2fs2 libsdl2-2.0-0 libss2 libssl1.1 netplan.io openssl
qemu-block-extra qemu-kvm qemu-system-common qemu-system-data qemu-system-gui qemu-system-x86 qemu-utils tzdata yarn
21 to upgrade, 0 to newly install, 0 to remove and 0 not to upgrade.
Need to get 13.2 MB of archives.
After this operation, 66.6 kB of additional disk space will be used.
Get:1 http://au.archive.ubuntu.com/ubuntu disco-updates/main amd64 libext2fs2 amd64 1.44.6-1ubuntu0.1 [160 kB]
Get:2 https://dl.yarnpkg.com/debian stable/main amd64 yarn all 1.19.0-1 [890 kB]
Current default time zone: 'Australia/Sydney'
Local time is now: Fri 4 Oct 00:04:06 AEST 2019.
Universal Time is now: Thu Oct 3 14:04:06 UTC 2019.
Run 'dpkg-reconfigure tzdata' if you wish to change it.
Setting up bluez (5.50-0ubuntu2.1) ...
Failed to restart bluetooth.service: Unit -.mount is masked.
invoke-rc.d: initscript bluetooth, action "restart" failed.
● bluetooth.service - Bluetooth service
Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2019-09-19 08:26:47 AEST; 2 weeks 0 days ago
Docs: man:bluetoothd(8)
Main PID: 1451 (bluetoothd)
Status: "Running"
Tasks: 1 (limit: 4915)
Memory: 2.8M
CGroup: /system.slice/bluetooth.service
└─1451 /usr/lib/bluetooth/bluetoothd
Oct 03 07:29:21 woodypear bluetoothd[1451]: Endpoint unregistered: sender=:1.15593 path=/MediaEndpoint/A2DPSource
Oct 03 07:29:21 woodypear bluetoothd[1451]: Endpoint unregistered: sender=:1.15593 path=/MediaEndpoint/A2DPSink
Oct 03 07:29:25 woodypear bluetoothd[1451]: Loading LTKs timed out for hci0
Oct 03 07:29:25 woodypear bluetoothd[1451]: Endpoint registered: sender=:1.15593 path=/MediaEndpoint/A2DPSource
Oct 03 07:29:25 woodypear bluetoothd[1451]: Endpoint registered: sender=:1.15593 path=/MediaEndpoint/A2DPSink
Oct 03 20:36:54 woodypear bluetoothd[1451]: Endpoint unregistered: sender=:1.15593 path=/MediaEndpoint/A2DPSource
Oct 03 20:36:54 woodypear bluetoothd[1451]: Endpoint unregistered: sender=:1.15593 path=/MediaEndpoint/A2DPSink
Oct 03 20:36:58 woodypear bluetoothd[1451]: Loading LTKs timed out for hci0
Oct 03 20:36:58 woodypear bluetoothd[1451]: Endpoint registered: sender=:1.15593 path=/MediaEndpoint/A2DPSource
Oct 03 20:36:58 woodypear bluetoothd[1451]: Endpoint registered: sender=:1.15593 path=/MediaEndpoint/A2DPSink
dpkg: error processing package bluez (--configure):
installed bluez package post-installation script subprocess returned error exit status 1
Setting up libss2:amd64 (1.44.6-1ubuntu0.1) ...
Setting up qemu-system-data (1:3.1+dfsg-2ubuntu3.5) ...
Setting up bluez-cups (5.50-0ubuntu2.1) ...
Setting up libbluetooth3:amd64 (5.50-0ubuntu2.1) ...
Setting up yarn (1.19.0-1) ...
Setting up libsdl2-2.0-0:amd64 (2.0.9+dfsg1-1ubuntu1.19.04.1) ...
Setting up openssl (1.1.1b-1ubuntu2.4) ...
Setting up qemu-block-extra:amd64 (1:3.1+dfsg-2ubuntu3.5) ...
Setting up qemu-system-common (1:3.1+dfsg-2ubuntu3.5) ...
Failed to restart qemu-kvm.service: Unit -.mount is masked.
Failed to try-restart qemu-kvm.service: Unit -.mount is masked.
Setting up qemu-system-x86 (1:3.1+dfsg-2ubuntu3.5) ...
Setting up e2fsprogs (1.44.6-1ubuntu0.1) ...
update-initramfs: deferring update (trigger activated)
Setting up qemu-utils (1:3.1+dfsg-2ubuntu3.5) ...
Setting up qemu-kvm (1:3.1+dfsg-2ubuntu3.5) ...
Processing triggers for man-db (2.8.5-2) ...
Processing triggers for dbus (1.12.12-1ubuntu1.1) ...
Processing triggers for libc-bin (2.29-0ubuntu2) ...
Processing triggers for systemd (240-6ubuntu5.7) ...
Processing triggers for initramfs-tools (0.131ubuntu19.1) ...
update-initramfs: Generating /boot/initrd.img-5.2.9-050209-generic
Errors were encountered while processing:
bluez
Error: GDBus.Error:org.freedesktop.systemd1.UnitMasked: Unit -.mount is masked.
E: Sub-process /usr/bin/dpkg returned an error code (1)
块设备/lsblk -f
:
我本想删除snap
相关的安装,但这可能实际上是相关的。我一直无法使用lxd
,唯一可用的安装似乎是snap
。
$ sudo lsblk -f
NAME FSTYPE LABEL UUID FSAVAIL FSUSE% MOUNTPOINT
loop0 squashfs 0 100% /snap/lxd/11985
loop1 squashfs 0 100% /snap/core/7396
loop2 squashfs 0 100% /snap/fwupd/880
loop3 squashfs 0 100% /snap/gnome-system-monitor/100
loop5 squashfs 0 100% /snap/core18/1098
loop6 squashfs 0 100% /snap/gnome-characters/296
loop7 squashfs 0 100% /snap/gnome-3-26-1604/92
loop8 squashfs 0 100% /snap/gnome-logs/73
loop9 squashfs 0 100% /snap/gnome-3-28-1804/67
loop10 squashfs 0 100% /snap/gnome-characters/317
loop11 squashfs 0 100% /snap/gnome-calculator/406
loop12 squashfs 0 100% /snap/gtk-common-themes/1313
loop13 squashfs 0 100% /snap/gtk-common-themes/1198
loop15 squashfs 0 100% /snap/gnome-3-26-1604/90
loop16 squashfs 0 100% /snap/core/7713
loop17 squashfs
loop18 squashfs 0 100% /snap/gnome-system-monitor/95
loop19 squashfs 0 100% /snap/core18/1144
loop20 squashfs 0 100% /snap/gnome-3-28-1804/71
loop21 squashfs 0 100% /snap/gnome-calculator/501
loop22 btrfs default ea3db848-1e70-4c8a-b602-66f3efXXXX
loop23 squashfs 0 100% /snap/fwupd/1023
loop24 squashfs 0 100% /snap/lxd/11964
loop25 squashfs 0 100% /snap/gnome-logs/81
sda
├─sda1 vfat 5888-2C75 1013.2M 1% /boot/efi
├─sda2 ext4 fa69a588-5a3c-4f5d-beff-d5c5f7XXXX 30.5G 46% /
├─sda3 ext4 Backup 81b6a1e3-0674-4c8c-b5ff-80010fXXXX 104.8G 46% /Backup
└─sda5 ext4 Moort c88ac1c9-9c80-4d56-9faf-5a3210XXXX 115.6G 87% /Moort
sdb
└─sdb1 btrfs zpanda 353f4608-a9be-464e-b9e5-6e53771XXX 779.3G 79% /mnt/Zpanda
sdc
└─sdc1 ntfs Xpanda 7CF02B31F02AXXX 1.5T 17% /mnt/Xpanda
sdd
└─sdd1 vfat ALEX-06 38BF-XXX 8.2G 86% /media/username/AAAAA
sde
└─sde1 exfat GGGGGG C3EC-XXX 117.2G 2% /media/username/GGGGGG
sr0
标有“GGGGGG”的 USB 没有自动挂载。这种方式不一致。有时它会自动挂载,有时则不会。它是用实用程序exfat
附带的Ubutnu 格式化的drives
。
坐骑/cat /etc/fstab
:
我认为安装错误是指systemd
模块而不是驱动器(然而我发现自己走错了路,这对我来说没关系。
$ cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
#
# / was on /dev/sda2 during installation
#
UUID=fa69a588-5a3c-4f5d-beff-d5c5f70XXXX / ext4 errors=remount-ro 0 1
##
# /boot/efi was on /dev/sda1 during installation
#
UUID=5888-XXXX /boot/efi vfat umask=0077 0 1
##
# /Moort partition
#
UUID=c88ac1c9-9c80-4d56-9faf-5a3210XXXX /Moort ext4 defaults 0 1
/Moort/work /work none bind
##
# /Backup partition
#
UUID=81b6a1e3-0674-4c8c-b5ff-80010XXXX /Backup ext4 defaults 0 2
##
# /mnt/Xpanda partition
#
UUID=7CF02B31F0XXXX /mnt/Xpanda ntfs umask=007,fmask=137,dmask=027,uid=XXXX,gid=XXXXX,nls=utf8,utf8 0 2
##
# /mnt/Zpanda partition
#
UUID=353f4608-a9be-464e-b9e5-6e53771XXXX /mnt/Zpanda btrfs defaults 0 1
##
#
/swapfile none swap sw 0 0
参考:
man systemd
man sysctrl
- Linux Systemd 基础知识:使用服务、单元和日志