-
Notifications
You must be signed in to change notification settings - Fork 0
/
ubuntu.yml
300 lines (263 loc) · 6.17 KB
/
ubuntu.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
---
image:
distribution: ubuntu
release: noble
architecture: amd64
name: "{{ image.distribution }}-{{ image.release }}-{{ image.variant }}-{{ image.serial }}"
description: "Ubuntu {{ image.release }} ({{ image.variant }}-{{ image.serial }})"
variant: default
source:
downloader: debootstrap
url: http://archive.ubuntu.com/ubuntu
variant: minbase
mappings:
architecture_map: debian
targets:
incus:
vm:
filesystem: ext4
size: 34359738368 # 32 GiB
packages:
manager: apt
cleanup: true
update: true
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
sets:
- packages:
- bash-completion
- bind9-host
- bind9-dnsutils
- cloud-init
- curl
- diffutils
- file
- fuse3
- gnupg2
- iputils-ping
- language-pack-en
- less
- lsb-release
- lsof
- netbase
- netplan.io
- netcat-openbsd
- nftables
- strace
- sudo
- systemd
- systemd-sysv
- ufw
- uidmap
- udev
- unzip
- vim
- wget
action: install
- packages:
- apparmor
- apparmor-profiles
- chrony
- cloud-guest-utils
- grub-efi-amd64-signed
- linux-image-virtual
- shim-signed
action: install
types:
- vm
- packages:
- unattended-upgrades
- networkd-dispatcher
- os-prober
- packagekit
action: remove
actions:
- trigger: post-packages
action: |-
#!/bin/sh
set -eux
systemd-machine-id-setup
types:
- vm
# Manage systemd-resolved
- trigger: post-packages
action: |-
#!/bin/sh
set -eux
umount -l /etc/resolv.conf || true
rm /etc/resolv.conf
ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf
# Configure timezone
- trigger: post-packages
action: |-
#!/bin/sh
set -eux
ln -sfn /usr/share/zoneinfo/Etc/UTC /etc/localtime
echo "Etc/UTC" > /etc/timezone
# Default systemd units to enable
- trigger: post-packages
action: |-
#!/bin/sh
set -eux
systemctl enable systemd-networkd systemd-resolved cloud-init ufw
# Additionnal units to manage for VMs
- trigger: post-packages
action: |-
#!/bin/sh
set -eux
systemctl enable chrony
types:
- vm
- 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/*-
# Source: https://github.com/lxc/lxc-ci/blob/main/images/ubuntu.yaml#L709
- trigger: post-files
action: |-
#!/bin/sh
set -eux
TARGET="x86_64"
update-grub
grub-install --uefi-secure-boot --target="${TARGET}-efi" --no-nvram --removable
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
# Re-generate initramfs
update-initramfs -u -k all
types:
- vm
files:
- name: fstab
generator: fstab
types:
- vm
- path: /etc/fstab
generator: dump
types:
- container
- path: /etc/machine-id
generator: dump
- path: /var/lib/dbus/machine-id
generator: remove
- 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
- name: meta-data
generator: cloud-init
- name: network-config
generator: cloud-init
- name: user-data
generator: cloud-init
- 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
# Fix behavior where initramfs will search for an non-existing swap partition on boot (the kernel will take more than 30sec to boot...)
# Caused by building images on a machine with swap (i.e Incus host)
- path: /etc/initramfs-tools/conf.d/resume
generator: dump
content: |-
RESUME=none
types:
- vm
# Disable automatic service start after deb package install
- path: /usr/sbin/policy-rc.d
generator: dump
mode: 755
content: |-
#!/bin/sh
exit 101
- path: /etc/sysctl.d/10-silence-audit.conf
source: config/sysctl/10-silence-audit.conf
generator: copy
uid: 0
gid: 0
mode: 0644
types:
- vm
- path: /etc/udev/rules.d/80-iosched.rules
source: config/udev/80-iosched.rules
generator: copy
uid: 0
gid: 0
mode: 0644
types:
- vm
- path: /etc/udev/rules.d/80-cpu-hotplug.rules
source: config/udev/80-cpu-hotplug.rules
generator: copy
uid: 0
gid: 0
mode: 0644
types:
- vm
- path: /etc/netplan/10-default.yaml
source: config/netplan/container.yaml
generator: copy
uid: 0
gid: 0
mode: 0644
types:
- container
- path: /etc/netplan/10-default.yaml
source: config/netplan/vm.yaml
generator: copy
uid: 0
gid: 0
mode: 0644
types:
- vm
- path: /etc/systemd/resolved.conf
source: config/systemd/resolved.conf
generator: copy
uid: 0
gid: 0
mode: 0644
- path: /etc/systemd/journald.conf
source: config/systemd/journald.conf
generator: copy
uid: 0
gid: 0
mode: 0644
- path: /etc/chrony/chrony.conf
source: config/chrony/chrony.conf
generator: copy
uid: 0
gid: 0
mode: 0644
types:
- vm
- path: /etc/cloud/cloud.cfg
source: config/cloud-init/ubuntu.cfg
generator: copy
uid: 0
gid: 0
mode: 0644