Skip to content

Preseed Client

Richard Spindler edited this page Oct 2, 2021 · 2 revisions

Preseed is the OS deployment technology for Debian and Ubuntu based Linux.

Server commands are run on the Deployment Server. The client configuration commands are run on the Deployment Server, and the client creation commands are run on the host.

The commands are split into three types:

  • Server configuration
    • Creating OS deployment repositories from the OS installation media (ISOs)
  • Client creation
    • Creating client VMs.
  • Client configuration
    • Creating client profiles
      • PXE / DHCP / BOOTP configuration
      • Install configurations
      • Post install scripts

This section refers to the client related commands. For the server related commands refer to the Preseed Server Examples.

For some VM examples of client creation commands refer to either the VirtualBox Examples or VMware Fusion Examples.

Preseed Client Examples

List Preseed clients:

./modest.rb --action list --method ps

Create Pressed client:

./modest.rb --action create --name ubuntu1310vm01 --mac 08:00:27:BA:34:7C --arch x86_64 --ip 192.168.1.196 --service ubuntu_13_10_x86_64

Delete Preseed client:

./modest.rb --action delete --name ubuntu1310vm01

Preseed Client Usage Examples

Delete a VMware Fusion Ubuntu VM:

./modest.rb --vm fusion --action delete --name ubuntu1404vm01 --verbose

Information:    Running in verbose mode
Information     Running in client mode
Information:    Home directory /Users/spindler
Information:    Setting work directory to /Users/spindler/.modest
Information:    Setting temporary directory to /Users/spindler/.modest
Determining:    Default host IP
Executing:      sudo sh -c "ifconfig en0 |grep 'inet ' |awk '{print $2}'"
Output:                 inet 192.168.1.12 netmask 0xffffff00 broadcast 192.168.1.255
Information:    Setting client name to ubuntu1404vm01
Information:    Not using sudo
Stopping:       Virtual Box VM ubuntu1404vm01
Executing:      '/Applications/VMware Fusion.app//Contents/Library/vmrun' -T fusion stop '/Users/spindler/Documents/Virtual Machines/ubuntu1404vm01.vmwarevm/ubuntu1404vm01.vmx'
Output:         Error: The virtual machine is not powered on: /Users/spindler/Documents/Virtual Machines/ubuntu1404vm01.vmwarevm/ubuntu1404vm01.vmx
Deleting:       VMware Fusion VM ubuntu1404vm01
Executing:      '/Applications/VMware Fusion.app/Contents/Library/vmrun' -T fusion deleteVM '/Users/spindler/Documents/Virtual Machines/ubuntu1404vm01.vmwarevm/ubuntu1404vm01.vmx'
Removing:       VMware Fusion VM ubuntu1404vm01 directory
Executing:      cd '/Users/spindler/Documents/Virtual Machines' ; rm -rf 'ubuntu1404vm01.vmwarevm'

Create a VMware Fusion Ubuntu VM (MAC Address is generated):

./modest.rb --action create --vm fusion --name ubuntu1404vm01 --arch x86_64 --verbose

