Commit Graph

145 Commits

Author SHA1 Message Date
Itxaka
d1f4669f03
🐛 Retry getting the state label (#115) 2023-04-29 12:21:33 +02:00
Itxaka
06ff33cc97
⬆️ Bump deps (#114) 2023-04-28 09:30:56 +02:00
Itxaka
f1c3aad0ee
🌱 activate LVM volumes at the start (#113) 2023-04-19 16:23:51 +02:00
Itxaka
6bf656cd21
Try to mount oem under livemedia (#110) 2023-04-12 16:19:21 +02:00
Itxaka
2534577e09
🐛 Add missing dependency to bind mounts (#102)
As overlay mounts its responsible of mounting some of the RW paths that
bind mounts are using (for example /etc) we need to depend on it and let
it finish before running ht ebind mounts

Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
2023-03-21 10:58:15 +01:00
Itxaka
8f7d808dec
Bring UKI to a working state (#97)
- Mount the needed base mounts (/proc /dev /sys /tmp)
 - Use our own console for yip (required to add the PATH under uki)
 - Order the DAG in a proper way (was out of order and not working)

Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
2023-03-14 10:33:38 +01:00
Itxaka
44c2a5be26
Update kairos sdk to latest master (#89)
Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
2023-03-09 19:45:24 +01:00
Itxaka
88a2ca8a9b
Conditional for loading oem (#85) 2023-03-09 12:57:10 +01:00
Itxaka
8832ec6981
Run yip directly for stages (#82) 2023-03-09 08:58:07 +01:00
Itxaka
9cada0ecd0
🐛 Separate weak steps vs normal steps (#81)
And dont set any step to weak

Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
2023-03-08 20:05:57 +01:00
Itxaka
41fcc3c03b
🐛 Fix chroot unmounting (#80)
Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
2023-03-08 19:44:45 +01:00
Itxaka
aa5939da89
Rework workflow (#77)
This makes immucore run more in parallel rather than block everything
else. We just tell sysroot.mount that eventually it will be mounted and
to wait for a bit.

This allows us to be more flexible where to run and run in parallel in
cases like cdrom in which we may do things but we need the sysroot to be
mounted already but not from us.

Also adds the initramfs stage directly in immucore and merges all the dracut config into one

    Dont create sysroot, just add a timeout override so it waits for us
    Dont block on the service, just make sure to finish before
    initrd.target
    Fix mounts from cmdline
    More proper log
    Store logs under the /run/immucore dir
    Store rootfs and initramfs logs separated
    Do not log the full stages in INFO level
    Run initramfs stage in immucore directly on boot and cd/netboot
    Drop systemd requirement from dracut module

Signed-off-by: Itxaka itxaka.garcia@spectrocloud.com
2023-03-08 11:45:11 +01:00
Itxaka
167cf5fa0d
🐛 Fix coverage (#76)
Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
2023-03-02 19:33:11 +01:00
Itxaka
fecfbf8e92
Add tests and fix some issues that arised from testing (#74)
* Add tests and fix some issues that arised from testing

Mainly around the cmdargs and how many items it returns.
Also drop the iso target and jobs as its not necessary now

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

* Lint

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

---------

Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
2023-03-02 16:46:25 +01:00
Itxaka
b0b326313b
🐛 Get oem label from cmdline before using runtime (#73)
Otherwise we are ignoring any override via stanza

Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
2023-03-02 11:45:05 +01:00
Itxaka
ea5c1c75f2
🐛 Support immucore stanzas in cmdline (#72)
Introduce support for the same old cos stanzas but with immucore naming
so we can control them better in the future

Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
2023-03-02 11:10:28 +01:00
Itxaka
6ed15c7227
🐛 Load overlay config from cos-layout.env (#71)
Load the base overlay config from the cos-layout.env file. This means we
have to depend the base overlay mount to the load-config step, which
moves things a bit in the DAG.

Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
2023-03-02 10:44:54 +01:00
Itxaka
73c4c3e0af
Add missing cmdline stanzas (#69)
Adds support for:
 - rd.cos.oemtimeout=
 - rd.cos.overlay=tmpfs:SIZE
 - rd.cos.overlay=LABEL=DEVICE_LABEL
 - rd.cos.overlay=UUID=DEVICE_UUID

Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
2023-03-01 21:45:32 +01:00
Itxaka
4fabf06d7f Fix running elemental
Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
2023-03-01 15:47:51 +01:00
Itxaka
2e8e30aa13 Just write to stdout for now
Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
2023-03-01 15:43:09 +01:00
Itxaka
086227d672
Uki Support (#67)
Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
2023-03-01 11:42:46 +01:00
Itxaka
3a52112b91
Revert "Uki support" (#66
This reverts commit 985b8c9401.
2023-02-28 19:46:15 +01:00
Itxaka
4cbff2d8d4
Do not mount tmp on livecd/netboot (#65
Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
2023-02-28 19:24:13 +01:00
Itxaka
985b8c9401
Uki support (#61) 2023-02-28 14:37:02 +01:00
Itxaka
9a480df901 Re-enable longer RW_PATHS
Looks like the problem comes from the custom mounts overriding this
values

Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
2023-02-22 12:21:02 +01:00
Itxaka
97478bd8ac Re-fix overlay and binds
Cleanup at the end, append both

Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
2023-02-22 11:57:38 +01:00
Itxaka
69b0c0131f Add custom mounts and fix default rw paths
Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
2023-02-22 11:26:59 +01:00
Itxaka
5dde396331
Add fsck before mounting (#56)
Respect all options from systemd-fsck as that it what is currently used
on kairos.

Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
2023-02-17 16:15:26 +01:00
Itxaka
c081f987f8
Fix recovery (#54)
* Fix recovery

 - change TargetLabel into TargetDevice to hav ethe full device instead
   of just the label
 - log error if we cant mount
 - Get state partition to mount depending on recovery or active/passive
 - Get state patition fs on the fly
 - Set proper label device to mount on sysroot based on our boot state

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

* Fix test

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

---------

Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
2023-02-17 11:53:26 +01:00
Itxaka
88df028e6d
Allow setting root to RW (#53)
This patch allows setting the root mount as RW indicated by setting
rd.cos.debugrw in the cmdline

Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
2023-02-17 09:54:23 +01:00
Itxaka
4083ff691d
Mark rd.cos.disable sentinel as livecd (#46)
Original cos-immutable-rootfs sets the sentinel to livecd if it finds
the rd.cos.disable in the cmdline.

We should do the same. Unfortunately the state sdk doesnt support that
yet so we have to do it on our side until its supported

Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
2023-02-17 09:27:12 +01:00
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
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
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
7430d6d9a9 Fix mount tests
Signed-off-by: Itxaka <itxaka@spectrocloud.com>
2023-02-09 16:43:12 +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
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
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
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
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
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
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
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
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
Itxaka
bfc337b499 sdfasd
Signed-off-by: Itxaka <itxaka@spectrocloud.com>
2023-02-08 14:14:37 +01:00
Itxaka
45c69d24fa Remove defaults from bind and extra logging
Signed-off-by: Itxaka <itxaka@spectrocloud.com>
2023-02-08 13:49:26 +01:00
Itxaka
6fedeef4ea Replace /sysroot on fstab
Signed-off-by: Itxaka <itxaka@spectrocloud.com>
2023-02-08 11:53:08 +01:00
Itxaka
b67c89c593 Translate auto fstype to actual type
Signed-off-by: Itxaka <itxaka@spectrocloud.com>
2023-02-08 11:33:11 +01:00
Itxaka
b628f959d3 Translate persistent to runtime device
Signed-off-by: Itxaka <itxaka@spectrocloud.com>
2023-02-08 11:01:21 +01:00
Itxaka
c2deb76192 Check symlink before creating it
Signed-off-by: Itxaka <itxaka@spectrocloud.com>
2023-02-08 10:32:11 +01:00
Itxaka
9aee940e64 more debug
Signed-off-by: Itxaka <itxaka@spectrocloud.com>
2023-02-08 10:09:21 +01:00
Itxaka
8366045036 drop defaults
Signed-off-by: Itxaka <itxaka@spectrocloud.com>
2023-02-08 08:45:52 +01:00
Itxaka
306d5c3e66 fix not initialized map and check for already mounted mounts instead of
failing

Signed-off-by: Itxaka <itxaka@spectrocloud.com>
2023-02-07 22:25:28 +01:00
Itxaka
856b01c540 i dunno lol
Signed-off-by: Itxaka <itxaka@spectrocloud.com>
2023-02-07 22:12:37 +01:00
Itxaka
bd5c1f1f55 Fix depends for rootfs, proper path for layout
Signed-off-by: Itxaka <itxaka@spectrocloud.com>
2023-02-07 21:52:40 +01:00
Itxaka
b62a1f2e99 fix deps of rootfs stage, not working modules, symlink
Signed-off-by: Itxaka <itxaka@spectrocloud.com>
2023-02-07 21:05:30 +01:00
Itxaka
63679b6df1 Add missing modules and fix rootfs stage
Signed-off-by: Itxaka <itxaka@spectrocloud.com>
2023-02-07 20:16:02 +01:00
Itxaka
717851b0b2 +x generator.sh
Signed-off-by: Itxaka <itxaka@spectrocloud.com>
2023-02-07 16:48:34 +01:00
Itxaka
41b1baf17b Remove auto stanza from mount
Signed-off-by: Itxaka <itxaka@spectrocloud.com>
2023-02-06 17:46:45 +01:00
Itxaka
2eef2c8922
Merge branch 'master' into changes_v4 2023-02-06 17:29:23 +01:00
Itxaka
7d539b63f4 more
more logging
run as dry-run
print version
remove nouser opt

Signed-off-by: Itxaka <itxaka@spectrocloud.com>
2023-02-06 17:24:50 +01:00
Itxaka
b071573758 use s.path for everything
So we can inherit the rootfs where to store stuff, no matter if / or
/sysroot.

also drop fstabfile as its alwasy gonna be the same file but with a
different rootfs

Signed-off-by: Itxaka <itxaka@spectrocloud.com>
2023-02-06 16:29:49 +01:00
Itxaka
f98954367f several improvements
- drop vfs
 - less hardcoded stuff, use the runtime status
 - Remove things that syscalls dont understand (defaults, auto)

Signed-off-by: Itxaka <itxaka@spectrocloud.com>
2023-02-06 16:20:18 +01:00
mudler
8f3a43861b Read cmdline mount args 2023-02-06 16:02:18 +01:00
mudler
67aea02ba7 Read mountpoint from env file 2023-02-06 15:41:52 +01:00
mudler
4011c3f41c Cleanup 2023-02-06 15:28:22 +01:00
mudler
70cce41004 Timeout must be created before, not during consumption
Fix: https://github.com/kairos-io/immucore/issues/12
2023-02-04 15:25:18 +01:00
Itxaka
8a916f4999 Error handling on dag creation
Signed-off-by: Itxaka <itxaka@spectrocloud.com>
2023-02-04 11:18:13 +01:00
Itxaka
93ceae89a2 Give a logger to State and add debug logs
Signed-off-by: Itxaka <itxaka@spectrocloud.com>
2023-02-04 10:33:58 +01:00
mudler
d6cbf70ae1 Add remaining hooks 2023-02-03 15:56:15 +01:00
mudler
d767523565 Add simple test suite 2023-02-02 15:12:33 +01:00
mudler
74fbe7bae2 reorder deps 2023-02-02 14:00:44 +01:00
mudler
87cd5e818c Define other dependencies 2023-02-01 22:51:31 +01:00
mudler
2e31f4cff4 Refactor, add dependant ops 2023-02-01 22:33:44 +01:00
mudler
087a8e5361 mount state depends on custom mounts 2023-02-01 19:27:01 +01:00
mudler
0b7d07d683 Put some order 2023-02-01 19:06:51 +01:00
mudler
de01370653 Reorg flow 2023-02-01 18:01:58 +01:00
mudler
a58f86aad1 Switch to ops model 2023-01-12 19:29:49 +01:00
mudler
2b6de44b9d Initial import 2023-01-12 19:10:10 +01:00