User Tools

Site Tools


Sidebar

Public
Internal
public:it:pxe

This is an old revision of the document!


PXE

Autoinstall/Preseed

Ubuntu Autoinstall yaml

PXE

iPXE Autoinstall Ubuntu Server from ISO or NFS

:ubuntu_20.04
set release focal
set type server
goto ubuntu_server

:ubuntu_20.04_nfs
set release focal
set type server
goto ubuntu_server_nfs

:ubuntu_server_nfs
imgfree
kernel ${boot-url}ubuntu/${release}/${type}/vmlinuz initrd=initrd netboot=nfs nfsroot=192.168.1.1:/srv/iso/ubuntu/${release}/${type} console=ttyS0 console=tty0 autoinstall net.ifnames=0 biosdevname=0 ip=dhcp ipv6.disable=1 ds=nocloud-net;s=${boot-url}ubuntu/cloud-init/
initrd ${boot-url}ubuntu/${release}/${type}/initrd
boot

:ubuntu_server
imgfree
kernel ${boot-url}ubuntu/${release}/${type}/vmlinuz initrd=initrd console=ttyS0 console=tty0 autoinstall url=${boot-url}ubuntu/${release}/live-${type}-${arch}.iso net.ifnames=0 biosdevname=0 ip=dhcp ipv6.disable=1 ds=nocloud-net;s=${boot-url}ubuntu/cloud-init/
initrd ${boot-url}ubuntu/${release}/${type}/initrd
boot

Some environments will require nfs-kernel-server to set port numbers for rpcmountd', mountd, and nlockmgr. It manifests itself as mount -t nfs server:/path/to/folder working, but /usr/lib/klibc/bin/nfsmount -o nolock -o ro <nfsserveriporhostname>:/srv/iso/ubuntu/focal/server /mnt getting a connection timeout. === iPXE Boot Ubuntu 20.04 Desktop ISO === <code> :focaldesktopiso imgfree kernel ${boot-url}nfs/focal/casper/vmlinuz initrd ${boot-url}nfs/focal/casper/initrd imgargs vmlinuz initrd=initrd boot=casper ip=dhcp url=${boot-url}ubuntu/focal/ubuntu-20.04.1-desktop-amd64.iso maybe-ubiquity boot </code> ==== Auto install 20.04 and greater using ubiquiti installer (autoinstall.yml) ==== ipxe menu item <code> :groovyserver imgfree kernel ${boot-url}ubuntu/groovy/iso/vmlinuz initrd=initrd autoinstall url=${boot-url}ubuntu/groovy/iso/groovy-live-server-amd64.iso net.ifnames=0 biosdevname=0 ip=dhcp ipv6.disable=1 ds=nocloud-net;s=${boot-url}ubuntu/groovy/cloud-init/ initrd ${boot-url}ubuntu/groovy/iso/initrd boot </code> File structure: <code> tftp$ find ubuntu/groovy/ ubuntu/groovy/ ubuntu/groovy/iso ubuntu/groovy/iso/initrd ubuntu/groovy/iso/groovy-live-server-amd64.iso ubuntu/groovy/iso/vmlinuz ubuntu/groovy/cloud-init ubuntu/groovy/cloud-init/meta-data ubuntu/groovy/cloud-init/user-data </code> meta-data <code> instance-id: groovy-autoinstall </code> user-data aka autoinstall.yml <code> #cloud-config autoinstall: apt: geoip: true preserve_sources_list: false primary: - arches: [amd64] uri: http://us.archive.ubuntu.com/ubuntu identity: {hostname: autoinstall-00, password: $6$supersecretpasswdhash, realname: phil, username: phil} keyboard: {layout: us, variant: }

locale: en_US.UTF-8
network:
  network:
    ethernets:
      eth0:
        critical: true
        dhcp-identifier: mac
        dhcp4: true
    version: 2
ssh:
  allow-pw: true
  authorized-keys:
    - "authkey ed25519 FTW"
  install-server: true
