204 Commits

Author SHA1 Message Date
Julian Andres Klode
6b4c6fc422 Update wording for universe sources
As specified in US095, following discussions.
2024-04-22 11:40:41 +02:00
Utkarsh Gupta
3bc9857bc7 Drop the second parameter passed to configure_oci
This has become moot now that the code block has been
moved out from live-build/functions to live-build/auto/build
so passing the argument is not needed anymore.
2024-03-13 18:26:31 +05:30
Utkarsh Gupta
45692d4300 Add build_name metadata to build.info file for OCI and Base images
Presence of this field helps in determining if the image is an
unminimized image, which then can be leveraged in the unminimize
script to easily determine the image type.
2024-03-13 18:26:31 +05:30
Chad Smith
0c53dae35d functions: cloud-init clean script needs to declar interpreter
LP: #2055729
2024-03-01 15:23:02 -07:00
Julian Andres Klode
8a0a5a7e4a Switch from sources.list to ubuntu.sources
Template is based on the specification with some rewording for
Ubuntu Pro as agreed.

v2:
- Enabled backports by default (I did not see that!)
- Enabled restricted, multiverse security updates
- Replaced tweaked with adjusted

v3:
- Insert an explanatory sources.list

LP: #2048129
2024-02-12 21:54:53 +01:00
dann frazier
3a00ad5263 Use flock to avoid races with systemd-udevd
The race causes loop device partitions to briefly disappear. LP: #2045586.
2024-01-31 15:12:42 -07:00
Utkarsh Gupta
e37253418b Merge remote-tracking branch 'virtustom/mount-partnum-param' into ubuntu/master
* virtustom/mount-partnum-param:
  feat: mount_disk_image: Add rootpart parameter
