Changes:
- ensure that kernel and initrd are relative links
- add 'active_snap' variable to grub (managed by snapshotter)
- add 'root_subpath' variable to grub
- snapper can now be used on orange flavor (see notes)
Notes:
- 'active_snap' and 'root_subpath' allows grub to build a relative path to the kernel and initrd when btrfs_relative_path is not available.
- Snapper works on orange flavor, however it can take several minutes before the daemon initialize in active or passive mode. If elemental upgrade is invoked during this time it will fail.
The default behavior has been to hide any errors and only log warnings.
Using the --strict flag will ensure any yip errors are actually
reported.
Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>
* Add cloud-init paths of the new root in 'after-*' hooks
This commit enables to run the non chrooted 'after-*' hooks
included in the newly deployed image root. This specially applies to the
install, reset, upgrade and build-disk commands.
Moreover, 'after-disk' command now includes static reference paths to
the new root and working directory, so that those can be used within
the hooks regardless of the choosen output directory.
* Include arm-firwmare feature
This commit introduces an arm-firmware feature adding
the required after-* hooks to ensure the RPi firmware is
copied to the EFI partition.
It could be, eventually, extended to support other boards
and it does not harm systems which are not including RPi
firmware.
* Allow features to be passed as arguments
Signed-off-by: David Cassany <dcassany@suse.com>
In this commit we add selinux support to the mount command.
During mount we put a list of persistent+ephemeral directories in
/run/systemd/extra-relabel.d/elemental.layout in order to make systemd
relabel the directories before loading the policy.
We also try to chroot into the new sysroot and run setfiles using a find
wrapper to set on deepest files first.
Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>
The other modes are covered in 03_branding.yaml, but not the live_mode.
This commit adds a short motd and hostname when booting from live CD.
Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>
* Enable SELinux for tumbleweed and rename it to green
Signed-off-by: David Cassany <dcassany@suse.com>
* Disable SELinux on recovery and refine relabelling
Signed-off-by: David Cassany <dcassany@suse.com>
* Remove k3s-selinux, not needed for examples
Signed-off-by: David Cassany <dcassany@suse.com>
* Improve SELinux labelling
Signed-off-by: David Cassany <dcassany@suse.com>
* Fix unit tests
Signed-off-by: David Cassany <dcassany@suse.com>
---------
Signed-off-by: David Cassany <dcassany@suse.com>
* Snapshottable recovery system
Deploy the entire recovery system to the same folder (kernel, initrd and
rootfs).
During upgrade deploy to a transitional folder and then switch it with
the current recovery system and then delete the old one.
This makes sure we clean up old recovery systems and don't risk mixing
systems during upgrade.
Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>
This commit ensures the boot assessment checkers wait for
the network and boot stages of yip. This makes sure
the checkers are executed once cloud-init based config
files are processed.
Signed-off-by: David Cassany <dcassany@suse.com>
The recovery system has been changed to extract the kernel/initrd and
bootargs.cfg in order to not rely on loopback devices.
This commit adds backwards compatibility to the grub configuration in
case we have upgraded the bootloader but not the recovery system on a
host.
Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>
This commit prevents falling back to recovery system during the boot
assessment process.
In addition it also sets the boot_assessment to be executed on install
and reset reboots.
Signed-off-by: David Cassany <dcassany@suse.com>
* make configurable boot-assessment checks
Signed-off-by: David Cassany <dcassany@suse.com>
* Improve EventuallyConnects in tests
Signed-off-by: David Cassany <dcassany@suse.com>
* Fix fallback test
Signed-off-by: David Cassany <dcassany@suse.com>
* Store boot assessment variables in grubenv
This commit refactors the boot-assessment logic to run checks
with a customizable service and to store grub variables in
already existing files in EFI partition and OEM.
Also the EFI partition is made accessible in after-*-chroot
hooks. This makes easier to write and manage files in EFI
partition if needed (e.g. grub_oem_env variable file), without
having to relay on mounts or remounts.
Signed-off-by: David Cassany <dcassany@suse.com>
---------
Signed-off-by: David Cassany <dcassany@suse.com>
* Default recovery system to squashfs
Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>
* Refactor build-iso
Refactors build-iso command to use the new DeployRecoverySystem method.
Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>
* Refactor install command
Use DeployRecoverySystem to deploy the recovery system.
Needs some changes to grub.cfg to be fully compatible and also extracts
the bootargs.cfg file into the recovery partition.
Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>
* Refactor build-disk command
Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>
* Refactor upgrade-recovery command
This commit changes the DeployRecoverySystem method to remove any
conflicting boot artifacts before copying the new files.
Also adds power and squashfs compression flags to the command.
Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>
---------
Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>
Use the same location as grub.conf, /etc/elemental.
The grub config is backwards compatible and tries to source from
/etc/cos/bootargs.conf as well.
Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>
* Remove deprecated feature immutable-rootfs
Immutable-rootfs is deprecated in favor of elemental-rootfs feature.
Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>
* Fix flaky downgrade test
Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>
---------
Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>
* bump elemental-toolkit to v2
Signed-off-by: David Cassany <dcassany@suse.com>
* Move pkg/types/v2 to simply pkg/types
This commit leaves the code with a single set of types
and in refers to it as the types packge instead of
v1 or v2.
For the time being we do not foresee managing more
than one single major version of type within the
same code.
Signed-off-by: David Cassany <dcassany@suse.com>
* Stop referring to mocks package as v2mock in favor of simply 'mocks'
Signed-off-by: David Cassany <dcassany@suse.com>
* Fix leftovers after rebase
Signed-off-by: David Cassany <dcassany@suse.com>
---------
Signed-off-by: David Cassany <dcassany@suse.com>
* Do not migrate legacy images if snapshots are already present
This commit prevents executing the legacy images migration logic
if snapshotter already finds available snapshots. This mostly
means the migration was already executed and legacy images
had already a chance to be converted into snapshots.
* Fix btrfs snapshotter image variable
Signed-off-by: David Cassany <dcassany@suse.com>
* Make snapshotter root dynamic based on the reported mountpoint
* Add state partition as a InitSnapshotter parameter
* Fix build-disk command and unit tests
Signed-off-by: David Cassany <dcassany@suse.com>
* Implementation of Btrfs snapshotter
* Btrfs based examples
* Refined and adapt features
* Update build-disk to new snapshotter and prevent including State partition on expandable images
* Remove /oem bind mount in initramfs, already mounted by mount command
* Adapt unit tests
* Add mount command unit tests
* Make grubfallback test more generic
* Adding btrfs snapshotter unit tests and fixing default snapshotter config constructor
* Add utils test
* Fix upgrade ENV variables mapping
* Include transactional-update package in example
* Fix persistent bind mounts
* Make sure state is RW mounted upgrading from legacy
* Remove unused passive symlinks for loopdevice
* Fix upgrade from older version
Signed-off-by: David Cassany <dcassany@suse.com>
Move elemental services to /etc
Move elemental-setup-* and elemental-rootfs services from /usr/lib/systemd/system to /etc/systemd/system.
Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>
* Generate tarballs
This commit generates tarballs for each feature and embeds that in the
elemental binary.
The tarballs are generated before build using 'go generate ./...' and
are not checked in to source control.
When a feature is installed using elemental init the tarball will be extracted
to the filesystem.
Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>
* Refactor to switch to snapshotter interface
This commit adopts snapshotter interface in install,
reset and upgrade commands. The change implies changes
to the respective specs, grub configuration and dracut
modules.
This commit also changes the behavior of recovery system
upgrades. Now recovery upgrades are an optional step
of a system upgrade. Recovery image can't be upgraded
without upgrading the active system.
Finally build-disk command is also changed to be better
aligned with upgrade and install procedures. Expandable
disks are an unprivileged build and non expandable ones
require privileges as they relay on snapshotter.
* Attempting to fix integration tests
* Adding a migration path from legacy deployments
* Omit /etc/resolv.conf for dir:// paths
* Adaptations after rebase
* Make sure we also mount EFI in upgrades if it was not already mounted
* Default maximum number of snapshots is 2
* Upgrade grub to EFI partition
* Improve recovery management
* Recovery back to ext2 by default
* Adapt upgrade after rebase
Signed-off-by: David Cassany <dcassany@suse.com>
Bind /oem into /sysroot/oem when running elemental-setup-initramfs to
enable running initramfs stages from config files in oem partition.
Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>
* Install grub.cfg into EFI System Partition
Change the bootloader install logic to install the grub.cfg into the EFI
System Partition (ESP).
This needs some changes to how root is set in the grub.cfg as well as
moving grub_oem_env file to ESP when created in install/reset/upgrade
command.
Install grub-modules to both EFI/BOOT and EFI/ELEMENTAL.
Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>