Commit Graph

82 Commits

Author SHA1 Message Date
Fredrik Lönnegren 1543213755 Permissive mode for green selinux
Set selinux explicitly in permissive mode for green flavor.

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>
2025-08-06 13:53:10 +02:00
Loic Devulder 25d9ae69cc Fix Dockerfile for riscv64
Signed-off-by: Loic Devulder <ldevulder@suse.com>
2024-12-03 12:44:21 +01:00
Rodolphe de Saint Léger 5b2bb7ab14 Add orange btrfs snapshotter support
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.
2024-11-07 19:03:24 +01:00
David Cassany c289f36812 Already fixed upstream
Signed-off-by: David Cassany <dcassany@suse.com>
2024-11-06 15:01:00 +01:00
David Cassany Viladomat ca0ac59258
Btrfs snapshotter without snapper (#2220)
* Isolating btrfs and snapper specific logic

Signed-off-by: David Cassany <dcassany@suse.com>

* Define a backend interface for btrfs snapshotter

This commit adds a backend interface in btrfs snapshotter. The interface
essentially wraps snapper and btrfs utilities.

The idea is make a pure btrfs implementation of the interface and
also a snapper based implementation.

The functions that snapper can't provide are simply managed by the btrfs
implementation.

Signed-off-by: David Cassany <dcassany@suse.com>

* Move snapper configuration to snapper backend

Signed-off-by: David Cassany <dcassany@suse.com>

* Implement btrfs backend

This commit implements the btrfs backend for the btrfs snapshotter
and moves all the logic of specific btrfs client calls there.

The backend interface is also refined for that purpose.

Signed-off-by: David Cassany <dcassany@suse.com>

* Make the btrfs snapshotter backend configurable

Signed-off-by: David Cassany <dcassany@suse.com>

* Add some method comment headers

Signed-off-by: David Cassany <dcassany@suse.com>

* Few small changes to facilitate testing

Signed-off-by: David Cassany <dcassany@suse.com>

* Add btrfs-backend unit tests

Signed-off-by: David Cassany <dcassany@suse.com>

* Add snapper backend unit tests

Signed-off-by: David Cassany <dcassany@suse.com>

* revert back to snapper for green example

Signed-off-by: David Cassany <dcassany@suse.com>

---------

Signed-off-by: David Cassany <dcassany@suse.com>
2024-11-05 13:47:03 +00:00
David Cassany Viladomat 55770a2f9e
A couple of Dockerfile cleanups (#2200)
* Remove already fixed workaround

Signed-off-by: David Cassany <dcassany@suse.com>

* Workaround for boo#1231244

Signed-off-by: David Cassany <dcassany@suse.com>

---------

Signed-off-by: David Cassany <dcassany@suse.com>
2024-10-02 11:54:48 +00:00
Fredrik Lönnegren 95cdcb2252 Add systemd-timesync user
This user is needed for systemd-timesyncd service to start without
errors.

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>
2024-10-02 12:35:58 +02:00
David Cassany 3da515bd63 Disable audit package in example Dockerfile
Signed-off-by: David Cassany <dcassany@suse.com>
2024-10-02 12:35:58 +02:00
Fredrik Lönnegren 84a71b9e21
green: install xterm-resize (#2194)
Useful tool when running the tests in serial mode (ELMNTL_DEBUG=yes).

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>
2024-10-02 11:09:56 +02:00
David Cassany Viladomat 30a64d70be
Add cloud-init paths of the new root in 'after-*' hooks (#2192)
* 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>
2024-09-25 09:47:12 +02:00
Fredrik Lönnegren 14c049c0ee Fix docker build warnings when using buildx
The following warnings are fixed in the example flavors + cli
Dockerfile:

```
- StageNameCasing: Stage name 'TOOLKIT' should be lowercase (line 7)
- StageNameCasing: Stage name 'OS' should be lowercase (line 10)
- InvalidDefaultArgInFrom: Default value for ARG
  ${TOOLKIT_REPO}:${VERSION} results in empty or invalid base image name
  (line 7)
- JSONArgsRecommended: JSON arguments recommended for CMD to prevent
  unintended behavior related to OS signals (line 97)
- FromAsCasing: 'as' and 'FROM' keywords' casing do not match (line 4)
```

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>
2024-09-16 16:02:39 +02:00
David Cassany 8dac61cbc2 Disable SELINUX enforcing mode, permissive is the default
Signed-off-by: David Cassany <dcassany@suse.com>
2024-09-05 13:20:53 +02:00
David Cassany 0b9170de76 Fix smoke test for orange flavor
Signed-off-by: David Cassany <dcassany@suse.com>
2024-06-10 10:22:08 +02:00
David Cassany f427491f00 Update example OSes to more recent versions
Signed-off-by: David Cassany <dcassany@suse.com>
2024-06-10 10:22:08 +02:00
David Cassany fc923f420d Remove default network configuration
Signed-off-by: David Cassany <dcassany@suse.com>
2024-06-07 14:07:33 +02:00
Fredrik Lönnegren e20e382908 Move green-rpi flavor to tumbleweed
Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>
2024-05-27 09:22:27 +02:00
David Cassany Viladomat 4d469e7f3a
Enable SELinux for tumbleweed and green (#2052)
* 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>
2024-04-29 15:20:36 +02:00
David Cassany c6b391a8a3 Move green to tumbleweed
Signed-off-by: David Cassany <dcassany@suse.com>
2024-04-23 09:34:31 +02:00
Marcus Furlong cccd8387d2
add symlink for missing binary on ubuntu 22.04+ (#2048) 2024-04-18 09:20:07 +02:00
Fredrik Lönnegren e7630b0a1f
Remove tumbleweed dracut patches (#1964)
The patches have been merged upstream (openSUSE/dracut).

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>
2024-02-22 13:49:16 +01:00
David Cassany Viladomat 8f802fa84b
Btrfs snapshotter implementation (#1957)
* 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>
2024-02-21 14:04:05 +01:00
Fredrik Lönnegren 4a6cd35dcd Run zypper clean --all in examples
Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>
2024-02-13 13:46:56 +01:00
Fredrik Lönnegren 95290e6fbc Install podman in example Dockerfiles
Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>
2024-02-06 23:01:37 +01:00
David Cassany 5763567398 Fix tumbleweed example
Signed-off-by: David Cassany <dcassany@suse.com>
2023-12-13 11:11:28 +01:00
David Cassany afbe0b4676 Make network configuration part of the example, not defaults
Signed-off-by: David Cassany <dcassany@suse.com>
2023-12-13 11:11:28 +01:00
Fredrik Lönnegren 9676ec906c
Refactor early system mounting (#1866)
* Add mount command

The mount command mounts the system and is meant to run in an initrd to
actually mount the root filesystem and use systemd to switch-root into
it.

It also optionally writes an /etc/fstab file to the newly mounted
system so that systemd will mount the system after switching root.

The command is used in the new dracut module elemental-rootfs, which
will coexist with immutable-rootfs (they are functionally the same)
until immutable-rootfs can be deprecated.

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>

Add tmpfs overlay mount

Mounts a tmpfs to /run/elemental/overlay with size= flag set

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>

Examples use the new elemental-rootfs

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>

Add persistent overlay mounts

Persistent mounts use the /run/elemental/persistent/.state directory to
store upper and work dirs.

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>

Add sentinel files

Write sentinel file (active_mode, passive_mode, recovery_mode) to
/run/cos or /run/elemental based on which kernel cmdline is used
(cos-img/filename or elemental.image)

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>

Read kernel cmdline for mount

This commit adds capabilities to the mount command to read configuration
from the kernel cmdline. The supported parameters are:

* elemental.disable + rd.cos.disable
* elemental.image + cos-img/filename
* elemental.oemlabel + rd.cos.oemlabel

In the new elemental.image parameter we can specify
active|passive|recovery instead of the path to the image.

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>

Enable recovery booting and reset

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>

Load env vars

Currently supported:
* OVERLAY
* RW_PATHS
* PERSISTENT_STATE_PATHS
* PERSISTENT_STATE_BIND

Loaded from files (if they exist):
* /run/elemental/layout.env
* /run/cos/cos-layout.env

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>

Run rootfs stage inside mount command

Since the rootfs stage should be run between mounting the image and
mounting the rest of the system I added a call to RunStage that takes
care of this and then uses godotenv dependency to actually load
/run/elemental/layout.env and /run/cos/cos-layout.env.

This means the old way of generating layout files will still work with
the new mount-command.

The caveat here is that in the current implementation the rootfs stage
will run twice, once from the elemental-setup-rootfs service and once
from this command. I would say the easiest way forward is to remove the
elemental-setup-rootfs when switching to elemental-rootfs as the default
mounting module.

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>

Add persistent bind mounts

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>

Add block overlay

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>

Use registry.opensuse.org for example images

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>

Minor changes to get tests working

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>

Fsck partitions before mounting

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>

Fix for fsck

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>

More mount tests

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>

Comment mount example configuration

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>

Add elemental-setup services to elemental-rootfs

The elemental-setup and rootfs features are heavily dependent on each
other.

This commit copies the elemental-setup feature into elemental-rootfs,
and changes the mount-command to actually start the
elemental-setup-rootfs service during mount to not run the yip rootfs
stage twice.

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>

Fix lint goconst

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>

* Add elemental-sysroot feature

The features elemental-sysroot, elemental-rootfs and elemental-setup are
used for mounting the root filesystem and all overlays.

elemental-sysroot is used for mounting state/recovery partition to
/run/elemental/state, and then mounting the image from the partition
based on kernel parameters.

elemental-setup actually runs the different stages of boot using
elemental run-stage command.

elemental-rootfs runs the 'elemental mount' command to mount tmpfs
overlays, persistent overlays and then writes the /etc/fstab to actually
mount when pivoting to the new root.

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>

* Update sysroot, setup and rootfs dracut modules

This commit goes through the early systemd services run in dracut and
adds Wants,Before,Requires to each step to make them run during the
correct stage of the bootup (man dracut.bootup).

We also change all the /run/cos and /run/initramfs/cos-state to the new
/run/elemental and /run/initramfs/elemental-state directories.

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>

* Test compatibility

Tests still use /run/cos, this commit adds back
/run/cos/active|passive|recovery_mode files

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>

* Update to latest ele-testhelpers

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>

* Forwards compatibility for immutable-rootfs feat

This commit makes the immutable-rootfs module forwards compatible with
the other changes in mount, elemental-sysroot and elemental-setup.

It uses the new elemental.image and elemental.oemlabel cmdline paramters
if found, otherwise falls back to the old parameters and also sets the
/run/elemental/active|passive|recovery_mode files.

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>

* Update init features for green and tumbleweed

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>

* Remove oem mounts from elemental-setup-initramfs

This should fix installer-tests in CI since the /oem might not exist
when booting from ISO.

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>

---------

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>
2023-12-12 13:50:54 +00:00
David Cassany 840c80c79d Add force flag in systemd-firstboot yip's plugin so default files are overwritten if they are already existing
Signed-off-by: David Cassany <dcassany@suse.com>
2023-12-11 16:25:45 +01:00
David Cassany Viladomat 1a1b942acd
Add other example distros (#1868)
Signed-off-by: David Cassany <dcassany@suse.com>
2023-12-11 10:31:56 +01:00
Fredrik Lönnegren d2d2889dac
Add target for rpi disk (#1859)
* Add target for rpi disk

This commit adds a flavor for tumbleweed raspberry pi image that uses a
after-disk hook to copy firmware into the EFI partition.

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>

* Add DOCKER_SOCK Makefile variable

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>

* Rebase rpi example to leap

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>

---------

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>
2023-11-29 13:07:49 +00:00
Loic Devulder 0e4c9fd9cb Add support for RISC-V 64bit architecture
Basic support of riscv64 architecture. Shim is not
supported yet, will be added later.

Signed-off-by: Loic Devulder <ldevulder@suse.com>
2023-11-27 16:10:25 +01:00
Fredrik Lönnegren a95d393010 Set PermitRootLogin in tumbleweed
Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>
2023-09-07 16:00:36 +02:00
Fredrik Lönnegren 17e4895c6a
Add tumbleweed example (#1823)
* Add tumbleweed example

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>

* Add status badges for workflows to README

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>

* Update ele-testhelpers to latest commit

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>

---------

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>
2023-09-06 13:46:06 +02:00
Fredrik Lönnegren 229438f87a
Update green to use leap 15.5 (#1821) 2023-09-05 16:08:10 +02:00
Fredrik Lönnegren 2360815df8
More documentation work (#1819)
* More documentation work

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>

* Improve multi-arch handling

GRUB_ARCH can be calculated in runtime, this makes toolkit Dockerfile
and green-example Dockerfile able to be built with buildx
--platform=linux/amd64,linux/arm64 flag at the same time.

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>

---------

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>
2023-08-31 14:36:37 +00:00
David Cassany 5ea572d3e7 Remove duplicated line
Signed-off-by: David Cassany <dcassany@suse.com>
2023-07-04 09:23:29 +02:00
Fredrik Lönnegren 64b8d0a148
Add init command (#1767) 2023-06-16 17:33:55 +02:00
Fredrik Lönnegren f6dc1ebef7
Add aarch64 workflow (#1779)
* Add arm64 workflow

This commit adds arm64 to the build-matrix for PRs and checks if the PR
is labeled with arm64 before running.

ARM64 tests are run on self-hosted runners while x86_64 tests are still
run on github macos-latest runners.

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>
2023-06-16 15:45:27 +02:00
Fredrik Lönnegren 5f4381a0e3
Update documentation (#1778)
* Update documentation

Remove old usages of luet/luet-makeiso and channel.

Goes through the Examples and updates the usage to reflect the latest
changes of the toolkit.

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>

* Changes to golangci-config

Disable all linters by default and add back the current default ones.

This is done in order to prevent new default linters in the
golangci-lint to take effect without noticing.

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>

* Also push elemental-cli on release to ghcr.io

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>

---------

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>
2023-06-02 14:40:49 +02:00
Fredrik Lönnegren 1262bcd099 Move elemental-cli into elemental-toolkit module
Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>
2023-05-16 09:43:57 +02:00
Fredrik Lönnegren 8db48e6b6f Try to fix tests
Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>
2023-05-11 15:31:28 +02:00
Fredrik Lönnegren 9a671a7aea Improve multi-arch support
Changes to makefile and packer setup to make it easier to build arm64
and multi-platform images.

Should be able to run `make ARCH=arm64 build-example-iso packer` etc and just work.

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>
2023-05-11 15:31:28 +02:00
David Cassany 8af7304137 explicitly install dracut wrapper
Signed-off-by: David Cassany <dcassany@suse.com>
2023-05-11 15:31:28 +02:00
David Cassany 5d643a0168 Include elemental-cli in toolkit and build it based on commit or tag
Signed-off-by: David Cassany <dcassany@suse.com>
2023-05-11 15:31:28 +02:00
David Cassany c272f599b9 Moving to a pure qemu approach for testing, no vagrant, no libvirt
Signed-off-by: David Cassany <dcassany@suse.com>
2023-05-11 15:31:28 +02:00
David Cassany 723bd937f2 Add test execution to Makefile
Signed-off-by: David Cassany <dcassany@suse.com>
2023-05-11 15:31:28 +02:00
David Cassany d3fc67fc52 Added make packer
Signed-off-by: David Cassany <dcassany@suse.com>
2023-05-11 15:31:28 +02:00
David Cassany 091d1b1a58 Add ISO build and remove unused examples
Signed-off-by: David Cassany <dcassany@suse.com>
2023-05-11 15:31:28 +02:00
David Cassany 58d63f0e8e Add new Makefile
Signed-off-by: David Cassany <dcassany@suse.com>
2023-05-11 15:31:28 +02:00
Fredrik Lönnegren 1342bae7ee
Add LUET_NOLOCK for example Dockerfile (#1651)
* Add LUET_NOLOCK for example Dockerfile

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>

* Update LUET_VERSION in examples

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>

Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>
2022-11-22 15:23:09 +01:00
Fredrik Lönnegren 0d0f9a7a7f
docs: Small changes (#1645)
Signed-off-by: Fredrik Lönnegren <fredrik.lonnegren@suse.com>
2022-11-17 12:58:55 +01:00