lefeck / ubuntu-autoinstall-generator-tools

Generate a fully-automated Ubuntu ISO for unattended installations.
GNU General Public License v3.0
30 stars 8 forks source link

user-data not being applied #1

Closed Swampcritter closed 8 months ago

Swampcritter commented 9 months ago

I used the generator and created a custom user-data file for building out a LVM configured Ubuntu 22.04 instance and yet none of the settings are being applied. Is there something I am doing that is wrong or does something else need to be done to order for the custom layout?

I built the new ISO via: sudo ./ubuntu-autoinstall-generator-tools.sh -n jammy -u user-data

User Data File -- user-data.txt

lefeck commented 9 months ago

You can also specify the -a option, and to build a new image it is recommended that you use the -d parameter to specify the name of the new image to build, as follows.

sudo ./ubuntu-autoinstall-generator-tools.sh  -n  jammy -a  -u user-data -d ubuntu22-autoinstall-jammy-test.iso

In addition, I found some small errors in your user-data definition parameter, corrected configuration file parameters are as follows:

#cloud-config
autoinstall:
  refresh-installer:
    # Whether to update or not. default: no
    update: yes
    # The channel to check for updates.
    channel: "stable/ubuntu-$REL"
  updates: all
  identity:
    hostname: ubuntu-server
    password: "$6$exDY1mhS4KUYCE/2$zmn9ToZwTKLhCw.b4/b.ZRTIZM30JZ4QrOQ2aOXJ8yk96xpcCof0kxKwuX1kqLG/ygbJ1f8wxED22bTL4F46P0"
    username: ubuntu
  keyboard:
    layout: us
    toggle: null
    variant: ''
  locale: en_US.UTF-8
  network:
    ethernets:
      # configure network inteface
      eth0:
        addresses:
          - 10.20.5.10/24
        nameservers:
          addresses:
           - 10.20.1.5
           - 10.20.1.6
          search:
           - ddc.local
        routes:
          - to: default
            via: 10.20.5.1
    version: 2
  ssh:
    install-server: true
    allow-pw: true
  storage:
    config:
    - { ptable: gpt, path: /dev/sda, wipe: superblock-recursive, preserve: false, grub_device: true, type: disk, id: disk-sda }
    - { type: partition, wipe: superblock-recursive, preserve: false, number: 1, device: disk-sda, flag: bios_grub, size: 1M, id: bios-grub }
    - { type: partition, wipe: superblock, preserve: false, number: 2, device: disk-sda, flag: boot, size: 1G, id: sda-boot }
    - { type: partition, wipe: superblock, preserve: false, number: 3, device: disk-sda, size: -1 , id: sda-lvm }
    - { type: lvm_volgroup, name: vg00, devices: [sda-lvm], id: vg00 }
    - { type: lvm_partition, volgroup: vg00, id: lvroot, name: lvroot, size: 20G }
    - { type: lvm_partition, volgroup: vg00, id: lvswap, name: lvswap, size: 4G }
    - { type: lvm_partition, volgroup: vg00, id: lvhome, name: lvhome, size: 5G }
    - { type: lvm_partition, volgroup: vg00, id: lvtmp, name: lvtmp, size: 2G }
    - { type: lvm_partition, volgroup: vg00, id: lvopt, name: lvopt, size: 2G }
    - { type: lvm_partition, volgroup: vg00, id: lvvar, name: lvvar, size: 10G }
    - { type: format, fstype: ext4, volume: sda-boot, id: sda-boot-fs }
    - { type: format, fstype: ext4, volume: lvroot, id: lv-root-fs }
    - { type: format, fstype: swap, volume: lvswap, id: lv-swap-fs }
    - { type: format, fstype: ext4, volume: lvhome, id: lv-home-fs }
    - { type: format, fstype: ext4, volume: lvtmp, id: lv-tmp-fs }
    - { type: format, fstype: ext4, volume: lvopt, id: lv-opt-fs }
    - { type: format, fstype: ext4, volume: lvvar, id: lv-var-fs }
    - { type: mount, path: /boot, id: m-boot, device: sda-boot-fs }
    - { type: mount, path: /, id: m-root, device: lv-root-fs }
    - { type: mount, path: '', id: m-swap, device: lv-swap-fs }
    - { type: mount, path: /home, id: m-home, device: lv-home-fs }
    - { type: mount, path: /tmp, id: m-tmp, device: lv-tmp-fs }
    - { type: mount, path: /opt, id: m-opt, device: lv-opt-fs }
    - { type: mount, path: /var, id: m-var, device: lv-var-fs }
  version: 1
  packages:
    - bash-completion
    - cloud-utils
    - cloud-guest-utils
    - git
    - curl
    - mlocate
    - resolvconf
    - htop
    - net-tools
    - dnsutils
    - aptitude
    - unzip

