Multiple fixes for Root on ZFS guide (#191)
* Let user know that SELinux will be re-enabled after reboot Signed-off-by: Maurice Zhou <jasper@apvc.uk> * compat with future releases: use zfs-dkms and newer repo Signed-off-by: Maurice Zhou <jasper@apvc.uk> * rm unused releasever option Signed-off-by: Maurice Zhou <jasper@apvc.uk> * let user aware of the ignorable errors Signed-off-by: Maurice Zhou <jasper@apvc.uk> * detailed explanations for errors during grub-menu generation Signed-off-by: Maurice Zhou <jasper@apvc.uk> * Build ZFS dkms module in installed system Signed-off-by: Maurice Zhou <jasper@apvc.uk> * switch to dkms package for better compatibility with kernels Signed-off-by: Maurice Zhou <jasper@apvc.uk> * add direct download links for live iso Signed-off-by: Maurice Zhou <jasper@apvc.uk> * rm zfs-fuse before install; mirrorlist Signed-off-by: Maurice Zhou <jasper@apvc.uk> * reformat notes Signed-off-by: Maurice Zhou <jasper@apvc.uk> * rm netconfig - networkmanager is enabled by default Signed-off-by: Maurice Zhou <jasper@apvc.uk> * load kernel module in live; Signed-off-by: Maurice Zhou <jasper@apvc.uk> * rm encrypted bpool: untested Signed-off-by: Maurice Zhou <jasper@apvc.uk> * use u=r,go= permission on key file Signed-off-by: Maurice Zhou <jasper@apvc.uk> * fix typo Signed-off-by: Maurice Zhou <jasper@apvc.uk> * use bash shell Signed-off-by: Maurice Zhou <jasper@apvc.uk> * suggest clean the disks Signed-off-by: Maurice Zhou <jasper@apvc.uk> * add grub-menu auto update Signed-off-by: Maurice Zhou <jasper@apvc.uk> * monitor kernel-core pkg Signed-off-by: Maurice Zhou <jasper@apvc.uk> * copyright 2021 Signed-off-by: Maurice Zhou <jasper@apvc.uk> * fix kernel var detection Signed-off-by: Maurice Zhou <jasper@apvc.uk> * read-only cache file Signed-off-by: Maurice Zhou <jasper@apvc.uk> * replace zfs-mount.service with zfs-mount-generator Signed-off-by: Maurice Zhou <jasper@apvc.uk> * notes for mount and POSIX-compliant Signed-off-by: Maurice Zhou <jasper@apvc.uk> * hard-code kernel version Signed-off-by: Maurice Zhou <jasper@apvc.uk> * fix chroot variable Signed-off-by: Maurice Zhou <jasper@apvc.uk> * fix grub cfg Signed-off-by: Maurice Zhou <jasper@apvc.uk> * fix grub Signed-off-by: Maurice Zhou <jasper@apvc.uk> * missing comment Signed-off-by: Maurice Zhou <jasper@apvc.uk> * comments Signed-off-by: Maurice Zhou <jasper@apvc.uk>
This commit is contained in:
@@ -72,13 +72,13 @@ Install GRUB
|
||||
|
||||
#. If using legacy booting, install GRUB to every disk::
|
||||
|
||||
for i in ${DISK[@]}; do
|
||||
for i in ${DISK}; do
|
||||
grub2-install --boot-directory /boot/efi/EFI/rocky --target=i386-pc $i
|
||||
done
|
||||
|
||||
#. If using EFI::
|
||||
|
||||
for i in ${DISK[@]}; do
|
||||
for i in ${DISK}; do
|
||||
efibootmgr -cgp 1 -l "\EFI\rocky\shimx64.efi" \
|
||||
-L "rocky-${i##*/}" -d ${i}
|
||||
done
|
||||
@@ -101,6 +101,17 @@ Install GRUB
|
||||
cp /boot/efi/EFI/rocky/grub.cfg /boot/efi/EFI/rocky/grub2/grub.cfg
|
||||
cp /boot/efi/EFI/rocky/grub.cfg /boot/grub2/grub.cfg
|
||||
|
||||
The following errors may be safely ignored:
|
||||
|
||||
- ``device-mapper: reload ioctl on osprober-linux-sda2 (253:0) failed: Device or resource busy``
|
||||
This is caused by os-prober probing OS on the partitions used by ZFS,
|
||||
harmless but os-prober can be disabled by::
|
||||
|
||||
echo GRUB_DISABLE_OS_PROBER=true >> /etc/default/grub
|
||||
|
||||
- ``/usr/sbin/grub2-probe: error: ../grub-core/kern/fs.c:120:unknown filesystem.``
|
||||
This is fixed by /etc/grub.d/09_fix_root_on_zfs
|
||||
|
||||
#. For both legacy and EFI booting: mirror ESP content::
|
||||
|
||||
ESP_MIRROR=$(mktemp -d)
|
||||
@@ -110,6 +121,33 @@ Install GRUB
|
||||
cp -r $ESP_MIRROR/EFI $i
|
||||
done
|
||||
|
||||
#. Automatically regenerate GRUB menu on kernel update::
|
||||
|
||||
tee /etc/dnf/plugins/post-transaction-actions.d/00-update-grub-menu-for-kernel.action <<EOF >/dev/null
|
||||
# kernel-core package contains vmlinuz and initramfs
|
||||
# change package name if non-standard kernel is used
|
||||
kernel-core:in:/usr/local/sbin/update-grub-menu.sh
|
||||
kernel-core:out:/usr/local/sbin/update-grub-menu.sh
|
||||
EOF
|
||||
|
||||
tee /usr/local/sbin/update-grub-menu.sh <<-'EOF' >/dev/null
|
||||
#!/bin/sh
|
||||
export PATH=$PATH:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
||||
export ZPOOL_VDEV_NAME_PATH=YES
|
||||
source /etc/os-release
|
||||
grub2-mkconfig -o /boot/efi/EFI/${ID}/grub.cfg
|
||||
cp /boot/efi/EFI/${ID}/grub.cfg /boot/efi/EFI/${ID}/grub2/grub.cfg
|
||||
cp /boot/efi/EFI/${ID}/grub.cfg /boot/grub2/grub.cfg
|
||||
ESP_MIRROR=$(mktemp -d)
|
||||
cp -r /boot/efi/EFI $ESP_MIRROR
|
||||
for i in /boot/efis/*; do
|
||||
cp -r $ESP_MIRROR/EFI $i
|
||||
done
|
||||
rm -rf $ESP_MIRROR
|
||||
EOF
|
||||
|
||||
chmod +x /usr/local/sbin/update-grub-menu.sh
|
||||
|
||||
#. Notes for GRUB on RHEL
|
||||
|
||||
To support Secure Boot, GRUB has been heavily modified by Fedora,
|
||||
@@ -157,6 +195,24 @@ Finish Installation
|
||||
|
||||
reboot
|
||||
|
||||
Post installaion
|
||||
~~~~~~~~~~~~~~~~
|
||||
|
||||
#. If you have other data pools, generate list of datasets for `zfs-mount-generator
|
||||
<https://manpages.ubuntu.com/manpages/focal/man8/zfs-mount-generator.8.html>`__ to mount them at boot::
|
||||
|
||||
DATA_POOL='tank0 tank1'
|
||||
|
||||
# tab-separated zfs properties
|
||||
# see /etc/zfs/zed.d/history_event-zfs-list-cacher.sh
|
||||
export \
|
||||
PROPS="name,mountpoint,canmount,atime,relatime,devices,exec\
|
||||
,readonly,setuid,nbmand,encroot,keylocation"
|
||||
|
||||
for i in $DATA_POOL; do
|
||||
zfs list -H -t filesystem -o $PROPS -r $i > /etc/zfs/zfs-list.cache/$i
|
||||
done
|
||||
|
||||
#. After reboot, consider adding a normal user::
|
||||
|
||||
myUser=UserName
|
||||
|
||||
Reference in New Issue
Block a user