Re: systemd-bless-boot not updating the loader.conf?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



As a follow up to this, we got this fixed by implementing an override for systemd-bless-boot.service that removes the assessment from the loader.conf with sed:

[Service]
# Remove the assessment suffix from loader.conf if any
ExecStartPost=sed -i -E 's/(default\s+)*\+[0-9]+(-[0-9]+)?(\.conf)/\1\3/' /efi/loader/loader.conf

Its not the cleanest thing ever but it works.

I still think that this should be either done by the service when marking a conf as good, or systemd-boot should ignore the assessment part when looking at the default entry but I'm not opening an issue against this as it seems to be the expected results.

If someone thinks that this is valid, let me know and I will open a feature request

Thanks!

On Thu, Nov 21, 2024 at 4:04 PM Itxaka Serrano Garcia <itxaka.garcia@xxxxxxxxxxxxxxxx> wrote:


On Thu, Nov 21, 2024 at 2:45 PM Lennart Poettering <lennart@xxxxxxxxxxxxxx> wrote:
On Do, 21.11.24 14:35, Itxaka Serrano Garcia (itxaka.garcia@xxxxxxxxxxxxxxxx) wrote:

> Hey folks,
>
> we are currently implementing systemd-boot boot assessment on Kairos, where
> we have a few entries under /loader/entries/
>
> We made it so they start at threes tries so the config fails are for
> example active+3.conf
>
> On boot, we can see the filename renamed properly to active+2-1.conf until
> the systemd-bless-boot starts, checks that the system is in complete boot
> (reached boot-complete.target) and it marks it as good and renames it to
> disable the boot assessment
>
>
> Nov 21 13:08:10 kairos-vfog systemd[1]: Starting systemd-bless-boot.service
> - Mark the Current Boot Loader Entry as Good...
> Nov 21 13:08:10 kairos-vfog systemd-bless-boot[1522]: Marked boot as
> 'good'. (Boot attempt counter is at 1.)
> Nov 21 13:08:10 kairos-vfog systemd[1]: Finished systemd-bless-boot.service
> - Mark the Current Boot Loader Entry as Good.
>
> That's all good and dandy but now, our loader.conf is pointing to the
> active+3.conf as the default key, so that wont match anymore.
>
> Should systemd-bless-boot update the default entry in loader.conf if it
> matches the current boot loader entry? Should systemd-boot ignore the boot
> assessment part in the loader.conf default?
>
> Does loader.conf accept a regex for the default entry so this can be fixed
> by setting the entry to ^WHATEVER\+\d+(-\d+)?.conf$ ?

See loader.conf(5). It supports globs, it's literally in the first
sentence. (i.e. * and ?)

Yeah I saw that but it's pretty difficult to set a glob that will work for both right? Does Not seem a use case for the boot assessment really, hence why I though some regex would make this easier (said no one ever lol)

root@kairos-1kfy:~# ls /efi/loader/entries/active*.*
/efi/loader/entries/active+2-1.conf  /efi/loader/entries/active2butbroken.conf
/efi/loader/entries/active.conf


This matches unwanted entries.
The idea is to have a glob that matches both active.conf and active+2-1.conf but doesnt match activeNotReally.conf which with globs is a terrible idea.

I still think that the boot assessment part should be ignored by systemd-boot, so an entry should just automatically remove that part before trying to load the conf file (X+3-1.conf should be autocleaned to X.conf)


I'll keep trying to fix this up without having unwanted consequences, open to ideas  :D

 

That said, i think we actually should check the glob against the
string where we stripped away the counters. Could you file a bug
against that?

Lennart

--
Lennart Poettering, Berlin

[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux