From 3af65754f760d2801e547733e309d61be9e8b2a8 Mon Sep 17 00:00:00 2001 From: Rohit Yadav Date: Thu, 3 Jun 2021 16:18:26 +0530 Subject: [PATCH 1/5] systemvmtemplate: use latest LTS kernel from buster-ports Use the latest v5.10 Linux kernel (LTS) from buster-ports Signed-off-by: Rohit Yadav (cherry picked from commit 2dd1650276e7fa31fc3b920b67be8396647c279d) Signed-off-by: Rohit Yadav --- tools/appliance/systemvmtemplate/http/preseed.cfg | 10 +++++++--- .../appliance/systemvmtemplate/scripts/apt_upgrade.sh | 6 ++++++ .../systemvmtemplate/scripts/configure_grub.sh | 2 ++ .../scripts/install_systemvm_packages.sh | 1 + tools/appliance/systemvmtemplate/template.json | 11 +++++++++-- 5 files changed, 25 insertions(+), 5 deletions(-) diff --git a/tools/appliance/systemvmtemplate/http/preseed.cfg b/tools/appliance/systemvmtemplate/http/preseed.cfg index ce51f746c300..f4c063b39a8e 100644 --- a/tools/appliance/systemvmtemplate/http/preseed.cfg +++ b/tools/appliance/systemvmtemplate/http/preseed.cfg @@ -41,10 +41,14 @@ d-i mirror/http/proxy string ### Apt setup d-i apt-setup/cdrom/set-first false d-i apt-setup/security-updates boolean true -d-i apt-setup/services-select multiselect security, updates +d-i apt-setup/services-select multiselect backports, security, updates d-i apt-setup/security_host string security.debian.org d-i apt-setup/local0/source boolean false d-i apt-setup/multiarch string i386 +d-i apt-setup/backports boolean true +d-i apt-setup/contrib boolean true +d-i apt-setup/multiverse boolean true +d-i apt-setup/universe boolean true ### Clock and time zone setup d-i clock-setup/utc boolean true @@ -56,13 +60,13 @@ d-i partman-auto/disk string /dev/vda d-i partman-auto/method string regular d-i partman-auto/expert_recipe string \ boot-root :: \ - 100 60 100 ext2 \ + 400 60 400 ext2 \ $primary{ } $bootable{ } \ method{ format } format{ } \ use_filesystem{ } filesystem{ ext2 } \ mountpoint{ /boot } \ . \ - 2240 40 2500 ext4 \ + 4000 40 5000 ext4 \ method{ format } format{ } \ use_filesystem{ } filesystem{ ext4 } \ mountpoint{ / } \ diff --git a/tools/appliance/systemvmtemplate/scripts/apt_upgrade.sh b/tools/appliance/systemvmtemplate/scripts/apt_upgrade.sh index ea75c2d8bf2c..8ba2df871e2f 100644 --- a/tools/appliance/systemvmtemplate/scripts/apt_upgrade.sh +++ b/tools/appliance/systemvmtemplate/scripts/apt_upgrade.sh @@ -53,11 +53,17 @@ function apt_upgrade() { rm -fv /root/*.iso apt-get -q -y update + + # Remove unused non-default kernel apt-get -q -y upgrade apt-get -q -y dist-upgrade + apt-get -q -y upgrade -t buster-backports + apt-get -q -y dist-upgrade -t buster-backports + apt-get -y autoremove --purge apt-get autoclean apt-get clean + reboot } return 2>/dev/null || apt_upgrade diff --git a/tools/appliance/systemvmtemplate/scripts/configure_grub.sh b/tools/appliance/systemvmtemplate/scripts/configure_grub.sh index 4d250c0417b1..a3310fe158de 100644 --- a/tools/appliance/systemvmtemplate/scripts/configure_grub.sh +++ b/tools/appliance/systemvmtemplate/scripts/configure_grub.sh @@ -20,6 +20,8 @@ set -e set -x function configure_grub() { + # Remove old kernel + apt-get remove -y --purge linux-image-amd64 linux-image-4.19.0-16-amd64 || true echo "blacklist floppy" > /etc/modprobe.d/blacklist-floppy.conf rmmod floppy || true update-initramfs -u diff --git a/tools/appliance/systemvmtemplate/scripts/install_systemvm_packages.sh b/tools/appliance/systemvmtemplate/scripts/install_systemvm_packages.sh index 82d08ce05845..bfab71c0c884 100644 --- a/tools/appliance/systemvmtemplate/scripts/install_systemvm_packages.sh +++ b/tools/appliance/systemvmtemplate/scripts/install_systemvm_packages.sh @@ -72,6 +72,7 @@ function install_packages() { strongswan libcharon-extra-plugins libstrongswan-extra-plugins strongswan-charon strongswan-starter \ virt-what open-vm-tools qemu-guest-agent hyperv-daemons + apt-get -y upgrade -t buster-backports apt-get -y autoremove --purge apt-get clean apt-get autoclean diff --git a/tools/appliance/systemvmtemplate/template.json b/tools/appliance/systemvmtemplate/template.json index 5ec5f35a3b19..277a2afb36eb 100644 --- a/tools/appliance/systemvmtemplate/template.json +++ b/tools/appliance/systemvmtemplate/template.json @@ -6,7 +6,14 @@ "type": "shell", "execute_command": "echo 'cloud' | sudo -u root -S bash {{.Path}}", "scripts": [ - "scripts/apt_upgrade.sh", + "scripts/apt_upgrade.sh" + ], + "expect_disconnect": true + }, + { + "type": "shell", + "execute_command": "echo 'cloud' | sudo -u root -S bash {{.Path}}", + "scripts": [ "scripts/configure_grub.sh", "scripts/configure_locale.sh", "scripts/configure_networking.sh", @@ -33,7 +40,7 @@ [ "-smp", "1" ] ], "format": "qcow2", - "disk_size": 2500, + "disk_size": 5000, "disk_interface": "virtio", "net_device": "virtio-net", "iso_url": "https://cdimage.debian.org/debian-cd/10.9.0/amd64/iso-cd/debian-10.9.0-amd64-netinst.iso", From db3d1f7fa038b82a9d5ce85b6ba47a4490119bf4 Mon Sep 17 00:00:00 2001 From: Rohit Yadav Date: Mon, 7 Jun 2021 15:36:59 +0530 Subject: [PATCH 2/5] Update configure_grub.sh --- tools/appliance/systemvmtemplate/scripts/configure_grub.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/appliance/systemvmtemplate/scripts/configure_grub.sh b/tools/appliance/systemvmtemplate/scripts/configure_grub.sh index a3310fe158de..1214fcf17181 100644 --- a/tools/appliance/systemvmtemplate/scripts/configure_grub.sh +++ b/tools/appliance/systemvmtemplate/scripts/configure_grub.sh @@ -21,7 +21,7 @@ set -x function configure_grub() { # Remove old kernel - apt-get remove -y --purge linux-image-amd64 linux-image-4.19.0-16-amd64 || true + apt-get remove -y --purge linux-image-amd64 linux-image-4* || true echo "blacklist floppy" > /etc/modprobe.d/blacklist-floppy.conf rmmod floppy || true update-initramfs -u From d66051ae1c12ef6e45ce6475b4a55f127b4f7644 Mon Sep 17 00:00:00 2001 From: Rohit Yadav Date: Thu, 17 Jun 2021 16:06:05 +0530 Subject: [PATCH 3/5] changes Signed-off-by: Rohit Yadav --- tools/appliance/systemvmtemplate/http/preseed.cfg | 14 +++++++------- .../systemvmtemplate/scripts/apt_upgrade.sh | 1 - .../systemvmtemplate/scripts/configure_grub.sh | 5 +++-- .../scripts/install_systemvm_packages.sh | 7 ++----- tools/appliance/systemvmtemplate/template.json | 2 +- 5 files changed, 13 insertions(+), 16 deletions(-) diff --git a/tools/appliance/systemvmtemplate/http/preseed.cfg b/tools/appliance/systemvmtemplate/http/preseed.cfg index f4c063b39a8e..ca5e624098a6 100644 --- a/tools/appliance/systemvmtemplate/http/preseed.cfg +++ b/tools/appliance/systemvmtemplate/http/preseed.cfg @@ -41,14 +41,14 @@ d-i mirror/http/proxy string ### Apt setup d-i apt-setup/cdrom/set-first false d-i apt-setup/security-updates boolean true -d-i apt-setup/services-select multiselect backports, security, updates +d-i apt-setup/services-select multiselect security, updates d-i apt-setup/security_host string security.debian.org d-i apt-setup/local0/source boolean false d-i apt-setup/multiarch string i386 -d-i apt-setup/backports boolean true -d-i apt-setup/contrib boolean true -d-i apt-setup/multiverse boolean true -d-i apt-setup/universe boolean true +d-i apt-setup/backports boolean true +d-i apt-setup/contrib boolean true +d-i apt-setup/multiverse boolean true +d-i apt-setup/universe boolean true ### Clock and time zone setup d-i clock-setup/utc boolean true @@ -60,13 +60,13 @@ d-i partman-auto/disk string /dev/vda d-i partman-auto/method string regular d-i partman-auto/expert_recipe string \ boot-root :: \ - 400 60 400 ext2 \ + 100 60 200 ext2 \ $primary{ } $bootable{ } \ method{ format } format{ } \ use_filesystem{ } filesystem{ ext2 } \ mountpoint{ /boot } \ . \ - 4000 40 5000 ext4 \ + 2240 40 4000 ext4 \ method{ format } format{ } \ use_filesystem{ } filesystem{ ext4 } \ mountpoint{ / } \ diff --git a/tools/appliance/systemvmtemplate/scripts/apt_upgrade.sh b/tools/appliance/systemvmtemplate/scripts/apt_upgrade.sh index 8ba2df871e2f..5699323f8941 100644 --- a/tools/appliance/systemvmtemplate/scripts/apt_upgrade.sh +++ b/tools/appliance/systemvmtemplate/scripts/apt_upgrade.sh @@ -54,7 +54,6 @@ function apt_upgrade() { rm -fv /root/*.iso apt-get -q -y update - # Remove unused non-default kernel apt-get -q -y upgrade apt-get -q -y dist-upgrade apt-get -q -y upgrade -t buster-backports diff --git a/tools/appliance/systemvmtemplate/scripts/configure_grub.sh b/tools/appliance/systemvmtemplate/scripts/configure_grub.sh index 1214fcf17181..231aa764449f 100644 --- a/tools/appliance/systemvmtemplate/scripts/configure_grub.sh +++ b/tools/appliance/systemvmtemplate/scripts/configure_grub.sh @@ -20,8 +20,9 @@ set -e set -x function configure_grub() { - # Remove old kernel - apt-get remove -y --purge linux-image-amd64 linux-image-4* || true + # Remove the old/unused kernel + dpkg --list | grep linux-image | awk '{ print $2 }' | sort -V | sed -n '/'`uname -r`'/q;p' | xargs sudo apt-get remove -y --purge || true + apt-get -y autoremove --purge echo "blacklist floppy" > /etc/modprobe.d/blacklist-floppy.conf rmmod floppy || true update-initramfs -u diff --git a/tools/appliance/systemvmtemplate/scripts/install_systemvm_packages.sh b/tools/appliance/systemvmtemplate/scripts/install_systemvm_packages.sh index bfab71c0c884..83cc0f30e28d 100644 --- a/tools/appliance/systemvmtemplate/scripts/install_systemvm_packages.sh +++ b/tools/appliance/systemvmtemplate/scripts/install_systemvm_packages.sh @@ -42,7 +42,7 @@ function install_packages() { debconf_packages - local apt_get="apt-get --no-install-recommends -q -y" + local apt_get="apt-get --no-install-recommends -q -y -t buster-backports" ${apt_get} install grub-legacy \ rsyslog logrotate cron net-tools ifupdown tmux vim-tiny htop netbase iptables nftables \ @@ -69,16 +69,13 @@ function install_packages() { haveged \ radvd \ sharutils genisoimage \ - strongswan libcharon-extra-plugins libstrongswan-extra-plugins strongswan-charon strongswan-starter \ + openvpn strongswan libcharon-extra-plugins libstrongswan-extra-plugins strongswan-charon strongswan-starter \ virt-what open-vm-tools qemu-guest-agent hyperv-daemons - apt-get -y upgrade -t buster-backports apt-get -y autoremove --purge apt-get clean apt-get autoclean - ${apt_get} install links - #32 bit architecture support for vhd-util: not required for 32 bit template if [ "${arch}" != "i386" ]; then dpkg --add-architecture i386 diff --git a/tools/appliance/systemvmtemplate/template.json b/tools/appliance/systemvmtemplate/template.json index 277a2afb36eb..1e33241cd893 100644 --- a/tools/appliance/systemvmtemplate/template.json +++ b/tools/appliance/systemvmtemplate/template.json @@ -40,7 +40,7 @@ [ "-smp", "1" ] ], "format": "qcow2", - "disk_size": 5000, + "disk_size": 3000, "disk_interface": "virtio", "net_device": "virtio-net", "iso_url": "https://cdimage.debian.org/debian-cd/10.9.0/amd64/iso-cd/debian-10.9.0-amd64-netinst.iso", From 4c8f7269ba1a355ae903fffeeff58afaec0139af Mon Sep 17 00:00:00 2001 From: Rohit Yadav Date: Thu, 17 Jun 2021 16:53:32 +0530 Subject: [PATCH 4/5] fix failing build Signed-off-by: Rohit Yadav --- tools/appliance/systemvmtemplate/http/preseed.cfg | 2 +- .../systemvmtemplate/scripts/install_systemvm_packages.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/appliance/systemvmtemplate/http/preseed.cfg b/tools/appliance/systemvmtemplate/http/preseed.cfg index ca5e624098a6..42718933ecba 100644 --- a/tools/appliance/systemvmtemplate/http/preseed.cfg +++ b/tools/appliance/systemvmtemplate/http/preseed.cfg @@ -60,7 +60,7 @@ d-i partman-auto/disk string /dev/vda d-i partman-auto/method string regular d-i partman-auto/expert_recipe string \ boot-root :: \ - 100 60 200 ext2 \ + 400 60 400 ext2 \ $primary{ } $bootable{ } \ method{ format } format{ } \ use_filesystem{ } filesystem{ ext2 } \ diff --git a/tools/appliance/systemvmtemplate/scripts/install_systemvm_packages.sh b/tools/appliance/systemvmtemplate/scripts/install_systemvm_packages.sh index 83cc0f30e28d..2b99983d68c1 100644 --- a/tools/appliance/systemvmtemplate/scripts/install_systemvm_packages.sh +++ b/tools/appliance/systemvmtemplate/scripts/install_systemvm_packages.sh @@ -22,7 +22,7 @@ set -x function install_vhd_util() { [[ -f /bin/vhd-util ]] && return - wget --no-check-certificate https://github.com/shapeblue/cloudstack-nonoss/raw/master/vhd-util -O /bin/vhd-util + wget --no-check-certificate https://github.com/shapeblue/cloudstack-nonoss/raw/main/vhd-util -O /bin/vhd-util chmod a+x /bin/vhd-util } From c905bd5b9e6205273a4d7213a14ad5f934c9082b Mon Sep 17 00:00:00 2001 From: Rohit Yadav Date: Thu, 15 Jul 2021 13:00:24 +0530 Subject: [PATCH 5/5] Update install_systemvm_packages.sh --- .../systemvmtemplate/scripts/install_systemvm_packages.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/appliance/systemvmtemplate/scripts/install_systemvm_packages.sh b/tools/appliance/systemvmtemplate/scripts/install_systemvm_packages.sh index 2b99983d68c1..d19fd06a8a7c 100644 --- a/tools/appliance/systemvmtemplate/scripts/install_systemvm_packages.sh +++ b/tools/appliance/systemvmtemplate/scripts/install_systemvm_packages.sh @@ -69,7 +69,7 @@ function install_packages() { haveged \ radvd \ sharutils genisoimage \ - openvpn strongswan libcharon-extra-plugins libstrongswan-extra-plugins strongswan-charon strongswan-starter \ + strongswan libcharon-extra-plugins libstrongswan-extra-plugins strongswan-charon strongswan-starter \ virt-what open-vm-tools qemu-guest-agent hyperv-daemons apt-get -y autoremove --purge