Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 488430 - app-admin/eclean-kernel - Add support for renamed kernels (.old)
Summary: app-admin/eclean-kernel - Add support for renamed kernels (.old)
Status: RESOLVED TEST-REQUEST
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal enhancement (vote)
Assignee: Michał Górny
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-10-17 22:34 UTC by Derk W te Bokkel
Modified: 2016-07-20 21:58 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
eclean-kernel-testing.txt compare old and new on a third machine (eclean-kernel-testing.txt,1.39 KB, text/plain)
2016-07-19 20:12 UTC, Derk W te Bokkel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Derk W te Bokkel 2013-10-17 22:34:15 UTC
eclean-kernel --list-kernels

3.11.5-gentoo [3.11.5-gentoo]:
- vmlinuz: /boot/vmlinuz-3.11.5-gentoo
- systemmap: /boot/System.map-3.11.5-gentoo
- config: /boot/config-3.11.5-gentoo
- modules: /lib64/modules/3.11.5-gentoo
- build: /usr/src/linux-3.11.5-gentoo
3.11.4-gentoo [3.11.4-gentoo]:
- vmlinuz: /boot/vmlinuz-3.11.4-gentoo
- systemmap: /boot/System.map-3.11.4-gentoo
- config: /boot/config-3.11.4-gentoo
- modules: /lib64/modules/3.11.4-gentoo
- build: /usr/src/linux-3.11.4-gentoo
3.11.4-gentoo.old [3.11.4-gentoo]:
- vmlinuz: /boot/vmlinuz-3.11.4-gentoo.old
- systemmap: /boot/System.map-3.11.4-gentoo.old
- config: /boot/config-3.11.4-gentoo.old
- modules: /lib64/modules/3.11.4-gentoo
- build: /usr/src/linux-3.11.4-gentoo

eclean-kernel -n 2 --debug
* Trying bootloader lilo
* Trying bootloader grub2
** /boot/grub/grub.cfg found
* In get_removal_list()
** Config is autogenerated, ignoring
Preserving currently running kernel (3.11.5-gentoo)
No outdated kernels found.
 
