Skip to content

Commit 784ee5f

Browse files
authored
Update hetzner-debian12-zfs-setup.sh (#81)
* Update hetzner-debian12-zfs-setup.sh fix for ===========remove unused kernels in rescue system========= Reading package lists... Done Building dependency tree... Done Reading state information... Done E: Unable to locate package linux-headers-6.11.3 E: Couldn't find any package by glob 'linux-headers-6.11.3' * try to fix Configuration file '/etc/issue' * try to fix mountpoint issue mountpoint '/mnt/' exists and is not empty use '-m' option to provide a different default
1 parent 8858afa commit 784ee5f

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

hetzner-debian12-zfs-setup.sh

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ set -o pipefail
1818
set -o nounset
1919

2020
export TMPDIR=/tmp
21+
export DEBIAN_FRONTEND=noninteractive
2122

2223
# Variables
2324
v_bpool_name=
@@ -491,8 +492,12 @@ clear
491492

492493
echo "===========remove unused kernels in rescue system========="
493494
for kver in $(find /lib/modules/* -maxdepth 0 -type d | grep -v "$(uname -r)" | cut -s -d "/" -f 4); do
494-
apt purge --yes "linux-headers-$kver"
495-
apt purge --yes "linux-image-$kver"
495+
if dpkg -l "linux-headers-$kver" 2>/dev/null | grep -q "^ii"; then
496+
apt purge --yes "linux-headers-$kver"
497+
fi
498+
if dpkg -l "linux-image-$kver" 2>/dev/null | grep -q "^ii"; then
499+
apt purge --yes "linux-image-$kver"
500+
fi
496501
done
497502

498503
echo "======= installing zfs on rescue system =========="
@@ -506,7 +511,7 @@ echo "======= installing zfs on rescue system =========="
506511
echo -e "deb http://deb.debian.org/debian/ testing main contrib non-free\ndeb http://deb.debian.org/debian/ testing main contrib non-free\n" >/etc/apt/sources.list.d/bookworm-testing.list
507512
echo -e "Package: src:zfs-linux\nPin: release n=testing\nPin-Priority: 990\n" > /etc/apt/preferences.d/90_zfs
508513
apt update
509-
apt install -t testing --yes zfs-dkms zfsutils-linux
514+
apt install -t testing --yes -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" zfs-dkms zfsutils-linux
510515
rm /etc/apt/sources.list.d/bookworm-testing.list
511516
rm /etc/apt/preferences.d/90_zfs
512517
apt update
@@ -558,13 +563,15 @@ echo "======= create zfs pools and datasets =========="
558563

559564
# shellcheck disable=SC2086
560565
zpool create \
566+
-m none \
561567
-o cachefile=/etc/zpool.cache \
562568
-o compatibility=grub2 \
563569
-O mountpoint=/boot -R $c_zfs_mount_dir -f \
564570
$v_bpool_name $pools_mirror_option "${bpool_disks_partitions[@]}"
565571

566572
# shellcheck disable=SC2086
567573
echo -n "$v_passphrase" | zpool create \
574+
-m none \
568575
$v_rpool_tweaks \
569576
-o cachefile=/etc/zpool.cache \
570577
"${encryption_options[@]}" \

0 commit comments

Comments
 (0)