From e2e830073895a8b914ec93c233e7fc40a752b14b Mon Sep 17 00:00:00 2001 From: terem42 <9478806+terem42@users.noreply.github.com> Date: Tue, 10 Oct 2023 11:23:52 +0200 Subject: [PATCH 1/4] rpool ref fix --- hetzner-debian10-zfs-setup.sh | 2 +- hetzner-debian11-zfs-setup.sh | 2 +- hetzner-debian12-zfs-setup.sh | 2 +- hetzner-ubuntu18-zfs-setup.sh | 2 +- hetzner-ubuntu20-zfs-setup.sh | 2 +- hetzner-ubuntu22-zfs-setup.sh | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/hetzner-debian10-zfs-setup.sh b/hetzner-debian10-zfs-setup.sh index cb427e9..c553ae8 100644 --- a/hetzner-debian10-zfs-setup.sh +++ b/hetzner-debian10-zfs-setup.sh @@ -755,7 +755,7 @@ chroot_execute "grub-install ${v_selected_disks[0]}" chroot_execute "sed -i 's/#GRUB_TERMINAL=console/GRUB_TERMINAL=console/g' /etc/default/grub" chroot_execute "sed -i 's|GRUB_CMDLINE_LINUX_DEFAULT=.*|GRUB_CMDLINE_LINUX_DEFAULT=\"net.ifnames=0\"|' /etc/default/grub" -chroot_execute "sed -i 's|GRUB_CMDLINE_LINUX=\"\"|GRUB_CMDLINE_LINUX=\"root=ZFS=rpool/ROOT/debian\"|g' /etc/default/grub" +chroot_execute "sed -i 's|GRUB_CMDLINE_LINUX=\"\"|GRUB_CMDLINE_LINUX=\"root=ZFS=$v_rpool_name/ROOT/debian\"|g' /etc/default/grub" chroot_execute "sed -i 's/quiet//g' /etc/default/grub" chroot_execute "sed -i 's/splash//g' /etc/default/grub" diff --git a/hetzner-debian11-zfs-setup.sh b/hetzner-debian11-zfs-setup.sh index db20137..eb50b10 100644 --- a/hetzner-debian11-zfs-setup.sh +++ b/hetzner-debian11-zfs-setup.sh @@ -760,7 +760,7 @@ chroot_execute "grub-install --recheck ${v_selected_disks[0]}" chroot_execute "sed -i 's/#GRUB_TERMINAL=console/GRUB_TERMINAL=console/g' /etc/default/grub" chroot_execute "sed -i 's|GRUB_CMDLINE_LINUX_DEFAULT=.*|GRUB_CMDLINE_LINUX_DEFAULT=\"net.ifnames=0\"|' /etc/default/grub" -chroot_execute "sed -i 's|GRUB_CMDLINE_LINUX=\"\"|GRUB_CMDLINE_LINUX=\"root=ZFS=rpool/ROOT/debian\"|g' /etc/default/grub" +chroot_execute "sed -i 's|GRUB_CMDLINE_LINUX=\"\"|GRUB_CMDLINE_LINUX=\"root=ZFS=$v_rpool_name/ROOT/debian\"|g' /etc/default/grub" chroot_execute "sed -i 's/quiet//g' /etc/default/grub" chroot_execute "sed -i 's/splash//g' /etc/default/grub" diff --git a/hetzner-debian12-zfs-setup.sh b/hetzner-debian12-zfs-setup.sh index 955786b..89c17a4 100644 --- a/hetzner-debian12-zfs-setup.sh +++ b/hetzner-debian12-zfs-setup.sh @@ -759,7 +759,7 @@ chroot_execute "grub-install --recheck ${v_selected_disks[0]}" chroot_execute "sed -i 's/#GRUB_TERMINAL=console/GRUB_TERMINAL=console/g' /etc/default/grub" chroot_execute "sed -i 's|GRUB_CMDLINE_LINUX_DEFAULT=.*|GRUB_CMDLINE_LINUX_DEFAULT=\"net.ifnames=0\"|' /etc/default/grub" -chroot_execute "sed -i 's|GRUB_CMDLINE_LINUX=\"\"|GRUB_CMDLINE_LINUX=\"root=ZFS=rpool/ROOT/debian\"|g' /etc/default/grub" +chroot_execute "sed -i 's|GRUB_CMDLINE_LINUX=\"\"|GRUB_CMDLINE_LINUX=\"root=ZFS=$v_rpool_name/ROOT/debian\"|g' /etc/default/grub" chroot_execute "sed -i 's/quiet//g' /etc/default/grub" chroot_execute "sed -i 's/splash//g' /etc/default/grub" diff --git a/hetzner-ubuntu18-zfs-setup.sh b/hetzner-ubuntu18-zfs-setup.sh index e1c4a85..5b17751 100644 --- a/hetzner-ubuntu18-zfs-setup.sh +++ b/hetzner-ubuntu18-zfs-setup.sh @@ -741,7 +741,7 @@ chroot_execute "grub-install ${v_selected_disks[0]}" chroot_execute "sed -i 's/#GRUB_TERMINAL=console/GRUB_TERMINAL=console/g' /etc/default/grub" chroot_execute "sed -i 's|GRUB_CMDLINE_LINUX_DEFAULT=.*|GRUB_CMDLINE_LINUX_DEFAULT=\"net.ifnames=0\"|' /etc/default/grub" -chroot_execute "sed -i 's|GRUB_CMDLINE_LINUX=\"\"|GRUB_CMDLINE_LINUX=\"root=ZFS=rpool/ROOT/ubuntu\"|g' /etc/default/grub" +chroot_execute "sed -i 's|GRUB_CMDLINE_LINUX=\"\"|GRUB_CMDLINE_LINUX=\"root=ZFS=$v_rpool_name/ROOT/ubuntu\"|g' /etc/default/grub" chroot_execute "sed -i 's/quiet//g' /etc/default/grub" chroot_execute "sed -i 's/splash//g' /etc/default/grub" diff --git a/hetzner-ubuntu20-zfs-setup.sh b/hetzner-ubuntu20-zfs-setup.sh index b77d2f3..09f8945 100644 --- a/hetzner-ubuntu20-zfs-setup.sh +++ b/hetzner-ubuntu20-zfs-setup.sh @@ -742,7 +742,7 @@ chroot_execute "grub-install ${v_selected_disks[0]}" chroot_execute "sed -i 's/#GRUB_TERMINAL=console/GRUB_TERMINAL=console/g' /etc/default/grub" chroot_execute "sed -i 's|GRUB_CMDLINE_LINUX_DEFAULT=.*|GRUB_CMDLINE_LINUX_DEFAULT=\"net.ifnames=0\"|' /etc/default/grub" -chroot_execute "sed -i 's|GRUB_CMDLINE_LINUX=\"\"|GRUB_CMDLINE_LINUX=\"root=ZFS=rpool/ROOT/ubuntu\"|g' /etc/default/grub" +chroot_execute "sed -i 's|GRUB_CMDLINE_LINUX=\"\"|GRUB_CMDLINE_LINUX=\"root=ZFS=$v_rpool_name/ROOT/ubuntu\"|g' /etc/default/grub" chroot_execute "sed -i 's/quiet//g' /etc/default/grub" chroot_execute "sed -i 's/splash//g' /etc/default/grub" diff --git a/hetzner-ubuntu22-zfs-setup.sh b/hetzner-ubuntu22-zfs-setup.sh index 1426a87..0f3ea07 100644 --- a/hetzner-ubuntu22-zfs-setup.sh +++ b/hetzner-ubuntu22-zfs-setup.sh @@ -742,7 +742,7 @@ chroot_execute "grub-install ${v_selected_disks[0]}" chroot_execute "sed -i 's/#GRUB_TERMINAL=console/GRUB_TERMINAL=console/g' /etc/default/grub" chroot_execute "sed -i 's|GRUB_CMDLINE_LINUX_DEFAULT=.*|GRUB_CMDLINE_LINUX_DEFAULT=\"net.ifnames=0\"|' /etc/default/grub" -chroot_execute "sed -i 's|GRUB_CMDLINE_LINUX=\"\"|GRUB_CMDLINE_LINUX=\"root=ZFS=rpool/ROOT/ubuntu\"|g' /etc/default/grub" +chroot_execute "sed -i 's|GRUB_CMDLINE_LINUX=\"\"|GRUB_CMDLINE_LINUX=\"root=ZFS=$v_rpool_name/ROOT/ubuntu\"|g' /etc/default/grub" chroot_execute "sed -i 's/quiet//g' /etc/default/grub" chroot_execute "sed -i 's/splash//g' /etc/default/grub" From 813aa0538bf24dbf6e3519f9417bdc0b54c05bc9 Mon Sep 17 00:00:00 2001 From: terem42 <9478806+terem42@users.noreply.github.com> Date: Tue, 10 Oct 2023 14:12:02 +0200 Subject: [PATCH 2/4] dropbear update --- hetzner-ubuntu22-zfs-setup.sh | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/hetzner-ubuntu22-zfs-setup.sh b/hetzner-ubuntu22-zfs-setup.sh index 0f3ea07..21ca5cf 100644 --- a/hetzner-ubuntu22-zfs-setup.sh +++ b/hetzner-ubuntu22-zfs-setup.sh @@ -752,36 +752,26 @@ for ((i = 1; i < ${#v_selected_disks[@]}; i++)); do dd if="${v_selected_disks[0]}-part1" of="${v_selected_disks[i]}-part1" done -if [[ $v_encrypt_rpool == "1" ]]; then +if [[ $v_encrypt_rpool == "1" ]]; then echo "=========set up dropbear==============" - chroot_execute "apt install --yes dropbear-initramfs" - cp /root/.ssh/authorized_keys "$c_zfs_mount_dir/etc/dropbear-initramfs/authorized_keys" + chroot_execute "apt install --yes dropbear-initramfs" + + mkdir -p "$c_zfs_mount_dir/etc/dropbear/initramfs" + cp /root/.ssh/authorized_keys "$c_zfs_mount_dir/etc/dropbear/initramfs/authorized_keys" cp "$c_zfs_mount_dir/etc/ssh/ssh_host_rsa_key" "$c_zfs_mount_dir/etc/ssh/ssh_host_rsa_key_temp" chroot_execute "ssh-keygen -p -i -m pem -N '' -f /etc/ssh/ssh_host_rsa_key_temp" - chroot_execute "/usr/lib/dropbear/dropbearconvert openssh dropbear /etc/ssh/ssh_host_rsa_key_temp /etc/dropbear-initramfs/dropbear_rsa_host_key" + chroot_execute "/usr/lib/dropbear/dropbearconvert openssh dropbear /etc/ssh/ssh_host_rsa_key_temp /etc/dropbear/initramfs/dropbear_rsa_host_key" rm -rf "$c_zfs_mount_dir/etc/ssh/ssh_host_rsa_key_temp" cp "$c_zfs_mount_dir/etc/ssh/ssh_host_ecdsa_key" "$c_zfs_mount_dir/etc/ssh/ssh_host_ecdsa_key_temp" chroot_execute "ssh-keygen -p -i -m pem -N '' -f /etc/ssh/ssh_host_ecdsa_key_temp" - chroot_execute "/usr/lib/dropbear/dropbearconvert openssh dropbear /etc/ssh/ssh_host_ecdsa_key_temp /etc/dropbear-initramfs/dropbear_ecdsa_host_key" + chroot_execute "/usr/lib/dropbear/dropbearconvert openssh dropbear /etc/ssh/ssh_host_ecdsa_key_temp /etc/dropbear/initramfs/dropbear_ecdsa_host_key" chroot_execute "rm -rf /etc/ssh/ssh_host_ecdsa_key_temp" rm -rf "$c_zfs_mount_dir/etc/ssh/ssh_host_ecdsa_key_temp" - rm -rf "$c_zfs_mount_dir/etc/dropbear-initramfs/dropbear_dss_host_key" - - cd "$c_zfs_mount_dir/root" - wget http://ftp.de.debian.org/debian/pool/main/libt/libtommath/libtommath1_1.2.0-6_amd64.deb - wget http://ftp.de.debian.org/debian/pool/main/d/dropbear/dropbear-bin_2020.81-3_amd64.deb - wget http://ftp.de.debian.org/debian/pool/main/d/dropbear/dropbear-initramfs_2020.81-3_all.deb - - chroot_execute "dpkg -i /root/libtommath1_1.2.0-6_amd64.deb" - chroot_execute "dpkg -i /root/dropbear-bin_2020.81-3_amd64.deb" - chroot_execute "dpkg -i /root/dropbear-initramfs_2020.81-3_all.deb" - - rm $c_zfs_mount_dir/root/*.deb - cd /root + rm -rf "$c_zfs_mount_dir/etc/dropbear/initramfs/dropbear_dss_host_key" fi echo "============setup root prompt============" From a4322f91557c6094bafe61a0ad4c326a47aed09f Mon Sep 17 00:00:00 2001 From: terem42 <9478806+terem42@users.noreply.github.com> Date: Tue, 10 Oct 2023 14:15:14 +0200 Subject: [PATCH 3/4] update --- hetzner-ubuntu22-zfs-setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hetzner-ubuntu22-zfs-setup.sh b/hetzner-ubuntu22-zfs-setup.sh index 2d833cb..6081bfa 100644 --- a/hetzner-ubuntu22-zfs-setup.sh +++ b/hetzner-ubuntu22-zfs-setup.sh @@ -752,7 +752,7 @@ for ((i = 1; i < ${#v_selected_disks[@]}; i++)); do dd if="${v_selected_disks[0]}-part1" of="${v_selected_disks[i]}-part1" done -if [[ $v_encrypt_rpool == "1" ]]; then +if [[ $v_encrypt_rpool == "1" ]]; then echo "=========set up dropbear==============" chroot_execute "apt install --yes dropbear-initramfs" From 59668c0ab9b696e7bb2afd55d05c216417c8940b Mon Sep 17 00:00:00 2001 From: terem42 <9478806+terem42@users.noreply.github.com> Date: Tue, 10 Oct 2023 17:04:04 +0200 Subject: [PATCH 4/4] update --- hetzner-debian10-zfs-setup.sh | 2 +- hetzner-debian11-zfs-setup.sh | 2 +- hetzner-debian12-zfs-setup.sh | 2 +- hetzner-ubuntu18-zfs-setup.sh | 2 +- hetzner-ubuntu20-zfs-setup.sh | 2 +- hetzner-ubuntu22-zfs-setup.sh | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/hetzner-debian10-zfs-setup.sh b/hetzner-debian10-zfs-setup.sh index c553ae8..5715d6b 100644 --- a/hetzner-debian10-zfs-setup.sh +++ b/hetzner-debian10-zfs-setup.sh @@ -845,7 +845,7 @@ chroot_execute "update-grub" echo "======= setting up zed ==========" if [[ $v_zfs_experimental == "1" ]]; then - chroot_execute "zfs set canmount=noauto rpool" + chroot_execute "zfs set canmount=noauto $v_rpool_name" else initial_load_debian_zed_cache fi diff --git a/hetzner-debian11-zfs-setup.sh b/hetzner-debian11-zfs-setup.sh index 2ce2c47..2726a69 100644 --- a/hetzner-debian11-zfs-setup.sh +++ b/hetzner-debian11-zfs-setup.sh @@ -842,7 +842,7 @@ chroot_execute "update-grub" echo "======= setting up zed ==========" if [[ $v_zfs_experimental == "1" ]]; then - chroot_execute "zfs set canmount=noauto rpool" + chroot_execute "zfs set canmount=noauto $v_rpool_name" else initial_load_debian_zed_cache fi diff --git a/hetzner-debian12-zfs-setup.sh b/hetzner-debian12-zfs-setup.sh index 89c17a4..c648c11 100644 --- a/hetzner-debian12-zfs-setup.sh +++ b/hetzner-debian12-zfs-setup.sh @@ -847,7 +847,7 @@ chroot_execute "update-grub" echo "======= setting up zed ==========" if [[ $v_zfs_experimental == "1" ]]; then - chroot_execute "zfs set canmount=noauto rpool" + chroot_execute "zfs set canmount=noauto $v_rpool_name" else initial_load_debian_zed_cache fi diff --git a/hetzner-ubuntu18-zfs-setup.sh b/hetzner-ubuntu18-zfs-setup.sh index 8620ac0..2562910 100644 --- a/hetzner-ubuntu18-zfs-setup.sh +++ b/hetzner-ubuntu18-zfs-setup.sh @@ -819,7 +819,7 @@ chroot_execute "update-grub" echo "======= setting up zed ==========" -chroot_execute "zfs set canmount=noauto rpool" +chroot_execute "zfs set canmount=noauto $v_rpool_name" echo "======= setting mountpoints ==========" chroot_execute "zfs set mountpoint=legacy $v_bpool_name/BOOT/ubuntu" diff --git a/hetzner-ubuntu20-zfs-setup.sh b/hetzner-ubuntu20-zfs-setup.sh index 09f8945..40ada20 100644 --- a/hetzner-ubuntu20-zfs-setup.sh +++ b/hetzner-ubuntu20-zfs-setup.sh @@ -832,7 +832,7 @@ chroot_execute "update-grub" echo "======= setting up zed ==========" -chroot_execute "zfs set canmount=noauto rpool" +chroot_execute "zfs set canmount=noauto $v_rpool_name" echo "======= setting mountpoints ==========" chroot_execute "zfs set mountpoint=legacy $v_bpool_name/BOOT/ubuntu" diff --git a/hetzner-ubuntu22-zfs-setup.sh b/hetzner-ubuntu22-zfs-setup.sh index 6081bfa..6439b3a 100644 --- a/hetzner-ubuntu22-zfs-setup.sh +++ b/hetzner-ubuntu22-zfs-setup.sh @@ -821,7 +821,7 @@ chroot_execute "update-grub" echo "======= setting up zed ==========" -chroot_execute "zfs set canmount=noauto rpool" +chroot_execute "zfs set canmount=noauto $v_rpool_name" echo "======= setting mountpoints ==========" chroot_execute "zfs set mountpoint=legacy $v_bpool_name/BOOT/ubuntu"