From: Ian Kelling Date: Fri, 24 Nov 2017 17:52:12 +0000 (-0500) Subject: raid10 replace docs, various fixes X-Git-Url: https://iankelling.org/git/?a=commitdiff_plain;h=9ac5bbeccb3e969e29b372656bd51352ff31b0b8;p=automated-distro-installer raid10 replace docs, various fixes --- diff --git a/README b/README index 3e6123b..9899ed3 100644 --- a/README +++ b/README @@ -81,6 +81,28 @@ fai-wrapper # use fai classes outside of fai. sourced, not called. faiserver-disable # Disable the fai nfs server exports fresize # resize swap or boot partitions in a host +# Replacing a raid 10 disk + +pxe-server -S HOST fai +ssh root@HOST +cat >p +PASSWORD HERE(ctrl-d ctrl-d) +for d in /dev/disk/by-id/ata*part1; do cryptsetup luksOpen --key-file p $d crypt_dev_${d##*/}; done +# btrfs replace disk # i forget the actual command +x=(/dev/mapper/*part1); mount -o subvol=root_trisquelflidas $x /mnt +mount -o subvol=boot_trisquelflidas /dev/sda3 /mnt/boot +for x in dev proc sys; do mount -o bind /$x /mnt/$x; done +chroot /mnt /bin/bash +# replace disk in fstab +# replace disk in /etc/crypttab +update-grub +update-initramfs -u +mount /a +/a/exe/keyscript-on +exit +reboot + + License stuff: The license for the project is GPLv2 or later, mostly because fai is and diff --git a/dsfull b/dsfull index df9c398..5cc0fad 100755 --- a/dsfull +++ b/dsfull @@ -59,27 +59,26 @@ host=$1 ##### end command line parsing ######## -e ser stop btrbk.timer +ser stop btrbk.timer if [[ ! $host ]]; then echo "$0: error: expected 1 arg of hostname" exit 1 fi -e() { echo "$@"; "$@"; } if $kexec; then - e fai-redep - e myfai-chboot $host - e fai-kexec $host ||: + fai-redep + myfai-chboot $host + fai-kexec $host ||: else cleanup() { pxe-server; }; _errcatch_cleanup=cleanup - e pxe-server $host fai + pxe-server $host fai if $reboot; then # untested, this caused hang using here doc. - ssh $host "touch /tmp/keyscript-off; sudo reboot" ||: & + ssh root@$host "touch /tmp/keyscript-off; reboot" ||: & fi - e pxe-server -a + pxe-server -a unset _errcatch_cleanup fi @@ -91,7 +90,7 @@ for ((i=0; i<240; i++)); do fi sleep 5 done -e faiserver-disable +faiserver-disable if $error; then echo "$0: error: timeout" exit 1 @@ -99,8 +98,8 @@ fi while [[ $(ser is-active btrbk.service) == active ]]; do sleep 5 done -e btrbk-run -t $host -ssh $host /a/bin/distro-setup/distro-begin +btrbk-run -t $host +#ssh $host /a/bin/distro-setup/distro-begin # this should be done instead of distro-begin, but # keeping it to 2 steps for now -#e dsremote $host +dsremote $host diff --git a/fai/config/class/50-host-classes b/fai/config/class/50-host-classes index 3169fd3..a6d8bc2 100755 --- a/fai/config/class/50-host-classes +++ b/fai/config/class/50-host-classes @@ -12,13 +12,7 @@ # We check the reverse condition in 51-multi-boot, # and set what os we are installing, but don't check it # into git since it changes regularly. -# It's code looks like this: -# if [[ ! -e /a/bin/fai/fai-wrapper ]]; then -# case $HOSTNAME in -# tp) DEBIAN STRETCH VOL_STRETCH STRETCH_FREE;; -# # add more multi-boot hostnames here -# esac -# fi + # # # Each host defines following: @@ -40,7 +34,7 @@ # # It's all a little redundant in some cases, but it keeps things # simpler. Belenos is broken right now, planning to remove it once -# flidas is released. +# flidas is released and rms has upgraded. # # # Other notable classes: @@ -60,6 +54,26 @@ # RAID0: Use raid 0 even if there are >= 4 disks with boot partititions. # # +# Code in 51-multi-boot, with reasonable combinations of above +# uncommented for easier editing, and runs as a noop until +# we replace _ with host names. +if [[ ! -e /a/bin/fai/fai-wrapper ]]; then + case $HOSTNAME in + # stretch based minimal recovery / bootstraping os: + _) echo DEBIAN STRETCH64 VOL_STRETCH_BOOTSTRAP STRETCH_NONFREE ;; + # flidas + _) echo UBUNTU FLIDAS64 VOL_FLIDAS FLIDAS ;; + # stretch + _) echo DEBIAN STRETCH64 VOL_STRETCH STRETCH_NONFREE ;; + # testing + _) echo DEBIAN STRETCH64 VOL_TESTING TESTING_NONFREE ;; + # belenos + _) echo UBUNTU BELENOS64 VOL_BELENOS BELENOS ;; + # xenial + _) echo UBUNTU XENIAL64 VOL_XENIAL XENIAL_FREE ;; + esac +fi + if [[ -e /a/bin/fai/fai-wrapper ]]; then source /a/bin/distro-functions/src/identify-distros if isdebian; then diff --git a/fai/config/distro-install-common/end b/fai/config/distro-install-common/end index 0642cf3..54a7b43 100755 --- a/fai/config/distro-install-common/end +++ b/fai/config/distro-install-common/end @@ -23,7 +23,8 @@ fi TPW=/q/root/shadow/traci-simple if ifclass tp; then - ROOTPW="$TPW" + ROOTPW=/q/root/shadow/standard +# ROOTPW="$TPW" else ROOTPW=/q/root/shadow/standard fi diff --git a/fai/config/files/etc/apt/sources.list.d/stretch.list/STRETCH_LINODE b/fai/config/files/etc/apt/sources.list.d/stretch.list/STRETCH_LINODE index 7c562d1..adf01da 100644 --- a/fai/config/files/etc/apt/sources.list.d/stretch.list/STRETCH_LINODE +++ b/fai/config/files/etc/apt/sources.list.d/stretch.list/STRETCH_LINODE @@ -4,21 +4,8 @@ deb-src http://mirrors.linode.com/debian/ stretch main deb http://security.debian.org/ stretch/updates main deb-src http://security.debian.org/ stretch/updates main -# stretch-updates, previously known as 'volatile' deb http://mirrors.linode.com/debian/ stretch-updates main deb-src http://mirrors.linode.com/debian/ stretch-updates main deb http://mirrors.linode.com/debian/ stretch-backports main deb-src http://mirrors.linode.com/debian/ stretch-backports main - -deb http://mirrors.linode.com/debian stretch main -deb-src http://mirrors.linode.com/debian stretch main - -deb http://security.debian.org/ stretch/updates main -deb-src http://security.debian.org/ stretch/updates main - -deb http://mirrors.linode.com/debian stretch-updates main -deb-src http://mirrors.linode.com/debian stretch-updates main - -deb http://mirrors.linode.com/debian unstable main -deb-src http://mirrors.linode.com/debian unstable main diff --git a/fai/config/hooks/partition.DEFAULT b/fai/config/hooks/partition.DEFAULT index 7a1967b..ddcf53d 100755 --- a/fai/config/hooks/partition.DEFAULT +++ b/fai/config/hooks/partition.DEFAULT @@ -270,10 +270,11 @@ if [[ ! -e $luks_dir/host-$HOSTNAME ]]; then fi lukspw=$(cat $luks_dir/iank) -# # ian: disabled while I use the tp host. -# if ifclass tp; then -# lukspw=$(cat $luks_dir/traci) -# fi +# # ian: disabled by chaning to tpnew while I use the tp host. +# # note, corresponding changes in /b/ds/keyscript-{on,off} +if ifclass tpnew; then + lukspw=$(cat $luks_dir/traci) +fi if ifclass demohost; then lukspw=x fi diff --git a/fai/config/scripts/GRUB_PC/11-iank b/fai/config/scripts/GRUB_PC/11-iank index 60403dd..c6948e7 100755 --- a/fai/config/scripts/GRUB_PC/11-iank +++ b/fai/config/scripts/GRUB_PC/11-iank @@ -70,6 +70,8 @@ fi chown -R 1000:1000 /home/iank/.ssh chmod -R u=Xrw,og= /home/iank/.ssh rm -rf /root/.ssh +# remove broken symlinks or the following cp will fail +find /home/iank/.ssh -xtype l -exec rm '{}' \; cp -rL /home/iank/.ssh /root chown -R root:root /root/.ssh chmod 700 /root/.ssh diff --git a/myfai-chboot-local b/myfai-chboot-local index d16f3b1..b2df864 100755 --- a/myfai-chboot-local +++ b/myfai-chboot-local @@ -60,12 +60,18 @@ if modprobe nfsd &>/dev/null; then root_arg="$my_ip:/srv/fai/nfsroot:vers=3" # fai-setup without -e sets the ip to the local_ip/local_network, eg 192.168.1.3/24 # I restrict it to one ip as simple but imperfect access control. - sed -ri --follow-symlinks '\%^/srv/fai/%d' /etc/exports - cat >>/etc/exports <>/etc/exports <