160 Commits

Author SHA1 Message Date
Dimitri John Ledkov
1979e61c36 Merge branch 'kpartx-fun' of git+ssh://git.launchpad.net/~mwhudson/livecd-rootfs/+git/livecd-rootfs into ubuntu/master 2020-05-12 12:19:32 +01:00
Dimitri John Ledkov
ad64e38c48 Run snap info on the downloaded snap, rather than against the store. First of all snap info doesn't have --channel argument, thus queries the wrong channel, and depening on the cohort, a different snap might be visible too. Thus seed the base of the snap revision we dowanloaded, rather than some random one from the store. 2020-04-17 00:58:32 +01:00
Robert C Jennings
66041e9d8c
Do not unconditionally install the core snap
Seeing any snap via snap_preseed will evaluate the base for each snap
and seed the appropriate base.  There should be no reason to explicitly
seed the 'core' snap and with snaps moving to 'core18' this will add
'core' without need.
2020-04-09 14:38:45 -05:00
Robert C Jennings
14066ce389
Fix logic to ensure snapd is seeded in core18-only images
The _snap_post_process function is meant to install snapd if core18 is the
only core snap installed or removed snapd if core is installed and snapd
was not explicitly installed.  But the current logic in _snap_preseed
will never call _snap_post_process.  $core_name will never be empty
with the existing logic, but even if it were that would only be for the
'core' snap and we'd miss using the 'core18' logic that pulls in snapd.
Given the case statement in _snap_post_process can handle doing the
right thing given any snap we can just call it unconditionally.
2020-04-09 14:36:35 -05:00
Michael Hudson-Doyle
2498aadebb Call udevadm settle before kpartx -d
Back in 2017 some code was added to ignore failures tearing down loop
devices. But debugging that growpart race on cloud images made me (very)
aware of a potential cause of the race: doing something like zerofree on
a device will cause udev scripts to run, and if they are still running
by the time kpartx is called, you would expect the kpartx -d to fail. So
lets see if a udevadm settle helps, and get rid of one of the "sometimes
this fails but we don't know why" comments...
2020-03-21 00:08:07 +13:00
Robert C Jennings
d214127b9f
Address snap base regression after snap-tool removal
With the removal of snap-tool failures are seen in image builds that do
not have the 'core' snap included by the seed.  This is the case for the
minimized subproject of the ubuntu-cpc project where lxd/core is removed.
In that subproject, any binary hook which adds a snap that is based
on 'core' will not add 'core' and fail 'snap debug validate-seed'.
snap-tool included the following logic in the 'snap-tool info' when
determining snap bases:

    # Have "base" initialized to something meaningful.
    if self.is_core_snap():
        snap_data["snap"]["base"] = ""
    elif snap_data["snap"].get("base") is None:
        snap_data["snap"]["base"] = "core"

The snap store does not return a base if the base is core which makes
this necessary.  This patch looks for the base in 'snap info' output
and if none is found (and the snap is not snapd or core) it assumes the
base is 'core' and installs it.  This restores the behavior lost in the
migration from snap-tool to snap cli.
2020-02-25 16:16:26 -06:00
Iain Lane
ede0be897b
Pass --verbose to snap info so that it includes the base. 2020-02-24 09:56:09 +00:00
Robert C Jennings
489f009e49
Use snap cli rather than custom snap-tool
snap-tool was added to support a deprecate cohort-key feature of the snap store.
Recent changes in snap assertions have added additional fields which snap-tool
is not retrieving.  This resulted in snap install failures on first boot.

This patch removes snap-tool and returns to using the snap cli.  This ensures
snap downloads will function without odd incompatibilities.
2020-02-21 14:56:25 -06:00
Michael Hudson-Doyle
21c57e2764 pass -xdev to find when making filelists 2019-11-27 21:11:04 +13:00
Michael Hudson-Doyle
51b59ed960 fix bashism 2019-11-25 11:51:51 +13:00
Michael Hudson-Doyle
16881594e0 Create a filelist whenever creating a manifest for an ubuntu-cpc project. 2019-11-25 11:51:51 +13:00
Iain Lane
2d19a9446e
snap_preseed: Handle SNAP_NO_VALIDATE_SEED being unset
Some builds run with `set -u` and were broken due to this.
2019-09-03 14:52:30 +01:00
Iain Lane
b68a5abf65
snap seeding: Defer validation for regular image builds
When getting the list of snaps to include on an image via germinate, we
process the snaps in alphabetical order. Currently we seed several
packages `gnome-foo` and also `gtk-common-themes`, the default provider
of `gtk-3-themes`. Since `gtk-common-themes` is alphabetically after
`gnome-foo`, the `seed.yaml` we generate is invalid when we are part way
through generating.

What we really care about, though, is not that the `seed.yaml` is always
valid at every step, but it is that it is valid at the *end* of seeding.
So for the germinate case, let's defer validation to happen once at the
end. Other callsites of `snap_preseed`, where callers are careful to
seed snaps in the right order, are unaffected by this.
2019-09-02 12:56:00 +01:00
Colin Watson
9a65a4013d Undivert update-initramfs more carefully
Previously the wrapper script and diversion were left in place on images
such as buildd images that don't have initramfs-tools installed.

LP: #1841573
2019-08-27 12:45:57 +01:00
Iain Lane
979dbde6a2
Fix slight whitespace error 2019-07-16 10:27:47 +01:00
Iain Lane
b208ded59e
Merge branch 'snap-validate-seed' of git+ssh://git.launchpad.net/~mvo/livecd-rootfs into ubuntu/master 2019-07-16 10:27:27 +01:00
Michael Vogt
4fb73c2b19 functions: use CHROOT_ROOT in snap_preseed 2019-07-16 08:29:09 +02:00
Michael Vogt
248efab2fd live-build: move snap seed validation into snap_preseed 2019-07-15 20:12:33 +02:00
Iain Lane
7f07cc8991
live-build/functions: Seed core again on non-minimized builds
This is apparently still required; without it snapd gives an error
message like:

  stateengine.go:102: state ensure error: devicemgr: cannot proceed without seeding "core"
