NetBSD Diskless Installation

Introduction

Examples here use OpenBSD/sparc64 to provide DHCP, TFTP and NFS services for booting an x86 laptop in a diskless configuration.

Installation

As “root” on the server create the NetBSD distribution directories:

mkdir -p /usr/export/client/NetBSD-2.0.2/installation
mkdir /usr/export/client/NetBSD-2.0.2/binary

Choose a local mirror service. I used “ncftp” to download the release:

# cd /usr/export/client/NetBSD-2.0.2/
# ncftp ftp.plig.org
ftp] cd /pub/NetBSD/NetBSD-2.0.2/i386
ftp] mget -R *
ftp] cd /pub/NetBSD/NetBSD-2.0.2/shared/ALL
ftp] get misc.tgz
ftp] get man.tgz
ftp] exit

Setup the NFS directories on the server:

mkdir -p /usr/export/client/root/dev
mkdir /usr/export/client/usr
mkdir /usr/export/client/home
touch /usr/export/client/swap

The server “/etc/exports” file should read:

/usr/export/client/root -maproot=root:wheel    laptop.localnet
/usr/export/client/swap -maproot=root:wheel    laptop.localnet
/usr/export/client/usr  -maproot=nobody:nobody laptop.localnet
/usr/export/client/home -maproot=nobody:nobody laptop.localnet

Enable NFS and RPC on the server:

# vi /etc/rc.conf
nfs_server=YES
portmap=YES

Add the new host to the server’s “/etc/hosts” database:

10.0.0.2 laptop.localnet laptop

Setup the client filesystem:

cd /usr/export/client/root
tar -xvpzf /usr/export/client/NetBSD-2.0.2/binary/sets/base.tgz
tar -xvpzf /usr/export/client/NetBSD-2.0.2/binary/sets/comp.tgz
tar -xvpzf /usr/export/client/NetBSD-2.0.2/binary/sets/etc.tgz
tar -xvpzf /usr/export/client/NetBSD-2.0.2/binary/sets/games.tgz
tar -xvpzf /usr/export/client/NetBSD-2.0.2/man.tgz
tar -xvpzf /usr/export/client/NetBSD-2.0.2/misc.tgz
tar -xvpzf /usr/export/client/NetBSD-2.0.2/binary/sets/text.tgz
tar -xvpzf /usr/export/client/NetBSD-2.0.2/binary/sets/xbase.tgz
tar -xvpzf /usr/export/client/NetBSD-2.0.2/binary/sets/xcomp.tgz
tar -xvpzf /usr/export/client/NetBSD-2.0.2/binary/sets/xetc.tgz
tar -xvpzf /usr/export/client/NetBSD-2.0.2/binary/sets/xfont.tgz
tar -xvpzf /usr/export/client/NetBSD-2.0.2/binary/sets/xserver.tgz
mkdir /usr/export/client/root/kern
mkdir /usr/export/client/root/swap
mkdir /usr/export/client/root/home
dd if=/dev/zero of=/usr/export/client/swap bs=4k count=40k
cd /usr/export/client/root
tar -xvpzf /usr/export/client/NetBSD-2.0.2/binary/sets/kern-GENERIC.tgz
mknod /usr/export/client/root/dev/console c 0 0

Edit the new NetBSD system’s configuration in “/usr/export/client/root/etc” dir:

“fstab” should read:

10.0.0.1:/usr/export/client/swap   none  swap  sw,nfsmntpt=/swap
10.0.0.1:/usr/export/client/root   /     nfs   rw 0 0
10.0.0.1:/usr/export/client/usr    /usr  nfs   rw 0 0
10.0.0.1:/usr/export/client/home   /home nfs   rw 0 0

“ifconfig.fxp0″ (replace fxp0 with your network card type):

inet client netmask 255.255.255.0 broadcast 10.0.0.255

“rc.conf” requires this addition:

