$HOME/.pam_mount.conf.xml
当我通过 SSH 登录时,我使用以下命令挂载 LXC 容器文件系统:
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE pam_mount SYSTEM "pam_mount.conf.xml.dtd">
<!--
See pam_mount.conf(5) for a description.
-->
<pam_mount>
<!-- debug should come before everything else,
since this file is still processed in a single pass
from top-to-bottom -->
<debug enable="0" />
<!-- Volume definitions -->
<volume
user="user" path="/dev/sda2" mountpoint="/var/lib/lxc/container"
fstype="crypt" options="exec,fsck" />
<volume
user="user" mountpoint="/home/user.orig"
path="/home/user" options="nosuid,nodev,bind" />
<volume
user="user" mountpoint="~"
path="/var/lib/lxc/container/rootfs/home/user"
options="nosuid,nodev,bind" />
<!-- pam_mount parameters: General tunables -->
</pam_mount>
然后我登录后启动 LXC 容器。自从升级到 Ubuntu Vid 以来,容器中/var/log/syslog
充斥着以下日志序列:
Jun 1 21:09:43 container systemd[1]: Unit home-user.mount is bound to inactive unit dev-mapper-_dev_sda2.device. Stopping, too.
Jun 1 21:09:43 container systemd[1]: Unmounting /home/user...
Jun 1 21:09:44 container umount[5799]: umount: /home/user: target is busy
Jun 1 21:09:44 container umount[5799]: (In some cases useful info about processes that
Jun 1 21:09:44 container umount[5799]: use the device is found by lsof(8) or fuser(1).)
Jun 1 21:09:44 container systemd[1]: home-user.mount mount process exited, code=exited status=32
Jun 1 21:09:44 container systemd[1]: Failed unmounting /home/user.
我该如何解决这个问题?有没有办法告诉容器的 systemd 不要管理该挂载?
答案1
这是 systemd 的一个已知问题。如果设备在 initramfs 中启动,则它会获得 SYSTEMD_STATUS=0 并始终被视为非活动设备。我有一个没有嵌入式 systemd 的自定义 initramfs,也遇到了同样的问题。我一直在尝试在网上找到某种方法,让 udev 和 systemd 知道设备实际上已启动并更改其状态,但似乎是一条死路。
我从开发人员那里看到的许多帖子也令人沮丧,因为他们不认为这是一个问题。