fixes plus readme updates
[automated-distro-installer] / README
1 PXE install w multi-boot, btrfs & Libreboot support
2
3 Some things are specific to my home network, and uses files with secrets
4 that are not in this repo. I use this for bare metal and vms, and two
5 scripts which can run post boot so I use them on vps distributed image
6 as well.
7
8 Features people may find useful: installs encrypted trisquel, debian,
9 ubuntu, and arch (havne't done recently, probably a bit broken), in a
10 multi-boot setup using multiple subvolumes of a single btrfs filesystem.
11 Utilizes multiple disks, with scripts to automatically decrypt on
12 intentional reboots, but not after shutdown or power loss.
13
14 Normal install mode for fai is using pxe, but on a libreboot system,
15 there is no pxe. The pxe in a normal computer is nonfree firmware. What
16 I've done instead:
17
18 * Use a live cd to call pxe-kexec, this is described later in this file.
19
20 * Use the fai autodiscover iso. This is more automated, so nicer.
21
22 * Use an install method above to setup a gnu/linux disk partition that
23 acts like a pxe boot using kexec, but it takes a bit longer. This is
24 the bootstrap partition in my scripts.
25
26 Things I haven't tried:
27
28 * There is iPXE, which requires standard bios functions, which can be
29 provided by seabios, which can be a libreboot payload.
30
31 * The bios chip has enough room for an initrd. This could be setup to
32 work like the partition I use to kexec, but it would be faster, and
33 not require installing to disk.
34
35 The partititioning and filesystem script is at
36 fai/config/hooks/partition.DEFAULT. Disks are grouped as ssd or hdd and
37 raided in raid 1 or raid 0 per configuration. The base partitions are
38 divided into boot, swap, and root, (only boot is unencrypted). There are
39 scripts to resize those partitions post-provision and while the system
40 is running.
41
42 People who use fai may find these things as useful examples: it uses
43 dnsmasq (on a openwrt machine) for dhcp instead of the isc
44 dhcp. fai-wrapper is a small script to use basic fai classes outside of
45 fai. It does not use the fai partitioning tool, but the script is
46 inspired from it and works outside of fai. It supports running a fai
47 server on debian within android via Maru.
48
49 It also automates configuration of an openwrt router after manual
50 initial installation.
51
52 After provisionining is done, I sync files using btrfs, or unison for
53 vps, then automate further setup using a different set of scripts,
54 https://iankelling.org/git/?p=distro-setup;a=tree.
55
56 My network is a wndr3700v2 router with openwrt on it and a few pcs/laptops.
57
58 Since fai requires a debian server as the fai server, there are also
59 scripts to automate a debian install using pxe and preseeding, which can
60 be done from any distro.
61
62 Some of the scripts have dependencies for some simple obvious utility
63 scripts from https://iankelling.org/git, and of course there are some
64 hostnames that are specific to my network.
65
66
67
68 All scripts meant to be used directly are listed here:
69
70
71 # Scripts to setup the environment for the install
72
73 arch-pxe # Setup arch pxe boot server from an arch base image
74 fai-redep # Deploy fai configuration to host "faiserver"
75 faiserver-revm # using pxe & preseed, create a vm which is a fai server
76 faiserver-uninstall # uninstall fai-server
77 faiserver-setup # install fai-server on the current machine
78 myfai-chboot # setup fai tftp and nfs. useful for doing pxe-kexec
79 pxe-server # disable/enable pxe dhcp, tfp, and nfs. calls myfai-chboot
80 wrt-setup-remote # setup my router in general: dhcp, dns, etc.
81
82
83 # Script to do a distro install
84
85 dsfull # install & post-install a new fai distro
86 arch-init-remote # install arch after it's been booted into it's setup env
87 fai-kexec # Kexec this or a remote machine using host faiserver
88 live-kexec # fai kexec from upstream live cds, e.g. curl live-kexec|bash
89
90
91 # Test scripts
92
93 arch-revm # test arch install on a fresh vm
94 fai-revm # test fai install on a fresh vm
95
96
97 # Scripts to call after a distro install for various reasons
98
99 chboot # Set grub to boot into a different distro (installed earlier)
100 install-chboot # reinstall chboot to /boot subvols, for chboot updates.
101 eboot # reboot without automatic disk decryption
102 fai-wrapper # use fai classes outside of fai. sourced, not called.
103 faiserver-disable # Disable the fai nfs server exports
104 fresize # resize swap or boot partitions in a host
105
106
107 # Replacing a raid 10 disk
108
109 pxe-server -S HOST fai
110 ssh root@HOST
111 cat >p
112 PASSWORD HERE(ctrl-d ctrl-d)
113 for d in /dev/disk/by-id/ata*part1; do cryptsetup luksOpen --key-file p $d crypt_dev_${d##*/}; done
114 # btrfs replace disk # i forget the actual command
115 x=(/dev/mapper/*part1); mount -o subvol=root_trisquelflidas $x /mnt
116 mount -o subvol=boot_trisquelflidas /dev/sda3 /mnt/boot
117 for x in dev proc sys; do mount -o bind /$x /mnt/$x; done
118 chroot /mnt /bin/bash
119 # replace disk in fstab
120 # replace disk in /etc/crypttab
121 update-grub
122 update-initramfs -u
123 mount /a
124 /a/exe/keyscript-on
125 exit
126 reboot
127
128
129 # dirinstall
130
131 host=kw
132 distro=trisquel
133 t=/dev/shm/t
134 myfai-chboot default
135 sudo sed -i 's/^LOGUSER=/#LOGUSER=/' /etc/fai/fai.conf
136 # config umount required after a failed run, proc umount always required
137 sudo umount /var/lib/fai/config ||: ; sudo umount -R $t/proc ||:
138 fai-redep faiserver $distro
139 sudo rm -rf $t ; mkdir $t; time sudo LANG= fai -N -u $host dirinstall $t
140
141 # cleanup:
142 sudo sed -i 's/^#LOGUSER=/LOGUSER=/' /etc/fai/fai.conf
143 sudo umount -R $t/proc
144
145
146 # Turning a dirinstall into a basefile. taken from mk-basefile
147
148 sudo chroot $t apt-get clean
149 sudo rm -f $t/etc/hostname $t/etc/resolv.conf \
150 $t/var/lib/apt/lists/*_* $t/usr/bin/qemu-*-static \
151 $t/etc/udev/rules.d/70-persistent-net.rules
152 echo | sudo dd of=$t/etc/machine-id
153 sudo tar --one-file-system -C $t -cf - . | gzip > /a/bin/fai-basefiles/basefiles/FLIDAS64X.tar.gz
154
155
156
157 # License
158
159 The license for the project is GPLv2 or later, mostly because fai is and
160 I periodically merge the upstream example config, which contains small
161 scripts. Also, there is a modified encrypt.upstream, which is from the
162 cryptsetup package in arch, which is under the same license.