[Tech] example PXE boot setup on Lubuntu

Michael Paoli Michael.Paoli at cal.berkeley.edu
Sun Apr 12 09:21:45 PDT 2015


Creating Lubntu PXE boot server

This doesn't cover all that may be desired of Partimus PXE boot, etc.
server, but should illustrate what's needed to at least get a
functioning PXE boot server built and configured on Lubuntu.
For a "real" installation, and for as desired by Partimus, we'd apply
the updates, set up server as transparent caching proxy server, etc.  I
mostly just show the (non-default) steps to set up operational DHCP/PXE
Lubuntu boot server, and then also test installation to PXE client host.
For a "real" installation, of course also the relevant actual network
configuration details would be used, in the demonstration, I have and
used:
network is 192.168.155.0/24
network's router/gateway is 192.168.155.1 (NATed access to Internet)
network's DNS server is 192.168.155.1 (NATed to resolve Internet, etc.)
For a "real" installation, after more suitably setting up the
server, we'd make the client host more dependent upon that server,
notably also using it as gateway, DNS server, etc.
Initially the network already has a DHCP server, which we used to
initially build our PXE server, but after that has DHCP server
installed, we disable the DHCP server that was already on the network.

In this example, I'm presently doing this on virtual machine (qemu-kvm
presently on
Debian GNU/Linux 7.8 (wheezy) x86_64
), but should work quite as well on physical, or VirtualBox, etc.

I specifically adjust my virtual machine configuration, notably:
going for relatively low-spec Partimus host:
i586 (Pentium)
512 MiB RAM
8 GiB hard drive
installing from CD ISO:
Lubuntu 14.04.2 LTS "Trusty Tahr" - Release i386 (20150218.1)
starting creation and install with:
# virt-install --name=lubuntupxesi386 \
> --cdrom=/var/tmp/ISOs/lubuntu-14.04.2-desktop-i386.iso \
> --disk=/var/tmp/lubuntu/lubuntupxesi386-sda \
> --network=network=pxenet,mac=52:54:00:7b:51:5d --ram=512 --wait=-1 \
> --os-type=linux --os-variant=debianwheezy --arch=i586 --virt-type kvm \
> --hvm
Setting specific Ethernet MAC address wasn't necessary, but I did that
for my convenience so I could use same MAC address later when
reconfiguring Network Manager to use static IPv4 address.

Installation ... non-default bits:
Mostly go just with defaults for simplicity ... non-defaults shown:

English (before the timeout)
Install Lubuntu
Continue
Your name: Michael Paoli
Your computer's name: lubuntupxesi386
Your login name: michael
Choose a password: [not shown]
Confirm your password: [not shown]
Installation is complete. ... [Restart Now]
... it hung on shutdown
(virtually) power cycled
(virtually) eject optical media
<<Control>-<Alt>-<F1>>
logged in
$ sudo su -
And for my convenience to also allow login via (virtual) serial:
# (cd /etc/init &&
> cp -p tty1.conf ttyS0.conf &&
> < tty1.conf > ttyS0.conf sed -e 's/tty1/ttyS0/g')
# start ttyS0
# apt-get update

And to keep vim and nano from generally annoying me:
# apt-get install nvi &&
> update-alternatives --set editor /usr/bin/nvi &&
> update-alternatives --set ex /usr/bin/nex &&
> update-alternatives --set vi /usr/bin/nvi &&
> update-alternatives --set view /usr/bin/nview
#

# apt-get install isc-dhcp-server tftpd-hpa
reconfigure Network Manager for static IPv4 address:
# stop network-manager
# ex /etc/NetworkManager/NetworkManager.conf
4a
no-auto-default=52:54:00:7B:51:5D,

.
w
q
# (
> umask 077 &&
> uuid="$(uuidgen -r)" &&
> timestamp="$(date +'%s')" &&
> > '/etc/NetworkManager/system-connections/Wired connection 1' \
> echo '[802-3-ethernet]
> duplex=full
> mac-address=52:54:00:7B:51:5D
>
> [connection]
> id=Wired connection 1
> uuid='"$uuid"'
> type=802-3-ethernet
> timestamp='"$timestamp"'
>
> [ipv6]
> method=auto
>
> [ipv4]
> method=manual
> dns=192.168.155.1;
> address1=192.168.155.2/24,192.168.155.1'
> )
# start network-manager

I then reconfigured the existing DHCP server on / forwarded via
192.168.155.1 to not handle or respond to the 192.168.155/24
subnet/VLAN for DHCP/bootp requests, and then continued:
# ex /etc/dhcp/dhcpd.conf
%s/^option domain-name "/#&
%s/^\(option domain-name-servers \).*$/\1 192.168.155.1;/
$a
next-server 192.168.155.2;
subnet 192.168.155.0 netmask 255.255.255.0 {
   range 192.168.155.100 192.168.155.200;
   option routers 192.168.155.1;
   filename "pxelinux.0";
}
.
w
q
(virtually) inserted optical media:
lubuntu-14.04.1-alternate-i386.iso
Lubuntu 14.04.1 LTS "Trusty Tahr" - Release i386 (20140722.2)
Ideally I'd use:
lubuntu-14.04.2-alternate-i386.iso
Lubuntu 14.04.2 LTS "Trusty Tahr" - Release i386
but that appears to not (yet) be available
 From the GUI as mere mortal user michael, did:
