Why does boot block for "Purge old kernels"?

6 views
Skip to first unread message

Tristan Miller

unread,
Apr 14, 2022, 7:11:27 AMApr 14
to
Greetings.

Occasionally when I boot my machine, the system pauses for a minute or
two with the message, "A start job is running for Purge old kernels".

If I understand correctly, purging old kernels simply means uninstalling
them. If this is the case, why is this something that boot has to block
for? I mean, once the system is up an running, I can always use zypper
or rpm to manually remove old kernels. So it's obviously something that
*can* be done without interfering with my use of the machine. I get why
the bootup script might want to clean up old kernels every once in a
while, but why can't it just launch a process that does this
unobtrusively in the background?

Regards,
Tristan

--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Tristan Miller
Free Software developer, ferret herder, logologist
https://logological.org/
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Andrew

unread,
Apr 14, 2022, 11:34:59 AMApr 14
to
Tristan Miller wrote:
> Greetings.
>
> Occasionally when I boot my machine, the system pauses for a minute or
> two with the message, "A start job is running for Purge old kernels".
>
> If I understand correctly, purging old kernels simply means uninstalling
> them.  If this is the case, why is this something that boot has to block
> for?  I mean, once the system is up an running, I can always use zypper
> or rpm to manually remove old kernels.  So it's obviously something that
> *can* be done without interfering with my use of the machine.  I get why
> the bootup script might want to clean up old kernels every once in a
> while, but why can't it just launch a process that does this
> unobtrusively in the background?
>
> Regards,
> Tristan
>

I think you'll find that the function runs the next time you boot after
a kernel update, but I was wondering exactly the same thing yesterday
evening. A new kernel was installed, I rebooted and then watched the
system taking a timeout while removing the (-2) kernel.

--
This mail has been tested by https://RKIvirus.com/ and has been found to
contain Covid-19. Disinfect after reading.

Carlos E.R.

unread,
Apr 16, 2022, 7:00:09 PMApr 16
to
On 2022-04-14 13:11, Tristan Miller wrote:
> Greetings.
>
> Occasionally when I boot my machine, the system pauses for a minute or
> two with the message, "A start job is running for Purge old kernels".
>
> If I understand correctly, purging old kernels simply means uninstalling
> them.  If this is the case, why is this something that boot has to block
> for?  I mean, once the system is up an running, I can always use zypper
> or rpm to manually remove old kernels.  So it's obviously something that
> *can* be done without interfering with my use of the machine.  I get why
> the bootup script might want to clean up old kernels every once in a
> while, but why can't it just launch a process that does this
> unobtrusively in the background?

AFAIK, it doesn't block here, other things continue running, even the
boot sequence. I can not check this instant, but I think I can login
while the job is running. I should be able to verify this tomorrow.

You do not say what release you are using.


The job simply calls on zypper to delete the oldest kernel after an update.

You can verify what it does by running:

systemctl cat purge-kernels.service


--
Cheers, Carlos.

Andrew

unread,
Apr 17, 2022, 3:16:31 AMApr 17
to
I have Leap 15.3 with the splash screen turned off so that I can see
what is going on. The script runs as part of the boot process and
*before* logging in is possible, this is obviously what Tristan sees as
well. In my case - on my old laptop, no ssd - it delays the appearance
of the login screen by just over a minute.
No idea if this is something new, I'll often boot and then get on with
something else for a minute or two. It *is* something I first noticed a
couple of days before Tristan reported it here.

Carlos E.R.

unread,
Apr 17, 2022, 6:28:08 AMApr 17
to
I booted this Leap 15.3 today after a kernel update. I did:

systemd-analyze plot >bootup.svg
eog bootup.svg


And I clearly see that the boot process continues running while
purge-kernels is running (for 41 seconds in my case).

It is the service "display-manager" which waits, apparently.


You can run "systemd-analyze critical-chain", but in my case
"purge-kernels" is not listed, which I think it means it does not delay
others.


I suggest you ask in the support mail list.


--
Cheers, Carlos.

Bit Twister

unread,
Apr 17, 2022, 9:48:24 AMApr 17
to
You can have a large delay if anything runs update-grub.
The large delay is caused by umount of each partition update-grub opened/mounted.

Tristan Miller

unread,
Apr 19, 2022, 8:05:15 AMApr 19
to
Dear Carlos,

On 17/04/2022 12.26, Carlos E.R. wrote:
> I booted this Leap 15.3 today after a kernel update. I did:
>
> systemd-analyze plot >bootup.svg
> eog bootup.svg
>
>
> And I clearly see that the boot process continues running while
> purge-kernels is running (for 41 seconds in my case).


I'm also running Leap 15.3. I produced an SVG plot as you suggested and
I see that you're right that the boot process continues while the
kernels are purged. However, it seems that multi-user.target and
graphical.target aren't reached until the purge is complete. So
contrary to what you recalled in your previous message, I can't actually
log in until the purge is complete.

Andrew

