From 1e6019a5846160b3f62fc94357e16944b5b3527b Mon Sep 17 00:00:00 2001 From: Ian Kelling Date: Sun, 7 Aug 2022 20:03:07 -0400 Subject: [PATCH] fixes, t11, install in ad-hoc network --- README | 61 ++++++++++++++++++- dhcpd.conf | 35 +++++++++++ fai-redep | 1 - .../root/fai-check/VOL_BULLSEYE_BOOTSTRAP | 41 ++++++++----- fai/config/scripts/IANK/11-iank | 4 +- fsf/dhcpd.conf | 35 +++++++++++ myfai-chboot-local | 18 +++++- pxe-server | 4 +- wrt-setup-local | 4 +- 9 files changed, 181 insertions(+), 22 deletions(-) create mode 100644 dhcpd.conf create mode 100644 fsf/dhcpd.conf diff --git a/README b/README index 0dc966b..fbfa4ae 100644 --- a/README +++ b/README @@ -292,7 +292,63 @@ fai.log:Error: /dev/vda: unrecognised disk label This is from parted -m $d unit MiB print. It happens when there are no partitions yet. -# linode notes + +######## notes on creating a lan with just 2 computers ######## + + +## below assumes eth0 is the ethernet device used to connect to the target computer. + + +# this is not strictly needed. I had my connection die at some point, +# and I suspected this might help. +# based on +# https://support.qacafe.com/knowledge-base/how-do-i-prevent-network-manager-from-controlling-an-interface/ +cat > /etc/NetworkManager/conf.d/99-fai-tmp.conf <<'EOF' +[main] +plugins=keyfile + +[keyfile] +unmanaged-devices=interface-name:eth0 +EOF +ser restart NetworkManager + + +cat >> /etc/network/interfaces <<'EOF' +iface eth0 inet static +address 10.0.44.1/24 +EOF + +ifup eth0 + +# note turn off fsf vpn, so route to coresite is the normal route. +echo 1 > /proc/sys/net/ipv4/ip_forward +m s iptables -t nat -A POSTROUTING -o $(ip -4 route get 8.8.8.8 | sed -nr 's,^.* dev\s+(\S+).*,\1,p') -j MASQUERADE + + +change /p/c/machine_specific/vps/bind-initial/db.b8.nz +faiserver 10.0.44.1 +TARGET 10.0.44.2 + +apt install isc-dhcp-server + +cat >> /etc/default/isc-dhcp-server <<'EOF' +INTERFACESv4="eth0" +EOF + +edit ./dhcpd.conf to change mac address and target host name. + +s cp /b/fai/dhcpd.conf /etc/dhcp/ +ser restart isc-dhcp-server + +edit /a/bin/fai/fai/config/class/51-multi-boot + +pxe-server -d TARGET fai + +Then do a pxe boot on the target host + + + +##### linode notes ###### * create 2 disks, installer (3000 mb, raw), boot (remaining, raw) * create 2 profiles w direct boot, no helpers: @@ -308,7 +364,8 @@ It happens when there are no partitions yet. settings. -# ubuntu notes + +###### ubuntu notes ###### For someone who really needed ubuntu on host tp, otherwise they would end up on a non-gnu os, and I didn't want to figure out how to get all diff --git a/dhcpd.conf b/dhcpd.conf new file mode 100644 index 0000000..8a3ddd4 --- /dev/null +++ b/dhcpd.conf @@ -0,0 +1,35 @@ +# + +# iank: just guessing here. +authoritative; + + +deny unknown-clients; +option dhcp-max-message-size 2048; +use-host-decl-names on; + +subnet 10.0.44.0 netmask 255.255.255.0 { +option routers 10.0.44.1; +option domain-name "b8.nz"; +option domain-search "b8.nz"; +option domain-name-servers 8.8.8.8; +option ntp-servers 0.ubuntu.pool.ntp.org, 1.ubuntu.pool.ntp.org, ntp.ubuntu.com; +# iank: not sure why this is here, but not in +#server-name faiserver; +option time-offset -18000; # Eastern Standard Time +} + +host community0p { +next-server faiserver.b8.nz; +filename "pxelinux.0"; + +hardware ethernet 00:1f:16:14:01:d8; +# 1st mobo, mostly fails to boot +#hardware ethernet 08:60:6e:10:f0:fe; +fixed-address 10.0.44.2; +option host-name "x3"; +} + + +default-lease-time 600; +max-lease-time 7200; diff --git a/fai-redep b/fai-redep index a974208..7c8b9dd 100755 --- a/fai-redep +++ b/fai-redep @@ -72,7 +72,6 @@ rsync -atL /home/iank/.ssh/authorized_keys fai/config/files/root/.ssh/authorized # we hssh and ssh_filter_btrbk for the initial btrbk (alternatively, I could open up the # permissions in authorized_keys, but that just seems lazy) install --owner=iank --group=iank -d fai/config/files/usr/local/bin/hssh -rsync -atL /a/bin/ds/hssh fai/config/files/usr/local/bin/hssh/IANK install --owner=iank --group=iank -d fai/config/files/usr/local/bin/ssh_filter_btrbk.sh rsync -atL /a/opt/btrbk/ssh_filter_btrbk.sh fai/config/files/usr/local/bin/ssh_filter_btrbk.sh/STANDARD diff --git a/fai/config/files/root/fai-check/VOL_BULLSEYE_BOOTSTRAP b/fai/config/files/root/fai-check/VOL_BULLSEYE_BOOTSTRAP index 6717987..1d7b5c7 100755 --- a/fai/config/files/root/fai-check/VOL_BULLSEYE_BOOTSTRAP +++ b/fai/config/files/root/fai-check/VOL_BULLSEYE_BOOTSTRAP @@ -7,7 +7,7 @@ trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR usage() { cat < deadline )); then echo "fai-check: hit $NETWORK_TIMOUT_SECS s tftp server timeout" return 0 fi sleep 1 done - m pxe-kexec -n --ignore-whitelist -l fai-generated faiserver ||: + m pxe-kexec -n --ignore-whitelist -l fai-generated $faiserver ||: } +force=false case $1 in + -h|--help) + usage + ;; -f|--force) - try-kexec - exit + force=true + shift ;; esac +faiserver=${1:-faiserver} + + +if $force; then + try-kexec + exit +fi first=true for dev in $(btrfs fi show / | sed -rn 's#^\s*devid\s.*\s([^0-9 ]+)\S+$#\1#p' \ |sort); do + found=false # Decide which is my grub_ext partition. see partition.DEFAULT file - # for details - if [[ $(blockdev --getsize64 ${dev}4) == 8388608 ]]; then - # Old partition scheme - grub_extn=${dev}4 - elif [[ $(blockdev --getsize64 ${dev}5) == 8388608 ]]; then - # Old partition scheme - grub_extn=${dev}5 - else - grub_extn=${dev}7 + # for details. currently it is 4 + for (( i=4; i<=7; i++ )); do + if [[ $(blockdev --getsize64 ${dev}$i) == 8388608 ]]; then + grub_extn=${dev}$i + break + fi + done + if ! $found; then + echo "$0: error: failed to find grub_ext partition." + exit 1 fi mount $grub_extn /mnt if $first; then diff --git a/fai/config/scripts/IANK/11-iank b/fai/config/scripts/IANK/11-iank index 5245b35..e77eb8f 100755 --- a/fai/config/scripts/IANK/11-iank +++ b/fai/config/scripts/IANK/11-iank @@ -143,7 +143,9 @@ esac # xorg stopped load nouveau # https://www.linuxquestions.org/questions/slackware-14/kernel-modules-conflicting-with-nouveau-driver-4175623867/ # https://nouveau.freedesktop.org/InstallNouveau.html -if lspci|grep -q 'GeForce GTX 6[0-9][0-9]\]'; then +# And now in t11, things got worse with a newer card also not loading +# nouveau when it did in t10. +if 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" diff --git a/fsf/dhcpd.conf b/fsf/dhcpd.conf new file mode 100644 index 0000000..9f12ec0 --- /dev/null +++ b/fsf/dhcpd.conf @@ -0,0 +1,35 @@ +# + +# iank: just guessing here. +authoritative; + + +deny unknown-clients; +option dhcp-max-message-size 2048; +use-host-decl-names on; + +subnet 209.51.188.0 netmask 255.255.255.0 { +option routers 209.51.188.1; +option domain-name "fsf.org"; +option domain-search "fsf.org"; +option domain-name-servers 209.51.188.16; +option ntp-servers 0.ubuntu.pool.ntp.org, 1.ubuntu.pool.ntp.org, ntp.ubuntu.com; +# iank: not sure why this is here, but not in +#server-name faiserver; +option time-offset -18000; # Eastern Standard Time +} + +host community0p { +next-server faiserver.fsf.org; +filename "pxelinux.0"; + +hardware ethernet ac:22:0b:1d:11:f9; +# 1st mobo, mostly fails to boot +#hardware ethernet 08:60:6e:10:f0:fe; +fixed-address 209.51.188.193; +option host-name "community0p"; +} + + +default-lease-time 600; +max-lease-time 7200; diff --git a/myfai-chboot-local b/myfai-chboot-local index 8ab5a92..cef41c4 100755 --- a/myfai-chboot-local +++ b/myfai-chboot-local @@ -34,6 +34,10 @@ while [[ $1 == -* ]]; do bond=true shift ;; + --no-r) + fai_reboot_arg= + shift + ;; esac done @@ -44,15 +48,27 @@ err() { echo "[$(date +'%Y-%m-%d %H:%M:%S%z')]: $pre: $*" >&2; } host=$1 + rm -f /srv/tftp/fai/pxelinux.cfg/* if [[ ! $1 ]]; then echo "$0: clearing pxe config and exiting" exit 0 fi +# somewhat duplicated in brc hostip() + case $host in + [0-9:]) + hostip=$host + ;; + *) + hostip=$(getent ahostsv4 "$host" | awk '{ print $1 }' | head -n1) + ;; + esac + + # assuming ipv4, or else we might need to deal with multiple addresses # in an ipv4 + ipv6 network. -my_ip=$(ip -4 route get 8.8.8.8 | sed -nr 's,^.*src\s+(\S+).*,\1,p') +my_ip=$(ip -4 route get $hostip | sed -nr 's,^.*src\s+(\S+).*,\1,p') if [[ ! $my_ip || $my_ip =~ [[:space:]] ]]; then echo "$0: error: failed to get \$my_ip, got: $my_ip" exit 1 diff --git a/pxe-server b/pxe-server index 78e25a6..1e99b03 100755 --- a/pxe-server +++ b/pxe-server @@ -49,6 +49,7 @@ TYPE One of arch, parabola, plain, fai. -d Don't alter dhcp config. Only make sense for fai type, and on network other than home or fsf, when using fai-cd, or pxe-kexec. -k Pass -k to myfai-chboot. +--no-r Pass --no-r to myfai-chboot. -r Don't redeploy fai config. For example, if there is a different host that is mid-install. @@ -105,13 +106,14 @@ case $HOSTNAME in esac chboot_args=() -temp=$(getopt -l help adkrSwh "$@") || usage 1 +temp=$(getopt -l no-r,help adkrSwh "$@") || usage 1 eval set -- "$temp" while true; do case $1 in -a) wait=true; set=false; shift ;; -d) dhcp=false; shift ;; -k) chboot_args+=(-k); shift ;; + --no-r) chboot_args+=(--no-r); shift ;; -r) redep=false; shift ;; -S) chboot_args+=(-S); shift ;; -w) wait=true; set=true; shift ;; diff --git a/wrt-setup-local b/wrt-setup-local index ce6ad03..df965ea 100755 --- a/wrt-setup-local +++ b/wrt-setup-local @@ -754,7 +754,7 @@ config redirect option src wan option src_dport 80 option dest lan - option dest_ip $l.7 + option dest_ip $l.2 option proto tcp config rule option src wan @@ -767,7 +767,7 @@ config redirect option src wan option src_dport 443 option dest lan - option dest_ip $l.7 + option dest_ip $l.2 option proto tcp config rule option src wan -- 2.30.2