Information:    Running in verbose mode
Information     Running in client mode
Information:    Home directory /Users/spindler
Information:    Setting work directory to /Users/spindler/.modest
Information:    Setting temporary directory to /Users/spindler/.modest
Determining:    Default host IP
Executing:      sudo sh -c "ifconfig en0 |grep 'inet ' |awk '{print $2}'"
Output:                 inet 192.168.1.12 netmask 0xffffff00 broadcast 192.168.1.255
Information:    Setting client name to ubuntu1404vm01
Information:    Setting install type to text based
Information:    Setting architecture to x86_64
Information:    Not using sudo
Information:    Generated MAC address 2A:16:87:B1:6A:38
Creating:       /Users/spindler/Documents/Virtual Machines/ubuntu1404vm01.vmwarevm
Executing:      mkdir -p '/Users/spindler/Documents/Virtual Machines/ubuntu1404vm01.vmwarevm'
Information:    VMware Fusion VM ubuntu1404vm01 configuration:
.encoding - "UTF-8"
config.version - "8"
virtualHW.version - "10"
vcpu.hotadd - "TRUE"
scsi0.present - "TRUE"
scsi0.virtualDev - "lsilogic"
sata0.present - "TRUE"
memsize - "1024"
mem.hotadd - "TRUE"
scsi0:0.present - "TRUE"
scsi0:0.fileName - "ubuntu1404vm01.vmdk"
sata0:1.present - "FALSE"
floppy0.fileType - "device"
floppy0.fileName - ""
floppy0.clientDevice - "FALSE"
ethernet0.present - "TRUE"
ethernet0.connectionType - "bridged"
ethernet0.virtualDev - "e1000"
ethernet0.wakeOnPcktRcv - "FALSE"
ethernet0.addressType - "static"
ethernet0.linkStatePropagation.enable - "TRUE"
usb.present - "TRUE"
ehci.present - "TRUE"
ehci.pciSlotNumber - "35"
sound.present - "TRUE"
sound.fileName - "-1"
sound.autodetect - "TRUE"
mks.enable3d - "TRUE"
pciBridge0.present - "TRUE"
pciBridge4.present - "TRUE"
pciBridge4.virtualDev - "pcieRootPort"
pciBridge4.functions - "8"
pciBridge5.present - "TRUE"
pciBridge5.virtualDev - "pcieRootPort"
pciBridge5.functions - "8"
pciBridge6.present - "TRUE"
pciBridge6.virtualDev - "pcieRootPort"
pciBridge6.functions - "8"
pciBridge7.present - "TRUE"
pciBridge7.virtualDev - "pcieRootPort"
pciBridge7.functions - "8"
vmci0.present - "TRUE"
hpet0.present - "TRUE"
usb.vbluetooth.startConnected - "TRUE"
tools.syncTime - "TRUE"
displayName - "ubuntu1404vm01"
guestOS - "ubuntu"
nvram - "ubuntu1404vm01.nvram"
virtualHW.productCompatibility - "hosted"
tools.upgrade.policy - "upgradeAtPowerCycle"
powerType.powerOff - "soft"
powerType.powerOn - "soft"
powerType.suspend - "soft"
powerType.reset - "soft"
extendedConfigFile - "ubuntu1404vm01.vmxf"
uuid.bios - "56"
uuid.location - "56"
replay.supported - "FALSE"
replay.filename - ""
pciBridge0.pciSlotNumber - "17"
pciBridge4.pciSlotNumber - "21"
pciBridge5.pciSlotNumber - "22"
pciBridge6.pciSlotNumber - "23"
pciBridge7.pciSlotNumber - "24"
scsi0.pciSlotNumber - "16"
usb.pciSlotNumber - "32"
ethernet0.pciSlotNumber - "33"
sound.pciSlotNumber - "34"
vmci0.pciSlotNumber - "36"
sata0.pciSlotNumber - "37"
ethernet0.generatedAddressOffset - "0"
vmci0.id - "-1176557972"
vmotion.checkpointFBSize - "134217728"
cleanShutdown - "TRUE"
softPowerOff - "FALSE"
usb:1.speed - "2"
usb:1.present - "TRUE"
usb:1.deviceType - "hub"
usb:1.port - "1"
usb:1.parent - "-1"
checkpoint.vmState - ""
sata0:1.startConnected - "FALSE"
usb:0.present - "TRUE"
usb:0.deviceType - "hid"
usb:0.port - "0"
usb:0.parent - "-1"
ethernet0.address - "2A:16:87:B1:6A:38"
floppy0.present - "FALSE"
serial0.present - "TRUE"
serial0.fileType - "pipe"
serial0.yieldOnMsrRead - "TRUE"
serial0.startConnected - "TRUE"
serial0.fileName - "/tmp/ubuntu1404vm01"
scsi0:0.redo - ""
Creating:       VMware Fusion disk '/Users/spindler/Documents/Virtual Machines/ubuntu1404vm01.vmwarevm/ubuntu1404vm01.vmdk' for ubuntu1404vm01
Executing:      cd '/Users/spindler/Documents/Virtual Machines/ubuntu1404vm01.vmwarevm' ; '/Applications/VMware Fusion.app//Contents/Library/vmware-vdiskmanager' -c -s '12G' -a LsiLogic -t 1 '/Users/spindler/Documents/Virtual Machines/ubuntu1404vm01.vmwarevm/ubuntu1404vm01.vmdk'
Output:         Creating disk '/Users/spindler/Documents/Virtual Machines/ubuntu1404vm01.vmwarevm/ubuntu1404vm01.vmdk'
Output:         Virtual disk creation successful.