unread,
Apr 19, 2022, 12:10:58 PMApr 19
to
Tristan Miller wrote:
> Dear Carlos,
>
> On 17/04/2022 12.26, Carlos E.R. wrote:
>> I booted this Leap 15.3 today after a kernel update. I did:
>>
>> systemd-analyze plot >bootup.svg
>> eog bootup.svg
>>
>>
>> And I clearly see that the boot process continues running while
>> purge-kernels is running (for 41 seconds in my case).
>
>
> I'm also running Leap 15.3.  I produced an SVG plot as you suggested and
> I see that you're right that the boot process continues while the
> kernels are purged. However, it seems that multi-user.target and
> graphical.target aren't reached until the purge is complete.  So
> contrary to what you recalled in your previous message, I can't actually
> log in until the purge is complete.
>
> Regards,
> Tristan
>

Carlos also says
> It is the service "display-manager" which waits, apparently.

which is - functionally - what we are both saying, the system is not
actually useable until the kernels have been purged. The two of us see
the boot-process as being over when we can log in.

Carlos E.R.

unread,
Apr 19, 2022, 9:51:00 PMApr 19
to
On 2022-04-19 14:05, Tristan Miller wrote:
> Dear Carlos,
>
> On 17/04/2022 12.26, Carlos E.R. wrote:
>> I booted this Leap 15.3 today after a kernel update. I did:
>>
>> systemd-analyze plot >bootup.svg
>> eog bootup.svg
>>
>>
>> And I clearly see that the boot process continues running while
>> purge-kernels is running (for 41 seconds in my case).
>
>
> I'm also running Leap 15.3.  I produced an SVG plot as you suggested and
> I see that you're right that the boot process continues while the
> kernels are purged. However, it seems that multi-user.target and
> graphical.target aren't reached until the purge is complete.  So
> contrary to what you recalled in your previous message, I can't actually
> log in until the purge is complete.


Well, I did say in my second post that "display-manager" did not start
till "purge-kernels" finished.

So, again, I suggest you bring up the issue in the mail list, because I
do not know why "display-manager" waits.

--
Cheers, Carlos.

Andrew

unread,
May 16, 2022, 9:53:02 AMMay 16
to
Tristan Miller wrote:
> Greetings.
>
> Occasionally when I boot my machine, the system pauses for a minute or
> two with the message, "A start job is running for Purge old kernels".
>
> If I understand correctly, purging old kernels simply means uninstalling
> them.  If this is the case, why is this something that boot has to block
> for?  I mean, once the system is up an running, I can always use zypper
> or rpm to manually remove old kernels.  So it's obviously something that
> *can* be done without interfering with my use of the machine.  I get why
> the bootup script might want to clean up old kernels every once in a
> while, but why can't it just launch a process that does this
> unobtrusively in the background?
>
> Regards,
> Tristan
>

I have just updated a kernel on my test machine, if you submitted a bug
report it has not been acted upon (yet).

Andrew

unread,
Aug 12, 2022, 2:03:00 PMAug 12
to
Tristan Miller wrote:
> Greetings.
>
> Occasionally when I boot my machine, the system pauses for a minute or
> two with the message, "A start job is running for Purge old kernels".
>
> If I understand correctly, purging old kernels simply means uninstalling
> them.  If this is the case, why is this something that boot has to block
> for?  I mean, once the system is up an running, I can always use zypper
> or rpm to manually remove old kernels.  So it's obviously something that
> *can* be done without interfering with my use of the machine.  I get why
> the bootup script might want to clean up old kernels every once in a
> while, but why can't it just launch a process that does this
> unobtrusively in the background?
>
> Regards,
> Tristan
>

Having just updated a kernel on a Leap 15.4 machine, the system still
waits for the purge to complete.

The purge of the old kernels runs in parallel to the setup of my "wicked
managed network interfaces". On a system with SSD discs the purge takes
only slightly longer than the wicked setup. On my older system the
purge takes well over a minute, I'd guess at 80 seconds.

The older system has another problem anyway, my /boot partition is over
500MB and has around 50% free with the current kernel and the -1 kernel.
This is insufficient when it comes to installing a new kernel and I'm
going to have to start getting rid of the -1 kernel before installing
the new one. The beast is dual-boot with Windows 10 and I am not
prepared to risk moving the main Windows partion which is just behind /boot.

Uwe Bonnes

unread,
Aug 14, 2022, 4:09:45 PMAug 14
to
I also have the impression that the update jobs, e.g. for the locate
database run blocking at that point. Opensuse 15.3.
--
Uwe Bonnes b...@elektron.ikp.physik.tu-darmstadt.de

Institut fuer Kernphysik Schlossgartenstrasse 9 64289 Darmstadt
--------- Tel. 06151 1623569 ------- Fax. 06151 1623305 ---------

Carlos E.R.

unread,
Aug 20, 2022, 10:52:10 AMAug 20
to
On 2022-08-14 22:09, Uwe Bonnes wrote:
> Andrew <Do...@hyperspace.vogon.gov> wrote:


> I also have the impression that the update jobs, e.g. for the locate
> database run blocking at that point. Opensuse 15.3.

Not during boot.

--
Cheers, Carlos.

Carlos E.R.

