Commit Graph

131 Commits

Author SHA1 Message Date
Itxaka
bc53b0de3a Workaround for kairos sdk not detecting netboot
Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
2023-02-16 15:30:54 +01:00
Itxaka
dac147da2d Avoid sysroot.mount starting before immucore
Make it explicit that we run before sysroot.mount, otherwise it may be
launched in parallel and fails as immucore hasnt mount the sysroot
already

Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
2023-02-16 11:16:43 +01:00
Itxaka
4cfe5e764d Run udevadm trigger after mounting loop device
So the devices get refreshed and they show up under /dev/disk/by-label

Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
2023-02-16 10:41:02 +01:00
Itxaka
ad014e9f22
Full rework (#41)
* Full rework

 - Extract steps to a different file
 - Simplify dag for easy understanding
 - Load dag based on our boot process
 - Simplify steps to not depend on useless stuff
 - Better logging

Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>

* Move sentinel file to the dag

Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>

* Adapt tests

Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>

---------

Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
2023-02-15 22:30:08 +01:00
Itxaka
4e2dd37e70 Use device to mount stuff
Unfortunately ghw detects mountpoint only by device, thus kairos-agent
does the same.

If we expect to make this work we need to mount the devices by the dev
instead of label until ghw supports detecting the devices mountpoint
ALSO via label.

Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
2023-02-15 15:30:21 +01:00
Itxaka
28e6cfbff8 Do not do anything if rd.cos.disable its on the cmdline
That means we dont want to run any immutable stuff, for netboot and
cdrom

Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
2023-02-15 10:53:48 +01:00
Itxaka
220641df60 Improvements
- Set debug from ENV var as well
 - Only set sentinel if we are not on a dry-run so we can examine the
   DAG
 - Set the DAG with Init so tmpfs is part of it

Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
2023-02-14 13:48:57 +01:00
Itxaka
3ef3ac0251 Always mount tmpfs
Even on cd boot. Also delay the cdboot check a bit so we can mount tmpfs
also on cdboot

Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
2023-02-14 12:26:04 +01:00
Itxaka
2aee7ab5a0 Symlink /sysroot/oem to /oem so we can run rootfs stage
Looks like we need to have the oem partition loaded for some cases, and
during rootfs we should pick it up.

Currently we only mount it under /sysroot/oem. IIRC in
cos-immutable-rootfs it was mounted under /oem directly, the rootfs
stage service run and then when cos-layout was launched it made sure to
unmount /oem so it could mount it under /sysroot/oem

In our case its a bit more complicated, we may need to mount it under
/oem before the rootfs run, then unmount it and mount it in the proper
place. Im hoping we can get away with just creating the symlink

Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
2023-02-14 09:51:51 +01:00
Itxaka
076bba95dc Set the sentinel file from immucore directly
Also add a missing livecd sentinel file

Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
2023-02-13 21:42:45 +01:00
Itxaka
1d6572faaa Drop uneeded install on conf file
Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
2023-02-13 16:16:09 +01:00
Itxaka
1cd53d8e57 Typo in service name
Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
2023-02-13 14:53:34 +01:00
Itxaka
56632ca277
Add extra files needed for dracut (#36)
* Add extra files needed for dracut

If we are dropping cos-immutable-rootfs then we have to include the
missing files that the package already added.

For example, the several dracut configs of modules for the initramfs
stage, or the general config for the dracut file.

We also need to install and link the initramfs elemental stage service
as that its no longer provided by the cos-immutable-rootfs package and
not integrated into immucore yet

Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>

* Minor improvements

Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>

---------

Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
2023-02-13 14:34:51 +01:00
mudler
5122a57cc1 📖 Add LICENSE
Signed-off-by: mudler <mudler@c3os.io>
2023-02-13 09:47:58 +01:00
renovate[bot]
2dca980891
fix(deps): update module github.com/containerd/containerd to v1.6.17 (#35)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-02-11 09:00:15 +01:00
Itxaka
7430d6d9a9 Fix mount tests
Signed-off-by: Itxaka <itxaka@spectrocloud.com>
2023-02-09 16:43:12 +01:00
Itxaka
c1ddd58377 Fix iso build artifact upload
Signed-off-by: Itxaka <itxaka@spectrocloud.com>
2023-02-09 16:24:34 +01:00
Itxaka
c40e1f97f1 Add build iso job
Signed-off-by: Itxaka <itxaka@spectrocloud.com>
2023-02-09 15:33:41 +01:00
Itxaka
08c66d99a7
Merge pull request #31 from kairos-io/changes_v6 2023-02-09 15:22:24 +01:00
Itxaka
109c1c745f Several fixes
- Set global debug log
 - Set caller in the log if debug
 - Fatal if cannot get target image
 - clean up slices from cos-layoout.env
 - Add generic log with more context info
 - dump runtime to log on start
 - Set proper default paths if overlay is empty (fixes recovery)
 - Fix ErrAlreadyMounted to not trigger failures

Signed-off-by: Itxaka <itxaka@spectrocloud.com>
2023-02-09 15:16:53 +01:00
Itxaka
7a9e574c21
Merge pull request #30 from kairos-io/renovate/github.com-spectrocloud-labs-herd-0.x 2023-02-09 14:25:51 +01:00
Itxaka
3078111c1d Leaving checking the mount status to the op.run
Signed-off-by: Itxaka <itxaka@spectrocloud.com>
2023-02-09 13:48:35 +01:00
Itxaka
b764634331 more error handling
Signed-off-by: Itxaka <itxaka@spectrocloud.com>
2023-02-09 13:24:45 +01:00
Itxaka
aee2bbde84 Deal nicely with already mounted errors
Signed-off-by: Itxaka <itxaka@spectrocloud.com>
2023-02-09 12:35:45 +01:00
renovate[bot]
b0d222ad45
fix(deps): update module github.com/spectrocloud-labs/herd to v0.4.0 2023-02-09 11:32:50 +00:00
Itxaka
645d0a428a Mount oem by label
Signed-off-by: Itxaka <itxaka@spectrocloud.com>
2023-02-09 10:50:30 +01:00
Itxaka
d0816bb7e3 Fix tmpfs fstab entry
Signed-off-by: Itxaka <itxaka@spectrocloud.com>
2023-02-09 10:34:43 +01:00
Itxaka
61e6607285 Properly clean the sysroot string from fstab
Signed-off-by: Itxaka <itxaka@spectrocloud.com>
2023-02-09 10:29:26 +01:00
Itxaka
0807fe08f5 Refactor
Signed-off-by: Itxaka <itxaka@spectrocloud.com>
2023-02-09 10:12:11 +01:00
Itxaka
ed6614b6c7 Remove cos-immutable-rootfs by default when building the iso
Signed-off-by: Itxaka <itxaka@spectrocloud.com>
2023-02-09 08:56:26 +01:00
Itxaka
cf69cffa4b Drop isrecovery from state struct
Only needed in one place, can be made into a function

Signed-off-by: Itxaka <itxaka@spectrocloud.com>
2023-02-09 08:54:16 +01:00
Itxaka
8cd3520311
Merge pull request #29 from kairos-io/changes_v5 2023-02-08 23:44:59 +01:00
Itxaka
c5e686883e Significantly drop logging
It was nice when things break all over but its much more stable now.
Lets add logging with head and with proper enrichment of the data being
sent

Signed-off-by: Itxaka <itxaka@spectrocloud.com>
2023-02-08 23:27:53 +01:00
Itxaka
f490b08587 Several fixes
- set debug level via cmdline
 - set default RW paths needed ALWAYS to boot a working system, even
   with no config files(recovery)
 - Check for loop device before mounting it to avoid duplicated mounts
 - Force overlay and bind arrays to uniqueness
 - Rename OverlayDir to OverlayDirs to better represent the content

Signed-off-by: Itxaka <itxaka@spectrocloud.com>
2023-02-08 22:54:17 +01:00
Itxaka
accaa2a114 Fix log if error is nil
Signed-off-by: Itxaka <itxaka@spectrocloud.com>
2023-02-08 22:03:45 +01:00
Itxaka
b2b870973c Return from cos-layout if recovery
Signed-off-by: Itxaka <itxaka@spectrocloud.com>
2023-02-08 21:19:57 +01:00
Itxaka
0ea1650838 fix auto fstype
Signed-off-by: Itxaka <itxaka@spectrocloud.com>
2023-02-08 19:35:13 +01:00
Itxaka
0323c5ab5f Fix recovery label
Signed-off-by: Itxaka <itxaka@spectrocloud.com>
2023-02-08 19:11:00 +01:00
Itxaka
0bf7b5f760 Check cdboot the first thing
Signed-off-by: Itxaka <itxaka@spectrocloud.com>
2023-02-08 18:58:02 +01:00
Itxaka
99cd455ce8 Fixes recovery
- Add isRecovery to state
 - Get the TargetImage from cmdline
 - Add isrecovery to conditions

Signed-off-by: Itxaka <itxaka@spectrocloud.com>
2023-02-08 18:51:53 +01:00
Itxaka
441c4d17a3 Fix wrong recovery-img
Signed-off-by: Itxaka <itxaka@spectrocloud.com>
2023-02-08 18:31:05 +01:00
Itxaka
1381041b7d switch state to recovery if we are on recovery
Signed-off-by: Itxaka <itxaka@spectrocloud.com>
2023-02-08 18:24:28 +01:00
Itxaka
23b4b8f69f Set sentinel file during generator
Some cloud init scripts may need it ASAP

Signed-off-by: Itxaka <itxaka@spectrocloud.com>
2023-02-08 18:24:02 +01:00
Itxaka
7416a49e21
Merge pull request #27 from kairos-io/changes_v4 2023-02-08 16:50:06 +01:00
Itxaka
c533ab825a bind: only add to fstab if we have no errors
Signed-off-by: Itxaka <itxaka@spectrocloud.com>
2023-02-08 16:36:12 +01:00
Itxaka
0939929821 drop empty binds, more logging
Signed-off-by: Itxaka <itxaka@spectrocloud.com>
2023-02-08 16:23:13 +01:00
Itxaka
3f4b782fe9 Add missing module rsync to initramfs
Signed-off-by: Itxaka <itxaka@spectrocloud.com>
2023-02-08 15:59:04 +01:00
Itxaka
2a62ff5dac Persistent should be RW
Signed-off-by: Itxaka <itxaka@spectrocloud.com>
2023-02-08 15:51:21 +01:00
Itxaka
4407bef252 return proper multierror or nil, print dag after execution
Signed-off-by: Itxaka <itxaka@spectrocloud.com>
2023-02-08 15:40:18 +01:00
Itxaka
98a2506859 check mount status in mountoperation.run not on bind mountpoint
preparation

Signed-off-by: Itxaka <itxaka@spectrocloud.com>
2023-02-08 14:43:58 +01:00