1
0
mirror of https://github.com/kairos-io/immucore.git synced 2025-05-14 11:00:14 +00:00
Commit Graph

121 Commits

Author SHA1 Message Date
Itxaka
a78e2b7ce7
Fix mounts ()
Co-authored-by: Dimitris Karakasilis <dimitris@karakasilis.me>
2024-03-15 09:24:54 +01:00
Itxaka
25975a5594
Chroot into a new dir before starting the system ()
* Chroot into a new dir before starting the system

Signed-off-by: Itxaka <itxaka@kairos.io>

* Use ReadDir and copy files int eh rootdir to the enw rootdir

Signed-off-by: Itxaka <itxaka@kairos.io>

* logggg

Signed-off-by: Itxaka <itxaka@kairos.io>

* Several fixes

Mount /dev at start so we can log to kmesg/ttyS0
Log more
Store the mountpoints found in root to bind them later to the new
sysroot

Signed-off-by: Itxaka <itxaka@kairos.io>

* debvuy

Signed-off-by: Itxaka <itxaka@kairos.io>

* Fix

Signed-off-by: Itxaka <itxaka@kairos.io>

* more debufg

Signed-off-by: Itxaka <itxaka@kairos.io>

* fix

Signed-off-by: Itxaka <itxaka@kairos.io>

* sfder

Signed-off-by: Itxaka <itxaka@kairos.io>

* Fix symlinks

Signed-off-by: Itxaka <itxaka@kairos.io>

* final

Signed-off-by: Itxaka <itxaka@kairos.io>

* disable mobving the / root mountpoint

Im not sure this works on our side or how, I just get errors

Signed-off-by: Itxaka <itxaka@kairos.io>

* Debug

Signed-off-by: Itxaka <itxaka@kairos.io>

* Disable remounting / as RO and enable remounting the new sysroot as RO

Signed-off-by: Itxaka <itxaka@kairos.io>

* Dont drop to bash like that

Signed-off-by: Itxaka <itxaka@kairos.io>

* Move "sysroot" to a constant, dry code and handle errors

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

* Fix linting errors by removing superflows `else` statements

because the `if`s end with `continue`

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

* Apply suggestions from code review

* Remove loggers that don't work

because `/dev` is not there yet (?). In any case, we need to switch to
the new logger

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

---------

Signed-off-by: Itxaka <itxaka@kairos.io>
Signed-off-by: Dimitris Karakasilis <dimitris@karakasilis.me>
Co-authored-by: Dimitris Karakasilis <dimitris@karakasilis.me>
2024-03-06 17:09:26 +02:00
Itxaka
a52b9651ad
Change the secureboot disable to not collide with disable immucore () 2024-03-06 10:30:18 +01:00
Itxaka
3604633112
Check secureboot if on uki mode and panic if not ()
* Check secureboot if on uki mode and panic if not

Signed-off-by: Itxaka <itxaka@kairos.io>

* Check cmdline for disable secureboot

Signed-off-by: Itxaka <itxaka@kairos.io>

* Fix tests

Signed-off-by: Itxaka <itxaka@kairos.io>

---------