unread,
Aug 20, 2022, 10:56:08 AMAug 20
to
On 2022-08-12 20:02, Andrew wrote:
> The older system has another problem anyway, my /boot partition is over
> 500MB and has around 50% free with the current kernel and the -1 kernel.
>  This is insufficient when it comes to installing a new kernel and I'm
> going to have to start getting rid of the -1 kernel before installing
> the new one.  The beast is dual-boot with Windows 10 and I am not
> prepared to risk moving the main Windows partion which is just behind
> /boot.

Try instead uninstalling "plymouth" (and then run mkinitrd).

This package does the graphic display during boot, and it makes the
kernel image much larger.

500 M should be enough.

Telcontar:~ # df -h | grep boot
/dev/nvme0n1p4 1011M 98M 862M 11% /boot
/dev/nvme0n1p1 500M 19M 482M 4% /boot/efi
Telcontar:~ #


--
Cheers, Carlos.

Andrew

unread,
Aug 20, 2022, 2:47:15 PMAug 20
to
Thanks, that particular machine is a test system so I tried it. It
still boots with no problems but I won't see if it really helped until
the next kernel comes along.
It's my only pre-UEFI system and has been running since 2010, which is
why the /boot is sized the way it is.

Carlos E.R.

unread,
Aug 21, 2022, 11:21:22 AMAug 21
to
You can simply do:

df -h /boot

before and after removing the package, to see the effect it has.

This is the file that changes:

cer@Telcontar:~> ls -lh /boot/initrd*

... 13M Aug 8 14:45 /boot/initrd-5.3.18-150300.59.63-default
... 13M Aug 8 14:45 /boot/initrd-5.3.18-150300.59.87-default


--
Cheers, Carlos.

Andrew

unread,
Aug 21, 2022, 4:11:39 PMAug 21
to
Oh, I did that immediately. The file was slightly smaller and the
partition dropped to 48% used.
Given that the previous 50% was with two kernels, an additional one
should still only be 75% before reverting to 50% once the oldest one had
been removed, I don't see any alternative to waiting for a new kernel
update.
The -1 kernel still has the Plymouth stuff in there so the next update
may fail until I remove it, and the following one could then still be
ok. Calculations will not help.

Carlos E.R.

unread,
Aug 22, 2022, 9:12:09 AMAug 22
to
Oh. I expected a significant difference. When I tested this was long
ago, though, so I suppose that now they are including so many things in
the initrd that it no longer makes an impact.

> Given that the previous 50% was with two kernels, an additional one
> should still only be 75% before reverting to 50% once the oldest one had
> been removed, I don't see any alternative to waiting for a new kernel
> update.
> The -1 kernel still has the Plymouth stuff in there so the next update
> may fail until I remove it, and the following one could then still be
> ok.  Calculations will not help.

Er... no, when you remove the package all the initrds are remade without
it. All kernels. Look at the dates of the files (see mine above, same
timestamp).

--
Cheers, Carlos.

Andrew

unread,
Sep 16, 2022, 4:52:21 PMSep 16
to
I suppose I could have said "you are right" (with the reduced size) but
I was waiting for a new kernel to come along. It has.

240 MB - Total size of /boot
107 MB - Used (with two kernels)
117 MB - Free
This means 48% of /boot is in use.
zypper still said it needed another 10 MB to install the new kernel.
Abort, retry, ignore? [a/r/i] (a):

The adventurous solution would have been to have tried "i" as in "do it
anyway". I copped out, removed the older kernel with Yast -> Software
Management (at which point 50-60 MB was in use) and then installed the
new one using zypper. The 240 / 107 / 117 / 48% figures still hold true.
I'm assuming zypper's calculation of how much it needs is at fault, the
additional kernel should have meant 160 MB was in use. zypper's
guesstimate of 127 MB for a new kernel seems ridiculous, unless there is
some compression going on there during the update process.
There are vmlinux-whatever.gz files in there which take 17-18 MB each,
if one takes 80 MB before compression that would explain a lot.

Carlos E.R.

unread,
Sep 17, 2022, 9:04:09 AMSep 17
to
When this happened to me I tried to find 10 meg I could move temporarily
to another partition. 240 megs is now too small. Mine is a gigabyte
(103M in use), of course after I changed the disk and reformatted.

--
Cheers, Carlos.


Andrew

unread,
Sep 18, 2022, 1:33:43 AMSep 18
to
This machine is ancient and is dual boot with Windows 10 (originally
Windows 7), I'll have to live with the pain.

Aragorn

unread,
Sep 18, 2022, 2:00:44 AMSep 18
to
On 18.09.2022 at 07:33, Andrew scribbled:

> Carlos E.R. wrote:
>
> > When this happened to me I tried to find 10 meg I could move
> > temporarily to another partition. 240 megs is now too small. Mine
> > is a gigabyte (103M in use), of course after I changed the disk and
> > reformatted.
>
> This machine is ancient and is dual boot with Windows 10 (originally
> Windows 7), I'll have to live with the pain.

Considering that you're also using Windows on that machine, living
with pain should be second nature to you by now. :p

--
With respect,
= Aragorn =

Reply all
Reply to author
Forward
0 new messages