From: Ian Kelling Date: Mon, 11 Dec 2023 12:20:00 +0000 (-0500) Subject: mostly fixes and host updates X-Git-Url: https://iankelling.org/git/?a=commitdiff_plain;h=f856a11aa6b4aaa454a5c93c4f1d9672591ca2eb;p=automated-distro-installer mostly fixes and host updates --- diff --git a/fai/config/distro-install-common/end b/fai/config/distro-install-common/end index 5d61d6d..8ad84c9 100755 --- a/fai/config/distro-install-common/end +++ b/fai/config/distro-install-common/end @@ -94,7 +94,7 @@ Defaults:root,iank !log_allowed, !pam_session Defaults>root env_file=/etc/rootsudoenv # a few commands we should be able to run with no password -iank ALL = (root) NOPASSWD: /usr/local/bin/spend,/usr/local/bin/us,/usr/local/bin/off,/usr/bin/nmtui-connect,/usr/local/bin/bitcoinoff +iank ALL = (root) NOPASSWD: /usr/local/bin/spend,/usr/local/bin/us,/usr/local/bin/off,/usr/bin/nmtui-connect,/usr/local/bin/bitcoinoff,/usr/local/bin/bitcoinon EOF diff --git a/fai/config/files/usr/bin/myncq/kd b/fai/config/files/usr/bin/myncq/kd index 2d65edb..255d6d1 100755 --- a/fai/config/files/usr/bin/myncq/kd +++ b/fai/config/files/usr/bin/myncq/kd @@ -7,18 +7,42 @@ trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" exit status: $?, PIPESTATUS: ${P [[ $EUID == 0 ]] || exec sudo -E "${BASH_SOURCE[0]}" "$@" + +# todo: we should make this be a service which sets the /sys/ value +# before the mount target or something like that, because if you hot +# plug a drive in, its ata number will change on reboot, meaning you +# have to remember to run this again and then reboot again. + +# example from t8 kernel +# Sep 01 14:35:01 watson kernel: ata7.00: status: { DRDY } +# Sep 01 14:35:01 watson kernel: ata7.00: failed command: WRITE FPDMA QUEUED +# Sep 01 14:35:01 watson kernel: ata7.00: cmd 61/08:c0:b8:bf:ff/00:00:01:00:00/40 tag 24 ncq 4096 out + + # https://wiki.archlinux.org/index.php/Solid_state_drive#Resolving_NCQ_errors # evo-870 doesnt get along well with d16. # Dmesg gives us an ata number we could disable specifically on the command line, but I've had that number change on me between oses, so reenabling ncq +debug=false +if [[ $1 == debug ]]; then + debug=true +fi + upgrub=true if [[ $1 == no-upgrub ]]; then upgrub=false fi -byid=/dev/disk/by-id/ata-Samsung_SSD_870_QVO_8TB_S5VUNG0N900656V +regex='^.*-part[0-9]*$' +for path in /dev/disk/by-id/ata-Samsung_SSD_870*; do + if [[ ! $path =~ $regex ]]; then + byid=$path + break + fi +done + if [[ ! -e $byid ]]; then - # not plugged in we assume + if $debug; then echo "samsung 870 not plugged in or not found"; fi exit 0 fi @@ -34,6 +58,10 @@ if [[ $depth != 0 ]]; then if grep -qF libata.force=noncq /proc/cmdline; then echo $0: warning, cant change queue_depth due to globally disabled ncq else + if $debug; then + echo "updating to 1 if not: cat /sys/block/$dev/device/queue_depth" + cat /sys/block/$dev/device/queue_depth + fi echo 1 >/sys/block/$dev/device/queue_depth fi fi diff --git a/fai/config/scripts/IANK/11-iank b/fai/config/scripts/IANK/11-iank index 43fc13b..0b8d6c5 100755 --- a/fai/config/scripts/IANK/11-iank +++ b/fai/config/scripts/IANK/11-iank @@ -19,7 +19,10 @@ if [[ -e /a/bin/fai/fai-wrapper ]]; then } fi - +if [[ $FAI_ROOT != / ]]; then + bprogs_pre=/srv + chroot="chroot $FAI_ROOT" +fi # -r = recursive # -i = ignore non-matching class warnings, always exit 0 @@ -53,13 +56,13 @@ $FAI/distro-install-common/end # I run this as a single post-fai script to update things that have changed. tmpfile1=$(mktemp) # this can fail if we need an apt update -chroot $FAI_ROOT /usr/bin/apt-cache policy >$tmpfile1 ||: +$chroot /usr/bin/apt-cache policy >$tmpfile1 ||: fcopy -riB /etc/apt tmpfile2=$(mktemp) -chroot $FAI_ROOT /usr/bin/apt-cache policy >$tmpfile2 +$chroot /usr/bin/apt-cache policy >$tmpfile2 if ! diff -q $tmpfile1 $tmpfile2; then - chroot $FAI_ROOT /usr/bin/apt update + $chroot /usr/bin/apt update fi # outside of fai, this seems to regularly lead to # E: Could not get lock /var/lib/apt/lists/lock - open (11: Resource temporarily unavailable) @@ -109,7 +112,7 @@ TimeoutStartSec=20 WantedBy=dev-disk-by\x2did-ata\x2dSamsung_SSD_870_QVO_8TB_S5VUNG0N900656V.device EOF - chroot $FAI_ROOT bash <<'EOFOUTER' + $chroot bash <<'EOFOUTER' systemctl enable myncq.service /usr/bin/myncq no-upgrub EOFOUTER @@ -159,7 +162,7 @@ fi # use networkmanager if this host has wireless. if [[ $HOSTNAME == bo ]] || type -p iw &>/dev/null && [[ $(iw dev) ]]; then - chroot $FAI_ROOT bash <&1 | grep -Fx "Status: install ok installed" &>/dev/null; then + urls=( + ${pre}headers-${vb}_${vc}_all.deb + ${pre}{headers,image-unsigned,modules}-${vb}-generic_${vc}_amd64.deb + ) + wget "${urls[@]}" + $chroot bash <