2024-01-29 22:19:20 +05:30
Michael Hudson-Doyle
57592e6dc1 live-build/functions: avoid losetup -P as it appears to race with udev and do it a bit more by-hand instead. (LP: #2045586) 2024-01-25 10:26:19 +13:00
Tomáš Virtus
dab1f8c765
feat: mount_disk_image: Add rootpart parameter
mount_disk_image function expects root partition to be at number 1. But
some images require the root partition to be at other some other number.
For example, EKS Anywhere images for bare metal are used with Tinkerbell
deployment with a default configuration that expects the root device to
be found at /dev/sda2. The knowledge of the root device path is needed
to modify certain files in the root filesystem (e.g. cloud-init configs)
for the machine to join Kubernetes cluster control plane.

The partition number can be changed in the hook by "sgidsk --transpose".
Allow the hook to use mount_disk_image with custom root partition number
by making it an optional third parameter that defaults to 1.
2024-01-24 13:53:24 +01:00
Michael Hudson-Doyle
c75f6b3db4 Merge remote-tracking branch 'xypron/umount' into ubuntu/master 2023-12-08 15:41:09 +13:00
Steve Langasek
220e563de3 live-build/functions: add additional debugging to mount_image() on failure since we again have loop partitions failing to be block devices. 2023-12-03 21:38:20 -08:00
Philip Roche
5d959b24da fix: Enable snap preseeding with ppc64el images where /boot/vmlinux is used instead of /boot/vmlinuz. (LP: #2038957)
ppc64el still uses /boot/vmlinux so we need to determine the boot file name as non ppc64el use /boot/vmlinuz. This
is then used to determine the kernel major minor version installed so that the correct apparmor features can be used
during snap preseeding. This preseeding was failing for ppc64el for the mantic 6.5 kernel as the /boot/vmlinuz
being checked did not exist.
2023-10-26 18:02:32 +01:00
Steve Langasek
85606c8b9d Merge remote-tracking branch 'philroche/bugfix/ubuntu-cpc-filelist-sort-LP-2033677' into ubuntu/master 2023-10-02 16:57:29 -07:00
Simon Poirier
f3114e7fb5 fix: fix var used before declaration in snap_validate_seed
Fix use of variable declared in conditional branch and used in parent
scope in snap_validate_seed. This would affect binary for images without
kernel and using "set -u". (LP: #2037338)
2023-09-25 19:31:58 -04:00
Steve Langasek
6820ef310c Merge remote-tracking branch 'toabctl/boot-partition' into ubuntu/master 2023-09-19 08:20:12 -07:00
Steve Langasek
1deccc2edd The chroot tmpfs mount should only be /var/lib/apt/lists, not /var/lib/apt; the latter breaks changes to /var/lib/apt/extended_states. LP: #2036195. 2023-09-16 17:27:45 -07:00
Gauthier Jolly
626e59b4e5 functions: add support for mounting boot partition
If the partition exists, we should mount it on /boot. Partition 16 was
chosen because it is not used anywhere else in livecd-rootfs yet.
2023-09-14 09:50:27 +02:00
Steve Langasek
34e850d4a5 blkid is unreliable in mount_image(), but this blkid call is only here for debugging, so ignore any failures (even if we don't understand them). LP: #2034299. 2023-09-05 12:30:15 -07:00
Philip Roche
f8bd628c83 fix: Sort filelists creating when building ubuntu-cpc images (LP: #2033677)
The image filelists created during ubuntu-cpc project image builds were not sorted.

Soring the filelists makes it easier to compare the filelists without needing to sort first.
2023-08-31 20:36:00 +01:00
Michael Hudson-Doyle
5456e4e5e6 Undo preseeding in reset_snapd_state. 2023-08-25 14:50:08 +12:00
Steve Langasek
b43e3b84f4 Reset /var/lib/snapd in the upper layers before calling snap prepare-image 2023-08-23 22:21:41 +12:00
Philip Roche
a373fb527c fix: Install required package fuse3 when preseeding snaps (LP: #2031640)
fuse3 was previously installed through recommends but with minimized images we no longer install recommends packages.

It is only required when preseeding snaps so does not need to be present in all minimized images so does not
need to be in the cloud-minimal seed.
2023-08-17 11:50:20 +01:00
Jess Jang
5e96ff013e fix: bind correct apparmor feature for validating snap seed
During Realtime kernel image build, there was an error during
validating snap seed which derivative images copied 5.19
apparmor feature and can't validate when Realtime kernel (5.15)
installed [0].

To prevent this, bind correct apparmor feature with kernel
version.

[0] https://bugs.launchpad.net/ubuntu/+source/livecd-rootfs/+bug/2024639

(cherry picked from commit 6b54faa6be6286017eb2dc701534cf780ae462ce)
2023-08-08 10:12:27 -05:00
Gauthier Jolly
2929ff092e Revert "ubuntu-cpc: Make the ESP 2GiB and mount it to /boot"
Revert this change for now as /boot then becomes a FAT partition which
breaks DPKG requirements[1]. This change is going to be re-evaluated and
maybe introduced in a different way.

This is not a clean revert because of 3282efb ("ubuntu-cpc: cleanup
disk-images-uefi.binary") which we want to keep.

[1] https://wiki.debian.org/Teams/Dpkg/FAQ#Q:_What_are_the_filesystem_requirements_by_dpkg.3F

This reverts commit 6a66666e0a5ab1ad96cb0e388f278aafbd012ffe.
2023-07-06 11:12:01 +02:00
Gauthier Jolly
bbedffe6ec ubuntu-cpc: fix images for hardware devices
Canonical Public Cloud's project seems a bad place to build images for
hardware devices however this is how things were done a we now need to
maintain this.
The recent change to mount the ESP on /boot breaks those images, instead
of adding more hacky things in the hook, create a dedicated target for
those images and use a different hook to build UEFI images.
2023-06-23 13:55:59 +02:00
Gauthier Jolly
6a66666e0a ubuntu-cpc: Make the ESP 2GiB and mount it to /boot
This is driven by online encryption scenarios. In order to efficiently
encrypt the root filesystem without modifying the partition layout, the
kernel should sit in an un-encrypted /boot partition.  Instead of
creating a new partition that would change the default partition layout,
we mount the ESP on /boot. We also need to then bind mount /boot on
/boot/efi because that's where Grub expects the ESP to be located.
2023-06-13 10:48:35 +02:00
Steve Langasek
6fac77b481 Revert "Revert "Revert "Revert the recent kpartx->losetup changes, as we need to put some other changes on top. Let's try to re-introduce this for MM."""
This reverts commit 1931bbcb194febe241aa82f03a6730ba82a84409.
2023-05-26 09:41:41 -07:00
Łukasz 'sil2100' Zemczak
1931bbcb19 Revert "Revert "Revert the recent kpartx->losetup changes, as we need to put some other changes on top. Let's try to re-introduce this for MM.""
This reverts commit ada1f09b39332ec828369e0a30f2870df5c4dc3e.
2023-05-24 11:06:56 +02:00
Łukasz 'sil2100' Zemczak
4dbd985231 Revert "Try to use udevadm settle after losetup to resolve race in riscv64 image builds."
This reverts commit ef146db89529fc7fbc48052e0b684f7cb95f34ee.
2023-05-24 11:05:47 +02:00
Michael Hudson-Doyle
a65c181596 auto/config: Rewrite add_task to use a Python script that cribs the logic from lp:ubuntu-archive-publishing's generate_extra_overrides.py. This means we can avoid some dubious hacks around seeding snaps and no longer depend on the Task headers in the archive. 2023-05-12 13:19:47 +12:00
Steve Langasek
ef146db895 Try to use udevadm settle after losetup to resolve race in riscv64 image builds. 2023-05-08 15:47:04 -07:00
Steve Langasek
ada1f09b39 Revert "Revert the recent kpartx->losetup changes, as we need to put some other changes on top. Let's try to re-introduce this for MM."
This reverts commit 7b07db91110a3dda2723bc853a43f81c4e2a2f75.
2023-05-02 15:27:41 +02:00
Łukasz 'sil2100' Zemczak
7b07db9111 Revert the recent kpartx->losetup changes, as we need to put some other changes on top. Let's try to re-introduce this for MM. 2023-04-18 10:10:28 +01:00
Steve Langasek
1e0daf6af9 Clean up some remaining references to /dev/mapper. 2023-04-17 18:50:08 -07:00
Steve Langasek
6b40317404 Use the correct path for the loop device. 2023-04-17 16:11:50 -07:00
Steve Langasek
a130ee17c3 Call losetup -d properly. 2023-04-17 12:22:17 -07:00
Steve Langasek
5e4b2d3cc3 Use losetup instead of kpartx to set up loopback partitions
kpartx on riscv64 appears to be racy.  Rather than trying to debug these
fraught races somewhere between udev and libdevmapper, we can use losetup
which should be simpler and less error-prone.
2023-04-17 08:20:49 -07:00
Chad Smith
9a82720f1c cloud-init: prefer netplan to handle all network manager config
Cloud-init cannot write directly to
/etc/NetworkManager/system-connections because subiquity may
need to emit config to /etc/netplan/00-installer.yaml and call
netplan apply for autoinstall.network use-cases.

When cloud-init's config is written directly to
/etc/NetworkManager, neither netplan nor subiquity has knowledge of
this config and this results in namespace collisions in NetworkManager
due to `netplan-` named connections and `cloud-init` connection ids
fighting over which config own a given interface name.

Deleting this config overlay allows subiquity to manage all network
setup when it needs to with netplan directly.

Subiquity already has logic to rename any unwanted netplan
configuration when it intends to write cfg and run netplan apply[1].
This should allow subiquity full control of network config when needed.

[1] https://github.com/canonical/subiquity/blob/
    92ac6544cdfedfd332d8cd94dbcfad0aab994575/subiquitycore/
        controllers/network.py#L267

LP: #2015605
2023-04-07 17:09:11 -06:00
Dave Jones
6a804b7b2c Don't add 01-network-manager-all.yaml to preinstalled desktop images 2023-03-28 14:55:33 +01:00
Chad Smith
fba5be17fd cloud-init.service: systemd ordering after after NetworkManager
Autoinstall directives can be provided on the grub cmdline to
cloud-init via kernel parameters like the following:
 autoinstall 'ds=nocloud-net;s=http://somedomain/'

In order to support DNS resolution for NoCloud datasource at
datasource discovery time, cloud-init.service needs to be
orderered after NetworkManager.service and
NetworkManager-wait-online.service
which will have brought up applicable NICs.

Since NetworkManager is After=dbus.service, the cloud-init.service
avoids systemd ordering cycles by also dropping
Before=sysinit.target when it adds, After=NetworkManager.service and
After=NetworkManager-wait-online.service

Add this file overlay for /lib/systemd/system/cloud-init.service
because systemd drop-in files can only add constraints and not
drop prexisting service constraints.

Also add an AUTOMATION_HEADER comment to any generated files to
add discoverability in the event of future bugs/concerns.

LP: #2008952
2023-03-23 17:05:30 -06:00
Łukasz 'sil2100' Zemczak
c335e6ed8b Merge branch 'cloud-init-and-u-d-i' of git+ssh://git.launchpad.net/~dbungert/livecd-rootfs into ubuntu/master 2023-03-10 12:21:22 +01:00
Heinrich Schuchardt
1b6b3db5ed functions: fix unmounting for local builds
When building locally using the auto/build script unmounting fails.

Avoid mounting via bind. Mount mountpoint/dev as devtmpfs file system and
mountpoint/dev/pts as devpts file system.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2023-02-28 09:57:02 +00:00
Utkarsh Gupta
e04ea00f1f Remove whitespaces 2022-11-14 15:28:02 +05:30
Samir Akarioh
8b8ad2e0ac feat: Add Ubuntu user
We add a ubuntu user inside the image because we
want to have a operational nonroot user and also
be aligned with the other Ubuntu images.

Signed-off-by: Samir Akarioh <samir.akarioh@canonical.com>
2022-11-08 12:01:35 +01:00
Samir Akarioh
105acdebc7 feat: Add metadata on ubuntu-oci image
Add a file build.info on etc/cloud
with the serial information

Signed-off-by: Samir Akarioh <samir.akarioh@canonical.com>
2022-10-27 09:03:38 +02:00
John Chittum
e11d091106
Revert "Disable the snap-preseed"
This reverts commit 31d42bfd2ff86d175f389ee5bbed6f275597c185.

Disable the snap-preseed calls in the interest of
getting images built for the 22.10 beta. (LP: #1990884)"
2022-10-13 12:39:17 -05:00
Brian Murray
31d42bfd2f Disable the snap-preseed calls in the interest of getting images built for the 22.10 beta. (LP: #1990884) 2022-09-26 15:55:19 -07:00
Dan Bungert
ef834c2e7d functions: let cloud-init clean inform about NM 2022-08-01 14:57:37 -06:00
Dan Bungert
eb0530b7a7 functions: inform cloud-init about network manager
LP: #1982855
Co-authored-by: Chad Smith <chad.smith@canonical.com>
2022-08-01 14:57:37 -06:00
Brian Murray
995295964b Use default compat for qcow2 images.
This will cause images to be created with more moderm features which
will make our images faster and provide better sparse handling.
2022-07-28 13:57:05 -07:00