From 40a7ea4bafdb02fbc0ad1297b147384ccb121120 Mon Sep 17 00:00:00 2001 From: Ian Kelling Date: Sun, 15 Feb 2026 18:47:54 -0500 Subject: [PATCH] various fixes, support for small root drive --- .../preferences.d/ecne-missing/ECNE_MISSING | 2 +- fai/config/hooks/partition.DEFAULT | 56 ++++++++++++------- fai/config/scripts/IANK/11-iank | 12 ++-- faiserver-setup | 3 - grub.cfg.autodiscover | 10 ++-- 5 files changed, 50 insertions(+), 33 deletions(-) diff --git a/fai/config/files/etc/apt/preferences.d/ecne-missing/ECNE_MISSING b/fai/config/files/etc/apt/preferences.d/ecne-missing/ECNE_MISSING index 763e897..c348c9e 100644 --- a/fai/config/files/etc/apt/preferences.d/ecne-missing/ECNE_MISSING +++ b/fai/config/files/etc/apt/preferences.d/ecne-missing/ECNE_MISSING @@ -2,6 +2,6 @@ Package: * Pin: release n=noble,o=Ubuntu Pin-Priority: -100 -Package: 9menu acetoneiso b43-fwcutter bibledit bibledit-cloud bibledit-cloud-data bibledit-data bible-kjv bible-kjv-text bibletime bibletime-data boinc boinc-client boinc-client-nvidia-cuda boinc-client-opencl boinc-dev boinc-manager boinc-screensaver bumblebee cgpt debian-reference debian-reference-common debian-reference-de debian-reference-en debian-reference-es debian-reference-fr debian-reference-id debian-reference-it debian-reference-ja debian-reference-pt debian-reference-pt-br debian-reference-zh-cn debian-reference-zh-tw dh-modaliases epoptes epoptes-client fglrx-pxpress grub-efi-amd64 grub-efi-amd64-bin grub-efi-amd64-dbg grub-efi-amd64-signed kde-config-whoopsie kernel-wedge kodi-inputstream-adaptive kodi-inputstream-rtmp kopete kopete-data libbiblesync1.1 libbiblesync-dev libboinc7t64 libboinc-app7t64 libboinc-app-dev libkopete1 libkopete-dev libnvpair3linux libuutil3linux libzpool5linux linux-xilinx-headers-6.8.0-1008 linux-xilinx-tools-common linux-xilinx-tools-host localechooser-data ltsp minigalaxy nvidia-common nvidia-prime oem-qemu-meta ophcrack ophcrack-cli origami p7zip p7zip-full pipsi pvpgn python3-pip python3-pip-whl qsampler qstat r8168-dkms rman rtl8812au-dkms shim shim-dbg shim-signed simutrans simutrans-data simutrans-makeobj simutrans-pak64 smtube tatan torbrowser-launcher ubufox ubuntu-keyring user-mode-linux-doc vboot-kernel-utils vboot-utils w9wm winetricks xdrawchem xqf xul-ext-ubufox +Package: 9menu acetoneiso b43-fwcutter bibledit bibledit-cloud bibledit-cloud-data bibledit-data bible-kjv bible-kjv-text bibletime bibletime-data boinc boinc-client boinc-client-nvidia-cuda boinc-client-opencl boinc-dev boinc-manager boinc-screensaver bumblebee debian-reference debian-reference-common debian-reference-de debian-reference-en debian-reference-es debian-reference-fr debian-reference-id debian-reference-it debian-reference-ja debian-reference-pt debian-reference-pt-br debian-reference-zh-cn debian-reference-zh-tw dh-modaliases fglrx-pxpress grub-efi-amd64-signed kde-config-whoopsie kodi-inputstream-adaptive kodi-inputstream-rtmp libbiblesync1.1 libbiblesync-dev libboinc7t64 libboinc-app7t64 libboinc-app-dev libnvpair3linux libuutil3linux libzpool5linux localechooser-data minigalaxy nvidia-common nvidia-prime ophcrack ophcrack-cli origami pipsi pvpgn python3-pip python3-pip-whl qsampler qstat r8168-dkms rman rtl8812au-dkms shim shim-dbg shim-signed simutrans simutrans-data simutrans-makeobj simutrans-pak64 smtube tatan torbrowser-launcher ubufox ubuntu-keyring user-mode-linux-doc w9wm winetricks xdrawchem xqf xul-ext-ubufox Pin: release n=noble,o=Ubuntu Pin-Priority: 500 diff --git a/fai/config/hooks/partition.DEFAULT b/fai/config/hooks/partition.DEFAULT index 4e1b851..fc5e521 100755 --- a/fai/config/hooks/partition.DEFAULT +++ b/fai/config/hooks/partition.DEFAULT @@ -373,7 +373,7 @@ $first_boot_dev /boot btrfs nofail,$fstabstd,noatime,subvol=$boot_vol $first_efi /boot/efi vfat nofail,$fstabstd 0 0 $first_boot_dev /mnt/boot btrfs nofail,$fstabstd,noatime,subvolid=0 0 0 EOF - if ! fsf; then + if ! fsf && ! $skip_o; then cat >> /tmp/fai/fstab <>/tmp/fai/crypttab <>/tmp/fai/crypttab <> /tmp/fai/fstab < 900000 )); then +elif (( boot_space > 80000 )); then # this is larger than needed for several /boot subvols, # becuase I keep a minimal debian install on it for # recovery needs and for doing pxe-kexec. boot_mib=10000 - root2_mib=500000 + root2_mib=$(( boot_space / 2 )) + if (( root2_mib > 500000 )); then + root2_mib=500000 + fi boot2_mib=5000 -elif (( boot_space > 30000 )); then - boot_mib=$(( 5000 + (boot_space - 30000) / 2 )) - root2_mib=100 - boot2_mib=100 else # Small vms don't have room for /boot recovery. With 3 kernels # installed, i'm using 132M on t8, so this seems like plenty of @@ -1087,14 +1095,18 @@ if $partition; then # 600 = uefi 512 + grubext 8 + bios grub 3 + some extra cuz this is lvm #root_mib=$(( disk_mib - root2_part_mib - swap_mib - boot_part_mib - boot2_part_mib - 600 )) - # If we have extra devices, give /o some overhead so that we can - # remove & then add a device if needed. - o_factor=$devs_count - if (( o_factor >= 2 )); then - o_factor=$(( o_factor - 1 )) + if $skip_o; then + o_mib=0 + else + # If we have extra devices, give /o some overhead so that we can + # remove & then add a device if needed. + o_factor=$devs_count + if (( o_factor >= 2 )); then + o_factor=$(( o_factor - 1 )) + fi + # note: math operations are left to right, so divide at the end. + o_mib=$(( 180 * 1000 * raid_duplication / o_factor )) fi - # note: math operations are left to right, so divide at the end. - o_mib=$(( 180 * 1000 * raid_duplication / o_factor )) # max minus o, minus a gig just for some extra space max_root_mib=$(( disk_mib - root2_part_mib - swap_mib - boot_part_mib - boot2_part_mib - 600 - o_mib - 1000 )) root_mib=$(( 1700 * 1000 )) # * 1000 to make it in gb. @@ -1108,7 +1120,7 @@ if $partition; then else # -L unit default mebibyte lvcreate -y -L $root_mib $vg -n root - if ! fsf; then + if ! fsf && ! $skip_o; then lvcreate -y -L $o_mib $vg -n o fi lvcreate -y -L $swap_mib $vg -n swap @@ -1196,7 +1208,9 @@ if $partition; then # sensitive data. if ! fsf; then luks-setup /dev/$vg/root crypt-$vg-root - luks-setup /dev/$vg/o crypt-$vg-o + if ! $skip_o; then + luks-setup /dev/$vg/o crypt-$vg-o + fi fi if [[ $special_disk ]]; then @@ -1208,7 +1222,7 @@ if $partition; then sleep 1 bpart ${root_devs[@]} - if ! fsf; then + if ! fsf && ! $skip_o; then bpart ${o_devs[@]} fi bpart ${boot_devs[@]} @@ -1225,8 +1239,10 @@ else ## end if $partition ## else cryptsetup luksOpen /dev/$vg/root crypt-$vg-root \ --key-file $luks_file - cryptsetup luksOpen /dev/$vg/o crypt-$vg-o \ - --key-file $luks_file + if ! $skip_o; then + cryptsetup luksOpen /dev/$vg/o crypt-$vg-o \ + --key-file $luks_file + fi fi done fi diff --git a/fai/config/scripts/IANK/11-iank b/fai/config/scripts/IANK/11-iank index fc273aa..c469efa 100755 --- a/fai/config/scripts/IANK/11-iank +++ b/fai/config/scripts/IANK/11-iank @@ -157,7 +157,7 @@ esac # https://nouveau.freedesktop.org/InstallNouveau.html # And now in t11, things got worse with a newer card also not loading # nouveau when it did in t10. -if [[ $HOSTNAME != frodo ]] && lspci|grep -q 'VGA compatible controller: NVIDIA'; then +if [[ $HOSTNAME != frodo && $HOSTNAME != kd ]] && lspci|grep -q 'VGA compatible controller: NVIDIA'; then mkdir -p $target/etc/X11/xorg.conf.d/ cat >$target/etc/X11/xorg.conf.d/10-nouveau.conf <<'EOF' Section "Device" @@ -354,16 +354,20 @@ if [[ $HOSTNAME == li ]]; then fi ## begin get new kernel and btrfs-progs ## +apt-get -y install wget + case $HOSTNAME in sy|so) # note, on sy t11, severe wifi degredation on mainline 6.8 $ROOTCMD apt-get -y install linux-image-generic ;; - frodo) : ;; + frodo|kd) : ;; *) if ! $ROOTCMD dpkg -s -- freesh-archive-keyring 2>&1 | grep -Fx "Status: install ok installed" &>/dev/null; then - apt-get -y install wget - wget -O $target/tmp/x.deb https://linux-libre.fsfla.org/pub/linux-libre/freesh/pool/main/f/freesh-archive-keyring/freesh-archive-keyring_1.1_all.deb + if ! wget -O $target/tmp/x.deb https://linux-libre.fsfla.org/pub/linux-libre/freesh/pool/main/f/freesh-archive-keyring/freesh-archive-keyring_1.3_all.deb; then + echo "error: check freesh keyring url at https://www.fsfla.org/ikiwiki/selibre/linux-libre/freesh.en.html" >&2 + exit 1 + fi $ROOTCMD dpkg -i $target/tmp/x.deb $ROOTCMD apt-get update $ROOTCMD apt-get -y install linux-libre diff --git a/faiserver-setup b/faiserver-setup index 4ecff54..6bf7295 100755 --- a/faiserver-setup +++ b/faiserver-setup @@ -297,9 +297,6 @@ EOF fi rm -f /srv/fai/nfsroot/root/.ssh/known_hosts -if [[ $HOSTNAME == kd ]]; then - keyscan_arg="-p 8989" -fi key=$(ssh-keyscan $keyscan_arg localhost |& grep -o "ecdsa-sha2-nistp256.*") for ip in faiserver.b8.nz $(ip addr show up| grep -w '^ *inet' | awk '{print $2}'| cut -d / -f 1 | grep -vF 127.0.0.1); do echo "$ip $key" >>/srv/fai/nfsroot/root/.ssh/known_hosts diff --git a/grub.cfg.autodiscover b/grub.cfg.autodiscover index fac9ef7..b52bd53 100644 --- a/grub.cfg.autodiscover +++ b/grub.cfg.autodiscover @@ -1,5 +1,5 @@ ## grub2 configuration -set default="FAI server via dns" +set default="FAI server via dns, no reboot" set timeout=20 # make sure we can access partitions @@ -23,21 +23,21 @@ set menu_color_highlight=black/yellow menuentry "FAI server via dns to faiserver.b8.nz" { set gfxpayload=$resolution search --set=root --file /FAI-CD - linux /boot/vmlinuz libata.force=noncq FAI_FLAGS=verbose,sshd,createvt,reboot FAI_CONFIG_SRC=nfs://faiserver.b8.nz/srv/fai/config root=/dev/nfs nfsroot=faiserver.b8.nz:/srv/fai/nfsroot,vers=3,nolock rootovl ip=dhcp + linux /boot/vmlinuz libata.force=noncq FAI_FLAGS=verbose,sshd,createvt,reboot FAI_CONFIG_SRC=nfs://faiserver.b8.nz/srv/fai/config root=/dev/nfs nfsroot=faiserver.b8.nz:/srv/fai/nfsroot,vers=3,nolock rootovl ip=dhcp console=ttyS0,115200 initrd /boot/initrd.img } menuentry "FAI server via dns, no reboot" { set gfxpayload=$resolution search --set=root --file /FAI-CD - linux /boot/vmlinuz libata.force=noncq FAI_FLAGS=verbose,sshd,createvt FAI_CONFIG_SRC=nfs://faiserver.b8.nz/srv/fai/config root=/dev/nfs nfsroot=faiserver.b8.nz:/srv/fai/nfsroot,vers=3,nolock rootovl ip=dhcp + linux /boot/vmlinuz libata.force=noncq FAI_FLAGS=verbose,sshd,createvt FAI_CONFIG_SRC=nfs://faiserver.b8.nz/srv/fai/config root=/dev/nfs nfsroot=faiserver.b8.nz:/srv/fai/nfsroot,vers=3,nolock rootovl ip=dhcp console=ttyS0,115200 initrd /boot/initrd.img } menuentry "FAI server via 192.168.122.1, no reboot" { set gfxpayload=$resolution search --set=root --file /FAI-CD - linux /boot/vmlinuz libata.force=noncq FAI_FLAGS=verbose,sshd,createvt FAI_CONFIG_SRC=nfs://192.168.122.1/srv/fai/config root=/dev/nfs nfsroot=192.168.122.1:/srv/fai/nfsroot,vers=3,nolock rootovl ip=dhcp + linux /boot/vmlinuz libata.force=noncq FAI_FLAGS=verbose,sshd,createvt FAI_CONFIG_SRC=nfs://192.168.122.1/srv/fai/config root=/dev/nfs nfsroot=192.168.122.1:/srv/fai/nfsroot,vers=3,nolock rootovl ip=dhcp console=ttyS0,115200 initrd /boot/initrd.img } @@ -45,7 +45,7 @@ menuentry "FAI server via 192.168.122.1, no reboot" { # ro,noatime,vers=3,rsize=1048576,wsize=same,namelen=255,hard,nolock,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=10.2.0.2,nountvers=3,mountport=49179,mountproto=udp,lock_lock=all,addr=10.2.0.2 menuentry "Autodiscover the FAI server" { search --set=root --file /FAI-CD - linux /boot/vmlinuz libata.force=noncq FAI_FLAGS="menu,verbose,createvt" fai.discover rootovl root=/dev/nfs ip=dhcp quiet + linux /boot/vmlinuz libata.force=noncq FAI_FLAGS="menu,verbose,createvt" fai.discover rootovl root=/dev/nfs ip=dhcp quiet console=ttyS0,115200 initrd /boot/initrd.img } -- 2.30.2