PXE Booting Debian Live

I have an older Thinkpad laptop that I wanted to use in the lab for reading/writing pcmcia cards. I tried to replace the original HDD with a flash drive but ran into issues. Since the laptop has a built-in NIC with PXE support, I decided to try to get a live lightweight linux environment I could use in a diskless setup.

NFS setup

setting up the NFS filesystem for the client:

apt install debootstrap nfs-kernel-server
mkdir -p /export/debian-nfsroot32
debootstrap --arch=i386 bookworm /export/debian-nfsroot http://deb.debian.org/debian/
mount --bind /dev /export/debian-nfsroot32/dev
mount --bind /proc /export/debian-nfsroot32/proc
mount --bind /sys /export/debian-nfsroot32/sys
mount --bind /dev/pts /export/debian-nfsroot32/dev/pts
chroot /export/debian-nfsroot32
## confirm our environment is i386:
dpkg --print-architecture
apt update
apt install locales
locale-gen en_US.UTF-8
##enable this:
sed -i 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen
locale-gen
update-locale LANG=en_US.UTF-8
## dpkg-reconfigure locales
echo "diskless-client" > /etc/hostname
apt install nfs-common
# X environment stuff:
apt install lxde-core xserver-xorg lightdm lxterminal desktop-base xterm --no-install-recommends
# install kernel
apt install --no-install-recommends linux-image-686-pae
# set root password , maybe add a user too?
passwd
## exit chroot:
exit
umount /export/debian-nfsroot32/dev/pts
umount /export/debian-nfsroot32/dev
umount /export/debian-nfsroot32/proc
umount /export/debian-nfsroot32/sys
echo "/export/debian-nfsroot32  *(rw,sync,no_subtree_check,no_root_squash)" >> /etc/exports
# export the NFS share:
exportfs -ra
# start or restart nfs server:
systemctl enable nfs-kernel-server ; systemctl start nfs-kernel-server
# show NFS exports:
exportfs -v

PXE Environment Setup

I already have basic PXE server setup on debian in /srv/tftp/menu1

cd /srv/tftp/menu1/debian
cp /export/debian-nfsroot32/boot/initrd.img-6.1.0-35-686-pae .
cp /export/debian-nfsroot32/boot/vmlinuz-6.1.0-35-686-pae .
## wget https://deb.debian.org/debian/dists/bookworm/main/installer-i386/current/images/netboot/netboot.tar.gz
## tar xvfz netboot.tar.gz
##
## add to PXE menu:
##
LABEL debianlive
    MENU LABEL Debian 12 i386 Live
    KERNEL debian/debian-installer/i386/linux
    APPEND initrd=debian/debian-installer/i386/initrd.gz root=/dev/nfs nfsroot=10.254.255.1:/export/debian-nfsroot rw

Further Customization

Autologin as root

in /etc/pam.d/lightdm-autologin , comment out this line:

#auth      required pam_succeed_if.so user != root quiet_success

and in /etc/lightdm/lightdm.conf , scroll down to [Seat:*] and set:

autologin-user=root
autologin-user-timeout=0

and disable light-locker which locks the screen after inactivity:

rm /etc/xdg/autostart/light-locker.desktop
To top