2019-07-15 16:15:31 +01:00
Tobias Koch
18468c4218 Check exit status of snap-tool info call while determining base snap 2019-07-15 07:49:59 +02:00
David Krauser
0e3b1e206b
Add support for HyperV Gallery images 2019-06-11 23:26:07 -04:00
Pat Viafore
9bf4c7cb52
Adding apt-get autoremove and setting IMAGE_STR 2019-06-06 08:21:22 -05:00
Pat Viafore
afbda566eb
Adding hooks and making replace_kernel function 2019-06-06 08:20:45 -05:00
Michael Hudson-Doyle
42992467a1 Remove device nodes later for ubuntu-base:minimized (i.e. docker) builds. (LP: #1828118) 2019-05-08 10:04:23 +12:00
Steve Langasek
39f2558b96 Fix the sed script that Tobias had right in the first place and I mangled in the previous upload. 2019-04-13 02:13:17 -07:00
Steve Langasek
f4fa240ed7 Adjust sed command for clarity. 2019-04-12 13:37:02 -07:00
Tobias Koch
79e3123053 Make snapd-explicit-install-stamp a part of the image 2019-04-12 13:37:02 -07:00
Tobias Koch
796211dde7 If image has core18 snaps only, automatically preseed snapd 2019-04-12 13:37:02 -07:00
Tobias Koch
05e71b3840 Do not include any snaps in ubuntu-cpc:minimized builds 2019-04-12 13:37:02 -07:00
Steve Langasek
7e4a2627ed Use python3 vmdkstream exclusively; we should not fall back to python2. 2019-02-18 18:06:01 +01:00
Dimitri John Ledkov
a77ec4a9df
Add python3 vmdkstream support 2019-02-18 12:01:25 +01:00
Balint Reczey
8a78ab4021 Merge make-rprivate-before-umount 2019-02-05 17:10:49 +07:00
Balint Reczey
96cc185813 Merge feature/parallelization-snap-version-fixing 2019-02-05 17:06:24 +07:00
Didier Roche
1c435c03d2 Fix customized images with multiple brand/models
Some customized images are built from the same chroot, but need to
override brands and models.
2019-02-05 10:13:37 +01:00
Tobias Koch
654fcae467 Replace "snap download" with tool that uses snap store's coherence feature
This is important for parallel image builds to ensure all pre-seeded snaps
have the same versions across image variants.
2019-02-05 10:04:40 +01:00
Balint Reczey
33c5ad0b19 live-build/functions: Always use mount --make-private before umount
Util-linux 2.33 fixed mount --rbind --make-rslave which did not pass MS_REC
with MS_BIND and livecd-rootfs did only --bind --make-rslave effectively with
prior mount versions.
While mount --rbind --rslave are properly passed the flags to mount()
unmounting did not work cleanly with --make-rslave.

To clearly stop propagation of umount, --make-private is used instead of
--make-rslave and it is always set before umounts. Umount -R is replaced
with a simple umount since submounts are tore down in teardown_mountpoint()
earlier.

LP: #1813730
2019-02-05 07:54:37 +07:00
Jean-Baptiste Lallement
3dce125d72 Remove inidrd and vmlinuz from live layers after they've been moved to casper 2019-01-31 12:16:07 +01:00
Jean-Baptiste Lallement
f84d92d76f Calculate total size of the image + typos 2019-01-30 12:29:57 +01:00
Jean-Baptiste Lallement
402cdd15be Adds is_root_layer
Factored the code to detect if a layer is a root layer in function
is_root_layer and execute lb_chroot_archives only on root layers.
2019-01-30 12:29:56 +01:00
Jean-Baptiste Lallement
283871573d Changed the naming scheme for multi layer images to dot format 2019-01-30 12:29:56 +01:00
Jean-Baptiste Lallement
e0d30dd2d3 Fixed substract -> subtract 2019-01-30 12:29:56 +01:00
Jean-Baptiste Lallement
43ec452fa0 Moved reusable functions to functions
Moved functions to reuse in lb_binary and lb_chroot to functions
2019-01-30 12:29:56 +01:00
Jean-Baptiste Lallement
3b21bd9a2e Moved back config helper functions to config
Moved back config specific functions from functions to config
2019-01-30 12:29:56 +01:00
Jean-Baptiste Lallement
f3dadf1091 Support for positive and negative sublayers
Calculate positive and negative package lists for sublayers
2019-01-30 12:29:56 +01:00
Jean-Baptiste Lallement
1ab78e783b Generate snap list from task 2019-01-30 12:29:56 +01:00
Jean-Baptiste Lallement
00e474e2ff Make snap functions idempotent
_snap_preseed and snap_prepare_assertions can be called several times
with the same snap and will only provision it once.
2019-01-30 12:29:56 +01:00
Jean-Baptiste Lallement
ef72cf5fe8 Code refactoring:
* Moved *inheritance functions from config to functions
 * Moved code to extract snap from seed to snap_from_seed function
2019-01-30 12:29:56 +01:00
Jean-Baptiste Lallement
3e34faaa70 Moved add_task and add_package to functions in order to be available in hooks 2019-01-30 12:29:56 +01:00
Steve Langasek
77c44167df Delete no longer accurate comments 2018-11-13 11:21:19 -08:00
Cody Shepherd
c7e0c27607 [ Cody Shepherd ]
Fix snap-seed-parse to take filename argument instead of printing to
stdout
2018-11-08 15:10:09 -08:00