Click Lubuntu icon in lower left, then:
Accessories
File Manager PCManFM
That then causes the CD-ROM to mount,
(for a "real" server, I'd copy the ISO on the host and loop mount it)
then ...
# mount -o bind,ro,nosuid,nodev \
> '/media/michael/Lubuntu 14.04.1 LTS i386'/install/netboot \
> /var/lib/tftpboot
# restart tftpd-hpa
# start isc-dhcp-server
I then boot my PXE client
For virtual, I'm doing:
# virt-install --name=lubuntupxeci386 --pxe \
> --disk=/var/tmp/lubuntu/lubuntupxeci386-sda --network=network=pxenet \
> --ram=512 --wait=-1 --os-type=linux --os-variant=debianwheezy \
> --arch=i586 --virt-type kvm --hvm
Again, similarly, I do that host as a low-spec Partimus machine:
i586 (Pentium)
512 MiB RAM
8 GiB hard drive
 From our PXE client, again, just showing non-defaults, and generally
going with defaults for simplicity:
Hostname: lubuntupxeci386
Full name for the new user: Michael Paoli
Username for your account: michael
Choose a password for the new user: [not shown]
Re-enter password to verify: [not shown]
Write the changes to disks? <Yes>
Continue
... and our PXE client installs successfully (did rather minimal software
installation in this demo run, but could install more at installation time
or after).

And, ... just for informational purposes, since I did these as virtual
machines and with their virtual hard drives on filesystem that uses
deduplication and compression (and also did those files as sparse
files), the actual on-drive storage used is rather minimal:
$ (cd /var/tmp/lubuntu && ls -onsh lubuntupxe[cs]i386-sda)
574M -rw------- 1 0 8.0G Apr 12 08:29 lubuntupxeci386-sda
939M -rw------- 1 0 8.0G Apr 12 08:30 lubuntupxesi386-sda
$
# zfs get -o all all |
> egrep '^lubuntu/lubuntu .* (compress|dedup|mountpoint|used )'
lubuntu/lubuntu  used                  1.48G                  -         -
lubuntu/lubuntu  compressratio         2.94x                  -         -
lubuntu/lubuntu  mountpoint            /var/tmp/lubuntu       -         local
lubuntu/lubuntu  compression           gzip-9                 -         local
lubuntu/lubuntu  dedup                 verify                 -         local
#

> From: "Michael Paoli" <Michael.Paoli at cal.berkeley.edu>
> Subject: example PXE boot setup on Debian (Ubuntu/Lubuntu should be  
> relatively similar)
> Date: Thu, 02 Apr 2015 03:58:33 -0700
>
>> From: "Tai Kedzierski" <dch.tai at gmail.com>
>> Subject: Re: [Tech] Partimus (PXE?) (nearly?) unattended install  
>> solution(s?)
>> Date: Thu, 2 Apr 2015 11:26:53 +0100
>>
>> * Yeah I'm still stuck on PXE - I've had some pointers from Rab in EdLUG
>> (basically, first, don't test using VirtualBox!) and Charlie's notes still
>> to review. And Michael's notes when he has a moment :-)
>
> Shouldn't be too hard with virtual (e.g. qemu-kvm, virtualbox, etc.),
> but key bits to be aware of there: They typically give a NATed network
> by default and including a built-in provided DHCP server on that network.
> Such generally conflicts with doing PXE boot - so one typically wants
> to place the virtual host on a different network/subnet/VLAN, where
> there isn't some conflicting DHCP/bootp server/service.  The only other
> slightly tricky bit with virtual and PXE - at least that I'm aware of
> so far, is that non-intuitive bit on VirtualBox - where some interface
> types don't support PXE boot (or need additional software or packages
> for such interfaces - that seemed to be implied from some of what I
> read about folks installing direct from Oracle rather than a linux
> distribution's packaging thereof ... probably proprietary and/or non-
> distribution restrictions on some extra bits for certain interface types
> to be able to PXE boot under VirtualBox - found no such issue with
> qemu-kvm).
>
> This is example I have on my
> Debian GNU/Linux 7.8 (wheezy) x86_64
> "server" <cough, cough> (laptop) at home.
> Looks like I mostly/initially based it upon:
> https://wiki.debian.org/PXEBootInstall
> (and probably from around 2012-03-11, as I made a few corrective edits
> to that wiki page around then).
>
> I was also interested in, as feasible, being
> able to PXE boot and then be able to select and install various
> distributions - so as I'd left it off, it could be used to PXE boot
> and install any of:
> Debian GNU/Linux 7.8 (wheezy) x86_64
> Debian GNU/Linux 7.8 (wheezy) i386
> Ubuntu-Server 14.04.1 LTS amd64
>
> From the wee bit of notes I made of it regarding my
> installation/configuration:
> $ cat /srv/tftp/NOTES
> http://http.debian.net/debian/dists/wheezy/main/installer-i386/current/images/netboot/netboot.tar.gz
> and:
> http://http.debian.net/debian/dists/wheezy/main/installer-amd64/current/images/netboot/netboot.tar.gz
> mostly extracted to:
> /srv/tftp
> except for the differing:
> lrwxrwxrwx 1 root root 35 2014-04-24 07:45:30.000000000 +0000  
> pxelinux.cfg -> debian-installer/amd64/pxelinux.cfg
> lrwxrwxrwx 1 root root 34 2014-04-24 07:46:21.000000000 +0000  
> pxelinux.cfg -> debian-installer/i386/pxelinux.cfg
> and also:
> lrwxrwxrwx 1 root root 33 2014-04-24 07:45:30.000000000 +0000  
> pxelinux.0 -> debian-installer/amd64/pxelinux.0
> lrwxrwxrwx 1 root root 32 2014-04-24 07:46:21.000000000 +0000  
> pxelinux.0 -> debian-installer/i386/pxelinux.0
> but in the case of pxelinux.0, the ordinary files are identical, so  
> replaced the symbolic link with a hard link
>
> also from:
> Ubuntu-Server 14.04 LTS "Trusty Tahr" - Release amd64 (20140416.2)
> contents under:
> install/netboot
> mostly also placed here, except:
> renamed version.info to version.info.ubuntu
> renamed pxelinux.cfg to pxelinux.cfg:ubuntu-server:amd64
> and left out symbolic links: pxelinux.0
>
> And further examining what I'd left in place in terms of mounts and
> configuration files and such (other than or in addition to that noted
> above, and mostly covered on:
> https://wiki.debian.org/PXEBootInstall
> )
>
> The relevant bits of data I have in /etc/fstab:
> /dev/tigger/tftp /srv/tftp ext3 ro,nosuid,nodev,noatime 0 2
> /var/tmp/ISOs/ubuntu-14.04.1-server-amd64.iso  
> /var/tmp/ISOs/ubuntu-14.04.1-server-amd64 iso9660  
> loop,ro,nosuid,nodev 0 0
> /var/tmp/ISOs/ubuntu-14.04.1-server-amd64/install/netboot/ubuntu-installer  
> /srv/tftp/ubuntu-installer none bind,ro,nosuid,nodev 0 0
> /var/tmp/ISOs/ubuntu-14.04.1-server-amd64/install/netboot/version.info  
> /srv/tftp/version.info.ubuntu none bind,ro,nosuid,nodev 0 0
> Probably better to use location other than /var/tmp for things intended
> to be there "permanently" or more longer term, but in any case ...
> Also, those last two bind mounts shown above, next to last is directory
> bind mounted atop directory, and the last one file mounted atop (empty)
> file.
> My "NOTES" from above covers much of it, but in addition (not covered by
> that, and installed/configured under /srv/tftp/) we have:
> $ < /srv/tftp/pxelinux.cfg/default expand
> serial 0 9600
> default debian-installer/i386/boot-screens/vesamenu.c32
> timeout 0
> label debian-i386
>         menu label debian-i386
>         config  pxelinux.cfg:i386/default
> label debian-amd64
>         menu label debian-amd64
>         config  pxelinux.cfg:amd64/default
> label ubuntu-server-amd64
>         menu label ubuntu-server-amd64
>         config pxelinux.cfg:ubuntu-server:amd64/default
> That works as my default PXE boot menu that comes up, allowing
> selections of:
> debian-i386
> debian-amd64
> ubuntu-server-amd64
> Each of which, when selected, then just chain loads the corresponding
> stock menu from that flavor's PXE boot menu.
> The
> serial 0 9600
> Allows that menu choice to also be made via the first (legacy) serial
> port (if present), so serial console may be used to launch/control the
> PXE boot and installation (can be quite handy for serial console
> install, virtual machines, IPMI, etc., and doesn't particularly hurt to
> include that, even if it's not being used).
>
> That's mostly it ... except the IP addresses and network configuration I
> have is different than the example given on the referenced wiki page.
>
> And, comparing what I earlier noted to actual files under /srv/tftp ...
> What doesn't seem to be quite covered in those earlier NOTES:
> $ ls -ld /srv/tftp/pxelinux.cfg /srv/tftp/pxelinux.cfg:[ai]*
> drwxr-xr-x 2 root root 1024 Apr 28  2014 /srv/tftp/pxelinux.cfg
> lrwxrwxrwx 1 root root   35 Apr 27  2014  
> /srv/tftp/pxelinux.cfg:amd64 -> debian-installer/amd64/pxelinux.cfg
> lrwxrwxrwx 1 root root   34 Apr 27  2014 /srv/tftp/pxelinux.cfg:i386  
> -> debian-installer/i386/pxelinux.cfg
> $




More information about the Tech mailing list