Skip to content

Commit ee71ebb

Browse files
Fix: Prevent Ubuntu autoinstall from hanging and enable proper apt repos
- Disable security/updates repos during installation to prevent unattended-upgrades from running - Configure APT to disable automatic updates during installation - Add DEBIAN_FRONTEND=noninteractive for 22.04 to prevent kexec-tools prompts - Recreate proper apt sources in runcmd with all repos enabled (main, updates, security, backports) - Use generic archive.ubuntu.com mirror for global users - Fixes installation hangs and package dependency issues in Ubuntu golden images
1 parent 83368ff commit ee71ebb

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

ks-manage/ks-templates/ubuntu-lts-latest-ks/user-data

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ autoinstall:
55

66
apt:
77
disable_suites: [security, updates]
8+
conf: |
9+
APT::Periodic::Enable "0";
10+
Unattended-Upgrade::Automatic-Reboot "false";
811

912
early-commands:
1013
- echo "ttyS0" >> /etc/securetty
@@ -25,6 +28,18 @@ autoinstall:
2528
list:
2629
- root:get_shadow_password_super_mgmt_user
2730
runcmd:
31+
- "echo 'Types: deb' > /etc/apt/sources.list.d/ubuntu.sources"
32+
- "echo 'URIs: http://archive.ubuntu.com/ubuntu/' >> /etc/apt/sources.list.d/ubuntu.sources"
33+
- "echo 'Suites: noble noble-updates noble-backports' >> /etc/apt/sources.list.d/ubuntu.sources"
34+
- "echo 'Components: main restricted universe multiverse' >> /etc/apt/sources.list.d/ubuntu.sources"
35+
- "echo 'Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg' >> /etc/apt/sources.list.d/ubuntu.sources"
36+
- "echo '' >> /etc/apt/sources.list.d/ubuntu.sources"
37+
- "echo 'Types: deb' >> /etc/apt/sources.list.d/ubuntu.sources"
38+
- "echo 'URIs: http://security.ubuntu.com/ubuntu/' >> /etc/apt/sources.list.d/ubuntu.sources"
39+
- "echo 'Suites: noble-security' >> /etc/apt/sources.list.d/ubuntu.sources"
40+
- "echo 'Components: main restricted universe multiverse' >> /etc/apt/sources.list.d/ubuntu.sources"
41+
- "echo 'Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg' >> /etc/apt/sources.list.d/ubuntu.sources"
42+
- apt-get update
2843
- apt-get install -y kexec-tools chrony vim less bash-completion nfs-common tmux net-tools sysstat zip tcpdump traceroute wget tar inetutils-ping dnsutils rsync netcat-openbsd nmap lsof autofs
2944
- apt-get remove -y lvm2 && apt-get autoremove -y
3045
- /usr/bin/echo -e "HISTSIZE=-1\nHISTFILESIZE=-1" | tee -a /home/get_mgmt_super_user/.bashrc /root/.bashrc

ks-manage/ks-templates/ubuntu-lts-previous-ks/user-data

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ autoinstall:
55

66
apt:
77
disable_suites: [security, updates]
8+
conf: |
9+
APT::Periodic::Enable "0";
10+
Unattended-Upgrade::Automatic-Reboot "false";
811

912
early-commands:
1013
- echo "ttyS0" >> /etc/securetty
@@ -25,7 +28,18 @@ autoinstall:
2528
list:
2629
- root:get_shadow_password_super_mgmt_user
2730
runcmd:
28-
- apt-get install -y kexec-tools chrony vim less bash-completion nfs-common tmux net-tools sysstat zip tcpdump traceroute wget tar inetutils-ping dnsutils rsync netcat-openbsd nmap lsof autofs
31+
- echo 'deb http://archive.ubuntu.com/ubuntu/ jammy main restricted' > /etc/apt/sources.list
32+
- echo 'deb http://archive.ubuntu.com/ubuntu/ jammy-updates main restricted' >> /etc/apt/sources.list
33+
- echo 'deb http://archive.ubuntu.com/ubuntu/ jammy universe' >> /etc/apt/sources.list
34+
- echo 'deb http://archive.ubuntu.com/ubuntu/ jammy-updates universe' >> /etc/apt/sources.list
35+
- echo 'deb http://archive.ubuntu.com/ubuntu/ jammy multiverse' >> /etc/apt/sources.list
36+
- echo 'deb http://archive.ubuntu.com/ubuntu/ jammy-updates multiverse' >> /etc/apt/sources.list
37+
- echo 'deb http://archive.ubuntu.com/ubuntu/ jammy-backports main restricted universe multiverse' >> /etc/apt/sources.list
38+
- echo 'deb http://security.ubuntu.com/ubuntu/ jammy-security main restricted' >> /etc/apt/sources.list
39+
- echo 'deb http://security.ubuntu.com/ubuntu/ jammy-security universe' >> /etc/apt/sources.list
40+
- echo 'deb http://security.ubuntu.com/ubuntu/ jammy-security multiverse' >> /etc/apt/sources.list
41+
- apt-get update
42+
- DEBIAN_FRONTEND=noninteractive apt-get install -y kexec-tools chrony vim less bash-completion nfs-common tmux net-tools sysstat zip tcpdump traceroute wget tar inetutils-ping dnsutils rsync netcat-openbsd nmap lsof autofs
2943
- apt-get remove -y lvm2 && apt-get autoremove -y
3044
- /usr/bin/echo -e "HISTSIZE=-1\nHISTFILESIZE=-1" | tee -a /home/get_mgmt_super_user/.bashrc /root/.bashrc
3145
- var_PS1_variable_get_mgmt_super_user=$(curl -s -L http://get_web_server_name.get_ipv4_domain/ksmanager-hub/addons-for-kickstarts/PS1-env-variable-normal-user)

0 commit comments

Comments
 (0)