Debian Codegraph @

upstream/mageia-cauldron/man1/remove-old-kernels.1

raw
1 .TH remove-old-kernels "31 Jan 2026"
2 .SH NAME
3 remove-old-kernels \- Utility to remove obsolete kernels in Mageia Systems using urpme.
4 .SH SYNOPSIS
5 \fBremove-old-kernels\fP [\fI\-option\fP]
6
7 \fBrok\fP [\fI\-option\fP]
8
9 .SH DESCRIPTION
10 \fBremove-old-kernels\fR runs automatically under cron.weekly using configuration settings in /etc/remove-old-kernels.cfg. This is the default in order to avoid system failure due to old kernels filling the root file system.
11 .br
12 For most users it can be left, as installed, to do it's job without any user intervention or concern.
13
14 .br
15 It keeps the default (3) kernels of EACH kernel flavour, NOT 3 in total. If there are kernels of various flavours installed, then only the flavours with more than 3 would see any removed.
16
17 .br
18 In a LIVE system with persistence only one kernel plus the original is kept, since only those two are bootable.
19
20 .br
21 It will never remove the running kernel, or the original kernel in a LIVE system with persistence.
22
23 .br
24 If the running kernel has been accidentally removed by some utility since boot then it will report the error and abort, removing nothing.
25
26 \fBremove-old-kernels\fP also allows interactive command\-line removal of kernel packages using various options.
27
28 \fBremove-old-kernels\fR with no arguments as a regular user, will display the current kernel(s) installed, the one in use, marked with 'U', and the ones it suggests to remove in red, if any.
29 .br
30 This is a good way to make a quick check without any risk of error.
31
32 \fBremove-old-kernels\fP is also available from the Mageia main menu system in graphical desktops for ease of use by users unfamiliar with the command line. Usually found under Tools -> System Tools. It will ask for the root password.
33
34 \fBIn automatic mode a log is kept at /var/log/remove-old-kernels.log. The log is limited to 1000 lines (up to a year) and will then start to remove the oldest entries whilst adding new ones. See the -l option to view the log.
35 .br
36
37 .SH DISPLAY
38
39 .TP
40 \fB\The header bar.
41 This shows:
42 .br
43 1 - The system release information.
44 .br
45 2 - The number of kernels found in the /boot directory
46 .br
47 3 - Whether the automatic mode is on (1) or off (0). '0' is highlighted in red as a warning when off.
48 .br
49 4 - The number of kernels to be kept per flavour.
50 .br
51 5 - Whether in advanced mode. e.g.| Q | Not shown when OFF.
52 .br
53 6 - The alternate configuration file in use. Not shown for the main configuration file. e.g. F:1
54
55 .TP
56 \fB\The list columns.
57 .br
58 1 - shows the number of kernels found of each flavour.
59 .br
60 2 - indicates whether the kernel will be kept or removed.
61 .br
62 3 - shows a key letter to indicate the reason for keeping. Run 'rok -h' for key.
63 .br
64 4 - shows the full kernel package name concerned.
65 .br
66 5 - shows the date and time that the kernel was installed.
67
68 .SH CONFIGURATION
69
70 \fBThe configuration file is /etc/remove-old-kernels.cfg which may be edited manually if desired.
71 .br
72 \fBThere are several options below which can also be used more conveniently to change settings in the configuration file
73 from the command line when run as root.
74 .br
75 .br
76 Several alternate configuration files may be added manually if desired. They must be named as follows:
77 .br
78 /etc/remove-old-kernels_N.cfg where N is a digit from 1 to 9.
79 .br
80 A template configuration file is provided containing default values which may be copied:
81 /usr/share/doc/remove-old-kernels/remove-old-kernels_N.cfg.template.
82 .br
83 To use a new alternate configuration file for the current run you can use the -f N option, or -F N to switch to it persistently.
84 NOTE that any changes like auto ON/OFF, or the number of kernels to keep, that are made while running an alternate configuration
85 will be saved to THAT configuration file. They will not affect the default 'main' configuration.
86 .br
87 To switch back to the original configuration use -F 0.
88
89 .SH OPTIONS
90
91 .TP
92 \fI\-h -?\fP help
93
94 Displays the available options and a key to column 3 of the display.
95
96 .TP
97 \fI\-n N\fP Set the number of kernels to keep. ONLY for the current run. (No effect in LIVE Systems)
98
99 This parameter sets the number of kernels to keep (this time) in interactive mode. It must be 2 or more, it's value may be restricted by the setting in etc/dnf/dnf.conf if dnf is installed, in which case there is an on-screen warning. dnf sets a default value of 3.
100
101 .TP
102 \fI\-N N\fP Like -n but stores the 'number of kernels to keep' persistently in the config file. e.g. -N 4 (No effect in LIVE Systems)
103
104 It must be run as root to take effect.
105
106 .TP
107 \fI\-a\fP automatic mode. Run once with no questions asked.
108
109 Similar to the weekly cron job and will use settings from /etc/remove-old-kernels.cfg.
110 .br
111 It may be used with the -n N option if desired. NOTE: No output is sent to the log when run manually.
112
113 .TP
114 \fI\-A [1|0]\fP Automatic mode ON/OFF switch.
115
116 This switches the automatic weekly run ON (1) or OFF (0).
117 It directly edits /etc/remove-old-kernels.cfg (or an alternate config file if it is currently in use), setting CRON=1 or CRON=0 so must be run as root to have any effect.
118
119 .TP
120 \fI\-c\fP Special option for system automatic mode. This option is NOT intended for manual use.
121
122 Checks if CRON=1 is in /etc/remove-old-kernels.cfg before running, or exits. The output is logged to /var/log/remove-old-kernels.log.
123 It is run by /etc/cron.weekly/remove-old-kernels.cron which also trims the log to 1000 lines if it is greater. This equates to something over one year of use for basic systems.
124 See the -l option for viewing the log.
125
126 .TP
127 \fI\-f N\fP Switch to an alternate configuration file. ONLY for the current run.
128
129 N is any number from 1 to 9. Alternate configuration files need to be prepared in advance.
130
131 .TP
132 \fI\-F N\fP Switch to an alternate configuration file. Persistently. (Must be root)
133
134 N is any number from 0 to 9. (0 returns to main configuration file). Alternate configuration files need to be prepared in advance.
135
136 .TP
137 \fI\-t\fP Test mode.
138
139 A test mode where no kernel is removed, to show what would be done. NOTE: If combined with options that change configuration then
140 when run as root those options will still work.
141
142 .TP
143 \fI\-p\fP Preview mode.
144
145 Dry run showing the urpme commands that would be used.
146
147 .TP
148 \fI\-q\fP Advanced mode, run once.
149
150 An advanced mode (developed for Mageia QA testers).
151 .br
152 In addition to the regular mode, when ON this will also NOT remove:
153 .br
154 A kernel devel package of the same version as a corresponding installed kernel, unless the kernel is going to be removed as well.
155 .br
156 A kernel potentially needed by an installed virtualbox kernel latest.
157 .br
158 A kernel potentially needed by an installed xtables-addons kernel latest.
159
160 .TP
161 \fI\-Q N\fP Advanced mode, persistent. OFF by default.
162 When ON, "Q" is displayed near the right end of the header bar.
163
164 N = 1 for enable, 0 to disable. Default disabled.
165
166 .TP
167 \fI\-l \fP Display the log file. (Only created by the weekly automatic runs)
168 .br
169 The last ~1000 lines of the log are retained. If no log has yet been created then it will exit.
170
171 .TP
172 \fI\-v\fP Show the version of the installed remove-old-kernels package.
173
174 .SH EXAMPLES
175 \fBrok\fP
176 .br
177 A shorthand link to 'remove-old-kernels'. Run as root to remove kernels or change settings.
178
179 \fBremove-old-kernels -n4\fP
180 .br
181 Remove old kernels interactively, this time, keeping 4 kernels of each flavour.
182
183 \fBrok -l\fP
184 .br
185 Display the log file.
186
187 .SH BUGS
188 None known. Report any issues with the program or documentation to https://bugs.mageia.org/
189
190 .SH AUTHOR
191 \fBremove-old-kernels is by Pierre Jarillon (2018-2021) Jean-Baptiste Biernacki (2021) Barry C Jackson (2022-2026)\fP
192 This document is by Barry C Jackson <[email protected]>.