# [solved] cleanup after kernel upgrade from 2.6.36 TO 3.3.8

## midway

Dear All,

After upgrading from kernel 2.6.36 to 3.3.8, I see the following at boot time:-

1. 3.3.8

2. 2.6.36

3. 2.6.34

4. 2.6.28

However eselect shows something different:

```

 ~ # eselect kernel list

Available kernel symlink targets:

  [1]   linux-2.6.36-hardened-r9

  [2]   linux-3.3.8-gentoo *

  [3]   linux-3.4.5-hardened

```

I followed the official upgrade guide (except the fact that update was not performed through portage as it could not find one):

http://www.gentoo.org/doc/en/kernel-upgrade.xml

```

 ~ # emerge -Du world

Calculating dependencies... done!

>>> Auto-cleaning packages...

>>> No outdated packages were found on your system.

 ~ # emerge -u gentoo-sources

Calculating dependencies... done!

>>> Verifying ebuild manifests

>>> Emerging (1 of 1) sys-kernel/gentoo-sources-3.3.8

>>> Downloading 'http://ftp.fi.muni.cz/pub/linux/gentoo/distfiles/linux-3.3.tar.bz2'

--2012-09-17 10:39:57--  http://ftp.fi.muni.cz/pub/linux/gentoo/distfiles/linux-3.3.tar.bz2

Resolving ftp.fi.muni.cz... 147.251.48.205, 2001:718:801:230::cd

Connecting to ftp.fi.muni.cz|147.251.48.205|:80... connected.

HTTP request sent, awaiting response... 200 OK

Length: 78963640 (75M) [application/x-bzip2]

Saving to: `/usr/portage/distfiles/linux-3.3.tar.bz2'

100%[======================================>] 78,963,640  2.57M/s   in 41s

2012-09-17 10:40:38 (1.84 MB/s) - `/usr/portage/distfiles/linux-3.3.tar.bz2' saved [78963640/78963640]

 * linux-3.3.tar.bz2 SHA256 SHA512 WHIRLPOOL size ;-) ...                                                                      [ ok ]

>>> Downloading 'http://ftp.fi.muni.cz/pub/linux/gentoo/distfiles/genpatches-3.3-9.base.tar.bz2'

--2012-09-17 10:40:44--  http://ftp.fi.muni.cz/pub/linux/gentoo/distfiles/genpatches-3.3-9.base.tar.bz2

Resolving ftp.fi.muni.cz... 147.251.48.205, 2001:718:801:230::cd

Connecting to ftp.fi.muni.cz|147.251.48.205|:80... connected.

HTTP request sent, awaiting response... 200 OK

Length: 220169 (215K) [application/x-bzip2]

Saving to: `/usr/portage/distfiles/genpatches-3.3-9.base.tar.bz2'

100%[======================================>] 220,169     1.05M/s   in 0.2s

2012-09-17 10:40:45 (1.05 MB/s) - `/usr/portage/distfiles/genpatches-3.3-9.base.tar.bz2' saved [220169/220169]

 * genpatches-3.3-9.base.tar.bz2 SHA256 SHA512 WHIRLPOOL size ;-) ...                                                          [ ok ]

>>> Downloading 'http://ftp.fi.muni.cz/pub/linux/gentoo/distfiles/genpatches-3.3-9.extras.tar.bz2'

--2012-09-17 10:40:45--  http://ftp.fi.muni.cz/pub/linux/gentoo/distfiles/genpatches-3.3-9.extras.tar.bz2

Resolving ftp.fi.muni.cz... 147.251.48.205, 2001:718:801:230::cd

Connecting to ftp.fi.muni.cz|147.251.48.205|:80... connected.

HTTP request sent, awaiting response... 200 OK

Length: 17199 (17K) [application/x-bzip2]

Saving to: `/usr/portage/distfiles/genpatches-3.3-9.extras.tar.bz2'

100%[======================================>] 17,199      --.-K/s   in 0.03s