hostname="laptop"
defaultroute="10.0.0.1"
nfs_client=YES
auto_ifconfig=NO
net_interfaces=""

The “hosts” database should be populated with your LAN settings:

10.0.0.1        ultra5.localnet ultra5
10.0.0.2        laptop.localnet laptop
10.0.0.3        hppa.localnet   hppa
10.0.0.4        unix.localnet   unix

“resolv.conf” requires setting:

 nameserver 192.168.1.1

Move the new NetBSD “/usr” filesystem to the correct location:

mv /usr/export/client/root/usr/* /usr/export/client/usr/

Enable TFTP service on the server:

mkdir /tftpboot
cp /usr/export/client/usr/mdec/pxeboot_ia32.bin /tftpboot/

# vi /etc/rc.conf
inetd=YES
# vi /etc/inetd.conf
tftp            dgram   udp     wait    root    /usr/libexec/tftpd      tftpd -s /tftpboot

Enable DHCP service on the server:

# vi /etc/rc.conf
dhcpd_flags="-q"

Edit the server’s “/etc/dhcpd.interfaces” file:

fxp0

Edit the server’s “/etc/dhcpd.conf” file:

deny unknown-clients;
allow bootp;
subnet 10.0.0.0 netmask 255.255.255.0 {
}
        group {
        option broadcast-address 10.0.0.255;
        option domain-name "localnet";
        option domain-name-servers 192.168.1.1;
        option subnet-mask 255.255.255.0;
        host laptop.localnet {
                hardware ethernet 00:00:f0:79:0b:0e;
                # ***Replace above with your client MAC***
                fixed-address 10.0.0.2;            
                option host-name "laptop";
                filename "pxeboot_ia32.bin";
                next-server 10.0.0.1;      
                option root-path "/usr/export/client/root";
                }                                          
        }

I’ve had to rename the netbsd kernel file to “pxeboot_ia32.bin” to get the host to boot.

Although the above DHCPd configuration is far from perfect, It Seems To Work ™.

cp /usr/export/client/root/netbsd /usr/export/client/root/pxeboot_ia32.bin

Remove the NetBSD release files in the “/usr/export/client” dir.

rm -rf /usr/export/client/NetBSD-2.0.2

The server configuration is now comlete. Reboot the OpenBSD/sparc64 to let config changes take effect. On the laptop, I hit [F12] to launch netbooting procedures.

Upon first boot – the system should load single-user. Hit return for a shell:

cd /dev
/bin/sh MAKEDEV all
mount -a

# vi /etc/rc.conf
rc_configured=YES
# exit

Login as “root” and change the administrator’s password:

passwd root

Perform any system configuration required as described in the NetBSD Guide. Basic setup is described in chapter five and six.

Configure startup:

# vi /etc/inetd.conf
inetd=NO
wscons=YES
sendmail=NO

Set keyboard encoding:

# vi /etc/wscons.conf
encoding=uk

Add a user account:

useradd -m -G wheel swm
passwd swm
reboot

Install PkgSrc:

ftp ftp://ftp.plig.org/pub/NetBSD/packages/pkgsrc.tar.gz
mv pkgsrc.tar.gz /usr
cd usr
tar -xvzf pkgsrc.tar.gz

Install some software:

cd /usr/pkgsrc/wm/windowmaker
make install
make clean clean-depends
cd /usr/pkgsrc/www/firefox
make install
make clean clean-depends
vi /etc/X11R6/lib/X11/xdm/Xsession

[near the end of this file, change "exec xsm" to "exec wmaker"]

# vi /etc/rc.conf
xdm=YES

Configure X11 (using xf86cfg). My Samsung V20 laptop (i845G) required:

Section "ServerLayout"
        Identifier     "XFree86 Configured"
        Screen      0  "Screen0" 0 0
        InputDevice    "Mouse0" "CorePointer"
        InputDevice    "Keyboard0" "CoreKeyboard"
EndSection

Section "Files"
        RgbPath      "/usr/X11R6/lib/X11/rgb"
        ModulePath   "/usr/X11R6/lib/modules"
        FontPath     "/usr/X11R6/lib/X11/fonts/misc/"
        FontPath     "/usr/X11R6/lib/X11/fonts/Speedo/"
        FontPath     "/usr/X11R6/lib/X11/fonts/Type1/"
        FontPath     "/usr/X11R6/lib/X11/fonts/CID/"
        FontPath     "/usr/X11R6/lib/X11/fonts/75dpi/"
        FontPath     "/usr/X11R6/lib/X11/fonts/100dpi/"
EndSection

Section "Module"
        Load  "dbe"
        Load  "extmod"
        Load  "glx"
        Load  "record"
        Load  "xtrap"
        Load  "speedo"
        Load  "type1"
EndSection

Section "InputDevice"
        Identifier  "Keyboard0"
        Driver      "keyboard"
        Option      "XkbRules" "xfree86"
        Option      "XkbModel" "pc105"
        Option      "XkbLayout" "gb"
EndSection

Section "InputDevice"
        Identifier  "Mouse0"
        Driver      "mouse"
        Option      "Protocol" "wsmouse"
        Option      "Device" "/dev/wsmouse"
EndSection

Section "Monitor"
        Identifier   "Monitor0"
        VendorName   "Monitor Vendor"
        ModelName    "Monitor Model"
        HorizSync    31.5 - 57.0
        VertRefresh  50.0 - 90.0
EndSection

Section "Device"

        ### Available Driver options are:-
        ### Values: : integer, : float, : "True"/"False",
        ### : "String", : " Hz/kHz/MHz"
        ### [arg]: arg optional
        #Option     "NoAccel"                   # []
        #Option     "SWcursor"                  # []
        #Option     "ColorKey"                  # 
        #Option     "CacheLines"                # 
        #Option     "Dac6Bit"                   # []
        #Option     "DRI"                       # []
        #Option     "NoDDC"                     # []
        #Option     "ShowCache"                 # []
        #Option     "XvMCSurfaces"              # 
        Identifier  "Card0"
        Driver      "i810"
        VendorName  "Intel Corp."
        BoardName   "82845G/GL [Brookdale-G] Chipset Integrated Graphics Device"
        ChipSet     "845G"
        BusID       "PCI:0:2:0"
EndSection

Section "Screen"
        Identifier "Screen0"
        Device     "Card0"
        Monitor    "Monitor0"
        SubSection "Display"
                Depth     1
        EndSubSection
        SubSection "Display"
                Depth     4
        EndSubSection
        SubSection "Display"
                Depth     8
        EndSubSection
        SubSection "Display"
                Depth     15
        EndSubSection
        SubSection "Display"
                Depth     16
        EndSubSection
        SubSection "Display"
                Depth     24
        EndSubSection
EndSection

Once completed – the disks looks like this:

# df -h
Filesystem                         Size     Used     Avail Capacity  Mounted on
10.0.0.1:/usr/export/client/root   5.7G     1.5G      4.0G    27%    /
10.0.0.1:/usr/export/client/usr    5.7G     1.5G      4.0G    27%    /usr
10.0.0.1:/usr/export/client/home   5.7G     1.5G      4.0G    27%    /home
10.0.0.1:/usr/export/client/swap   5.7G     1.5G      4.0G    27%    /swap

# mount
10.0.0.1:/usr/export/client/root on / type nfs
10.0.0.1:/usr/export/client/usr on /usr type nfs
10.0.0.1:/usr/export/client/home on /home type nfs
10.0.0.1:/usr/export/client/swap on /swap type nfs

# dmesg
NetBSD 2.0.2 (GENERIC) #0: Wed Mar 23 08:53:42 UTC 2005
jmc@faith.netbsd.org:/home/builds/ab/netbsd-2-0-2-RELEASE/i386/200503220140Z-obj
/home/builds/ab/netbsd-2-0-2-RELEASE/src/sys/arch/i386/compile/GENERIC
total memory = 246 MB
avail memory = 234 MB
BIOS32 rev. 0 found at 0xfd780
mainbus0 (root)
cpu0 at mainbus0: (uniprocessor)
cpu0: Intel Pentium 4 (686-class), 1994.22 MHz, id 0xf27
cpu0: features bfebf9ff
cpu0: features bfebf9ff
cpu0: features bfebf9ff
cpu0: I-cache 12K uOp cache 8-way, D-cache 8 KB 64B/line 4-way
cpu0: L2 cache 512 KB 64B/line 8-way
cpu0: ITLB 4K/4M: 128 entries
cpu0: DTLB 4K/4M: 64 entries
cpu0: 16 page colors
pci0 at mainbus0 bus 0: configuration mode 1
pci0: i/o space, memory space enabled, rd/line, rd/mult, wr/inv ok
pchb0 at pci0 dev 0 function 0
pchb0: Intel 82845G/GL DRAM Controller / Host-Hub I/F Bridge (rev. 0x01)
agp0 at pchb0: detected 8060k stolen memory
agp0: aperture at 0x88000000, size 0x8000000
vga1 at pci0 dev 2 function 0: Intel 82845G/GL Integrated Graphics Device (rev. 0x01)
wsdisplay0 at vga1 kbdmux 1: console (80x25, vt100 emulation)
wsmux1: connecting to wsdisplay0
uhci0 at pci0 dev 29 function 0: Intel 82801DB/DBM USB UHCI Controller #1 (rev. 0x01)
uhci0: interrupting at irq 10
usb0 at uhci0: USB revision 1.0
uhub0 at usb0
uhub0: Intel UHCI root hub, class 9/0, rev 1.00/1.00, addr 1
uhub0: 2 ports with 2 removable, self powered
uhci1 at pci0 dev 29 function 1: Intel 82801DB/DBM USB UHCI Controller #2 (rev. 0x01)
uhci1: interrupting at irq 11
usb1 at uhci1: USB revision 1.0
uhub1 at usb1
uhub1: Intel UHCI root hub, class 9/0, rev 1.00/1.00, addr 1
uhub1: 2 ports with 2 removable, self powered
uhci2 at pci0 dev 29 function 2: Intel 82801DB/DBM USB UHCI Controller #3 (rev. 0x01)
uhci2: interrupting at irq 5
usb2 at uhci2: USB revision 1.0
uhub2 at usb2
uhub2: Intel UHCI root hub, class 9/0, rev 1.00/1.00, addr 1
uhub2: 2 ports with 2 removable, self powered
ehci0 at pci0 dev 29 function 7: Intel 82801DB/DBM USB EHCI Controller (rev. 0x01)
ehci0: interrupting at irq 11
ehci0: EHCI version 1.0
ehci0: companion controllers, 2 ports each: uhci0 uhci1 uhci2
usb3 at ehci0: USB revision 2.0
uhub3 at usb3
uhub3: Intel EHCI root hub, class 9/0, rev 2.00/1.00, addr 1
uhub3: 6 ports with 6 removable, self powered
ppb0 at pci0 dev 30 function 0: Intel 82801BA Hub-to-PCI Bridge (rev. 0x81)
pci1 at ppb0 bus 2
pci1: i/o space, memory space enabled
cbb0 at pci1 dev 3 function 0: Ricoh 5C475 PCI-CardBus bridge (rev. 0x80)
fxp0 at pci1 dev 8 function 0: Intel PRO/100 VE Network Controller with 82562ET/EZ PHY, rev 129
fxp0: interrupting at irq 11
fxp0: Ethernet address 00:00:f0:79:0b:0e
inphy0 at fxp0 phy 1: i82562ET 10/100 media interface, rev. 0
inphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
cbb0: interrupting at irq 10
cardslot0 at cbb0 slot 0 flags 0
cardbus0 at cardslot0: bus 3 device 0
pcmcia0 at cardslot0
pcib0 at pci0 dev 31 function 0
pcib0: Intel 82801DB LPC Interface Bridge (rev. 0x01)
piixide0 at pci0 dev 31 function 1
piixide0: Intel 82801DB IDE Controller (ICH4) (rev. 0x01)
piixide0: bus-master DMA support present
piixide0: primary channel wired to compatibility mode
piixide0: primary channel interrupting at irq 14
atabus0 at piixide0 channel 0
piixide0: secondary channel wired to compatibility mode
piixide0: secondary channel interrupting at irq 15
atabus1 at piixide0 channel 1
Intel 82801DB/DBM SMBus Controller (SMBus serial bus, revision 0x01) at pci0 dev 31 function 3 not configured
auich0 at pci0 dev 31 function 5: i82801DB/DBM (ICH4/ICH4M) AC-97 Audio
auich0: interrupting at irq 5
auich0: ac97: Crystal CS4202 codec; headphone, 20 bit DAC, 18 bit ADC, no 3D stereo
auich0: ac97: ext id 605
Intel 82801DB/DBM AC97 Modem Controller (modem communications, revision 0x01) at pci0 dev 31 function 6 not configured
isa0 at pcib0
lpt0 at isa0 port 0x378-0x37b irq 7
com0 at isa0 port 0x3f8-0x3ff irq 4: ns16550a, working fifo
pckbc0 at isa0 port 0x60-0x64
pckbd0 at pckbc0 (kbd slot)
pckbc0: using irq 1 for kbd slot
wskbd0 at pckbd0: console keyboard, using wsdisplay0
pms0 at pckbc0 (aux slot)
pckbc0: using irq 12 for aux slot
wsmouse0 at pms0 mux 0
pcppi0 at isa0 port 0x61
midi0 at pcppi0: PC speaker
sysbeep0 at pcppi0
isapnp0 at isa0 port 0x279: ISA Plug 'n Play device support
npx0 at isa0 port 0xf0-0xff: using exception 16
isapnp0: no ISA Plug 'n Play devices found
auich0: measured ac97 link rate at 47984 Hz, will use 48000 Hz
audio0 at auich0: full duplex, mmap, independent
Kernelized RAIDframe activated
wd0 at atabus0 drive 0: 
wd0: drive supports 16-sector PIO transfers, LBA addressing
wd0: 19077 MB, 38760 cyl, 16 head, 63 sec, 512 bytes/sect x 39070080 sectors
wd0: 32-bit data port
wd0: drive supports PIO mode 4, DMA mode 2, Ultra-DMA mode 5 (Ultra/100)
wd0(piixide0:0:0): using PIO mode 4, Ultra-DMA mode 5 (Ultra/100) (using DMA data transfers)
atapibus0 at atabus1: 2 targets
cd0 at atapibus0 drive 0:  cdrom removable
cd0: 32-bit data port
cd0: drive supports PIO mode 4, DMA mode 2, Ultra-DMA mode 2 (Ultra/33)
cd0(piixide0:1:0): using PIO mode 4, Ultra-DMA mode 2 (Ultra/33) (using DMA data transfers)
boot device: fxp0
root on fxp0
nfs_boot: trying DHCP/BOOTP
nfs_boot: DHCP next-server: 10.0.0.1
nfs_boot: my_name=laptop
nfs_boot: my_domain=localnet
nfs_boot: my_addr=10.0.0.2
nfs_boot: my_mask=255.255.255.0
root on 10.0.0.1:/usr/export/client/root
root file system type: nfs
wsdisplay0: screen 1 added (80x25, vt100 emulation)
wsdisplay0: screen 2 added (80x25, vt100 emulation)
wsdisplay0: screen 3 added (80x25, vt100 emulation)
wsdisplay0: screen 4 added (80x25, vt100 emulation)

Speak Your Mind

*