Client:     ubuntu1404vm01 created with MAC address 2A:16:87:B1:6A:38

Adding a Virtual Box VM (Specify MAC Address):

./modest.rb --action create --vm vbox --name ubuntu1410vb01 --mac 2A:16:87:B1:6A:40 --arch x86_64 --verbose
Information:	Running in verbose mode
Information:	Setting publisher host to 10081
Information:	Client ethernet MAC address is 2A:16:87:B1:6A:40
Information:	Setting architecture to x86_64
Information     Running in client mode
Information:	Home directory /Users/spindler
Information:	Setting work directory to /Users/spindler/.modest
Information:	Setting temporary directory to /Users/spindler/.modest
Changing ownership of /Users/spindler/.modest to 501
Executing:	sudo sh -c "chown -R 501 /Users/spindler/.modest"
Determining:	Default host IP
Executing:	sudo sh -c "ifconfig en0 |grep 'inet ' |awk '{print $2}'"
Information:	Setting client name to ubuntu1410vb01
Information:	Not running in windowed mode
Information:	Not using sudo
Setting:	VirtualBox VM ubuntu1410vb01 MAC address to 2A:16:87:B1:6A:40
Executing:	VBoxManage modifyvm ubuntu1410vb01 --macaddress1 2A1687B16A40
Checking:	VirtualBox hostonly network exists
Executing:	VBoxManage list hostonlyifs |grep '^Name' |awk '{print $2}' |head -1
Output:		vboxnet0
Checking:	VirtualBox hostonly network vboxnet0 has address 192.168.2.254
Executing:	VBoxManage list hostonlyifs |grep 'IPAddress' |awk '{print $2}' |head -1
Output:		192.168.2.254
Getting:	Interface name of default router
Executing:	netstat -rn |grep ^default |head -1 |awk '{print $6}'
Output:		en3
Checking:	IP forwarding is enabled
Executing:	sudo sysctl -a net.inet.ip.forwarding |awk '{print $2}'
Output:		1
Checking:	Rule for IP forwarding has been created
Executing:	sudo pfctl -a '*' -sr 2>&1 |grep 'pass quick on en3'
Output:		pass quick on en3 proto udp from any to any port = 53 keep state
Output:		pass quick on en3 proto tcp from any to any port = 53 flags S/SA keep state
Getting:	VirtualBox VM directory
Executing:	VBoxManage list systemproperties |grep 'Default machine folder' |cut -f2 -d':' |sed 's/^[         ]*//g'
Output:		/Users/spindler/VirtualBox VMs
Checking:	VM ubuntu1410vb01 doesn't exist
Executing:	VBoxManage list vms
Output:		"sol11u02vb01" {9db2a0e6-2ba2-423b-b543-8acc3711420c}
Output:		"sles12vb01" {a08246c8-420e-468c-b4e4-64c1c8711e7e}
Registering:	VM ubuntu1410vb01
Executing:	VBoxManage createvm --name "ubuntu1410vb01" --ostype "Ubuntu_64" --register
Output:		Virtual machine 'ubuntu1410vb01' is created and registered.
Output:		UUID: 6523b18b-fad9-46ca-a101-60fb74d7aa84
Output:		Settings file: '/Users/spindler/VirtualBox VMs/ubuntu1410vb01/ubuntu1410vb01.vbox'
Adding:		Controller to VirtualBox VM
Executing:	VBoxManage storagectl "ubuntu1410vb01" --name "sas" --add "sas" --controller "LSILogicSAS"
Creating:	VM hard disk for ubuntu1410vb01
Executing:	VBoxManage createhd --filename "/Users/spindler/VirtualBox VMs/ubuntu1410vb01/ubuntu1410vb01.vdi" --size "12000"
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Output:		Disk image created. UUID: e368815a-4ac1-477d-a2c3-d6fb0886b625
Attaching:	Storage to VM ubuntu1410vb01
Executing:	VBoxManage storageattach "ubuntu1410vb01" --storagectl "sas" --port 0 --device 0 --type hdd --medium "/Users/spindler/VirtualBox VMs/ubuntu1410vb01/ubuntu1410vb01.vdi"
Adding:		Memory to VM ubuntu1410vb01
Executing:	VBoxManage modifyvm "ubuntu1410vb01" --memory "1024"
Adding:		Serial controller to ubuntu1410vb01
Executing:	VBoxManage modifyvm "ubuntu1410vb01" --uartmode1 server /tmp/ubuntu1410vb01
Adding:		Serial Port to ubuntu1410vb01
Executing:	VBoxManage modifyvm "ubuntu1410vb01" --uart1 0x3F8 4
Adding:		Network vboxnet0 to ubuntu1410vb01
Executing:	VBoxManage modifyvm ubuntu1410vb01 --hostonlyadapter1 vboxnet0 ; VBoxManage modifyvm ubuntu1410vb01 --nic1 hostonly
Setting:	Boot priority for ubuntu1410vb01 to disk then network
Executing:	VBoxManage modifyvm ubuntu1410vb01 --boot1 disk --boot2 net
Attaching:	CDROM to VM ubuntu1410vb01
Executing:	VBoxManage storagectl "ubuntu1410vb01" --name "cdrom" --add "sata" --controller "IntelAHCI"
Attaching:	ISO /Applications/VirtualBox.app//Contents/MacOS/VBoxGuestAdditions.iso to VM ubuntu1410vb01
Executing:	VBoxManage storageattach "ubuntu1410vb01" --storagectl "cdrom" --port 0 --device 0 --type dvddrive --medium "/Applications/VirtualBox.app//Contents/MacOS/VBoxGuestAdditions.iso"
Setting:	VirtualBox VM ubuntu1410vb01 MAC address to 2A:16:87:B1:6A:40
Executing:	VBoxManage modifyvm ubuntu1410vb01 --macaddress1 2A1687B16A40
Created:	VirtualBox VM ubuntu1410vb01 with MAC address 2A:16:87:B1:6A:40