Network section, missing network interface name, I'm not sure about your network interface name, I customized it to eth0, you need to change it to match the actual one.

Swampcritter commented 8 months ago

Thanks for the help. I made the changes as recommended and tried the new command, but its not creating the image called ubuntu22-autoinstall-jammy-test.iso. I kick it off, it runs for a few minutes then its back to a command prompt. No error messages or anything. I ran it in verbose/debug mode.

tempest@L4133:~/github/ubuntu-autoinstall-generator-tools$ sudo ./ubuntu-autoinstall-generator-tools.sh -a -n jammy -u user-data -d ubuntu22-a
utoinstall-jammy-test.iso -v
+ shift
+ :
+ case "${1-}" in
+ break
+ log '👶 Starting up...'
++ date '+%Y-%m-%d %H:%M:%S'
+ echo -e '[2024-01-05 11:52:10] 👶 Starting up...'
[2024-01-05 11:52:10] 👶 Starting up...
+ '[' 1 -ne 0 ']'
+ [[ -z user-data ]]
+ [[ ! -f user-data ]]
+ [[ -n '' ]]
+ [[ -z jammy ]]
+ '[' 1 -eq 1 ']'
+ download_url=https://releases.ubuntu.com/jammy
+ log '🔎 Checking for current release...'
++ date '+%Y-%m-%d %H:%M:%S'
+ echo -e '[2024-01-05 11:52:10] 🔎 Checking for current release...'
[2024-01-05 11:52:10] 🔎 Checking for current release...
+ '[' jammy == kinetic ']'
++ curl -sSL https://releases.ubuntu.com/jammy
++ grep -oP 'ubuntu-[0-9][0-9]\.[0-9][0-9]\.[0-9]-live-server-amd64\.iso'
++ head -n 1
+ download_iso=ubuntu-22.04.3-live-server-amd64.iso
+ source_iso=/home/tempest/github/ubuntu-autoinstall-generator-tools/ubuntu-22.04.3-live-server-amd64.iso
++ echo ubuntu-22.04.3-live-server-amd64.iso
++ cut -f2 -d-
+ current_release=22.04.3
+ sha_suffix=22.04.3
+ log '💿 Current release is 22.04.3'
++ date '+%Y-%m-%d %H:%M:%S'
+ echo -e '[2024-01-05 11:52:11] 💿 Current release is 22.04.3'
[2024-01-05 11:52:11] 💿 Current release is 22.04.3
++ realpath ubuntu22-autoinstall-jammy-test.iso
+ destination_iso=/home/tempest/github/ubuntu-autoinstall-generator-tools/ubuntu22-autoinstall-jammy-test.iso
+ return 0
++ mktemp -d
+ tmpdir=/tmp/tmp.8PsbKS8wxl
+ [[ ! -n /tmp/tmp.8PsbKS8wxl ]]
+ [[ ! -d /tmp/tmp.8PsbKS8wxl ]]
+ log '📁 Created temporary working directory /tmp/tmp.8PsbKS8wxl'
++ date '+%Y-%m-%d %H:%M:%S'
+ echo -e '[2024-01-05 11:52:11] 📁 Created temporary working directory /tmp/tmp.8PsbKS8wxl'
[2024-01-05 11:52:11] 📁 Created temporary working directory /tmp/tmp.8PsbKS8wxl
+ log '🔎 Checking for required utilities...'
++ date '+%Y-%m-%d %H:%M:%S'
+ echo -e '[2024-01-05 11:52:11] 🔎 Checking for required utilities...'
[2024-01-05 11:52:11] 🔎 Checking for required utilities...
++ command -v xorriso
+ [[ ! -x /usr/bin/xorriso ]]
++ command -v 7z
+ [[ ! -x /usr/bin/7z ]]
++ command -v dpkg-scanpackages
+ [[ ! -x /usr/bin/dpkg-scanpackages ]]
++ command -v aptitude
+ [[ ! -x /usr/bin/aptitude ]]
+ '[' jammy == focal ']'
++ command -v xorriso
+ [[ ! -x /usr/bin/xorriso ]]
++ command -v sed
+ [[ ! -x /usr/bin/sed ]]
++ command -v curl
+ [[ ! -x /usr/bin/curl ]]
++ command -v gpg
+ [[ ! -x /usr/bin/gpg ]]
++ command -v 7z
+ [[ ! -x /usr/bin/7z ]]
++ command -v dpkg-scanpackages
+ [[ ! -x /usr/bin/dpkg-scanpackages ]]
++ command -v aptitude
+ [[ ! -x /usr/bin/aptitude ]]
+ log '👍 All required utilities are installed.'
++ date '+%Y-%m-%d %H:%M:%S'
+ echo -e '[2024-01-05 11:52:11] 👍 All required utilities are installed.'
[2024-01-05 11:52:11] 👍 All required utilities are installed.
+ '[' '!' -f /home/tempest/github/ubuntu-autoinstall-generator-tools/ubuntu-22.04.3-live-server-amd64.iso ']'
+ log '☑️ Using existing /home/tempest/github/ubuntu-autoinstall-generator-tools/ubuntu-22.04.3-live-server-amd64.iso file.'
++ date '+%Y-%m-%d %H:%M:%S'
+ echo -e '[2024-01-05 11:52:11] ☑️ Using existing /home/tempest/github/ubuntu-autoinstall-generator-tools/ubuntu-22.04.3-live-server-amd64.iso file.'
[2024-01-05 11:52:11] ☑️ Using existing /home/tempest/github/ubuntu-autoinstall-generator-tools/ubuntu-22.04.3-live-server-amd64.iso file.
+ '[' 1 -eq 1 ']'
+ '[' /home/tempest/github/ubuntu-autoinstall-generator-tools/ubuntu-22.04.3-live-server-amd64.iso '!=' /home/tempest/github/ubuntu-autoinstall-generator-tools/ubuntu-22.04.3-live-server-amd64.iso ']'
+ '[' 1 -eq 1 ']'
+ '[' '!' -f /home/tempest/github/ubuntu-autoinstall-generator-tools/SHA256SUMS-22.04.3 ']'
+ log '☑️ Using existing SHA256SUMS-22.04.3 & SHA256SUMS-22.04.3.gpg files.'
++ date '+%Y-%m-%d %H:%M:%S'
+ echo -e '[2024-01-05 11:52:11] ☑️ Using existing SHA256SUMS-22.04.3 & SHA256SUMS-22.04.3.gpg files.'
[2024-01-05 11:52:11] ☑️ Using existing SHA256SUMS-22.04.3 & SHA256SUMS-22.04.3.gpg files.
+ '[' '!' -f /home/tempest/github/ubuntu-autoinstall-generator-tools/843938DF228D22F7B3742BC0D94AA3F0EFE21092.keyring ']'
+ log '☑️ Using existing Ubuntu signing key saved in /home/tempest/github/ubuntu-autoinstall-generator-tools/843938DF228D22F7B3742BC0D94AA3F0EFE21092.keyring'
++ date '+%Y-%m-%d %H:%M:%S'
+ echo -e '[2024-01-05 11:52:11] ☑️ Using existing Ubuntu signing key saved in /home/tempest/github/ubuntu-autoinstall-generator-tools/843938DF228D22F7B3742BC0D94AA3F0EFE21092.keyring'
[2024-01-05 11:52:11] ☑️ Using existing Ubuntu signing key saved in /home/tempest/github/ubuntu-autoinstall-generator-tools/843938DF228D22F7B3742BC0D94AA3F0EFE21092.keyring
+ log '🔐 Verifying /home/tempest/github/ubuntu-autoinstall-generator-tools/ubuntu-22.04.3-live-server-amd64.iso integrity and authenticity...'
++ date '+%Y-%m-%d %H:%M:%S'
+ echo -e '[2024-01-05 11:52:11] 🔐 Verifying /home/tempest/github/ubuntu-autoinstall-generator-tools/ubuntu-22.04.3-live-server-amd64.iso integrity and authenticity...'
[2024-01-05 11:52:11] 🔐 Verifying /home/tempest/github/ubuntu-autoinstall-generator-tools/ubuntu-22.04.3-live-server-amd64.iso integrity and authenticity...
+ gpg -q --keyring /home/tempest/github/ubuntu-autoinstall-generator-tools/843938DF228D22F7B3742BC0D94AA3F0EFE21092.keyring --verify /home/tempest/github/ubuntu-autoinstall-generator-tools/SHA256SUMS-22.04.3.gpg /home/tempest/github/ubuntu-autoinstall-generator-tools/SHA256SUMS-22.04.3
lefeck commented 8 months ago

Thank you for reply. The logs don't seem to be complete, I'm not sure it's a network issue that's causing the outage, you could try adding the -k option to build the image ignoring the gpg key checksum, hopefully you'll get good results.

maworsham commented 8 months ago

Adding the -k option allowed it to process to completion. Thanks.

lefeck commented 8 months ago

Adding the -k option allowed it to process to completion. Thanks.

Great!