Skip to content

Conversation

@afbjorklund
Copy link
Member

@afbjorklund afbjorklund commented Dec 8, 2025

Only try to reboot when upgradePackages is true, and check the network connectivity before checking if a restart is needed.

Also don't hide the stderr output, in case of any errors, and also show the list of packages that are requiring the reboot.

Closes #4440

first boot:

+ command -v dnf
+ dnf -h needs-restarting
+ dnf check-update
Updating and loading repositories:
Repositories loaded.
+ '[' 0 '!=' 1 ']'
+ dnf needs-restarting -r
Updating and loading repositories:
 Fedora 43 openh264 (From Cisco) - x86_ 100% |   1.6 KiB/s |  10.1 KiB |  00m06s
 Fedora 43 - x86_64 - Updates           100% |   1.7 MiB/s |  21.9 MiB |  00m13s
 Fedora 43 - x86_64                     100% |   2.2 MiB/s |  57.8 MiB |  00m26s
Repositories loaded.
Core libraries or services have been updated since boot-up:
  * glib2
  * gnutls
  * kernel-core
  * kernel-modules-core
  * libxcrypt
  * openssl-libs
  * systemd

Reboot is required to fully utilize these updates.
More information: https://access.redhat.com/solutions/27943
+ systemctl reboot

Broadcast message from root@localhost (Mon 2025-12-08 12:46:02 CET):

The system will reboot now!

second boot:

+ command -v dnf
+ dnf -h needs-restarting
+ dnf check-update
Updating and loading repositories:
Repositories loaded.
+ '[' 0 '!=' 1 ']'
+ dnf needs-restarting -r
Updating and loading repositories:
Repositories loaded.
No core libraries or services have been updated since boot-up.
Reboot should not be necessary.

Copy link
Member

@jandubois jandubois left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand which part of the PR is supposed to stop the reboot loop in case there is a network problem.

Comment on lines 35 to 39
{{- if .UpgradePackages}}
LIMA_CIDATA_UPGRADE_PACKAGES=1
{{- else}}
LIMA_CIDATA_UPGRADE_PACKAGES=0
{{- end}}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It bothers me that we do these silly translations from booleans to environment variables that have to be set to 1 or the empty string. Or in this case 0.

Why don't we assign the boolean value directly and deal with it that the variable will be set to true or false?

Suggested change
{{- if .UpgradePackages}}
LIMA_CIDATA_UPGRADE_PACKAGES=1
{{- else}}
LIMA_CIDATA_UPGRADE_PACKAGES=0
{{- end}}
LIMA_CIDATA_UPGRADE_PACKAGES={{.UpgradePackages}}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was just following the rest of them, either way

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But then it would be more on the lines of:

$LIMA_CIDATA_UPGRADE_PACKAGES || exit 0

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And using 0 is a bit unconventional, not "ifdef"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently that was my bad, it was only 1 being used

@afbjorklund

This comment was marked as resolved.

Only try to reboot when upgradePackages is true, and check the
network connectivity before checking if a restart is needed.

Also don't hide the stderr output, in case of any errors, and
also show the list of packages that are requiring the reboot.

Signed-off-by: Anders F Björklund <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fedora Lima image gets stuck in reboot loop if mirror is unavailable

3 participants