To connect to the serial console of this machine once booted run the following command:

socat UNIX-CONNECT:/tmp/ubuntu1410vb01 STDIO,raw,echo=0,escape=0x11,icanon=0

If you wish to disconnect from this session use CTRL-Q

Preseed client configuration using defaults:

./modest.rb --method ps --action create --name ubuntu1310vm01 --mac 08:00:27:BA:34:7C --arch x86_64 --ip 192.168.1.196 --service ubuntu_13_10_x86_64 --defaults --verbose 
Information:    Running in verbose mode
Information:    Home directory /root
Information:    Setting work directory to /opt/modest
Information:    Setting temporary directory to /opt/modest
Determining:    Default host IP
Executing:      ipadm show-addr net0/v4 |grep net |awk '{print $4}' |cut -f1 -d'/'
Output:         192.168.1.191
Information:    Setting client name to ubuntu1310vm01
Information:    Setting service name to ubuntu_13_10_x86_64
Information:    Client ethernet MAC address is 08:00:27:BA:34:7C
Information:    Setting install type to text based
Information:    Setting publisher port to 10081
Information:    Setting publisher host to 10081
Information:    Client IP address is 192.168.1.196
Information:    Setting architecture to x86_64
Information:    Setting answers to defaults

Setting:        Parameter language to en
Setting:        language to en
Setting:        Parameter country to AU
Setting:        country to AU
Setting:        Parameter locale to en_US
Setting:        locale to en_US
Setting:        Parameter interface to eth0
Setting:        interface to eth0
Setting:        Parameter autoconfig to true
Setting:        autoconfig to true
Setting:        Parameter nameserver to 8.8.8.8
Setting:        nameserver to 8.8.8.8
Setting:        Parameter ipaddress to 192.168.1.196
Setting:        ipaddress to 192.168.1.196
Setting:        Parameter netmask to 255.255.255.0
Setting:        netmask to 255.255.255.0
Setting:        Parameter gateway to 192.168.1.254
Setting:        gateway to 192.168.1.254
Setting:        Parameter static to true
Setting:        static to true
Setting:        Parameter hostname to ubuntu1310vm01
Setting:        hostname to ubuntu1310vm01
Setting:        Parameter domain to
Setting:        domain to
Setting:        Parameter domain to
Setting:        Parameter clock to false
Setting:        clock to false
Setting:        Parameter timezone to Australia/Victoria
Setting:        timezone to Australia/Victoria
Setting:        Parameter timeserver to 0.au.pool.ntp.org
Setting:        timeserver to 0.au.pool.ntp.org
Setting:        Parameter partition_method to regular
Setting:        partition_method to regular
Setting:        Parameter purge_existing to true
Setting:        purge_existing to true
Setting:        Parameter partition_write to true
Setting:        partition_write to true
Setting:        Parameter filesystem_layout to atomic
Setting:        filesystem_layout to atomic
Setting:        Parameter kernel_image to linux-generic
Setting:        kernel_image to linux-generic
Setting:        Parameter root_login to false
Setting:        root_login to false
Setting:        Parameter make_user to true
Setting:        make_user to true
Setting:        Parameter root_password to XXXX
Setting:        root_password to XXXX
Setting:        Parameter root_crypt to $1$GJPCQ0et$tm7avAvG3jMubA0t96NWP.
Setting:        root_crypt to $1$8rYompzo$oiIKQhcJuRsVkSYWVeAVf1
Setting:        Parameter root_crypt to $1$IVD6qLo9$tl.qmHEWCXDg4gUFXyYaf0
Setting:        Parameter user_fullname to Sys Admin
Setting:        user_fullname to Sys Admin
Setting:        Parameter user_username to administrator
Setting:        user_username to administrator
Setting:        Parameter user_password to YYYY
Setting:        user_password to YYYY
Setting:        Parameter user_crypt to $1$KXTXo5K4$8gQ.bzsCqeUtsDcebjj4J/
Setting:        user_crypt to $1$At6zNVWH$oyRnv6V78tT.fTvuAdLLs0
Setting:        Parameter user_crypt to $1$iOC9iPbE$SKg1SUiwlAx8XwPINA.zK.
Setting:        Parameter user_groups to wheel
Setting:        user_groups to wheel
Setting:        Parameter user_home_encrypt to false
Setting:        user_home_encrypt to false
Setting:        Parameter install_grub_mbr to true
Setting:        install_grub_mbr to true
Setting:        Parameter late_command to in-target wget http://192.168.1.191/ubuntu_13_10_x86_64/ubuntu1310vm01_post.sh -O - |sh
Setting:        late_command to in-target wget http://192.168.1.191/ubuntu_13_10_x86_64/ubuntu1310vm01_post.sh -O - |sh
Creating:       Preseed file /export/repo/ubuntu_13_10_x86_64/ubuntu1310vm01.cfg
Information:    Install file /export/repo/ubuntu_13_10_x86_64/ubuntu1310vm01_post.sh contents:

#!/bin/sh
apt-get install -y puppet
apt-get install -y openssh-server
apt-get install -y python-software-properties
apt-get install -y software-properties-common
echo "  ALL-(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/administrator


Information:    PXE menu file /etc/netboot/pxelinux.cfg/01-08-00-27-ba-34-7c contents:

DEFAULT LINUX
LABEL LINUX
	KERNEL /ubuntu_13_10_x86_64/images/pxeboot/vmlinuz
	APPEND auto-true priority-critical preseed/url-http://192.168.1.191/ubuntu_13_10_x86_64/ubuntu1310vm01.cfg console-keymaps-at/keymap-us locale-en_US hostname-ubuntu1310vm01 initrd-/ubuntu_13_10_x86_64/images/pxeboot/netboot/ubuntu-installer/amd64/initrd.gz text

Checking:
				 If DHCPd configuration contains ubuntu1310vm01
Executing:      cat /etc/inet/dhcpd4.conf | grep 'ubuntu1310vm01'
Output:         host ubuntu1310vm01 {
Clone this wiki locally