Applicable to:
- SolusVM
Question
How to modify the first boot script in the TDN KVM template in SolusVM?
Answer
Warning: Modifying first boot template can break the template. Perform the modification with caution.
- Connect to the KVM Slave Node via SSH
- Open the firstboot script for editing with virt-edit utility and modify it in necessary way:
# virt-edit -a <path-to-template> <path-to-firstboot-script>
Replace <path-to-template> and <path-to-firstboot-script> with the actual path to corresponding template and firstboot script accordingly.
All the templates are located at /home/solusvm/kvm/template<path-to-firstboot-script> depends on template OS.
- For Ubuntu 20, Centos 7, Centos 8 and Almalinux 8:
CONFIG_TEXT: /usr/lib/virt-sysprep/scripts/0001-swapoff--dev-vda2-mkswap--dev-vda2-swapon--dev-vda2-resize2f
- for Ubuntu 18, Debian 9 and Debian 10:
CONFIG_TEXT: /usr/lib/virt-sysprep/scripts/0001-mkswap--dev-vda2-update-initramfs--u-resize2fs--dev-vda1-apt
Command examples:
# virt-edit -a /home/solusvm/kvm/template/linux-debian-9-x86_64-minimal-latest.gz /usr/lib/virt-sysprep/scripts/0001-swapoff--dev-vda2-mkswap--dev-vda2-swapon--dev-vda2-resize2f
# virt-edit -a /home/solusvm/kvm/template/linux-centos-8-x86_64-gen2-v1.gz /usr/lib/virt-sysprep/scripts/0001-swapoff--dev-vda2-mkswap--dev-vda2-swapon--dev-vda2-resize2f - For Ubuntu 20, Centos 7, Centos 8 and Almalinux 8:
Comments
2 comments
This is what I have in mine for Ubuntu 18.04 I was hoping it would update when it first boots but there are around 5 things that need user input so how do I fix this.
mkswap /dev/vda2;update-initramfs -u;resize2fs /dev/vda1;apt-get update;apt-get upgrade -y;systemctl disable guestfs-firstboot;reboot
what you need to do to get this to work with Ubuntu is enable non interactive mode so you will have a file like this
swapoff /dev/vda2;mkswap /dev/vda2;update-initramfs -u;resize2fs /dev/vda1;DEBIAN_FRONTEND=noninteractive apt-get update -y;DEBIAN_FRONTEND=noninteractive apt-get dist-upgrade -y;systemctl disable guestfs-firstboot;reboot
Please sign in to leave a comment.