无法在 20.04 上升级 zfsutils-linux

无法在 20.04 上升级 zfsutils-linux

所以。我被困住了。这是最近安装的 Ubuntu 20.04。所有磁盘都设置为 ZFS 文件系统。

 ⚡ root@docker /var zpool list
NAME    SIZE  ALLOC   FREE  CKPOINT  EXPANDSZ   FRAG    CAP  DEDUP    HEALTH  ALTROOT
bpool  1,88G   506M  1,38G        -         -     0%    26%  1.00x    ONLINE  -
data   10,9T  1,76G  10,9T        -         -     0%     0%  1.00x    ONLINE  -
rpool   920G  7,61G   912G        -         -     0%     0%  1.00x    ONLINE  -

bpool 是我的启动分区,rpool 是我的根分区。它看起来像这样:

 ⚡ root@docker /var zfs list
NAME                                                                                                     USED  AVAIL     REFER  MOUNTPOINT
bpool                                                                                                    505M  1,26G       96K  /boot
bpool/BOOT                                                                                               503M  1,26G       96K  none
bpool/BOOT/ubuntu_u1x577                                                                                 503M  1,26G      269M  /boot
data                                                                                                    1,76G  10,5T       96K  /data
data/home                                                                                                110M  10,5T      110M  /home
data/var                                                                                                1,65G  10,5T     1,58G  /var
data/var/lib                                                                                            77,8M  10,5T       96K  /var/lib
data/var/lib/docker                                                                                     77,7M  10,5T      772K  /var/lib/docker
data/var/lib/docker/3507eb58f488f64c7b9fc52fec17371e733dccf691d88a55ce23e4a732694f1d                      84K  10,5T     76,5M  legacy
data/var/lib/docker/66f1d3eb20e22d69da12e47e6e363c2c4ccfe71d9c9d58b46c4a27a0a143b354                    5,02M  10,5T     11,1M  legacy
data/var/lib/docker/7fac28892c840428c90e8a0eff4289b3791f816ea8eef6a0606d141fb2f83ada                    65,5M  10,5T     76,5M  legacy
data/var/lib/docker/cd2984a7ec9b4a4d4138d92c189d5c4c13fe4ace09aa88f3cd7603fd65005042                    6,31M  10,5T     6,30M  legacy
data/volumes                                                                                             308K  10,5T      308K  /data/volumes
rpool                                                                                                   7,61G   884G       96K  /
rpool/ROOT                                                                                              7,48G   884G       96K  none
rpool/ROOT/ubuntu_u1x577                                                                                7,48G   884G     3,31G  /

我删掉了其余部分,因为我认为它们并不重要。如果我运行,apt install我会得到以下内容:

 ⚡ root@docker /var apt install
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
3 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
INFO Requesting to save current system state
Successfully saved as "autozsys_apdldl"
Setting up zfsutils-linux (0.8.3-1ubuntu12) ...
zfs-import-scan.service is a disabled or a static unit, not starting it.
zfs-import-scan.service is a disabled or a static unit, not starting it.
Job for zfs-mount.service failed because a fatal signal was delivered to the control process.
See "systemctl status zfs-mount.service" and "journalctl -xe" for details.
invoke-rc.d: initscript zfs-mount, action "start" failed.
● zfs-mount.service - Mount ZFS filesystems
     Loaded: loaded (/lib/systemd/system/zfs-mount.service; enabled; vendor preset: enabled)
     Active: failed (Result: signal) since Fri 2020-04-24 23:51:39 CEST; 9ms ago
       Docs: man:zfs(8)
    Process: 71542 ExecStart=/sbin/zfs mount -a (code=killed, signal=SEGV)
   Main PID: 71542 (code=killed, signal=SEGV)

Apr 24 23:51:38 docker systemd[1]: Starting Mount ZFS filesystems...
Apr 24 23:51:38 docker zfs[71542]: cannot mount '/var': directory is not empty
Apr 24 23:51:38 docker zfs[71542]: cannot mount '/home': mount failed
Apr 24 23:51:39 docker systemd[1]: zfs-mount.service: Main process exited, code=killed, status=11/SEGV
Apr 24 23:51:39 docker systemd[1]: zfs-mount.service: Failed with result 'signal'.
Apr 24 23:51:39 docker systemd[1]: Failed to start Mount ZFS filesystems.
dpkg: error processing package zfsutils-linux (--configure):
 installed zfsutils-linux package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of zfs-initramfs:
 zfs-initramfs depends on zfsutils-linux (>= 0.8.3-1ubuntu12); however:
  Package zfsutils-linux is not configured yet.

dpkg: error processing package zfs-initramfs (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of zfs-zed:
 zfs-zed depends on zfsutils-linux (>= 0.8.3-1ubuntu12); however:
  Package zfsutils-linux is not configured yet.

dpkg: error processing package zfs-zed (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                          No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                    Errors were encountered while processing:
 zfsutils-linux
 zfs-initramfs
 zfs-zed
INFO Updating GRUB menu
E: Sub-process /usr/bin/dpkg returned an error code (1)

因此,它看起来像是zfsutils-linux试图重新挂载 /var 和 /home,但是由于目录不为空所以无法挂载(因为我假设它已经挂载了?)。

有人知道我该如何排除故障吗?

答案1

我知道发生了什么事。

我有/var/home作为 ZFS 池的一部分data。显然,在某个时候,当它没有被挂载时,有东西写入了/var和 ,/home这意味着dataZFS 池无法挂载,因为正如消息所说cannot mount '/var': directory is not empty

如果他们在错误消息中包含了池名称,这将会更清楚一些。

如果其他人遇到这种情况:

  1. 您需要停止机器上所有可能写入受影响目录的服务。
  2. 然后您需要将目录移开。 mv /var /var.old
  3. 现在强制 zfs 挂载目录:zfs mount -a
  4. 对于每个受影响的目录,将旧文件复制到新文件上rsync -avz --delete /var.old/* /var/
  5. 交叉手指(按压拇指,或任何适合当地文化的手势)
  6. 重启

答案2

我遇到了同样的问题(就我而言,存在一些文件/home阻止/home/username干净挂载),但我以不同的方式解决了它,并且麻烦更少:

  1. 从 GRUB 启动到恢复模式并选择进入 root shell 提示符

  2. 卸载所有 ZFS 数据集:zfs unmount -a

  3. 确认所有池都已卸载

  4. 手动挂载有问题的数据集:zfs mount pool/home

  5. 检查不应该存在的文件并将其移开:

    mv /home/username /home/username.old

  6. 检查挂载所有 ZFS 数据集是否仍会产生错误

    zfs mount -a

  7. 如果是,则重复,否则reboot

  8. 了解如何处理/home/username.old

答案3

我对我的 Ubuntu 20.04 进行了升级,并且出现了类似的错误,如下所示:

Package zfsutils-linux is not configured yet.

我搜索并找到这些命令来解决包未配置问题

$ sudo mv /var/lib/dpkg/info/ /var/lib/dpkg/info_old/
$ sudo mkdir /var/lib/dpkg/info/
$ sudo apt-get update

$ sudo mv /var/lib/dpkg/info/* /var/lib/dpkg/info_old/
$ sudo rm -rf /var/lib/dpkg/info
$ sudo mv /var/lib/dpkg/info_old/ /var/lib/dpkg/info/

相关内容