You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

118 lines
2.0 KiB

# Network booting
without GRUB
https://www.youtube.com/watch?v=U3RC20ANomk
`apt install dnsmasq`
`/etc/dnsmasq.conf`
```
interface=<your interface>,lo
bind-interfaces
dhcp-range=<your interface>,192.168.11.101,192.168.11.200
dhcp-boot=pxelinux.0
dhcp-match=set:efi-x86_64,option:client-arch,7
dhcp-boot=tag:efi-x86_64,syslinux.efi
enable-tftp
tftp-root=/srv/tftp
```
`mkdir -p /srv/tftp`
`apt install syslinux-common syslinux-efi`
`cd /usr/lib/syslinux/modules/efi64`
`cp ldlinux.e64 libutil.c32 menu.c32 /srv/tftp`
`cp /usr/lib/SYSLINUX.EFI/efi64/syslinux.efi /srv/tftp`
`mkdir /srv/tftp/pxelinux.cfg`
`/srv/tftp/pxelinux.cfg/default`
```
UI menu.c32
LABEL FIKS OS
MENU LABEL FIKS
KERNEL vmlinuz
APPEND initrd=initrd.img debug components boot=nfs ip=dhcp root=/dev/nfs nfsroot=192.168.11.11:/srv/nfs/live/ ro
TEXT HELP
Lmao Yeet!
ENDTEXT
```
`systemctl restart dnsmasq.service`
`apt install nfs-kernel-server`
`mkdir -p /srv/nfs/live`
`/etc/exports`
```
/srv/nfs *(ro,sync,no_root_squash,no_subtree_check)
```
`exportfs -a`
`systemctl restart nfs-kernel-server`
## Client system
~~`apt install live-build live-config`~~
~~`mkdir live-fiks && cd live-fiks`~~
~~`lb config -b netboot --net-root-path "/srv/nfs" --net-root-server "192.168.11.11"`~~
~~`lb build`~~
~~`cd ..`~~
`mkdir initrd-workdir && cd initrd-workdir`
`unmkinitramfs /boot/initrd.img-$(uname -r) .`
`cd main`
`/etc/initramfs-tools/modules`
```
e1000
igb
r8169
nfs
nfsv3
nfsv4
sunrpc
lockd
fscache
overlay
```
`find . | cpio -H newc -o | gzip -9 > /srv/tftp/initrd.img`
Disable systemd-resolved (requires writable /etc/resolve.conf):
`systemctl mask systemd-resolved`
`mksquashfs / /opt/fiks-image.squashfs -e /proc /sys /dev /tmp /run /mnt /media /var/cache /var/tmp /opt`
`scp initrd.img server@192.168.11.11:/srv/nfs/`
## Back on the server
`mount -o loop /srv/nfs/fiks-image.squashfs /srv/nfs/tmp/`
`cp -a /srv/nfs/tmp/* /srv/nfs/live/`
`mkdir live/{dev,proc,run,sys,tmp}`