Signed-off-by: Itxaka <itxaka@kairos.io>
2024-03-01 09:42:03 +01:00
Itxaka
4c2ba5883b
Be slower to find the install media () 2024-02-28 12:28:50 +01:00
Dimitris Karakasilis
4521fe6fcd
2226 detect boot state ()
* 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
c9c9edb261
Mount cdrom efiboot contents under /run/rootfsbase ()
Signed-off-by: Itxaka <itxaka@kairos.io>
2024-02-11 18:37:24 +01:00
Itxaka
a2874ca3ee
Mount livecd in /run/initramfs/live under uki () 2024-02-08 14:22:44 +01:00
Itxaka
55a6622c4a
Copy PCR related files generated by systemd-stub in uki () 2023-12-16 07:54:42 +01:00
Itxaka
6592034132
Update dag_steps.go 2023-12-15 23:12:28 +01:00
Itxaka
76e605d9fd
Do not fail if we cant measure 2023-12-15 23:03:59 +01:00
Itxaka
424392b390
measure PCR phase () 2023-12-15 16:20:34 +01:00
Ettore Di Giacinto
8827393083
Lower to warning when we continue the loop () 2023-12-11 18:43:19 +01:00
Itxaka
c4ad991e0c
unlock partitions with UKI TPM values () 2023-11-30 22:19:47 +01:00
Itxaka
ad83785e37
Fix log to add timestamp () 2023-09-26 10:56:32 +02:00
Itxaka
30b454eac4
Check if uki install mode before mounting oem ()
Signed-off-by: Itxaka <itxaka@kairos.io>
2023-09-25 17:03:50 +02:00
Itxaka
7f2813e5b7
Mount ESP under /efi if possible + identify EFI run source () 2023-09-25 14:14:56 +02:00
Itxaka
5412c76ebb
Uki changes for iso/install () 2023-09-22 14:56:26 +02:00
Itxaka
a1710b8589
Set basic /run mount from the start to be able to always log () 2023-09-19 09:51:57 +02:00
Mauro Morales
62831b8ecf
Sort bind mounts ()
* Sort bind mounts

Signed-off-by: Mauro Morales <mauro.morales@spectrocloud.com>

* Add comment

Signed-off-by: Mauro Morales <mauro.morales@spectrocloud.com>

---------

Signed-off-by: Mauro Morales <mauro.morales@spectrocloud.com>
2023-06-12 10:47:49 +02:00
Itxaka
0811f0f054
Increase compatibility with alpine systems () 2023-05-30 21:51:03 +02:00
Itxaka
18c70b4ff1
Unlock after oem to read the server config () 2023-05-09 15:45:26 +02:00
Itxaka
9399d0cf08
Move some err to warnings () 2023-05-08 15:20:05 +02:00
Itxaka
14426d39b4
Upgrade kcrypt partitions on boot ()
Co-authored-by: Dimitris Karakasilis <jimmykarily@gmail.com>
2023-05-08 09:44:43 +02:00
Itxaka
2e9e5de03e
Fix missing sysroot mount in fstab () 2023-05-05 12:34:23 +02:00
Itxaka
d644fb0af9
Run kcrypt unlock via immucore () 2023-05-04 18:58:26 +02:00
Itxaka
d1f4669f03
🐛 Retry getting the state label () 2023-04-29 12:21:33 +02:00
Itxaka
06ff33cc97
⬆️ Bump deps () 2023-04-28 09:30:56 +02:00
Itxaka
f1c3aad0ee
🌱 activate LVM volumes at the start () 2023-04-19 16:23:51 +02:00
Itxaka
6bf656cd21
Try to mount oem under livemedia () 2023-04-12 16:19:21 +02:00
Itxaka
2534577e09
🐛 Add missing dependency to bind mounts ()
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 ()
- 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 ()
Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
2023-03-09 19:45:24 +01:00
Itxaka
88a2ca8a9b
Conditional for loading oem () 2023-03-09 12:57:10 +01:00
Itxaka
8832ec6981
Run yip directly for stages () 2023-03-09 08:58:07 +01:00
Itxaka
9cada0ecd0
🐛 Separate weak steps vs normal steps ()
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 ()
Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
2023-03-08 19:44:45 +01:00
Itxaka
aa5939da89
Rework workflow ()
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 ()
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 ()
* 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 ()
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 ()
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 ()
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 ()
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 ()
Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
2023-03-01 11:42:46 +01:00
Itxaka
3a52112b91
Revert "Uki support" (
This reverts commit 985b8c9401.
2023-02-28 19:46:15 +01:00
Itxaka
4cbff2d8d4
Do not mount tmp on livecd/netboot (
Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
2023-02-28 19:24:13 +01:00
Itxaka
985b8c9401
Uki support () 2023-02-28 14:37:02 +01:00