Commit Graph

32 Commits

Author SHA1 Message Date
Itxaka
93f5cf5de6
Rework immucore (#246) 2024-03-20 11:48:51 +01:00
Itxaka
572002fb38
Bump lint and fix issues (#245) 2024-03-18 14:38:57 +01:00
Dimitris Karakasilis
4521fe6fcd
2226 detect boot state (#225)
* WIP

Signed-off-by: Dimitris Karakasilis <dimitris@karakasilis.me>

* WIP

Signed-off-by: Dimitris Karakasilis <dimitris@spectrocloud.com>
Signed-off-by: Dimitris Karakasilis <dimitris@karakasilis.me>

* WIP add logs everywhere (EOD wip)

Signed-off-by: Dimitris Karakasilis <dimitris@karakasilis.me>

* Do the livecd check as late as possible

because the herd condition is evaluated too early before the /sys
is mounted and thus we don't detect the installed system correctly in
UKI mode.

Signed-off-by: Dimitris Karakasilis <dimitris@karakasilis.me>

* Wrap NewRuntime to allow passing down a logger

so that kairos-sdk logs make it to the immucore.log file

Signed-off-by: Dimitris Karakasilis <dimitris@karakasilis.me>

* Add TODOs and remove redundant check in code

the livecd check already happens some lines above

Signed-off-by: Dimitris Karakasilis <dimitris@karakasilis.me>

* Replace the "replace" with an actual tag

Signed-off-by: Dimitris Karakasilis <dimitris@karakasilis.me>

* Remoce "replace" directive and use wrapper method for UnlockAll

Signed-off-by: Dimitris Karakasilis <dimitris@karakasilis.me>

* Remove unecessary TODO

the log message describes what happened

* Re-use the method from kairos-sdk for uki boot detection

Signed-off-by: Dimitris Karakasilis <dimitris@karakasilis.me>

* Move messages from Info() to Debug() (PR review request)

Signed-off-by: Dimitris Karakasilis <dimitris@karakasilis.me>

---------

Signed-off-by: Dimitris Karakasilis <dimitris@karakasilis.me>
Signed-off-by: Dimitris Karakasilis <dimitris@spectrocloud.com>
Co-authored-by: Mauro Morales <mauro.morales@spectrocloud.com>
2024-02-19 13:42:06 +02:00
Itxaka
7f2813e5b7
Mount ESP under /efi if possible + identify EFI run source (#158) 2023-09-25 14:14:56 +02:00
Dimitris Karakasilis
13b06d9e35
1448 use yip (#135)
Co-authored-by: Mauro Morales <mauro.morales@spectrocloud.com>
Co-authored-by: Itxaka <itxaka.garcia@spectrocloud.com>
2023-07-04 14:52:26 +02:00
Itxaka
0811f0f054
Increase compatibility with alpine systems (#132) 2023-05-30 21:51:03 +02:00
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
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
217fdaa8e6 Fix for runtime being fixed
Now the proper label is under the filesystem label

Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
2023-03-10 00:02:14 +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
b2f3615534
🐛 Add custom layout plugin (#87)
The default plugin does not support gpt

Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
2023-03-09 17:19:15 +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
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
68fc3afa24
Fix master to boot normal (#68)
* Be more careful with commandWithPaths PATHS

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

* Do not mount all the things :/

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

* Only mount /proc otherwise we break stuff

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

---------

Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
2023-03-01 16:20:45 +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
985b8c9401
Uki support (#61) 2023-02-28 14:37:02 +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
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
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
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
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
0807fe08f5 Refactor
Signed-off-by: Itxaka <itxaka@spectrocloud.com>
2023-02-09 10:12:11 +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
0323c5ab5f Fix recovery label
Signed-off-by: Itxaka <itxaka@spectrocloud.com>
2023-02-08 19:11:00 +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
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
13e11fca24 Use SDK to get machine state 2023-02-06 14:49:35 +01:00
Itxaka
4ade174057 dont do anything if booting from CD
We leave dracut to do its own thing and mount the CD properly

Signed-off-by: Itxaka <itxaka@spectrocloud.com>
2023-02-06 11:31:46 +01:00