-- does not remove 3.11.4-gentoo.old :(


emerge --info eclean-kernel
Portage 2.2.7 (default/linux/amd64/13.0, gcc-4.8.1, glibc-2.17, 3.11.5-gentoo x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-3.11.5-gentoo-x86_64-Intel-R-_Core-TM-2_Duo_CPU_T5870_@_2.00GHz-with-gentoo-2.2
KiB Mem:     4007720 total,   1048932 free
KiB Swap:    8201176 total,   8200848 free
Timestamp of tree: Thu, 17 Oct 2013 20:45:01 +0000
ld GNU ld (GNU Binutils) 2.23.2
app-shells/bash:          4.2_p45
dev-java/java-config:     2.2.0
dev-lang/python:          2.7.5-r3, 3.2.5-r3, 3.3.2-r2
dev-util/cmake:           2.8.11.2
dev-util/pkgconfig:       0.28
sys-apps/baselayout:      2.2
sys-apps/openrc:          0.12.2
sys-apps/sandbox:         2.6-r1
sys-devel/autoconf:       2.13, 2.69
sys-devel/automake:       1.11.6, 1.13.4, 1.14
sys-devel/binutils:       2.23.2
sys-devel/gcc:            4.8.1-r1
sys-devel/gcc-config:     1.8
sys-devel/libtool:        2.4.2
sys-devel/make:           3.82-r4
sys-kernel/linux-headers: 3.11 (virtual/os-headers)
sys-libs/glibc:           2.17
Repositories: gentoo xfce-dev x-portage derk-personal
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -pipe"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="--autounmask --autounmask-write --quiet-build=y"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="en_US.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j4"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/var/lib/layman/xfce-dev /usr/local/portage /home/derk/portage"
SYNC="rsync://rsync.namerica.gentoo.org/gentoo-portage"
USE="X a52 aac acl alsa amd64 apng archive avcodec avformat berkdb bzip2 cairo cdda cddb cdr cifs cli cracklib crypt cups cxx dbus dri dvd dvdr encode ffmpeg flac fortran fuse gallium gdbm gnutls gphoto2 gpm gstreamer gtk gtk3 iconv id3tag ipv6 java jpeg jpeg2k lame lcms libnotify live mad mmx modules mp3 mpeg mudflap multilib ncurses nfs nls nptl ntp ogg opengl openmp openrc opus pam parted pcre pdf pm-utils png postproc ppds qt4 readline samba scanner session sna sqlite sse sse2 ssl ssse3 startup-notification svg tcpd theora threads tiff truetype twolame udev unicode v4l vdpau vorbis vpx wav webm wma wma-fixed x264 xcb xinerama xorg xvid zlib" ABI_X86="64" ALSA_CARDS="hda-intel" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="*" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="keyboard mouse synaptics evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer nlpsolver" LINGUAS="en en_GB en_US" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_2 python2_7 python3_2 python3_3" RUBY_TARGETS="ruby19 ruby18" USERLAND="GNU" VIDEO_CARDS="intel" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
USE_PYTHON=" 2.7 3.2 3.3"
Unset:  CPPFLAGS, CTARGET, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

=================================================================
                        Package Settings
=================================================================

app-admin/eclean-kernel-9999 was built with the following:
USE="" PYTHON_TARGETS="python2_7 python3_2 python3_3 -pypy2_0 -python2_6"
Comment 1 Tom Wijsman (TomWij) (RETIRED) gentoo-dev 2013-10-17 23:10:59 UTC
As you can see on its homepage, it doesn't support this syntax yet; would be a nice feature to have, I used to keep backup kernels around in the early days too and now I rename them to have Nouveau and NVIDIA specific boots.
Comment 2 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2013-10-18 04:06:52 UTC
Could you please use '--list-kernels' with the today's -9999 version? I've added additional info about mtime which could help debug this.
Comment 3 Derk W te Bokkel 2013-10-18 11:16:39 UTC
as requested:

eclean-kernel --list-kernels
3.11.4-gentoo [3.11.4-gentoo]:
- vmlinuz: /boot/vmlinuz-3.11.4-gentoo
- systemmap: /boot/System.map-3.11.4-gentoo
- config: /boot/config-3.11.4-gentoo
- modules: /lib64/modules/3.11.4-gentoo
- build: /usr/src/linux-3.11.4-gentoo
- last modified: 2013-10-14 20:51:04
3.11.4-gentoo.old [3.11.4-gentoo]:
- vmlinuz: /boot/vmlinuz-3.11.4-gentoo.old
- systemmap: /boot/System.map-3.11.4-gentoo.old
- config: /boot/config-3.11.4-gentoo.old
- modules: /lib64/modules/3.11.4-gentoo
- build: /usr/src/linux-3.11.4-gentoo
- last modified: 2013-10-14 20:40:13
3.11.5-gentoo [3.11.5-gentoo]:
- vmlinuz: /boot/vmlinuz-3.11.5-gentoo
- systemmap: /boot/System.map-3.11.5-gentoo
- config: /boot/config-3.11.5-gentoo
- modules: /lib64/modules/3.11.5-gentoo
- build: /usr/src/linux-3.11.5-gentoo
- last modified: 2013-10-14 17:58:47
Comment 4 Derk W te Bokkel 2013-10-18 11:31:14 UTC
Ah does eclean-kernel base age on mtime .. (or really install time) .. So when trying to generate a sample for earlier testing of grub.cfg generation .. I rebuilt/installed an "earlier kernel version" it changed the mtime to be newer and now " the old does not get removed .. as the running kernel is the oldest mtime .. so reinstall of running kernel should fix this ? 

As an aside .. the kernel "make install" creates the .old suffixes on reinstalls .. for the same versions .. the .olds should be removed preferentially before other versions in my opinion .. but others may differ .. 

tested:

 eclean-kernel --list-kernels
 
3.11.5-gentoo [3.11.5-gentoo]:
- vmlinuz: /boot/vmlinuz-3.11.5-gentoo
- systemmap: /boot/System.map-3.11.5-gentoo
- config: /boot/config-3.11.5-gentoo
- modules: /lib64/modules/3.11.5-gentoo
- build: /usr/src/linux-3.11.5-gentoo
- last modified: 2013-10-18 11:27:17
3.11.4-gentoo [3.11.4-gentoo]:
- vmlinuz: /boot/vmlinuz-3.11.4-gentoo
- systemmap: /boot/System.map-3.11.4-gentoo
- config: /boot/config-3.11.4-gentoo
- modules: /lib64/modules/3.11.4-gentoo
- build: /usr/src/linux-3.11.4-gentoo
- last modified: 2013-10-14 20:51:04
3.11.4-gentoo.old [3.11.4-gentoo]:
- vmlinuz: /boot/vmlinuz-3.11.4-gentoo.old
- systemmap: /boot/System.map-3.11.4-gentoo.old
- config: /boot/config-3.11.4-gentoo.old
- modules: /lib64/modules/3.11.4-gentoo
- build: /usr/src/linux-3.11.4-gentoo
- last modified: 2013-10-14 20:40:13
3.11.5-gentoo.old [3.11.5-gentoo]:
- vmlinuz: /boot/vmlinuz-3.11.5-gentoo.old
- systemmap: /boot/System.map-3.11.5-gentoo.old
- config: /boot/config-3.11.5-gentoo.old
- modules: /lib64/modules/3.11.5-gentoo
- build: /usr/src/linux-3.11.5-gentoo
- last modified: 2013-10-14 17:58:47

eclean-kernel -n 2 --debug
* Trying bootloader lilo
* Trying bootloader grub2
** /boot/grub/grub.cfg found
* In get_removal_list()
** Config is autogenerated, ignoring
* Removing kernel 3.11.4-gentoo.old (not referenced by bootloader (grub2))
- /boot/vmlinuz-3.11.4-gentoo.old
- /boot/System.map-3.11.4-gentoo.old
- /boot/config-3.11.4-gentoo.old
* Removing kernel 3.11.5-gentoo.old (not referenced by bootloader (grub2))
- /boot/vmlinuz-3.11.5-gentoo.old
- /boot/System.map-3.11.5-gentoo.old
- /boot/config-3.11.5-gentoo.old
Removed 2 kernels
* Calling grub2-mkconfig
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-3.11.5-gentoo
Found linux image: /boot/vmlinuz-3.11.4-gentoo
Found Gentoo Base System release 2.2 on /dev/sda1
done
Comment 5 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2013-10-18 18:40:49 UTC
Yes, it uses mtime of vmlinuz purely. I didn't really want to implement any kind of version parsing since that would be complex and wouldn't be able to handle all the different cases (like having multiple variants of kernels or installing older version of kernel for some reason).
Comment 6 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2016-07-19 13:39:16 UTC
With testing pre-release of ek2 (1.99.0), it does version comparison now. I think it should fix your issue (and introduce a ton others ;-)).
Comment 7 Derk W te Bokkel 2016-07-19 18:51:37 UTC
mm tried the  newest version .. 

version 1.99 or 9999
on one computer inside chroot of a full install on disk

total 48100
-rw-r--r-- 1 root root 4344723 Jul 19 14:37 System.map-4.6.3-gentoo
-rw-r--r-- 1 root root 4344723 Jun 25 08:52 System.map-4.6.3-gentoo.old
-rw-r--r-- 1 root root 4344723 Jul 19 14:37 System.map-4.6.4-gentoo
-rw-r--r-- 1 root root 4344723 Jul 14 19:27 System.map-4.6.4-gentoo.old
lrwxrwxrwx 1 root root       1 Dec  3  2014 boot -> .
-rw-r--r-- 1 root root  105615 Jul 19 14:37 config-4.6.3-gentoo
-rw-r--r-- 1 root root  105615 Jun 25 08:52 config-4.6.3-gentoo.old
-rw-r--r-- 1 root root  105615 Jul 19 14:37 config-4.6.4-gentoo
-rw-r--r-- 1 root root  105615 Jul 14 19:27 config-4.6.4-gentoo.old
drwxr-xr-x 6 root root    4096 Jul 14 19:28 grub
-rw-r--r-- 1 root root 7858848 Jul 19 14:37 vmlinuz-4.6.3-gentoo
-rw-r--r-- 1 root root 7858848 Jun 25 08:52 vmlinuz-4.6.3-gentoo.old
-rw-r--r-- 1 root root 7859008 Jul 19 14:37 vmlinuz-4.6.4-gentoo
-rw-r--r-- 1 root root 7859008 Jul 14 19:27 vmlinuz-4.6.4-gentoo.old


eclean-kernel -p -n 2 
The following kernels would be removed:
Segmentation fault (core dumped)

previously on another machine on the live drive

eclean-kernel -n 2

.. unfortunately it clobbered .. removed without a trace .. all the sources including the most current installed sources -- definitely not desired, all the modules in /lib/modules .. including the running kernel modules .. in /boot it clobbers every version except the running version 4.6.4 also leaves the  .old version with it anyways not leaving the 4.6.3 non-.old version instead ..

The way I envisioned this working  was *.old are clobbered first then the check is done for how many kernels remain .. the most recent "-n 2" of these is left alone .. /lib/modules , /usr/src etc. are also untouched  every other kernel older is then clobbered ..

I am continuing to test .. rebuilding the installed kernels to try again ..
Comment 8 Derk W te Bokkel 2016-07-19 19:01:36 UTC
inside chroot 

eclean-kernel -l
4.6.3-gentoo.old:
- kernel: /boot/vmlinuz-4.6.3-gentoo.old
- build: /usr/src/linux-4.6.3-gentoo
- modules: /lib/modules/4.6.3-gentoo
- aux: /boot/System.map-4.6.3-gentoo.old
- aux: /boot/config-4.6.3-gentoo.old
4.6.3-gentoo:
- aux: /boot/config-4.6.3-gentoo
- kernel: /boot/vmlinuz-4.6.3-gentoo
Segmentation fault (core dumped)
zlink1 / # ls /boot
System.map-4.6.3-gentoo      config-4.6.3-gentoo      vmlinuz-4.6.3-gentoo
System.map-4.6.3-gentoo.old  config-4.6.3-gentoo.old  vmlinuz-4.6.3-gentoo.old
System.map-4.6.4-gentoo      config-4.6.4-gentoo      vmlinuz-4.6.4-gentoo
System.map-4.6.4-gentoo.old  config-4.6.4-gentoo.old  vmlinuz-4.6.4-gentoo.old
boot                         grub

????!!!
Comment 9 Derk W te Bokkel 2016-07-19 19:18:37 UTC
the one that got destroyed .. now rebuilt

eclean-kernel -l
4.6.3-gentoo.old:- aux: /boot/System.map-4.6.3-gentoo.old
- kernel: /boot/vmlinuz-4.6.3-gentoo.old
- modules: /lib/modules/4.6.3-gentoo
- build: /usr/src/linux-4.6.3-gentoo
- aux: /boot/config-4.6.3-gentoo.old
4.6.3-gentoo:- aux: /boot/config-4.6.3-gentoo
- aux: /boot/System.map-4.6.3-gentoo
- kernel: /boot/vmlinuz-4.6.3-gentoo
Segmentation fault

ls -l /boot
total 43212
-rw-r--r-- 1 root root 4058546 Jul 19 15:14 System.map-4.6.3-gentoo
-rw-r--r-- 1 root root 4058546 Jul 19 15:14 System.map-4.6.3-gentoo.old
-rw-r--r-- 1 root root 4058546 Jul 19 15:15 System.map-4.6.4-gentoo
-rw-r--r-- 1 root root 4058546 Jul 19 14:33 System.map-4.6.4-gentoo.old
lrwxrwxrwx 1 root root       1 Dec  8  2015 boot -> .
-rw-r--r-- 1 root root  111733 Jul 19 15:14 config-4.6.3-gentoo
-rw-r--r-- 1 root root  111733 Jul 19 15:14 config-4.6.3-gentoo.old
-rw-r--r-- 1 root root  111733 Jul 19 15:15 config-4.6.4-gentoo
-rw-r--r-- 1 root root  111733 Jul 19 14:33 config-4.6.4-gentoo.old
drwxr-xr-x 6 root root    4096 Jul 19 15:15 grub
-rw-r--r-- 1 root root 6885280 Jul 19 15:14 vmlinuz-4.6.3-gentoo
-rw-r--r-- 1 root root 6885280 Jul 19 15:14 vmlinuz-4.6.3-gentoo.old
-rw-r--r-- 1 root root 6885696 Jul 19 15:15 vmlinuz-4.6.4-gentoo
-rw-r--r-- 1 root root 6885696 Jul 19 14:33 vmlinuz-4.6.4-gentoo.old
Comment 10 Derk W te Bokkel 2016-07-19 19:28:01 UTC
version 4.2 gives  (as per comment 9 machine)
eclean-kernel -l
4.6.4-gentoo [4.6.4-gentoo]:
- vmlinuz: /boot/vmlinuz-4.6.4-gentoo
- systemmap: /boot/System.map-4.6.4-gentoo
- config: /boot/config-4.6.4-gentoo
- modules: /lib64/modules/4.6.4-gentoo
- build: /usr/src/linux-4.6.4-gentoo
- last modified: 2016-07-19 19:15:00
4.6.3-gentoo [4.6.3-gentoo]:
- vmlinuz: /boot/vmlinuz-4.6.3-gentoo
- systemmap: /boot/System.map-4.6.3-gentoo
- config: /boot/config-4.6.3-gentoo
- modules: /lib64/modules/4.6.3-gentoo
- build: /usr/src/linux-4.6.3-gentoo
- last modified: 2016-07-19 19:14:39
4.6.3-gentoo.old [4.6.3-gentoo]:
- vmlinuz: /boot/vmlinuz-4.6.3-gentoo.old
- systemmap: /boot/System.map-4.6.3-gentoo.old
- config: /boot/config-4.6.3-gentoo.old
- modules: /lib64/modules/4.6.3-gentoo
- build: /usr/src/linux-4.6.3-gentoo
- last modified: 2016-07-19 19:14:10
4.6.4-gentoo.old [4.6.4-gentoo]:
- vmlinuz: /boot/vmlinuz-4.6.4-gentoo.old
- systemmap: /boot/System.map-4.6.4-gentoo.old
- config: /boot/config-4.6.4-gentoo.old
- modules: /lib64/modules/4.6.4-gentoo
- build: /usr/src/linux-4.6.4-gentoo
- last modified: 2016-07-19 18:33:21

FYI
Comment 11 Derk W te Bokkel 2016-07-19 20:12:00 UTC
Created attachment 441166 [details]
eclean-kernel-testing.txt compare old and new on a third machine

more testing .. failure to list ... is it related to age of the files .. this is on a third live machine ..

on my first initial tests (on first live machine) new version did not crash .. but on rebuild of /boot to similar state it did. I added .old files by doing make install modules_install from src directories again ..

odd results that it does not work now .. when it did work .. I failed to copy the actual output ... sorry
Comment 12 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2016-07-19 20:22:07 UTC
I guess I need to verify that I didn't break .old handling in late refactor. I'll take a look at it tomorrow.
Comment 13 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2016-07-19 20:30:24 UTC
It actually turned out to be a trivial over-optimization, and I've fixed it in -9999 now.

As for the behavior regarding .old, I think the current one makes more sense. It is especially important if you modify the current kernel, rebuild it and then figure out the new version doesn't work. Then you'd rather have the known-working .old than some older version.

It also fits 'make install' behavior better -- i.e. vmlinuz.old points at previous kernel, possibly moved to .old.
Comment 14 Derk W te Bokkel 2016-07-20 00:24:06 UTC
yeah that seems to work better .. I suspect the boot loader config (i.e. grub2-mkconfig, lilo, etc) is not yet called in the new version  ..
Comment 15 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2016-07-20 20:52:55 UTC
(In reply to Derk W te Bokkel from comment #14)
> yeah that seems to work better .. I suspect the boot loader config (i.e.
> grub2-mkconfig, lilo, etc) is not yet called in the new version  ..

Yes, I'm still thinking how to solve that best. I'll probably go for not having any specific Bootloader classes like before, and instead create a regular post-removal event for grub2.

I suspect all of bootloader support you need is to call grub2-mkconfig (or something like this), correct?
Comment 16 Derk W te Bokkel 2016-07-20 21:58:56 UTC
yes normal grub2 command line is:

grub2-mkconfig -o /boot/grub/grub.cfg