2012-09-17 10:40:45 (593 KB/s) - `/usr/portage/distfiles/genpatches-3.3-9.extras.tar.bz2' saved [17199/17199]

 * genpatches-3.3-9.extras.tar.bz2 SHA256 SHA512 WHIRLPOOL size ;-) ...                                                        [ ok ]

>>> Preparing to unpack ...

>>> Unpacking source...

>>> Unpacking linux-3.3.tar.bz2 to /var/tmp/portage/sys-kernel/gentoo-sources-3.3.8/work

>>> Unpacking genpatches-3.3-9.base.tar.bz2 to /var/tmp/portage/sys-kernel/gentoo-sources-3.3.8/work/patches

>>> Unpacking genpatches-3.3-9.extras.tar.bz2 to /var/tmp/portage/sys-kernel/gentoo-sources-3.3.8/work/patches

 * Applying 1000_linux-3.3.1.patch (-p0+) ...

 * Applying 1002_linux-3.3.3.patch (-p0+) ...                                                                                  [ ok ]

 * Applying 1003_linux-3.3.4.patch (-p0+) ...                                                                                  [ ok ]

 * Applying 1004_linux-3.3.5.patch (-p0+) ...                                                                                  [ ok ]

 * Applying 1005_linux-3.3.6.patch (-p0+) ...                                                                                  [ ok ]

 * Applying 1006_linux-3.3.7.patch (-p0+) ...                                                                                  [ ok ]

 * Applying 1007_linux-3.3.8.patch (-p0+) ...                                                                                  [ ok ]

 * Applying 1700_tsunami-modpost-include-fix.patch (-p0+) ...                                                                  [ ok ]

 * Applying 2400_kcopy-patch-for-infiniband-driver.patch (-p0+) ...                                                            [ ok ]

 * Applying 4200_fbcondecor-0.9.6.patch (-p0+) ...                                                                             [ ok ]

>>> Source unpacked in /var/tmp/portage/sys-kernel/gentoo-sources-3.3.8/work

>>> Preparing source in /var/tmp/portage/sys-kernel/gentoo-sources-3.3.8/work/linux-3.3.8-gentoo ...

>>> Source prepared.

>>> Configuring source in /var/tmp/portage/sys-kernel/gentoo-sources-3.3.8/work/linux-3.3.8-gentoo ...

>>> Source configured.

>>> Compiling source in /var/tmp/portage/sys-kernel/gentoo-sources-3.3.8/work/linux-3.3.8-gentoo ...

>>> Source compiled.

>>> Test phase [not enabled]: sys-kernel/gentoo-sources-3.3.8

>>> Install gentoo-sources-3.3.8 into /var/tmp/portage/sys-kernel/gentoo-sources-3.3.8/image/ category sys-kernel

>>> Copying sources ...

>>> Completed installing gentoo-sources-3.3.8 into /var/tmp/portage/sys-kernel/gentoo-sources-3.3.8/image/

>>> Installing (1 of 1) sys-kernel/gentoo-sources-3.3.8

 * If you are upgrading from a previous kernel, you may be interested

 * in the following document:

 *   - General upgrade guide: http://www.gentoo.org/doc/en/kernel-upgrade.xml

 * For more info on this patchset, and how to report problems, see:

 * http://dev.gentoo.org/~mpagano/genpatches

>>> Recording sys-kernel/gentoo-sources in "world" favorites file...

 * Messages for package sys-kernel/gentoo-sources-3.3.8:

 * If you are upgrading from a previous kernel, you may be interested

 * in the following document:

 *   - General upgrade guide: http://www.gentoo.org/doc/en/kernel-upgrade.xml

>>> Auto-cleaning packages...

>>> No outdated packages were found on your system.

 * GNU info directory index is up-to-date.

~ # genkernel all

* Gentoo Linux Genkernel; Version 3.4.24_p2

* Running with options: all

* Linux Kernel 3.3.8-gentoo for x86...

mount: special device /dev/sda1 does not exist

* WARNING: Failed to mount /boot!

* kernel: Using config from /usr/share/genkernel/arch/x86/kernel-config

* kernel: >> Running mrproper...

*         >> Running oldconfig...

* kernel: >> Cleaning...

*         >> Compiling 3.3.8-gentoo bzImage...

>> Not installing firmware as it's included in the kernel already (CONFIG_FIRMWARE_IN_KERNEL=y)...

*         >> Compiling 3.3.8-gentoo modules...

```

