snapcore / core-initrd

initrd implementation in ubuntu core
https://ubuntu.com/core/docs
GNU General Public License v3.0
9 stars 27 forks source link

factory: handle properly snapd_recovery_mode based on modeenv value #213

Closed kubiko closed 10 months ago

kubiko commented 10 months ago

The real source of true for the current mode is stored in /var/lib/snapd/modeenvthis value might be altered after /usr/lib/systemd/system-generators/journald-console was already run. Or /var/lib/snapd/modeenv did not even exist at that time. This happens in install/factory-reset/recovery modes which might be handled within the initrd. If this is detected, update journald-console generator and remove already created journald.conf.d/core-override.conf config overlay.

kubiko commented 10 months ago

Redone as per @xnox suggestion

alfonsosanchezbeato commented 10 months ago

We would need a PR for main

kubiko commented 10 months ago

@alfonsosanchezbeato I have tested this on the system with compressed install steps and it does behave there as expected. So generator is re-run before root pivot

alfonsosanchezbeato commented 10 months ago

@alfonsosanchezbeato I have tested this on the system with compressed install steps and it does behave there as expected. So generator is re-run before root pivot

Right, because at some point there is some daemon-reload happening iirc. But that is a bit of an accident I'd say, and even more, that means that journal will stop to be sent to console while we have not switched root yet. Maybe the file could be removed in a ExecStopPost= stanza inside itself. A bit strange as the file would be removing itself, but I think that is fine as that information is kept in memory I think.

xnox commented 10 months ago

@kubiko it is confusing to submit multiple PRs of the same to all series whilst review comments then spread across all of them.

Also i agree with review comments here.

Please land changes in main branch first, ahead of backporting. The code proposed here is now different to what has landed in main branch. Please fix main branch first.