Last active
June 29, 2024 06:27
-
-
Save brandonkal/bda67b27f713055c7cf9cb4b517ff9b9 to your computer and use it in GitHub Desktop.
Ubuntu Incus Distrobuilder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
root@45d:~/incus-build# distrobuilder pack-incus ubuntu.yaml rootfs -o source.url=http://archive.ubuntu.com/ubuntu -o image.serial=20240628 -o image.release=jammy -o image.variant=complete --vm | |
INFO [2024-06-29T05:45:38Z] Managing repositories | |
INFO [2024-06-29T05:45:38Z] Running hooks trigger=post-unpack | |
INFO [2024-06-29T05:45:38Z] Managing packages | |
Hit:1 http://archive.ubuntu.com/ubuntu jammy InRelease | |
Hit:2 http://security.ubuntu.com/ubuntu jammy-security InRelease | |
Hit:3 http://archive.ubuntu.com/ubuntu jammy-updates InRelease | |
Reading package lists... Done | |
Reading package lists... Done | |
Building dependency tree... Done | |
Reading state information... Done | |
Calculating upgrade... Done | |
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. | |
INFO [2024-06-29T05:45:43Z] Running hooks trigger=post-update | |
Reading package lists... Done | |
Building dependency tree... Done | |
Reading state information... Done | |
The following additional packages will be installed: | |
efibootmgr grub-common grub-efi-amd64 grub-efi-amd64-bin grub2-common libfreetype6 linux-image-5.15.0-113-generic | |
linux-modules-5.15.0-113-generic mokutil os-prober | |
Suggested packages: | |
multiboot-doc grub-emu mtools xorriso desktop-base fdutils linux-doc | linux-source-5.15.0 linux-tools | |
linux-headers-5.15.0-113-generic linux-modules-extra-5.15.0-113-generic | |
The following NEW packages will be installed: | |
efibootmgr grub-common grub-efi-amd64 grub-efi-amd64-bin grub-efi-amd64-signed grub2-common libfreetype6 | |
linux-image-5.15.0-113-generic linux-image-virtual linux-modules-5.15.0-113-generic mokutil os-prober shim-signed | |
0 upgraded, 13 newly installed, 0 to remove and 0 not upgraded. | |
Need to get 41.2 MB of archives. | |
After this operation, 167 MB of additional disk space will be used. | |
Get:1 http://archive.ubuntu.com/ubuntu jammy/main amd64 efibootmgr amd64 17-1ubuntu2 [29.8 kB] | |
Get:2 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 libfreetype6 amd64 2.11.1+dfsg-1ubuntu0.2 [389 kB] | |
Get:3 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 grub-common amd64 2.06-2ubuntu7.2 [2,214 kB] | |
Get:4 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 grub-efi-amd64-bin amd64 2.06-2ubuntu14.4 [1,592 kB] | |
Get:5 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 grub2-common amd64 2.06-2ubuntu7.2 [652 kB] | |
Get:6 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 grub-efi-amd64 amd64 2.06-2ubuntu14.4 [47.1 kB] | |
Get:7 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 grub-efi-amd64-signed amd64 1.187.6+2.06-2ubuntu14.4 [1,389 kB] | |
Get:8 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 linux-modules-5.15.0-113-generic amd64 5.15.0-113.123 [22.6 MB] | |
Get:9 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 linux-image-5.15.0-113-generic amd64 5.15.0-113.123 [11.5 MB] | |
Get:10 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 linux-image-virtual amd64 5.15.0.113.113 [2,436 B] | |
Get:11 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 mokutil amd64 0.6.0-2~22.04.2 [27.3 kB] | |
Get:12 http://archive.ubuntu.com/ubuntu jammy/main amd64 os-prober amd64 1.79ubuntu2 [19.3 kB] | |
Get:13 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 shim-signed amd64 1.51.3+15.7-0ubuntu1 [667 kB] | |
Fetched 41.2 MB in 1s (32.2 MB/s) | |
Preconfiguring packages ... | |
E: Can not write log (Is /dev/pts mounted?) - posix_openpt (2: No such file or directory) | |
Selecting previously unselected package efibootmgr. | |
(Reading database ... 34605 files and directories currently installed.) | |
Preparing to unpack .../00-efibootmgr_17-1ubuntu2_amd64.deb ... | |
Unpacking efibootmgr (17-1ubuntu2) ... | |
Selecting previously unselected package libfreetype6:amd64. | |
Preparing to unpack .../01-libfreetype6_2.11.1+dfsg-1ubuntu0.2_amd64.deb ... | |
Unpacking libfreetype6:amd64 (2.11.1+dfsg-1ubuntu0.2) ... | |
Selecting previously unselected package grub-common. | |
Preparing to unpack .../02-grub-common_2.06-2ubuntu7.2_amd64.deb ... | |
Unpacking grub-common (2.06-2ubuntu7.2) ... | |
Selecting previously unselected package grub-efi-amd64-bin. | |
Preparing to unpack .../03-grub-efi-amd64-bin_2.06-2ubuntu14.4_amd64.deb ... | |
Unpacking grub-efi-amd64-bin (2.06-2ubuntu14.4) ... | |
Selecting previously unselected package grub2-common. | |
Preparing to unpack .../04-grub2-common_2.06-2ubuntu7.2_amd64.deb ... | |
Unpacking grub2-common (2.06-2ubuntu7.2) ... | |
Selecting previously unselected package grub-efi-amd64. | |
Preparing to unpack .../05-grub-efi-amd64_2.06-2ubuntu14.4_amd64.deb ... | |
Unpacking grub-efi-amd64 (2.06-2ubuntu14.4) ... | |
Selecting previously unselected package grub-efi-amd64-signed. | |
Preparing to unpack .../06-grub-efi-amd64-signed_1.187.6+2.06-2ubuntu14.4_amd64.deb ... | |
Unpacking grub-efi-amd64-signed (1.187.6+2.06-2ubuntu14.4) ... | |
Selecting previously unselected package linux-modules-5.15.0-113-generic. | |
Preparing to unpack .../07-linux-modules-5.15.0-113-generic_5.15.0-113.123_amd64.deb ... | |
Unpacking linux-modules-5.15.0-113-generic (5.15.0-113.123) ... | |
Selecting previously unselected package linux-image-5.15.0-113-generic. | |
Preparing to unpack .../08-linux-image-5.15.0-113-generic_5.15.0-113.123_amd64.deb ... | |
Unpacking linux-image-5.15.0-113-generic (5.15.0-113.123) ... | |
Selecting previously unselected package linux-image-virtual. | |
Preparing to unpack .../09-linux-image-virtual_5.15.0.113.113_amd64.deb ... | |
Unpacking linux-image-virtual (5.15.0.113.113) ... | |
Selecting previously unselected package mokutil. | |
Preparing to unpack .../10-mokutil_0.6.0-2~22.04.2_amd64.deb ... | |
Unpacking mokutil (0.6.0-2~22.04.2) ... | |
Selecting previously unselected package os-prober. | |
Preparing to unpack .../11-os-prober_1.79ubuntu2_amd64.deb ... | |
Unpacking os-prober (1.79ubuntu2) ... | |
Selecting previously unselected package shim-signed. | |
Preparing to unpack .../12-shim-signed_1.51.3+15.7-0ubuntu1_amd64.deb ... | |
Unpacking shim-signed (1.51.3+15.7-0ubuntu1) ... | |
Setting up efibootmgr (17-1ubuntu2) ... | |
Setting up mokutil (0.6.0-2~22.04.2) ... | |
Setting up libfreetype6:amd64 (2.11.1+dfsg-1ubuntu0.2) ... | |
Setting up grub-common (2.06-2ubuntu7.2) ... | |
Created symlink /etc/systemd/system/multi-user.target.wants/grub-common.service → /lib/systemd/system/grub-common.service. | |
Created symlink /etc/systemd/system/sleep.target.wants/grub-common.service → /lib/systemd/system/grub-common.service. | |
Created symlink /etc/systemd/system/multi-user.target.wants/grub-initrd-fallback.service → /lib/systemd/system/grub-initrd-fallback.service. | |
Created symlink /etc/systemd/system/rescue.target.wants/grub-initrd-fallback.service → /lib/systemd/system/grub-initrd-fallback.service. | |
Created symlink /etc/systemd/system/emergency.target.wants/grub-initrd-fallback.service → /lib/systemd/system/grub-initrd-fallback.service. | |
Created symlink /etc/systemd/system/sleep.target.wants/grub-initrd-fallback.service → /lib/systemd/system/grub-initrd-fallback.service. | |
update-rc.d: warning: start and stop actions are no longer supported; falling back to defaults | |
invoke-rc.d: could not determine current runlevel | |
invoke-rc.d: policy-rc.d denied execution of start. | |
Setting up os-prober (1.79ubuntu2) ... | |
Setting up grub-efi-amd64-bin (2.06-2ubuntu14.4) ... | |
Setting up grub2-common (2.06-2ubuntu7.2) ... | |
Setting up grub-efi-amd64 (2.06-2ubuntu14.4) ... | |
Creating config file /etc/default/grub with new version | |
Setting up grub-efi-amd64-signed (1.187.6+2.06-2ubuntu14.4) ... | |
Setting up shim-signed (1.51.3+15.7-0ubuntu1) ... | |
update-alternatives: using /usr/lib/shim/shimx64.efi.signed.latest to provide /usr/lib/shim/shimx64.efi.signed (shimx64.efi.signed) in auto mode | |
Setting up linux-modules-5.15.0-113-generic (5.15.0-113.123) ... | |
Setting up linux-image-5.15.0-113-generic (5.15.0-113.123) ... | |
I: /boot/vmlinuz.old is now a symlink to vmlinuz-5.15.0-113-generic | |
I: /boot/initrd.img.old is now a symlink to initrd.img-5.15.0-113-generic | |
I: /boot/vmlinuz is now a symlink to vmlinuz-5.15.0-113-generic | |
I: /boot/initrd.img is now a symlink to initrd.img-5.15.0-113-generic | |
Setting up linux-image-virtual (5.15.0.113.113) ... | |
Processing triggers for install-info (6.8-4build1) ... | |
Processing triggers for libc-bin (2.35-0ubuntu3.8) ... | |
Processing triggers for man-db (2.10.2-1) ... | |
Processing triggers for linux-image-5.15.0-113-generic (5.15.0-113.123) ... | |
/etc/kernel/postinst.d/initramfs-tools: | |
update-initramfs: Generating /boot/initrd.img-5.15.0-113-generic | |
cryptsetup: ERROR: Couldn't resolve device overlay | |
cryptsetup: WARNING: Couldn't determine root device | |
cryptsetup: ERROR: Couldn't resolve device /dev/md127p1 | |
W: Possible missing firmware /lib/firmware/ast_dp501_fw.bin for module ast | |
W: Couldn't identify type of root file system for fsck hook | |
I: The initramfs will attempt to resume from /dev/md127p1 | |
I: Set the RESUME variable to override this. | |
NEEDRESTART-VER: 3.5 | |
NEEDRESTART-KCUR: 6.5.0-41-generic | |
NEEDRESTART-KEXP: 5.15.0-113-generic | |
NEEDRESTART-KSTA: 3 | |
NEEDRESTART-UCSTA: 0 | |
Reading package lists... Done | |
Building dependency tree... Done | |
Reading state information... Done | |
The following packages will be REMOVED: | |
os-prober | |
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded. | |
After this operation, 115 kB disk space will be freed. | |
E: Can not write log (Is /dev/pts mounted?) - posix_openpt (2: No such file or directory) | |
(Reading database ... 36439 files and directories currently installed.) | |
Removing os-prober (1.79ubuntu2) ... | |
Reading package lists... Done | |
Building dependency tree... Done | |
Reading state information... Done | |
cloud-guest-utils is already the newest version (0.32-22-g45fe84a5-0ubuntu1). | |
cloud-guest-utils set to manually installed. | |
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. | |
INFO [2024-06-29T05:46:14Z] Running hooks trigger=post-packages | |
INFO [2024-06-29T05:46:14Z] Running generator generator=hostname | |
INFO [2024-06-29T05:46:14Z] Running generator generator=hosts | |
INFO [2024-06-29T05:46:14Z] Running generator generator=remove | |
INFO [2024-06-29T05:46:14Z] Running generator generator=remove | |
INFO [2024-06-29T05:46:14Z] Running generator generator=dump | |
INFO [2024-06-29T05:46:14Z] Running generator generator=remove | |
INFO [2024-06-29T05:46:14Z] Running generator generator=dump | |
INFO [2024-06-29T05:46:14Z] Running generator generator=dump | |
INFO [2024-06-29T05:46:14Z] Running generator generator=fstab | |
INFO [2024-06-29T05:46:14Z] Running generator generator=incus-agent | |
INFO [2024-06-29T05:46:14Z] Running generator generator=dump | |
Creating new GPT entries in memory. | |
Warning: The kernel is still using the old partition table. | |
The new table will be used at the next reboot or after you | |
run partprobe(8) or kpartx(8) | |
GPT data structures destroyed! You may now partition the disk using fdisk or | |
other utilities. | |
Creating new GPT entries in memory. | |
Warning: The kernel is still using the old partition table. | |
The new table will be used at the next reboot or after you | |
run partprobe(8) or kpartx(8) | |
The operation has completed successfully. | |
Warning: The kernel is still using the old partition table. | |
The new table will be used at the next reboot or after you | |
run partprobe(8) or kpartx(8) | |
The operation has completed successfully. | |
Error: Failed to mount image: Failed to wait loop device ready: exit status 1 | |
ERROR [2024-06-29T05:48:17Z] Failed running distrobuilder err="Failed to mount image: Failed to wait loop device ready: exit status 1" | |
INFO [2024-06-29T05:48:17Z] Removing cache directory |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
image: | |
distribution: "ubuntu" | |
release: jammy | |
description: |- | |
Ubuntu {{ image.release }} Complete | |
architecture: x86_64 | |
source: | |
downloader: rootfs-http | |
# Downloaded via: | |
# wget https://cloud-images.ubuntu.com/releases/jammy/release/ubuntu-22.04-server-cloudimg-amd64-root.tar.xz | |
url: file:///root/incus-build/ubuntu-22.04-server-cloudimg-amd64-root.tar.xz | |
targets: | |
lxc: | |
create_message: |- | |
You just created an {{ image.description }} container. | |
To enable SSH, run: apt install openssh-server | |
No default root or user password are set by LXC. | |
config: | |
- type: all | |
before: 5 | |
content: |- | |
lxc.include = LXC_TEMPLATE_CONFIG/ubuntu.common.conf | |
- type: user | |
before: 5 | |
content: |- | |
lxc.include = LXC_TEMPLATE_CONFIG/ubuntu.userns.conf | |
- type: all | |
after: 4 | |
content: |- | |
lxc.include = LXC_TEMPLATE_CONFIG/common.conf | |
- type: user | |
after: 4 | |
content: |- | |
lxc.include = LXC_TEMPLATE_CONFIG/userns.conf | |
- type: all | |
content: |- | |
lxc.arch = {{ image.architecture_personality }} | |
files: | |
- path: /etc/hostname | |
generator: hostname | |
- path: /etc/hosts | |
generator: hosts | |
- path: /etc/resolvconf/resolv.conf.d/original | |
generator: remove | |
- path: /etc/resolvconf/resolv.conf.d/tail | |
generator: remove | |
- path: /etc/machine-id | |
generator: dump | |
- path: /var/lib/dbus/machine-id | |
generator: remove | |
- path: /etc/netplan/10-lxc.yaml | |
generator: dump | |
mode: 0600 | |
content: |- | |
network: | |
version: 2 | |
ethernets: | |
eth0: | |
dhcp4: true | |
dhcp-identifier: mac | |
releases: | |
- bionic | |
- focal | |
- jammy | |
- mantic | |
- noble | |
types: | |
- container | |
variants: | |
- default | |
- path: /etc/network/interfaces | |
generator: dump | |
content: |- | |
# This file describes the network interfaces available on your system | |
# and how to activate them. For more information, see interfaces(5). | |
# The loopback network interface | |
auto lo | |
iface lo inet loopback | |
auto eth0 | |
iface eth0 inet dhcp | |
source /etc/network/interfaces.d/*.cfg | |
releases: | |
- xenial | |
types: | |
- container | |
- path: /root/.tmux.conf | |
generator: dump | |
mode: 0644 | |
content: |- | |
new-session | |
set-window-option -g mouse on | |
set -g history-limit 30000 | |
set -g default-terminal "xterm-256color" | |
# split panes using | and - | |
bind | split-window -h | |
bind - split-window -v | |
unbind '"' | |
unbind % | |
- path: /home/ubuntu/.tmux.conf | |
generator: dump | |
mode: 0644 | |
content: |- | |
new-session | |
set-window-option -g mouse on | |
set -g history-limit 30000 | |
set -g default-terminal "xterm-256color" | |
# split panes using | and - | |
bind | split-window -h | |
bind - split-window -v | |
unbind '"' | |
unbind % | |
- path: /etc/network/interfaces | |
generator: dump | |
content: |- | |
# This file describes the network interfaces available on your system | |
# and how to activate them. For more information, see interfaces(5). | |
# The loopback network interface | |
auto lo | |
iface lo inet loopback | |
auto enp5s0 | |
iface enp5s0 inet dhcp | |
source /etc/network/interfaces.d/*.cfg | |
releases: | |
- xenial | |
types: | |
- vm | |
- name: meta-data | |
generator: cloud-init | |
variants: | |
- cloud | |
- name: network-config | |
generator: cloud-init | |
variants: | |
- cloud | |
- name: user-data | |
generator: cloud-init | |
variants: | |
- cloud | |
- name: vendor-data | |
generator: cloud-init | |
variants: | |
- cloud | |
- name: ext4 | |
generator: fstab | |
types: | |
- vm | |
- name: incus-agent | |
generator: incus-agent | |
types: | |
- vm | |
- path: /etc/default/grub.d/50-incus.cfg | |
generator: dump | |
content: |- | |
GRUB_RECORDFAIL_TIMEOUT=0 | |
GRUB_TIMEOUT=0 | |
GRUB_CMDLINE_LINUX_DEFAULT="${GRUB_CMDLINE_LINUX_DEFAULT} console=tty1 console=ttyS0" | |
GRUB_TERMINAL=console | |
types: | |
- vm | |
- path: /etc/sudoers.d/90-incus | |
generator: dump | |
mode: 0440 | |
content: |- | |
# User rules for ubuntu | |
ubuntu ALL=(ALL) NOPASSWD:ALL | |
variants: | |
- default | |
- path: /etc/sudoers.d/90-incus | |
generator: dump | |
mode: 0440 | |
content: |- | |
# User rules for ubuntu | |
ubuntu ALL=(ALL) NOPASSWD:ALL | |
variants: | |
- desktop | |
types: | |
- vm | |
packages: | |
manager: apt | |
update: true | |
cleanup: true | |
sets: | |
- packages: | |
- fuse | |
releases: | |
- xenial | |
- bionic | |
- focal | |
action: install | |
- packages: | |
- fuse3 | |
releases: | |
- jammy | |
- mantic | |
- noble | |
action: install | |
- packages: | |
- openssh-client | |
- sudo | |
- vim | |
# Custom packages | |
- htop | |
- silversearcher-ag | |
- tmux | |
- nano | |
- curl | |
- wget | |
- jq | |
- git | |
action: install | |
- packages: | |
- language-pack-en | |
action: install | |
architectures: | |
- amd64 | |
- arm64 | |
- armhf | |
- powerpc | |
- powerpc64 | |
- packages: | |
- language-pack-en | |
action: install | |
architectures: | |
- ppc64el | |
releases: | |
- xenial | |
- bionic | |
- jammy | |
- mantic | |
- noble | |
- packages: | |
- cloud-init | |
action: install | |
variants: | |
- cloud | |
- packages: | |
- systemd-resolved | |
action: install | |
releases: | |
- mantic | |
- noble | |
- packages: | |
- acpid | |
action: install | |
architectures: | |
- amd64 | |
- arm64 | |
releases: | |
- xenial | |
types: | |
- vm | |
- packages: | |
- grub-efi-amd64-signed | |
- shim-signed | |
action: install | |
architectures: | |
- amd64 | |
types: | |
- vm | |
- packages: | |
- grub-efi-arm64-signed | |
action: install | |
architectures: | |
- arm64 | |
types: | |
- vm | |
- packages: | |
- shim-signed | |
action: install | |
architectures: | |
- arm64 | |
releases: | |
- focal | |
- jammy | |
- mantic | |
- noble | |
types: | |
- vm | |
- packages: | |
- linux-image-virtual-hwe-16.04 | |
action: install | |
releases: | |
- xenial | |
types: | |
- vm | |
- packages: | |
- linux-image-virtual | |
action: install | |
releases: | |
- bionic | |
- focal | |
- jammy | |
- mantic | |
- noble | |
types: | |
- vm | |
- packages: | |
- os-prober | |
action: remove | |
types: | |
- vm | |
- packages: | |
- cloud-guest-utils | |
action: install | |
types: | |
- vm | |
- packages: | |
- ubuntu-desktop-minimal | |
action: install | |
variants: | |
- desktop | |
types: | |
- vm | |
repositories: | |
- name: sources.list | |
url: |- | |
deb http://archive.ubuntu.com/ubuntu {{ image.release }} main restricted universe multiverse | |
deb http://archive.ubuntu.com/ubuntu {{ image.release }}-updates main restricted universe multiverse | |
deb http://security.ubuntu.com/ubuntu {{ image.release }}-security main restricted universe multiverse | |
architectures: | |
- amd64 | |
- i386 | |
- name: sources.list | |
url: |- | |
deb http://ports.ubuntu.com/ubuntu-ports {{ image.release }} main restricted universe multiverse | |
deb http://ports.ubuntu.com/ubuntu-ports {{ image.release }}-updates main restricted universe multiverse | |
deb http://ports.ubuntu.com/ubuntu-ports {{ image.release }}-security main restricted universe multiverse | |
architectures: | |
- armhf | |
- arm64 | |
- powerpc | |
- powerpc64 | |
- ppc64el | |
- riscv64 | |
actions: | |
- trigger: post-unpack | |
action: |- | |
#!/bin/sh | |
set -eux | |
# Make sure systemd doesn't think it's running. | |
[ ! -d /run/systemd ] && exit 0 | |
rm -Rf /run/systemd/system | |
chattr +i /run/systemd | |
- trigger: post-packages | |
action: |- | |
#!/bin/sh | |
set -eux | |
# Remove the immutable flag. | |
[ ! -d /run/systemd ] && exit 0 | |
chattr -i /run/systemd | |
- trigger: post-update | |
action: |- | |
#!/bin/sh | |
set -eux | |
# Create the ubuntu user account | |
getent group sudo >/dev/null 2>&1 || groupadd --system sudo | |
useradd --create-home -s /bin/bash -G sudo -U ubuntu | |
variants: | |
- default | |
- trigger: post-packages | |
action: |- | |
#!/bin/sh | |
set -eux | |
# Enable systemd-networkd | |
systemctl enable systemd-networkd | |
# Disable UA attach | |
systemctl mask ua-auto-attach | |
- trigger: post-packages | |
action: |- | |
#!/bin/sh | |
set -eux | |
curl -L "https://github.com/dbrgn/tealdeer/releases/download/v1.6.1/tealdeer-linux-x86_64-musl" -o /usr/local/bin/tldr | |
chmod +x /usr/local/bin/tldr | |
- trigger: post-packages | |
action: |- | |
#!/bin/sh | |
set -eux | |
# Ensure /etc/resolv.conf is symlinked to /run/systemd/resolve/stub-resolv.conf | |
ln -sf ../run/systemd/resolve/stub-resolv.conf /etc/resolv.conf | |
releases: | |
- mantic | |
- noble | |
- trigger: post-packages | |
action: |- | |
#!/bin/sh | |
set -eux | |
# Make sure the locale is built and functional | |
locale-gen en_US.UTF-8 | |
update-locale LANG=en_US.UTF-8 | |
# Cleanup underlying /run | |
mount -o bind / /mnt | |
rm -rf /mnt/run/* | |
umount /mnt | |
# Cleanup temporary shadow paths | |
rm /etc/*- | |
- trigger: post-files | |
action: |- | |
#!/bin/sh | |
set -eux | |
TARGET="x86_64" | |
[ "$(uname -m)" = "aarch64" ] && TARGET="arm64" | |
update-grub | |
# This will create EFI/BOOT | |
grub-install --uefi-secure-boot --target="${TARGET}-efi" --no-nvram --removable | |
# This will create EFI/ubuntu | |
grub-install --uefi-secure-boot --target="${TARGET}-efi" --no-nvram | |
update-grub | |
sed -i "s#root=[^ ]*#root=${DISTROBUILDER_ROOT_UUID}#g" /boot/grub/grub.cfg | |
types: | |
- vm | |
- trigger: post-files | |
action: |- | |
#!/bin/sh | |
set -eux | |
# Automatic disk resize | |
cat << EOF > /etc/systemd/system/incus-growpart.service | |
[Unit] | |
Description=Incus - grow root partition | |
[Service] | |
Type=oneshot | |
ExecStartPre=-/usr/bin/growpart /dev/sda 2 | |
ExecStart=/sbin/resize2fs /dev/sda2 | |
[Install] | |
WantedBy=default.target | |
EOF | |
systemctl enable incus-growpart | |
types: | |
- vm | |
variants: | |
- default | |
- desktop | |
- trigger: post-packages | |
action: |- | |
#!/bin/sh | |
set -eux | |
# Disable location service | |
systemctl mask geoclue.service | |
# Timezone | |
rm -f /etc/localtime | |
ln -s /usr/share/zoneinfo/UTC /etc/localtime | |
echo UTC > /etc/timezone | |
# Locale | |
echo en_US.UTF-8 UTF-8 > /etc/locale.gen | |
locale-gen | |
echo LANG=en_US.UTF-8 > /etc/locale.conf | |
# User | |
USERNAME="ubuntu" | |
useradd ${USERNAME} -s /bin/bash -m -U -G adm,video,users | |
cat << EOF > /etc/gdm3/custom.conf | |
[daemon] | |
AutomaticLogin=${USERNAME} | |
AutomaticLoginEnable=true | |
EOF | |
cat << EOF > /home/ubuntu/firstboot.sh | |
#!/bin/sh | |
set -e | |
# Disable automatic screensaver lock | |
gsettings set org.gnome.desktop.screensaver lock-enabled false | |
# Disable welcome tour. | |
gsettings set org.gnome.shell welcome-dialog-last-shown-version '4294967295' | |
# Delete this script | |
rm /home/ubuntu/firstboot.sh | |
EOF | |
chown ubuntu:ubuntu /home/ubuntu/firstboot.sh | |
chmod +x /home/ubuntu/firstboot.sh | |
cat << EOF > /etc/systemd/user/firstboot.service | |
[Unit] | |
Description=One time boot script | |
After=dbus.service | |
After=display-manager.service | |
ConditionPathExists=/home/ubuntu/firstboot.sh | |
[Service] | |
Type=oneshot | |
ExecStart=/home/ubuntu/firstboot.sh | |
[Install] | |
WantedBy=default.target | |
EOF | |
mkdir -p /home/ubuntu/.config/systemd/user/default.target.wants | |
ln -s /etc/systemd/user/firstboot.service /home/ubuntu/.config/systemd/user/default.target.wants/firstboot.service | |
chown -R ubuntu:ubuntu /home/ubuntu/.config | |
variants: | |
- desktop | |
types: | |
- vm | |
mappings: | |
architecture_map: debian |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment