Kernel packages marked as automatically installed after upgrading to Fedora 40

After upgrading to Fedora 40 I noticed that the kernel package seems to be marked as automatically installed:

# dnf remove virtualbox-guest-additions
Updating Subscription Management repositories.
Dependencies resolved.
==============================================================================================================================================================================================================================================
 Package                                                               Architecture                                      Version                                                    Repository                                           Size
==============================================================================================================================================================================================================================================
Removing:
 virtualbox-guest-additions                                            x86_64                                            7.0.16-1.fc40                                              @updates                                            2.7 M
Removing unused dependencies:
 kernel                                                                x86_64                                            6.8.5-201.fc39                                             @updates                                              0  
 kernel                                                                x86_64                                            6.8.6-200.fc39                                             @updates                                              0  
 kernel                                                                x86_64                                            6.8.7-200.fc39                                             @updates                                              0  
 kernel                                                                x86_64                                            6.8.7-300.fc40                                             @updates                                              0  
 kernel-modules                                                        x86_64                                            6.8.5-201.fc39                                             @updates                                             58 M
 kernel-modules                                                        x86_64                                            6.8.6-200.fc39                                             @updates                                             58 M
 kernel-modules                                                        x86_64                                            6.8.7-200.fc39                                             @updates                                             58 M
 kernel-modules                                                        x86_64                                            6.8.7-300.fc40                                             @updates                                             58 M

Transaction Summary
==============================================================================================================================================================================================================================================
Remove  9 Packages

Freed space: 235 M
Is this ok [y/N]: 

I resolved this with dnf mark install kernel. Was that the right thing to do?

no

All kernel packages are automatically updated when a new kernel version is released. Users should never change the way they are marked to avoid unwanted side effects.

The virtualbox-guest-additions are installed by fedora and needed just in case a user decides to use VB to manage VMs.

I have not installed VirtualBox, but on my systems (One upgraded and one new install) both allow removing the guest-additions package without trying to remove a kernel package.

$ sudo dnf remove virtualbox-guest-additions
Dependencies resolved.
====================================================================================================================================
 Package                                   Architecture          Version                      Repository                       Size
====================================================================================================================================
Removing:
 virtualbox-guest-additions                x86_64                7.0.16-1.fc40                @updates-testing                2.7 M

Transaction Summary
====================================================================================================================================
Remove  1 Package

Freed space: 2.7 M
Is this ok [y/N]: 

That doesn’t seem right. virtualbox-guest-additions is intended to be installed in VirtualBox guests. And it was installed after I ran dnf upgrade a couple of days ago–I’m not sure why, nothing else installed on my system appears to require or recommend it.

Anyway–without virtualbox-guest-additions being installed on my system, as you can see, DNF wants to remove the kernel package. On another system I have lying around, running Fedora 39, kernel and related packages are already marked as user-installed:

$ dnf -C rq --userinstalled | grep kernel
kernel-0:6.7.7-200.fc39.x86_64
kernel-0:6.8.6-200.fc39.x86_64
kernel-0:6.8.7-200.fc39.x86_64
kernel-core-0:6.7.7-200.fc39.x86_64
kernel-core-0:6.8.6-200.fc39.x86_64
kernel-core-0:6.8.7-200.fc39.x86_64
kernel-modules-0:6.7.7-200.fc39.x86_64
kernel-modules-0:6.8.6-200.fc39.x86_64
kernel-modules-0:6.8.7-200.fc39.x86_64
kernel-modules-core-0:6.7.7-200.fc39.x86_64
kernel-modules-core-0:6.8.6-200.fc39.x86_64
kernel-modules-core-0:6.8.7-200.fc39.x86_64
kernel-modules-extra-0:6.7.7-200.fc39.x86_64
kernel-modules-extra-0:6.8.6-200.fc39.x86_64
kernel-modules-extra-0:6.8.7-200.fc39.x86_64
kernel-srpm-macros-0:1.0-20.fc39.noarch
kernel-tools-0:6.8.7-200.fc39.x86_64

… so running dnf mark install kernel on the Fedora 40 system has at least brought it back in line with the other system, and I can now remove virtualbox-guest-additions without kernel etc being removed.

[edit]

Had the idea to check some RHEL systems as well, and they too have kernel marked as user-installed. So it seems that, for whatever reason, kernel was marked as non-user-installed during the Fedora 40 upgrade.

I’ll keep an eye on what happens when I upgrade my Fedora 39 system to 40, and file a bug if it happens there too.