我全新安装了 Ubuntu 24.04,其中有 ZFS 和由 Ubuntu 安装程序自动创建的 8GB 交换分区,如下所示/dev/nvme0n1p3
。
我升级到 24.10,重启后交换分区不可用。似乎swapon
找不到加密分区。升级过程中出了什么问题?
/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>
/dev/disk/by-id/dm-uuid-CRYPT-PLAIN-dm_crypt-0 none swap sw 0 0
# Use `zfs list` for current zfs mount info
# bpool none defaults 0 0
# Use `zfs list` for current zfs mount info
# rpool none defaults 0 0
# Use `zfs list` for current zfs mount info
# rpool / defaults 0 0
# Use `zfs list` for current zfs mount info
# rpool none defaults 0 0
# Use `zfs list` for current zfs mount info
# rpool /root defaults 0 0
# Use `zfs list` for current zfs mount info
# rpool /home defaults 0 0
# Use `zfs list` for current zfs mount info
# bpool /boot defaults 0 0
# /boot/efi was on /dev/nvme0n1p1 during curtin installation
/dev/disk/by-uuid/6DA7-371B /boot/efi vfat defaults 0 1
还有我的/etc/crypttab
:
dm_crypt-0 PARTUUID=d5018485-33be-40b8-80a1-9adb3c96ff16 /dev/urandom swap,initramfs
我尝试用/etc/crypttab
替换 ID ,但重启后问题仍未解决。PARTUUID=d5018485-33be-40b8-80a1-9adb3c96ff16
/dev/nvme0n1p3
我还尝试添加以下选项:
swap,initramfs,plain,cipher=aes-xts-plain64,size=256
$ sudo blkid
:(我没有显示许多循环设备)
/dev/nvme0n1p1: UUID="6DA7-371B" BLOCK_SIZE="512" TYPE="vfat" PARTUUID="604b52dd-b0fc-43d8-8661-3dcb64869220"
/dev/nvme0n1p4: LABEL="rpool" UUID="15673004915406136913" UUID_SUB="7631777870671497537" BLOCK_SIZE="4096" TYPE="zfs_member" PARTUUID="2157f054-6832-42fb-8032-8d2fb89b235b"
/dev/nvme0n1p2: LABEL="bpool" UUID="8036775395222734905" UUID_SUB="16758030276404416519" BLOCK_SIZE="4096" TYPE="zfs_member" PARTUUID="ec3c6766-9115-4fa6-b9d4-793d092a7bb4"
/dev/mapper/keystore-rpool: LABEL="keystore-rpool" UUID="bda5d08f-4300-4ecf-9dd1-9c6958d53738" BLOCK_SIZE="4096" TYPE="ext4"
/dev/nvme0n1p3: PARTUUID="d5018485-33be-40b8-80a1-9adb3c96ff16"
/dev/zd0: UUID="2586988a-ff8b-4fdf-96c1-dd1532b1eb90" TYPE="crypto_LUKS"
$ sudo swapon -a
swapon: cannot open /dev/disk/by-id/dm-uuid-CRYPT-PLAIN-dm_crypt-0: No such file or directory
$ sudo update-initramfs -u -k all
update-initramfs: Generating /boot/initrd.img-6.11.0-9-generic
cryptsetup: ERROR: dm_crypt-0: Source mismatch
device-mapper: table ioctl on dm_crypt-0 failed: No such device or address
Command failed.
cryptsetup: WARNING: Couldn't determine cipher modules to load for dm_crypt-0
mkinitramfs: copy_file: config '/etc/zfs/vdev_id.conf' not found
mkinitramfs: copy_file: config '/etc/zfs/initramfs-tools-load-key' not found
mkinitramfs: copy_file: config '/etc/zfs/initramfs-tools-load-key.d/*' not found
update-initramfs: Generating /boot/initrd.img-6.8.0-48-generic
cryptsetup: ERROR: dm_crypt-0: Source mismatch
device-mapper: table ioctl on dm_crypt-0 failed: No such device or address
Command failed.
cryptsetup: WARNING: Couldn't determine cipher modules to load for dm_crypt-0
mkinitramfs: copy_file: config '/etc/zfs/vdev_id.conf' not found
mkinitramfs: copy_file: config '/etc/zfs/initramfs-tools-load-key' not found
mkinitramfs: copy_file: config '/etc/zfs/initramfs-tools-load-key.d/*' not found
$ sudo fdisk -l /dev/nvme0n1
Disk /dev/nvme0n1: 3,64 TiB, 4000787030016 bytes, 7814037168 sectors
Disk model: CT4000P3SSD8
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 8B4A35DE-55EE-4ECA-99B3-E52D0FAC4A75
Device Start End Sectors Size Type
/dev/nvme0n1p1 2048 2203647 2201600 1G EFI System
/dev/nvme0n1p2 2203648 6397951 4194304 2G Linux filesystem
/dev/nvme0n1p3 6397952 23175167 16777216 8G Linux filesystem
/dev/nvme0n1p4 23175168 7814033407 7790858240 3,6T Linux filesystem
$ lsblk -o +PATH,UUID,PARTUUID
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS PATH UUID PARTUUID
zd0 230:0 0 20M 0 disk /dev/zd0 2586988a-ff8b-4fdf-96c1-dd1532b1eb90
└─keystore-rpool 252:0 0 4M 0 crypt /run/keystore/rpool /dev/mapper/keystore-rpool bda5d08f-4300-4ecf-9dd1-9c6958d53738
nvme0n1 259:0 0 3,6T 0 disk /dev/nvme0n1
├─nvme0n1p1 259:1 0 1G 0 part /boot/efi /dev/nvme0n1p1 6DA7-371B 604b52dd-b0fc-43d8-8661-3dcb64869220
├─nvme0n1p2 259:2 0 2G 0 part /dev/nvme0n1p2 8036775395222734905 ec3c6766-9115-4fa6-b9d4-793d092a7bb4
├─nvme0n1p3 259:3 0 8G 0 part /dev/nvme0n1p3 d5018485-33be-40b8-80a1-9adb3c96ff16
└─nvme0n1p4 259:4 0 3,6T 0 part /dev/nvme0n1p4 15673004915406136913 2157f054-6832-42fb-8032-8d2fb89b235b
$ ls -al /dev/mapper/
crw------- 1 root root 10, 236 Nov 15 22:55 control
lrwxrwxrwx 1 root root 7 Nov 15 22:55 keystore-rpool -> ../dm-0
$ ls -al /dev/disk/by-uuid/
lrwxrwxrwx 1 root root 15 Nov 15 22:54 15673004915406136913 -> ../../nvme0n1p4
lrwxrwxrwx 1 root root 9 Nov 15 22:54 2586988a-ff8b-4fdf-96c1-dd1532b1eb90 -> ../../zd0
lrwxrwxrwx 1 root root 15 Nov 15 22:54 6DA7-371B -> ../../nvme0n1p1
lrwxrwxrwx 1 root root 15 Nov 15 22:54 8036775395222734905 -> ../../nvme0n1p2
lrwxrwxrwx 1 root root 10 Nov 15 22:55 bda5d08f-4300-4ecf-9dd1-9c6958d53738 -> ../../dm-0
$ ls -al /dev/block/
lrwxrwxrwx 1 root root 6 Nov 15 22:55 230:0 -> ../zd0
lrwxrwxrwx 1 root root 7 Nov 15 22:55 252:0 -> ../dm-0
lrwxrwxrwx 1 root root 10 Nov 15 22:55 259:0 -> ../nvme0n1
lrwxrwxrwx 1 root root 12 Nov 15 22:55 259:1 -> ../nvme0n1p1
lrwxrwxrwx 1 root root 12 Nov 15 22:55 259:2 -> ../nvme0n1p2
lrwxrwxrwx 1 root root 12 Nov 15 22:55 259:3 -> ../nvme0n1p3
lrwxrwxrwx 1 root root 12 Nov 15 22:55 259:4 -> ../nvme0n1p4
$ sudo parted /dev/nvme0n1 unit GB print free
Model: CT4000P3SSD8 (nvme)
Disk /dev/nvme0n1: 4001GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
0,00GB 0,00GB 0,00GB Free Space
1 0,00GB 1,13GB 1,13GB fat32 boot, esp
2 1,13GB 3,28GB 2,15GB zfs
3 3,28GB 11,9GB 8,59GB
4 11,9GB 4001GB 3989GB zfs
4001GB 4001GB 0,00GB Free Space
另外,我不知道这是否相关,但在启动过程中,当提示输入(ZFS 加密)磁盘密码时,我收到以下警告:
cryptsetup: WARNING: Option 'size' missing in crypttab for plain dm-crypt mapping dm_crypt-0. Please read /usr/share/doc/cryptsetup-initramfs/README.initramfs.gz and add the correct 'size' option to your crypttab(5).