```

 ~ # emerge --info

Portage 2.1.11.9 (hardened/linux/x86, gcc-4.5.4, glibc-2.15-r2, 3.3.8-gentoo i686)

=================================================================

System uname: Linux-3.3.8-gentoo-i686-Intel-R-_Xeon-R-_CPU_X5450_@_3.00GHz-with-gentoo-2.1

Timestamp of tree: Sun, 16 Sep 2012 23:45:01 +0000

app-shells/bash:          4.2_p37

dev-java/java-config:     2.1.11-r3

dev-lang/python:          2.7.3-r2, 3.2.3

dev-util/cmake:           2.8.1-r2

dev-util/pkgconfig:       0.27.1

sys-apps/baselayout:      2.1-r1

sys-apps/openrc:          0.9.8.4

sys-apps/sandbox:         2.5

sys-devel/autoconf:       2.68

sys-devel/automake:       1.11.6

sys-devel/binutils:       2.22-r1

sys-devel/gcc:            4.4.7, 4.5.4

sys-devel/gcc-config:     1.7.3

sys-devel/libtool:        2.4-r1

sys-devel/make:           3.82-r3

sys-kernel/linux-headers: 3.1 (virtual/os-headers)

sys-libs/glibc:           2.15-r2

Repositories: gentoo

ACCEPT_KEYWORDS="x86"

ACCEPT_LICENSE="* -@EULA dlj-1.1"

CBUILD="i686-pc-linux-gnu"

CFLAGS="-march=native -O2 -pipe -fomit-frame-pointer"

CHOST="i686-pc-linux-gnu"

CONFIG_PROTECT="/etc"

CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.3/ext-active/ /etc/php/cgi-php5.3/ext-active/ /etc/php/cli-php5.3/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"

CXXFLAGS="-march=native -O2 -pipe -fomit-frame-pointer"

DISTDIR="/usr/portage/distfiles"

FCFLAGS="-march=i686 -O2 -pipe"

FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles news parallel-fetch parse-eapi-ebuild-head protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"

FFLAGS="-march=i686 -O2 -pipe"

GENTOO_MIRRORS="ftp://mirrors.blueyonder.co.uk/mirrors/gentoo/"

LDFLAGS="-Wl,-O1 -Wl,--as-needed"

MAKEOPTS="-j4"

PKGDIR="/usr/portage/packages"

PORTAGE_CONFIGROOT="/"

PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --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=""

SYNC="rsync://abc.ac.uk/gentoo-portage"

USE="acl ads berkdb bzip2 cli cracklib crypt cups cxx dri gdbm gpm hardened iconv ipv6 jpeg modules mudflap mysql ncurses nls nptl openmp pam pax_kernel pcre perl pic png pppd python readline session ssl tcpd truetype unicode urandom x86 zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic auth_digest authn_anon authn_dbd authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock dbd deflate dir disk_cache env expires ext_filter file_cache filter headers ident imagemap include info log_config logio mem_cache mime mime_magic negotiation proxy proxy_ajp proxy_balancer proxy_connect proxy_http rewrite setenvif so speling status unique_id userdir usertrack vhost_alias cgi" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump" CAMERAS="ptp2" 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 evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" PHP_TARGETS="php5-3" PYTHON_TARGETS="python3_2 python2_7" RUBY_TARGETS="ruby18 ruby19" USERLAND="GNU" VIDEO_CARDS="apm ark chips cirrus cyrix dummy fbdev glint i128 i740 intel mach64 mga neomagic nsc nv r128 radeon rendition s3 s3virge savage siliconmotion sis sisusb tdfx tga trident tseng v4l vesa via vmware nouveau" 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"

Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, LINGUAS, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON

```

Many thanks.Last edited by midway on Tue Sep 18, 2012 10:24 am; edited 4 times in total

----------

## aCOSwt

 *nitish.anand wrote:*   

> Dear All,
> 
> After upgrading from kernel 2.6.36 to 3.3.8, I see the following at boot time:-
> 
> 1. 3.3.8
> ...

 

There is nothing really wrong in this.

The difference simply means that :

a/ you still get the 3.3.8 / 2.6.36 / 2.6.34 / 2.6.28 kernel bzimages in your /boot and they are still referenced in your bootloader configuration file

AND

b/ you removed from /usr/src the distributions of the 2.6.34 and 2.6.28 kernels.

AND 

c/ you keep a distribution for 3.4.5-hardened for which no kernel image is made available to the bootloader.

Apart from the fact that while being still able to boot under 2.6.34 / 2.6.28, you won't be able to update your non-in-kernel drivers for these versions of kernel. But you might well not care about this.

Then, depending of what you actually need / want as available kernels, you might want to do some cleaning, either in your boot config file & /boot or within your /usr/src dir.

----------

## midway

thx for the prompt reply aCOSwt.

Yes I do have the following:

```

~ # eselect kernel list

Available kernel symlink targets:

  [1]   linux-2.6.36-hardened-r9

  [2]   linux-3.3.8-gentoo *

  [3]   linux-3.4.5-hardened

 ~ # cd /usr/src/

.keep                     linux/                    linux-2.6.36-hardened-r9/ linux-3.3.8-gentoo/       linux-3.4.5-hardened/

 ~ # cd /boot/

.keep                                        initramfs-genkernel-x86-2.6.36-hardened-r6

System.map-genkernel-x86-2.6.28-hardened-r9  initramfs-genkernel-x86-2.6.36-hardened-r9

System.map-genkernel-x86-2.6.34-hardened-r3  initramfs-genkernel-x86-3.3.8-gentoo

System.map-genkernel-x86-2.6.36-hardened-r6  kernel-genkernel-x86-2.6.28-hardened-r9

System.map-genkernel-x86-2.6.36-hardened-r9  kernel-genkernel-x86-2.6.34-hardened-r3

System.map-genkernel-x86-3.3.8-gentoo        kernel-genkernel-x86-2.6.36-hardened-r6

boot/                                        kernel-genkernel-x86-2.6.36-hardened-r9

grub/                                        kernel-genkernel-x86-3.3.8-gentoo

initramfs-genkernel-x86-2.6.28-hardened-r9   memtest86plus/

initramfs-genkernel-x86-2.6.34-hardened-r3

```

