# emerge linux-headers changing my symlink? [SOLVED]

## OneOfMany

I just did an "emerge -e world" and noticed for the (at least) second time that my /usr/src/linux symlink was pointing to an older version of linux than emerge -s gentoo-sources claimed was installed.  Both times this has happened I've noticed I had an older linux directory in /usr/src than I remember installing too.  It turns out the linux-headers version is the same as that directory's version number.

So not hard to fix, but odd.  Is this a portage problem?  And am I supposed to get a directory in /usr/src for the headers version?  I thought I didn't a while back, but I could be wrong...Last edited by OneOfMany on Thu Sep 20, 2007 4:37 am; edited 2 times in total

----------

## Hu

What versions of the headers and sources are you using?  The output of emerge --info; emerge -p -v gentoo-sources would be useful.

----------

## OneOfMany

*  sys-kernel/linux-headers

      Latest version available: 2.6.21

      Latest version installed: 2.6.21

*  sys-kernel/gentoo-sources

      Latest version available: 2.6.22-r5

      Latest version installed: 2.6.22-r5

```

Portage 2.1.2.12 (default-linux/x86/2007.0, gcc-4.1.2, glibc-2.5-r4, 2.6.22-gentoo-r5 i686)

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

System uname: 2.6.22-gentoo-r5 i686 Intel(R) Core(TM)2 CPU 6600 @ 2.40GHz

Gentoo Base System release 1.12.9

Timestamp of tree: Wed, 12 Sep 2007 19:50:01 +0000

ccache version 2.4 [enabled]

app-shells/bash:     3.2_p17

dev-java/java-config: 1.3.7, 2.0.33-r1

dev-lang/python:     2.4.4-r4

dev-python/pycrypto: 2.0.1-r6

dev-util/ccache:     2.4-r7

sys-apps/baselayout: 1.12.9-r2

sys-apps/sandbox:    1.2.17

sys-devel/autoconf:  2.13, 2.61-r1

sys-devel/automake:  1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10

sys-devel/binutils:  2.17

sys-devel/gcc-config: 1.3.16

sys-devel/libtool:   1.5.24

virtual/os-headers:  2.6.21

ACCEPT_KEYWORDS="x86"

CBUILD="i686-pc-linux-gnu"

CFLAGS="-march=nocona -O3 -pipe"

CHOST="i686-pc-linux-gnu"

CONFIG_PROTECT="/etc /usr/share/X11/xkb"

CONFIG_PROTECT_MASK="/etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/revdep-rebuild /etc/terminfo"

CXXFLAGS="-march=nocona -O3 -pipe"

DISTDIR="/usr/portage/distfiles"

FEATURES="ccache distlocks metadata-transfer parallel-fetch sandbox sfperms strict"

GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/linux/distributions/gentoo"

LANG="en_US.UTF-8"

LINGUAS="en"

MAKEOPTS="-j3"

PKGDIR="/usr/portage/packages"

PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --filter=H_**/files/digest-*"

PORTAGE_TMPDIR="/var/tmp"

PORTDIR="/usr/portage"

SYNC="rsync://rsync.namerica.gentoo.org/gentoo-portage"

USE="X aac acl acpi aotuv asf avahi berkdb bitmap-fonts cddb cdr cli cracklib crypt cups dbus doc dri dts dvd dvdnav dvdr examples fortran gdbm gnome gpm gtk gtkhtml hal iconv ipv6 isdnlog java javascript jpeg logitech-mouse midi mmx mmxext mp3 mp4 mpeg mudflap ncurses nls nptl nptlonly nsplugin ntfs nvidia ogg openmp pam pcre perl pppd python rar readline reflection session smp source spl sse sse2 ssl ssse3 svga symlink tcpd threads truetype-fonts type1-fonts unicode usb vim-syntax vorbis x264 x86 xorg xulrunner xvid xvmc 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 mulaw multi null plug rate route share shm softvol" ELIBC="glibc" INPUT_DEVICES="evdev keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en" USERLAND="GNU" VIDEO_CARDS="vesa nvidia nv"

Unset:  CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, LDFLAGS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PORTDIR_OVERLAY

These are the packages that would be merged, in order:

Calculating dependencies... done!

[ebuild   R   ] sys-kernel/gentoo-sources-2.6.22-r5  USE="symlink -build" 0 kB 

Total: 1 package (1 reinstall), Size of downloads: 0 kB

```

----------

## loki_val

Just disable the symlink USE flag. That's what's doing it.

----------

## OneOfMany

Yep...done.  But still, I figure it should work properly or not exist (or be undocumented in the example for make.conf)...

----------

## John R. Graham

Sorry, but, unless I'm sorely mistaken, you've misdiagnosed the root cause.  I've looked very closely at the linux-headers ebuild (and the inherited kernel-2 eclass) and it does not move the symlink.  Prove it to yourself like this:

```
rm /usr/src/linux

USE="symlink" emerge -1v linux-headers

ls /usr/src
```

You won't see a "linux" symlink in there.  (If you do, then please let me know.)

What I suspect happened is that a new version of gentoo-sources (or whatever '.*-sources' you use) was emerged at the same time as (or even some time prior to) linux-headers and that's what moved the symlink.  Now, the fix is the same:  if you don't want the symlink moved, then make sure you don't have the "symlink" USE flag set.  But linux-headers is not the culprit here and there's no bug to fix.

- John

----------

## OneOfMany

Ok...then why would multiple versions of the gentoo-sources package be installed?  Without specifying them manually...just with things like "emerge -e world", "emerge -uD world" and the like.

And thanks for looking into this more closely.  I wasn't sure how the symlink functionality worked, so wasn't sure if I could do something like that (just look for that use entry in the ebuild...or was it something in portage that did it automatically?).

[update after looking at the headers and sources ebuilds]

So neither one mentions symlink that I can find.  Unless that ETYPE thingy does something maybe?  That isn't an entry I'm familiar with (off to gentoo's doc area).

Or maybe it is the "kernel-2_pkg_postinst" that is run at the end of the sources ebuild?

Yeah, that looks like where the magic happens (the ETYPE is what signifies it should get different treatment).  I'll try the header emerge in a second just to be sure.

[After test]

All good!  No extra directories, or symlink (now how did I get them before?)

----------

## desultory

 *OneOfMany wrote:*   

> Ok...then why would multiple versions of the gentoo-sources package be installed?  Without specifying them manually...just with things like "emerge -e world", "emerge -uD world" and the like.

 This is the expected behavior, it is due to the use of slots.

----------

## John R. Graham

Yep.  To elaborate, anything that is in "world" gets new versions installed automatically on an "emerge --update".  gentoo-sources is slotted, perhaps among other reasons, because it's not good to overwrite old versions of your kernel sources (which might be your current running kernel) when the "emerge --update" happens.  If you don't like this behavior, you can mask versions greater than your current version in /etc/portage/package.mask.

- John

----------

