![无法在带有分离标头的 luks 上的 lvm 上挂载 /sysroot - zfs](https://linux22.com/image/15358/%E6%97%A0%E6%B3%95%E5%9C%A8%E5%B8%A6%E6%9C%89%E5%88%86%E7%A6%BB%E6%A0%87%E5%A4%B4%E7%9A%84%20luks%20%E4%B8%8A%E7%9A%84%20lvm%20%E4%B8%8A%E6%8C%82%E8%BD%BD%20%2Fsysroot%20-%20zfs.png)
我尝试安装新系统。具有加密的 zfs 和分离的标头并在 USB 上启动。但我无法启动,因为 /sysroot 挂载失败。
我尝试更改内核参数和不同的挂钩。我无法进入紧急 shell,因为 root 似乎被锁定,尽管为 root 设置了密码。所以我只能通过 live iso 进行访问。
chroot 中的journalctl 回复没有日志。
这是我的设置:
sda
└─luksCont crypt
├─systemVG-rootLV lvm
| └─zfs pool /mnt
└─systemVG-swapLV lvm
sdc (USB)
├─sdc1 /mnt/efi
└─sdc2 /mnt/boot
└─luksheader, keyfile
/etc/mkinitcpio.conf(我改变了什么)
FILES=(/boot/header.img /boot/key.img)
HOOKS=(base systemd autodetect modconf keyboard sd-vconsole block mycustomencrypthook lvm2 zfs filesystems)
/etc/initcpio/install/mycustomhook
#!/bin/bash
build() {
local mod
add_module dm-crypt
if [[ $CRYPTO_MODULES ]]; then
for mod in $CRYPTO_MODULES; do
add_module "$mod"
done
else
add_all_modules '/crypto/'
fi
add_binary "cryptsetup"
add_binary "dmsetup"
add_file "/usr/lib/udev/rules.d/10-dm.rules"
add_file "/usr/lib/udev/rules.d/13-dm-disk.rules"
add_file "/usr/lib/udev/rules.d/95-dm-notify.rules"
add_file "/usr/lib/initcpio/udev/11-dm-initramfs.rules" "/usr/lib/udev/rules.d/11-dm-initramfs.rules"
add_runscript
}
/etc/initcpio/hooks/mycustomhook
#!/usr/bin/ash
run_hook() {
modprobe -a -q dm-crypt >/dev/null 2>&1
modprobe loop
[ "${quiet}" = "y" ] && CSQUIET=">/dev/null"
echo 'Waiting for USB:'
echo ' /efi '
i=1
sp="/-\|"
echo -n ' '
while [ ! -L '/dev/disk/by-uuid/3EF6-1EDA' ]; do
printf "\b${sp:i++%${#sp}:1}"
sleep 1
done
printf "\bfound!"
echo ' /boot '
i=1
echo -n ' '
while [ ! -L '/dev/disk/by-uuid/1667-253D' ]; do
printf "\b${sp:i++%${#sp}:1}"
sleep 1
done
printf "\bfound!"
#mkdir -p /mnt
#mount /dev/disk/by-uuid/1667-253D /mnt
#cryptsetup open /mnt/key.img lukskey
cryptsetup open /boot/key.img luks-key
cryptsetup open /dev/disk/by-id/ata-SAMSUNG... --header=/boot/header.img --key-file=/dev/mapper/luks-key enc
cryptsetup close luks-key
}
/efi/loader/loader.conf
default archlinux
timeout 3
console-mode max
editor 1
random-seed-mode with-system-token
/boot/loader/entries/archlinux.conf
title Arch Linux
linux /vmlinuz-5.10-x86_64
initrd /intel-ucode.img
initrd /initramfs-5.10-x86_64.img
options root=zfs:AUTO
#options root=zfs:rpool/ROOT/arch
#options root=ZFS=rpool/ROOT/arch
#options zfs=rpool/ROOT/arch
ZFS坐骑
zfs get mountpoint
rpool mountpoint /mnt local
rpool/ROOT mountpoint none local
rpool/ROOT/arch mountpoint /mnt local
rpool/ROOT/opt mountpoint /mnt/opt local
rpool/ROOT/usr mountpoint /mnt/usr local
rpool/ROOT/usr/local mountpoint /mnt/usr/local inherited from rpool/ROOT/usr
rpool/ROOT/var mountpoint /mnt/var local
rpool/ROOT/var/lib mountpoint /mnt/var/lib inherited from rpool/ROOT/var
rpool/ROOT/var/lib/systemd mountpoint /mnt/var/lib/systemd inherited from rpool/ROOT/var
rpool/ROOT/var/lib/systemd/coredump mountpoint /mnt/var/lib/systemd/coredump inherited from rpool/ROOT/var
rpool/ROOT/var/log mountpoint /mnt/var/log inherited from rpool/ROOT/var
rpool/ROOT/var/log/journal mountpoint /mnt/var/log/journal inherited from rpool/ROOT/var
rpool/home mountpoint /mnt/home inherited from rpool
rpool/home/maksim mountpoint /mnt/home/maksim inherited from rpool
rpool/home/root mountpoint /mnt/root local
我有点困惑为什么
zfs mount
在 chroot 中为我显示不同的输出
zfs mount (in chroot)
rpool/ROOT/arch /
(直播系统中)
zfs mount (in live system)
rpool/ROOT/opt /mnt/opt
rpool/home/root /mnt/root
rpool/ROOT/var/log /mnt/var/log
rpool/home /mnt/home
rpool/ROOT/var/lib/systemd/coredump /mnt/var/lib/systemd/coredump
rpool/ROOT/usr/local /mnt/usr/local
rpool/home/maksim /mnt/home/maksim
rpool/ROOT/var/log/journal /mnt/var/log/journal
rpool/ROOT/arch /mnt
答案1
我只是花了最后几个小时解决相同的错误,但设置了单个磁盘。也许这会有所帮助。
尝试在计算机上运行 LIVE USB/CD 并安装 EPS 分区。在那里检查loader/entries/arch.conf
文件。我发现我有一个像root=PARTUUID=xxxxxxxx...
.我所要做的就是将其更改为root=/dev/mapper/<partition label>
.这按预期工作了。希望有帮助。