1464 Commits

Author SHA1 Message Date
Gauthier Jolly
330720f686
ubuntu-cpc: secure esp mountpoint (LP: #1881006)
Change mount option for ubuntu-cpc images from "defaults" to
"umask=0077". ESP partitions might contain sensitive data and
non-root users shouldn't have read access on it.
2021-03-18 10:10:43 +00:00
Pat Viafore
0775862a25
Add mechanism to detect initrdless boot fallback
With this change, when we attempt to boot with an initramfs and fail,
initrdless_boot_fallback_triggered is set to non-zero in the grubenv.
This value can be checked after boot by looking in /boot/grub/grubenv
or by using the grub-editenv list command.

Addresses LP: #1870189
2021-02-18 15:47:20 -06:00
David Krauser
4030c8bc5a
Drop hack in kvm image that forces initramfs-less boot
Since the kvm image now boots without an initramfs by default, we
don't need to force it in the build hook.
2021-02-18 15:40:46 -06:00
David Krauser
c81f4ca2e3
Boot without an initramfs by default if running a custom kernel
Initramfs-less boot, which is a boot optimization, should only be
applied where we know it could work for users and provide an improved
boot boot experience; images with custom kernels are candidates for
that.
2021-02-18 15:40:45 -06:00
David Krauser
6a37833973
Boot with an initramfs by default in cloud images
Generic cloud images with the linux-generic kernel are not able to
boot without an initramfs. Previously, these images attempted to boot
without an initramfs, would fail, and then retry with an initramfs.
This slows the boot and is confusing behavior.
2021-02-18 15:40:42 -06:00
Dimitri John Ledkov
6b32cd5fb1
functions: stop removing systemd-detect-virt unconditionally in undivert_grub
One can call divert_grub; replace_kernel; undivert_grub. And
replace_kernel will call into force_boot_without_initramfs, which
under certain conditions can call divert_grub &
undivert_grub. Resulting in undivert_grub called twice in a row.

When undivert_grub is called twice in a row it wipes
systemd-detect-virt binary from disk, as the rm call is unguarded to
check that there is something to divert if systemd package is
installed. And if the systemd package is not installed, it does not
check that systemd-detect-virt file is in-fact what divert_grub has
created.

Add a guard to check that systemd-detect-virt is the placeholder one,
before removing it.

LP: #1902260
(cherry picked from commit 096a00f40459187719840ccad99e86c7ade2ec12)
2021-02-09 00:51:00 +00:00
Dimitri John Ledkov
e1bea4d00e
Perform fsck on all rootfs.
LP: #1912835
(cherry picked from commit 33b7272a2331279b4c7aa8de73ed8a9069d0bd39)
2021-02-09 00:50:52 +00:00
Dimitri John Ledkov
5c802316f2
esp: perform fsck.
LP: #1912835
(cherry picked from commit 53b28d5f58284657ee8efd08a633d557af1fcd97)
2021-02-09 00:50:46 +00:00
Dimitri John Ledkov
2646b9c459
esp: install grub in ubuntu bootloader id path, instead of removable.
Do not use removable uefi bootloader path in the cloud-images by
default, as that prevents upgrades of the bootloader.

LP: #1912830
(cherry picked from commit 7c760864fdcb278ca37396f06f5e3f297428d63d)
2021-02-09 00:50:38 +00:00
Dimitri John Ledkov
cc13644b6a
Merge branch 'dk/focal-buildd-unpack-kernel-initrd' of git+ssh://git.launchpad.net/~davidkrauser/livecd-rootfs/+git/livecd-rootfs into ubuntu/focal
(Cherry-pick commit 065c82314464fa78337d5122e1d4826a7d6edbb0)
2021-02-09 00:50:00 +00:00
Cody Shepherd
ff91fd7da4
Omit file type exensions in manifest names 2021-02-03 07:27:40 -08:00
Cody Shepherd
7af37be61a
Create manifests for buildd tarballs 2021-02-03 07:27:30 -08:00
Łukasz 'sil2100' Zemczak
befad641dc Support the lowlatency-hwe-* when handling kernel flavours. 2021-02-02 11:51:21 +01:00
Łukasz 'sil2100' Zemczak
e22a16b068 Enable the HWE kernel for all flavours. 2021-02-01 22:25:00 +01:00
Łukasz 'sil2100' Zemczak
e88f07a6e8 enable hwe variant 2021-01-26 15:46:11 +01:00
Dimitri John Ledkov
4be305fedc
chroot: disable amd64 codepath on riscv64 2021-01-15 17:22:01 +00:00
Dimitri John Ledkov
7680ece7b0
riscv64: backport HiFive unleashed & cloud-image building support
All commits are cherrypicks from hirsute, and includes:

make-lxd-metadata: add riscv64 lxd architecture tag
control: install qemu-utils & snapd on riscv64.
disk-image.binary: actually skip building MBR image on EFI platforms.
disk-image.binary: skip building MBR image on riscv64.
disk-image.binary: however still build MBR image on amd64.
disk-image-uefi.binary: build riscv64 image without a bootloader.
disk-image-uefi: riscv64 add u-boot spl
disk-image-uefi: riscv64 add ubuntu:ubuntu login, without expiry.
riscv64: build preinstalled riscv64 image with uboot SPL and CIDATA.
riscv64: fixup subarch build, unbound variable
qcow2-image: unbreak builds without subarch.
disk-image-uefi: fix riscv64 subarch user-data.

LP: #1903034
2021-01-15 17:06:44 +00:00
David Krauser
689631931e Produce buildd kernel and initrd as separate artifacts
Multipass on Mac OS X requires standalone kernel and initrd artifacts
to boot.

Also call update-initramfs on all installed kernels. We only have one
kernel installed, so we don't need to specify an explicit version.
2021-01-08 14:51:18 -05:00
Łukasz 'sil2100' Zemczak
4e8e1fed07 Ok, last commit didn't remove enough lines, sorry for that. 2020-12-03 18:21:57 +01:00
Łukasz 'sil2100' Zemczak
2029f49fe6 Still hardcode UC20 amd64 image size, but to the same value as for UC16 and UC18. 2020-12-03 12:22:31 +01:00
Łukasz 'sil2100' Zemczak
a4838e3245 Merge branch 'uc20-no-fixed-size' of git+ssh://git.launchpad.net/livecd-rootfs into ubuntu/focal 2020-11-27 17:59:08 +01:00
Robert C Jennings
172b217128
Merge focal-open-vm-tools-update into ubuntu/focal [a=jchittum] [r=rcj]
Backport vmtools version in vmdk (LP: #1893898)

Backport
LP: #1893898 describes missing vmtools version from the vmdk headers.
The version should be added as ddb.toolsVersion = "2147483647" however
the sed was no longer replacing a ddb.comment field with the tools
version. Rather than subbing ddb.comment with toolsVersion, this commit
deletes ddb.comment (which the comment mentions could cause errors),
and adds the correct value. There was no visibility into the descriptor
during hook creation, so debug statements were added. This allows us to
quickly verify in the logs that bad statements are removed (the possibly
offending comments), as well as ensuring that the toolsVersion is added

MP: https://code.launchpad.net/~jchittum/livecd-rootfs/+git/livecd-rootfs/+merge/394142
2020-11-20 14:35:25 -06:00
John Chittum
c5cea219f4
re-add sed command
Older version of vmdk-stream-converter has an incorrect header. The
original sed command replaced the incorrect "Description File" comment
with the correct "Disk DescriptorFile".
2020-11-17 15:40:45 -06:00
Joshua Powers
ef950f5214
amd64: always install grub-pc with shim-signed
shim-signed depends on grub-efi-amd64-signed, which in turn has
alternative depends on either `grub-efi-amd64 | grub-pc`. However to
support booting with either via shim&signed-grub and BIOS, the choice
must be made to install grub-pc, not grub-efi-amd64.

This makes images consistent with Ubuntu Deskop, Live Server, buildd
bootable images; all of which already do install grub-pc and
shim-signed.

Additionally, this will ensure that autoremove is run after installing
anything in the CPC build hooks. This is done to avoid shipping images
that include packages that are autoremovable. This will clean-up as
packages are installed and detect any breakage at build time.

LP: #1901906
2020-11-13 09:07:12 -08:00
John Chittum
56862cd9b8
Backport vmtools version in vmdk (LP: #1893898)
Backport
LP: #1893898 describes missing vmtools version from the vmdk headers.
The version should be added as ddb.toolsVersion = "2147483647" however
the sed was no longer replacing a ddb.comment field with the tools
version. Rather than subbing ddb.comment with toolsVersion, this commit
deletes ddb.comment (which the comment mentions could cause errors),
and adds the correct value. There was no visibility into the descriptor
during hook creation, so debug statements were added. This allows us to
quickly verify in the logs that bad statements are removed (the possibly
offending comments), as well as ensuring that the toolsVersion is added
2020-11-10 12:50:32 -06:00
Łukasz 'sil2100' Zemczak
433c2363d8 Do not hard-code the UC20 amd64 image size anymore 2020-11-03 11:30:23 +01:00
Dimitri John Ledkov
558bcbc47e
functions: provide nss_systemd-less nsswitch.conf in chroots.
(cherry picked from commit 4d4f113f42d6c3a58a484582af4d2c02f96a42bf)
2020-10-05 10:32:16 +01:00
Dimitri John Ledkov
2be2852ee0
auto/build: use setup|teardown_mountpoint to reduce duplication
(cherry picked from commit 109e6c6613aae4cbd4e8793709ab52c3cbce214c)
2020-10-05 10:32:15 +01:00
Robert C Jennings
e2ae9c245d
Avoid rbind /sys for chroot snap pre-seeding (cgroups fail to unmount)
Builds in LP with the Xenial kernel were happy with the recursive mount of
/sys inside the chroot while performing snap-preseeding but autopkgtests
with the groovy kernel failed.  With the groovy kernel the build was
unable to unmount sys/kernel/slab/*/cgroup/* (Operation not permitted).

This patch mounts /sys and /sys/kernel/security in the chroot in the
same way we've added for binary hooks.  This provides the paths under
/sys needed for snap-preseed while avoiding issues unmounting other
paths.

(cherry picked from commit 84397b50989670c2cfff01de23a5a73e67cd4088)
2020-10-05 10:32:14 +01:00
Dimitri John Ledkov
260c051032
apparmor: compile all profiles
(cherry picked from commit b14f79ce2e9a18b5832c5488146dbdd7edcd65dd)
2020-10-05 10:32:13 +01:00
Dimitri John Ledkov
ce5a138c79
seccomp: mount more up-to-date seccomp features
(cherry picked from commit 31861fd40dabd62e789aeb6d9e64b1ada7b908d8)
2020-10-05 10:32:12 +01:00
Dimitri John Ledkov
c95652e47d
seccomp: add more up-to-date seccomp actions
(cherry picked from commit bc4d32a422c4558656576cb0d3a1e4f3d0c42f76)
2020-10-05 10:32:11 +01:00
Dimitri John Ledkov
acc7e97f38
apparmor: mount more up-to-date apparmor features in the chroot.
(cherry picked from commit a14a31b7514e3f602f29f9af61e6b7bc97662dc2)
2020-10-05 10:32:10 +01:00
Dimitri John Ledkov
d724069fab
apparmor: Add generic v5.4 kernel apparmor features
(cherry picked from commit 37be000f39a1713c095d6758b41d9dc087079ddb)
2020-10-05 10:32:09 +01:00
Dimitri John Ledkov
56a7169ebe
live-server: remove duplicate snaps, due to overlayfs vs snap-preseed.
(cherry picked from commit 6e6ab16bf268c038392e9f4aa7b8398a53af65d5)
2020-10-05 10:32:08 +01:00
Robert C Jennings
39ebdf6902
Apply snap-preseed optimizations after seeding snaps
The snap-preseed command can do a number of things during the build
that are currently performed at first boot (apparmor profiles, systemd
unit generation, etc).  This patch adds a call to reset the seeding and
apply these optimizations when adding a seeded snap.  As a prerequisite
to calling snap-preseed we need to make /dev/mem available as well as
mounts from the host to perform this work, so those are also added here.

(cherry picked from commit 1ca11c979505ae1b8c4621f034d28070a2715293)
2020-10-05 10:32:07 +01:00
John Chittum
05bba4cbbd
ubuntu-cpc:Vagrant Serial to Null (LP: #1874453)
Original fix proposed by Stanislav German-Evtushenko (giner)

CPC Ubuntu cloud images default to enabling a serial console connection
via the kernel commandline option `console=ttyS0`. Many clouds support
the serial connection, and utilize it for debugging purposes. Virtualbox
supports the serial connection as well. In Bionic and earlier images,
Vagrant boxes created a serial log file in the directory of the
Vagrantfile by default. However this is not standard behaviour for
Vagrant images, and so it was removed in Eoan onwards.

Starting in Eoan, there were reports of image booting slowdown (1874453
is a single example). After testing, it was determined that the serial
connection starting, without a device attached, was the cause of the
slow down. However, we did not want to revert to the old functionality
of creating a file. Much thanks to <giner> for providing the Ruby syntax
for sending to File::NULL.

This option will not create a local file, however, the default
Vagrantfile configuration is overwritable via a users Vagrantfile. The
original syntax for creating a file local to the users Vagrantfile has
been included as an example.
2020-09-22 15:57:52 -05:00
Jinming Wu, Patrick
a58b91da5f
Revert azure kernel change 2020-09-02 05:48:42 +08:00
Jinming Wu, Patrick
419a21205c Fix a mistake on the location of policy file 2020-08-26 14:06:01 -07:00
Jinming Wu, Patrick
5a0e23fefe Update linux-tools/linux-cloud-tools to use Azure 2020-08-26 14:06:01 -07:00
Jinming Wu, Patrick
92dd127d83 xRDP fixes for Hyper-V build
- use of linux-azure, which is the optimized kernel for Hyper-V by
Microsoft
- xRDP configuration changes due to the config changes in this version
compared to 18.04.
- 46-allow-update-repo.pkla inclusion to aviod "Authentication required
to refresh system repositories" bug in xRDP
2020-08-26 14:06:01 -07:00
Steve Langasek
2404d27f5b Merge remote-tracking branch 'codyshepherd/bootable-buildd/dist-upgrade/focal' into ubuntu/focal 2020-08-04 12:40:29 -07:00
Robert C Jennings
136562b837
Handle seeded lxd snap with channel name for ubuntu-cpc:minimized (LP: #1889470)
The seed now specifies the lxd snap in focal as
'lxd=4.0/stable/ubuntu-20.04' which doesn't match the expectations of
the code with looks for lxd as the only snap in the seed for minimized
images.  This patch updates the pattern to accept 'lxd' or 'lxd=*'.
2020-07-29 14:55:19 -05:00
Dimitri John Ledkov
896b5962db
snap_preseed: support channel specification with snap name
snap_name[/classic]=track/risk/branch is now the supported snap name
specification, which allows to specify the full default track and
optional classic confinemnt.

Supporting such specification in the seedtext allows one to specify a
better default channel. For example, this will allow lxd to switch
from latest/stable/ubuntu-20.04 to 4.0/stable/ubuntu-20.04 as 4.0 is
the LTS track matching 20.04 support timeframe.

LP: #1882374

(cherry picked from commit 7bae9201d20822d6875bcf5949e1fff839b8774c)
(cherry picked from commit 2976a99f292c500f39aace25ad08de21b37d7b31)
(cherry picked from commit d542e8e4a08467ef9b6237b9fcbd9166c8c99e8b)
2020-07-23 19:06:57 +01:00
Iain Lane
54508e6583
Hack seeding of linux kernel in ubuntustudio/focal
ubuntustudio-default-settings in focal release has a Recommends to this
kernel, which makes it impossible to update the kernel later on, since
we would install the -updates and release kernel, which isn't allowed
and causes FTBFS. Hack out the focal-release kernel and let the rest of
the build process pull in the right one.

LP: #1884915
2020-07-21 16:23:39 +01:00
Cody Shepherd
690522e89b
Remove explicit install of grub-efi-* package as it is not necessary,
and potentially overexplicit
2020-07-13 09:10:05 -07:00
Cody Shepherd
315a453ba6
Perform a dist-upgrade prior to installing packages for bootable-buildd
image in order to pull in package updates
2020-07-08 14:03:56 -07:00
Łukasz 'sil2100' Zemczak
e611dfc1c4 Enable overrides of UC20 grade dangerous channels 2020-05-25 18:44:08 +02:00
Philip Roche
cd098e7c41 Revert of initramfs package removal in KVM image (LP: #1880170)
It was reported and confirmed in LP bug #1875400
(https://bugs.launchpad.net/cloud-images/+bug/1875400) that on the public
KVM cloud image there exists a large list of packages marked for auto-removal.

This should never be the case on a released cloud image.

These packages are marked for auto-removal because in the KVM image binary hook
we removed both initramfs-tools and busybox-initramfs packages. Due to package
dependencies this also removed:

busybox-initramfs* cloud-initramfs-copymods* cloud-initramfs-dyn-netconf*
cryptsetup-initramfs* initramfs-tools* initramfs-tools-core* multipath-tools*
overlayroot* sg3-utils-udev* ubuntu-server*

But it did not remove all the packages that the above list depended on.
This resulted in all those packages being marked for auto-removal because they
were not manually installed nor did they have any manually installed packages
that depended on them.

The removal of initramfs-tools and busybox-initramfs was to avoid the
generation of initramfs in images that should boot initramfsless.

This requirement is obsolete now because the initramfsless boot handling
is now handled via setting GRUB_FORCE_PARTUUID in /etc/default/grub.d/40-force-partuuid.cfg.

In test images I have verified that GRUB_FORCE_PARTUUID is set and that
boot speeds have not regressed.

LP: #1880170
2020-05-22 13:38:22 +01:00
Łukasz 'sil2100' Zemczak
225f2fe504 Fix indentation. 2020-05-07 10:48:51 +02:00