Hello There!
I am currently trying to figure out the series of steps I need to take in order to automate the install of VyOS onto my bare metal host. I have managed to get the host to successfully PXE boot into VyOS live but I am running into issues with installing VyOS to disk. Has anyone every done this before and have some insight as to what I could be doing wrong here?
Appreciate Any Help!
Thanks!
Goal
Automate the install of VyOS onto a bare metal host using PXE.
Current Error
I am able to get my host to PXE boot into live and am able to SSH into VyOS just fine but when I try to run the install image
command, I get the following error.
vyos@vyos:~$ install image
The system is already installed. Please use "add system image" instead.
Troubleshooting Steps
vyos@vyos:~$ add system image http://10.10.10.10/isos/vyos/15/vyos-1.5-rolling-202402120819-amd64.iso
The file is 444.000 MiB.
[#################################################################################################################################################################################] 100%
Validating signature
Signature is valid
Validating image checksums
What would you like to name this image? (Default: 1.5-rolling-202402120819)
Would you like to set the new image as the default one for boot? [Y/n] Y
An active configuration was found. Would you like to copy it to the new image? [Y/n] Y
Copying configuration directory
Would you like to copy SSH host keys? [Y/n] Y
Copying SSH host keys
Copying system image files
Cleaning up
Unmounting target filesystems
Removing temporary files
[Errno 2] No such file or directory: '//boot/grub/grub.cfg'
vyos@vyos:~$ sudo wget http://10.10.10.10/netboot/boot/amd64/vyos/15/boot/grub/grub.cfg -O /boot/grub/grub.cfg
--2024-02-13 18:25:25-- http://10.10.10.10/netboot/boot/amd64/vyos/15/boot/grub/grub.cfg
Connecting to 10.10.10.10:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1606 (1.6K) [application/octet-stream]
Saving to: ‘/boot/grub/grub.cfg’
/boot/grub/grub.cfg 100%[=======================================================================================================>] 1.57K --.-KB/s in 0s
2024-02-13 18:25:25 (17.3 MB/s) - ‘/boot/grub/grub.cfg’ saved [1606/1606]
vyos@vyos:~$ add system image http://10.10.10.10/isos/vyos/15/vyos-1.5-rolling-202402120819-amd64.iso
The file is 444.000 MiB.
[#################################################################################################################################################################################] 100%
Validating signature
Signature is valid
Validating image checksums
What would you like to name this image? (Default: 1.5-rolling-202402120819)
Would you like to set the new image as the default one for boot? [Y/n] Y
An active configuration was found. Would you like to copy it to the new image? [Y/n] Y
Copying configuration directory
Cleaning up
Unmounting target filesystems
Removing temporary files
Error: [Errno 17] File exists: '/boot/1.5-rolling-202402120819/rw/opt/vyatta/etc/config'
vyos@vyos:~$ sudo rm -rf /boot/1.5-rolling-202402120819
vyos@vyos:~$ add system image http://10.10.10.10/isos/vyos/15/vyos-1.5-rolling-202402120819-amd64.iso
The file is 444.000 MiB.
[#################################################################################################################################################################################] 100%
Validating signature
Signature is valid
Validating image checksums
What would you like to name this image? (Default: 1.5-rolling-202402120819)
Would you like to set the new image as the default one for boot? [Y/n] Y
An active configuration was found. Would you like to copy it to the new image? [Y/n] Y
Copying configuration directory
Would you like to copy SSH host keys? [Y/n] Y
Copying SSH host keys
Copying system image files
Cleaning up
Unmounting target filesystems
Removing temporary files
vyos@vyos:~$ install image
The system is already installed. Please use "add system image" instead.
vyos@vyos:~$ show system image
Name Default boot Running
------ -------------- ---------
System Information
vyos@vyos:~$ show system image
Name Default boot Running
------ -------------- ---------
vyos@vyos:~$ show version
Version: VyOS 1.5-rolling-202402120819
Release train: current
Built by: [email protected]
Built on: Mon 12 Feb 2024 10:20 UTC
Build UUID: b1a917a9-cda4-49ad-a327-58321f1067dc
Build commit ID: 8c5299e1cf7c7b
Architecture: x86_64
Boot via: livecd
System type: bare metal
Hardware vendor: Dell Inc.
Hardware model: OptiPlex 7050
Hardware S/N: 1234567
Hardware UUID: 4c4c4544-0046-4d10-8052-b3c04f384e32
Copyright: VyOS maintainers and contributors
PXE Configuration
dnsmasq
root@bootstrapper:/mnt/data# cat /etc/dnsmasq.conf
port=0
interface=eth0
dhcp-range=10.10.10.100,10.10.10.200,12h
dhcp-option=option:router,10.10.10.1
dhcp-option=option:dns-server,1.1.1.1
dhcp-boot=pxelinux.0,bootstrapper,10.10.10.10
# DHCP Reservations For Vyos and Hypervisor Mgmt Interfaces
dhcp-host=d8:9e:f3:7b:f4:a9,10.10.10.1
tftp-root=/mnt/data/netboot
log-facility=/var/log/dnsmasq.log
enable-tftp
log-queries
dnsmasq.log
Feb 13 13:21:04 dnsmasq-dhcp[14725]: DHCPDISCOVER(eth0) d8:9e:f3:7b:f4:a9
Feb 13 13:21:04 dnsmasq-dhcp[14725]: DHCPOFFER(eth0) 10.10.10.1 d8:9e:f3:7b:f4:a9
Feb 13 13:21:08 dnsmasq-dhcp[14725]: DHCPREQUEST(eth0) 10.10.10.1 d8:9e:f3:7b:f4:a9
Feb 13 13:21:08 dnsmasq-dhcp[14725]: DHCPACK(eth0) 10.10.10.1 d8:9e:f3:7b:f4:a9
Feb 13 13:21:08 dnsmasq-tftp[14725]: error 0 TFTP Aborted received from 10.10.10.1
Feb 13 13:21:08 dnsmasq-tftp[14725]: sent /mnt/data/netboot/pxelinux.0 to 10.10.10.1
Feb 13 13:21:08 dnsmasq-tftp[14725]: sent /mnt/data/netboot/pxelinux.0 to 10.10.10.1
Feb 13 13:21:08 dnsmasq-tftp[14725]: sent /mnt/data/netboot/ldlinux.c32 to 10.10.10.1
Feb 13 13:21:08 dnsmasq-tftp[14725]: file /mnt/data/netboot/pxelinux.cfg/44454c4c-4600-104d-8052-b3c04f384e32 not found for 10.10.10.1
Feb 13 13:21:08 dnsmasq-tftp[14725]: sent /mnt/data/netboot/pxelinux.cfg/01-d8-9e-f3-7b-f4-a9 to 10.10.10.1
Feb 13 13:21:09 dnsmasq-tftp[14725]: sent /mnt/data/netboot/boot/amd64/vyos/15/live/vmlinuz to 10.10.10.1
Feb 13 13:21:13 dnsmasq-tftp[14725]: sent /mnt/data/netboot/boot/amd64/vyos/15/live/initrd.img-6.6.16-amd64-vyos to 10.10.10.1
pxelinux.cfg
root@bootstrapper:/mnt/data/netboot/pxelinux.cfg# cat 01-d8-9e-f3-7b-f4-a9
DEFAULT VyOS14
LABEL VyOS14
KERNEL ::boot/amd64/vyos/15/live/vmlinuz
APPEND initrd=::boot/amd64/vyos/15/live/initrd.img-6.6.16-amd64-vyos boot=live nopersistence noautologin fetch=http://10.10.10.10/netboot/boot/amd64/vyos/15/live/filesystem.squashfs
VyOS ISO Download Process
root@bootstrapper:/mnt/data/isos/vyos/15# for item in $(curl -s https://api.github.com/repos/vyos/vyos-rolling-nightly-builds/releases/latest | jq -r '.assets[] | select(.name | contains ("iso")) | .browser_download_url'); do wget $item; done
root@bootstrapper:/mnt/data/isos/vyos/15# ls
vyos-1.5-rolling-202402120819-amd64.iso vyos-1.5-rolling-202402120819-amd64.iso.minisig
root@bootstrapper:/mnt/data/isos/vyos/15# mount -o loop -t iso9660 /mnt/data/isos/vyos/15/vyos-1.5-rolling-202402120819-amd64.iso /media
root@bootstrapper:/mnt/data/isos/vyos/15# rsync -av /media/ /mnt/data/netboot/boot/amd64/vyos/15
root@bootstrapper:/mnt/data/isos/vyos/15# umount /media