I am after a prefered step to safely remove all the old kernels and any other related files on my server Could you point to a direction?

I saw this on one of the forums:

```

emerge -C <kernel-version>

rm -rf /usr/src/linux-<kernel-version>

rm -rf /lib/modules/<kernel-version>

rm -rf /boot/<bzImage>

```

----------

## aCOSwt

 *nitish.anand wrote:*   

> I am after a prefered step to safely remove all the old kernels and any other related files on my server Could you point to a direction?
> 
> I saw this on one of the forums:
> 
> ```
> ...

 

You are correct, being said that CAUTION, you will be using rm -r as root => TRIPLE check the operands before validating.

In addition to this, you can update (remove the unnecessary entries) your bootloader configuration file (/etc/lilo.conf if using lilo, something equivalent if you use grub. I don't know exactly what, I use lilo.)

----------

## midway

ok i have manually removed the modules and src. However, I am not sure about the files under boot (can I get rid of system map / init / genkernel for all old kernels). I have the following:

```

boot # ls -al

total 42512

drwxr-xr-x  4 root root    4096 Sep 12 15:38 .

drwx--x--x 19 root root    4096 Aug  9 09:46 ..

-rw-r--r--  1 root root       0 Sep 14 15:09 .keep

-rw-r--r--  1 root root 1211987 Oct 21  2009 System.map-genkernel-x86-2.6.28-hardened-r9

-rw-r--r--  1 root root 1459189 Sep  6  2010 System.map-genkernel-x86-2.6.34-hardened-r3

-rw-r--r--  1 root root 1489066 Jan 24  2011 System.map-genkernel-x86-2.6.36-hardened-r6

-rw-r--r--  1 root root 1489148 Feb  7  2011 System.map-genkernel-x86-2.6.36-hardened-r9

-rw-r--r--  1 root root 1603641 Sep 12 16:06 System.map-genkernel-x86-3.3.8-gentoo

lrwxrwxrwx  1 root root       1 Sep 10  2009 boot -> .

drwxr-xr-x  3 root root    4096 Sep 12 16:27 grub

-rw-r--r--  1 root root 4133501 Jan  4  2010 initramfs-genkernel-x86-2.6.28-hardened-r9

-rw-r--r--  1 root root 4246953 Sep  6  2010 initramfs-genkernel-x86-2.6.34-hardened-r3

-rw-r--r--  1 root root 4220754 Jan 24  2011 initramfs-genkernel-x86-2.6.36-hardened-r6

-rw-r--r--  1 root root 4218946 Feb  7  2011 initramfs-genkernel-x86-2.6.36-hardened-r9

-rw-r--r--  1 root root 4170499 Sep 12 16:27 initramfs-genkernel-x86-3.3.8-gentoo

-rw-r--r--  1 root root 2588944 Oct 21  2009 kernel-genkernel-x86-2.6.28-hardened-r9

-rw-r--r--  1 root root 3220736 Sep  6  2010 kernel-genkernel-x86-2.6.34-hardened-r3

-rw-r--r--  1 root root 3217696 Jan 24  2011 kernel-genkernel-x86-2.6.36-hardened-r6

-rw-r--r--  1 root root 3209280 Feb  7  2011 kernel-genkernel-x86-2.6.36-hardened-r9

-rw-r--r--  1 root root 3005552 Sep 12 16:06 kernel-genkernel-x86-3.3.8-gentoo

drwxr-xr-x  2 root root      59 Sep 14 15:09 memtest86plus

```

and 3.3.8 is the active one (also I would like to keep 2.6.36-hardened-r9 too)  :Smile: Last edited by midway on Mon Sep 17, 2012 2:38 pm; edited 1 time in total

----------

## aCOSwt

 *nitish.anand wrote:*   

> ok i have manually removed the modules and src. However, I am not sure about the files under boot (can I get rid of system map / init / genkernel for all old kernels).

 

Yes you can.

----------

## midway

thx aCOSwt. 

removed all except 3.3.8 and 2.6.36-r9

machine reboots into the active 3.3.8 fine  :Smile: 

however, I still see the earlier kernels listed at boot time. 

Have I missed something else?Last edited by midway on Tue Sep 18, 2012 10:12 am; edited 1 time in total

----------

## aCOSwt

 *nitish.anand wrote:*   

> 
> 
> however, I still see the earlier kernels listed at boot time. 
> 
> Have I missed something else?

 

Yes !

Chances are that you forgot to update your bootloader configuration file. (deleting no longer needed entries)

As I can see you use grub => /boot/grub/grub.conf

----------

## midway

Great, that solved the problem. many thanks.  :Smile: 

----------

