Sample Header Ad - 728x90

ubuntu-live-server installation through PXE user-data config error

1 vote
1 answer
116 views
I am trying to install Ubuntu live server. Everything works fine till the system requests the cloud-init configs. I have tried to change my user-data file several times. Ether it throughs an error "An error occurred. Press enter to start shell (image 1) Image 1 then I change the configuration file user-data file, it passes from waiting for cloud-init step and loads (I suppose ) user data file then it throws another error: Image 2 Here is my user-data file:
#cloud-config

# Locale and Timezone
locale: en_US.UTF-8
timezone: UTC

# Preserve the hostname
preserve_hostname: true

# Users configuration
users:
  - name: user
    gecos: ubuntu-server
    groups: adm, cdrom, dip, lxd, plugdev, sudo
    lock_passwd: false
    passwd: some-hashed-password
    sudo: ALL=(ALL) NOPASSWD:ALL
    shell: /bin/bash
    ssh_pwauth: true

# Disk setup for flexible sizes
# The partitioning will use the entire disk size
disk_setup:
  /dev/sda:
    table_type: gpt
    layout: true
    overwrite: false
    partition:
      - size: 1024        # 1GB for /boot
        type: 0xEF00      # EFI System Partition
      - size: 2048        # 2GB for /boot
        type: 0x8300      # Linux Filesystem for /boot
      - size: -1          # Use remaining space for root (LVM)

# LVM setup to use remaining disk space
lvm:
  vg:
    ubuntu-vg:
      devices:
        - /dev/sda3  # Third partition is for LVM

fs_setup:
  - label: boot
    filesystem: ext4
    device: /dev/sda2  # Boot partition

  - label: root
    filesystem: ext4
    device: /dev/mapper/ubuntu--vg-ubuntu--lv  # LVM root partition

# Mount points configuration
mounts:
  - [ /dev/sda2, /boot ]
  - [ /dev/mapper/ubuntu--vg-ubuntu--lv, / ]

# Growpart to automatically resize partitions
growpart:
  mode: 'auto'
  devices: ['/']

resize_rootfs: true  # Automatically resize the root filesystem

# Network setup (adjust the interface as needed)
network:
  version: 2
  ethernets:
    ens160:
      dhcp4: true

# Packages to install
packages:
  - openssh-server
  - htop
  - curl

# Run custom commands after first boot
runcmd:
  - echo "System successfully initialized!"
  - apt-get update && apt-get upgrade -y

# Reboot after cloud-init is done
power_state:
  mode: reboot

# Final message after boot
final_message: "The system is ready! You can now log in."
Could someone suggest me how to figure it out and make it work?
Asked by AdkhamSec (13 rep)
Sep 9, 2024, 12:58 PM
Last activity: Sep 9, 2024, 01:43 PM