storage:
  grub:
    reorder_uefi: False
  config:
  - {ptable: gpt, wwn: '0x50026b77832fae66',
    path: /dev/sda, wipe: superblock, preserve: false, name: '', grub_device: false,
    type: disk, id: disk-sda}
  - {device: disk-sda, size: 536870912, wipe: superblock, flag: boot, number: 1,
    preserve: false, grub_device: true, type: partition, id: partition-0}
  - {fstype: fat32, volume: partition-0, preserve: false, type: format, id: format-0}
  - {device: disk-sda, size: 1073741824, wipe: superblock, flag: '', number: 2,
    preserve: false, grub_device: false, type: partition, id: partition-1}
  - {fstype: ext4, volume: partition-1, preserve: false, type: format, id: format-1}
  - {device: disk-sda, size: 238444085248, wipe: superblock, flag: '', number: 3,
    preserve: false, grub_device: false, type: partition, id: partition-2}
  - name: ubuntu-vg
    devices: [partition-2]
    preserve: false
    type: lvm_volgroup
    id: lvm_volgroup-0
  - {name: ubuntu-lv, volgroup: lvm_volgroup-0, size: 119220994048B, preserve: false,
    type: lvm_partition, id: lvm_partition-0}
  - {fstype: ext4, volume: lvm_partition-0, preserve: false, type: format, id: format-2}
  - {device: format-2, path: /, type: mount, id: mount-2}
  - {device: format-1, path: /boot, type: mount, id: mount-1}
  - {device: format-0, path: /boot/efi, type: mount, id: mount-0}
version: 1
user-data:
  timezone: America/Chicago
  disable_root: false
late-commands:
  - echo 'phil ALL=(ALL) NOPASSWD:ALL' > /target/etc/sudoers.d/ubuntu
  - sed -ie 's/GRUB_CMDLINE_LINUX=.*/GRUB_CMDLINE_LINUX="net.ifnames=0 ipv6.disable=1 biosdevname=0"/' /target/etc/default/grub
  - curtin in-target --target /target update-grub2

</code>

autoinstall.yml config bugs

list of bugs

FreeDOS w/ Payload

#!ipxe
 
:freedos
:freedosfirmware
sanhook ${boot-url}firmware/precision_3420/payload.img || goto failed
sanboot --no-describe --drive 0x00 ${boot-url}firmware/freedos12.img
boot || goto failed

 
:failed
echo Booting failed, dropping to shell
goto shell
truncate payload.img --size 32MB
sfdisk payload.img << EOF
63,,b
EOF
losetup --partscan /dev/loop20 ./payload.img
mkfs.vfat /dev/loop20p1
mount /dev/loop20p1 /mnt/ 
cp <necessary files> /mnt/
umount /mnt
losetup -d /dev/loop20

WinPE

  1. Copy WinPE into temp directory:
    1. Open “Deployment and Imaging Tools Environment”. This is a command prompt.
    2. mkdir C:\temp\winpe
      copype x86 C:\temp\winpe\x86
      copype amd64 C:\temp\winpe\amd64
  2. Inject virtio drivers into winpe
    1. Open an elevated “Deployment and Imaging Tools Environment” prompt.
    2. Inject drivers AMD64
      dism /mount-image /imagefile:"C:\temp\winpe\amd64\media\sources\boot.wim" /index:1 /mountdir:"C:\temp\winpe\amd64\mount"
      dism /image:C:\temp\winpe\amd64\mount /add-driver /driver:c:\temp\winpe\drivers /recurse /forceunsigned
      dism /unmount-image /mountdir:"C:\temp\winpe\amd64\mount" /commit
    3. Inject drivers x86
      dism /mount-image /imagefile:"C:\temp\winpe\x86\media\sources\boot.wim" /index:1 /mountdir:"C:\temp\winpe\x86\mount"
      dism /image:C:\temp\winpe\x86\mount /add-driver /driver:c:\temp\winpe\drivers /recurse /forceunsigned
      dism /unmount-image /mountdir:"C:\temp\winpe\x86\mount" /commit
public/it/pxe.1619116418.txt.gz · Last modified: 2021/04/22 13:33 by phil