This is not a duplicate of bug 198200. I use eselect to choose which kernel is the "current" one. Logically, this should count as a dependency. Nevertheless, "emerge --depclean" wants to remove the current kernel source. Reproducible: Always Steps to Reproduce: 1. Update portage so that it installs source for a new kernel 2. Don't use eselect to choose the newer kernel 3. emerge --depclean Actual Results: depclean wants to remove the current kernel source Expected Results: Since eselect defines a dependency, it should not remove the current kernel source Portage 2.1.6.13 (default/linux/amd64/2008.0, gcc-4.4.1, glibc-2.10.1-r0, 2.6.30-gentoo-r5 x86_64) ================================================================= System uname: Linux-2.6.30-gentoo-r5-x86_64-Intel-R-_Core-TM-2_Quad_CPU_Q9450_@_2.66GHz-with-gentoo-2.0.1 Timestamp of tree: Thu, 03 Sep 2009 07:00:01 +0000 app-shells/bash: 4.0_p28 dev-java/java-config: 2.1.9 dev-lang/python: 2.6.2-r1, 3.1.1 dev-util/cmake: 2.6.4-r2 sys-apps/baselayout: 2.0.1 sys-apps/openrc: 0.4.3-r3 sys-apps/sandbox: 2.1 sys-devel/autoconf: 2.13, 2.63-r1 sys-devel/automake: 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10.2, 1.11 sys-devel/binutils: 2.19.1-r1 sys-devel/gcc-config: 1.4.1 sys-devel/libtool: 2.2.6a virtual/os-headers: 2.6.30-r1 ACCEPT_KEYWORDS="amd64 ~amd64" CBUILD="x86_64-pc-linux-gnu" CFLAGS="-O2 -march=core2 -ggdb -pipe" CHOST="x86_64-pc-linux-gnu" CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/config" 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/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/udev/rules.d" CXXFLAGS="-O2 -march=core2 -ggdb -pipe" DISTDIR="/usr/portage/distfiles" EMERGE_DEFAULT_OPTS="--jobs=5" FEATURES="distlocks fixpackages parallel-fetch protect-owned sandbox sfperms splitdebug strict unmerge-orphans userfetch" GENTOO_MIRRORS="http://gentoo.osuosl.org/ http://gentoo.netnitco.net http://mirror.csclub.uwaterloo.ca/gentoo-distfiles/ ftp://mirror.datapipe.net/gentoo ftp://mirror.csclub.uwaterloo.ca/gentoo-distfiles/ http://gentoo.mirrors.easynews.com/linux/gentoo/ ftp://ftp.free.fr/mirrors/ftp.gentoo.org/ ftp://gentoo.imj.fr/pub/gentoo/ ftp://distro.ibiblio.org/pub/linux/distributions/gentoo/" LANG="en_US.utf8" LDFLAGS="-Wl,-O1" LINGUAS="en en_US" MAKEOPTS="--jobs=5" PKGDIR="/usr/portage/packages" PORTAGE_CONFIGROOT="/" PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" PORTDIR_OVERLAY="/usr/local/portage" SYNC="rsync://rsync.gentoo.org/gentoo-portage" USE="X a52 aac acl acpi alsa amd64 apache2 bash-completion berkdb bidi bzip2 cairo cdda cdio cdr cli cracklib crypt ctype cups dbus dri dts dvd dvdr encode fbcon ffmpeg filter flac fortran freetype gcj gd gdbm gnutls gpm hal httpd iconv ipv6 isdnlog jadetex java jpeg jpeg2k kde kde4 kerberos lapack ldap live lm_sensors mad matroska mjpeg mmx mng mp3 mpeg mudflap multilib mysql mysqli ncurses nls nptl nptlonly ogg oggvorbis opengl openmp openssl pam pcre perl php png pppd python qt3support qt4 quicktime readline reflection ruby samba session spl sql sse sse2 sse3 ssl stream svg sysfs tcpd theora threads tiff tk truetype unicode utempter vcd vlm vorbis webkit wxwindows x264 xorg xv xvid zeroconf zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci 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 authn_alias authn_anon 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 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" ELIBC="glibc" INPUT_DEVICES="keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en en_US" USERLAND="GNU" VIDEO_CARDS="radeon radeonhd" Unset: CPPFLAGS, CTARGET, FFLAGS, INSTALL_MASK, LC_ALL, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Interesting riddle as this doesn't follow the usual "highest is best" ordering logic ...
Would you mind elaborating on that comment? I just don't see a need to update to the latest kernel every time a new one comes out.
This will be fairly easy to implement with a custom package set. All that that has to be done is to lookup the owner of the /usr/src/linux symlink target. The existing OwnerSet class could do this if it was modified to call os.path.realpath() on each of the given paths.
*** Bug 293157 has been marked as a duplicate of this bug. ***
*** Bug 297305 has been marked as a duplicate of this bug. ***
I think what we really need to to have a standard interface for eselect modules to interact with package managers, specified in PMS.
Seems like a very good idea; this will help solve a number of problems, with the kernel (see bug 198200), with python (bug 289147) and with binutils (see https://bugs.gentoo.org/show_bug.cgi?id=198200#c59). Possible implementation strategy: eselect modules can implement an optional action called "protected" or some such which will return a list of package atoms that should be protected from being depclean'ed.
(In reply to comment #7) > Possible implementation strategy: eselect modules can implement an optional > action called "protected" or some such which will return a list of package > atoms that should be protected from being depclean'ed. Problem is that eselect (e.g., the kernel module) so far knows nothing about packages. In fact, the current kernel symlink can even point to a private user's kernel tree that doesn't belong to any package. It would be much easier for eselect to return a list of protected files/directories. The PM could then map the elements of that list to package atoms.
(In reply to comment #8) > Problem is that eselect (e.g., the kernel module) so far knows nothing about > packages. In any case, each installed choice has to expose itself to the eselect module somehow. We can easily modify these packages to expose themselves in a way that is more useful for communication between the eselect module and the package manager. > In fact, the current kernel symlink can even point to a private > user's kernel tree that doesn't belong to any package. In this case, there's nothing for the eselect module to communicate to the package manager, so nothing of value is lost. > It would be much easier for eselect to return a list of protected > files/directories. The PM could then map the elements of that list to package > atoms. Requiring the package manager to map files/directories to package identifiers wouldn't be as efficient as having the eselect module provide the package identifiers directly.
How about some /{etc,var/lib}/portage/world.d/ directory where eselect modules can write package names to. The contents would be treated as if they were in world. To assign files to package names, eselect modules could parse output from portage-utils.
(In reply to comment #10) > How about some /{etc,var/lib}/portage/world.d/ directory where eselect modules > can write package names to. The contents would be treated as if they were in > world. Sure. Also, the package manager would need to automatically apply package moves to those files when appropriate. > To assign files to package names, eselect modules could parse output from > portage-utils. That's one way to do it. Alternatively, we could have each choice install a file somewhere like /etc/eselect/choices/${module}.d for the module that it applies to. For kernel.d, each file could contain a path to the kernel sources and the name of the package that provides it. That, way, it wouldn't be necessary to do a brute-force lookup with portage-utils. Again, the package manager would need to automatically apply package moves to these files when appropriate.
This is still happening for me: Available kernel symlink targets: [1] linux-2.6.36-hardened-r9 [2] linux-2.6.37-hardened-r7 [3] linux-2.6.38-hardened-r6 [4] linux-2.6.39-hardened-r8 * [5] linux-3.0.4-hardened-r1 uname -r 2.6.39-hardened-r8 emerge -av --depclean >>> These are the packages that would be unmerged: dev-lang/swig selected: 1.3.40-r1 protected: none omitted: none dev-perl/TermReadKey selected: 2.300.0 protected: none omitted: none sys-devel/gcc selected: 4.4.5 protected: none omitted: 4.5.3-r1 sys-kernel/hardened-sources selected: 2.6.38-r6 2.6.39-r8 protected: none omitted: 3.0.4-r1 emerge --info Portage 2.1.10.11 (hardened/linux/x86, gcc-4.4.5, glibc-2.12.2-r0, 2.6.39-hardened-r8 i686) ================================================================= System uname: Linux-2.6.39-hardened-r8-i686-AMD_Sempron-tm-_2200+-with-gentoo-2.0.3 Timestamp of tree: Tue, 11 Oct 2011 15:30:01 +0000 ccache version 2.4 [enabled] app-shells/bash: 4.1_p9 dev-lang/python: 2.7.1-r1, 3.1.3-r1 dev-util/ccache: 2.4-r9 dev-util/cmake: 2.8.4-r1 dev-util/pkgconfig: 0.26 sys-apps/baselayout: 2.0.3 sys-apps/openrc: 0.8.3-r1 sys-apps/sandbox: 2.4 sys-devel/autoconf: 2.68 sys-devel/automake: 1.11.1 sys-devel/binutils: 2.20.1-r1 sys-devel/gcc: 4.4.5, 4.5.3-r1 sys-devel/gcc-config: 1.4.1-r1 sys-devel/libtool: 2.4-r1 sys-devel/make: 3.82-r1 sys-kernel/linux-headers: 2.6.36.1 (virtual/os-headers) sys-libs/glibc: 2.12.2 Repositories: gentoo local_overlay ACCEPT_KEYWORDS="x86" ACCEPT_LICENSE="* -@EULA" CBUILD="i686-pc-linux-gnu" CFLAGS="-O2 -march=athlon-xp -fomit-frame-pointer" CHOST="i686-pc-linux-gnu" CONFIG_PROTECT="/etc /usr/share/openvpn/easy-rsa" CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /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="-O2 -march=athlon-xp -fomit-frame-pointer" DISTDIR="/usr/portage/distfiles" EMERGE_DEFAULT_OPTS="--autounmask=n" FEATURES="assume-digests binpkg-logs ccache distlocks ebuild-locks fixlafiles fixpackages news parallel-fetch protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch" FFLAGS="" GENTOO_MIRRORS="http://distfiles.gentoo.org" LDFLAGS="-Wl,-O1 -Wl,--as-needed" LINGUAS="en es" MAKEOPTS="-j2" PKGDIR="/usr/portage/packages" PORTAGE_CONFIGROOT="/" PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" PORTDIR_OVERLAY="/usr/local/portage" SYNC="rsync://rsync.gentoo.org/gentoo-portage" USE="acl bash-completion berkdb bzip2 cli cracklib crypt cups cxx dbus dri gdbm gpm hardened iconv mmx modules mudflap ncurses nls nptl nptlonly openmp pam pax_kernel pcre pic pppd readline session sse sse2 ssl sysfs tcpd udev unicode urandom x86 xorg 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="alias auth_basic authn_alias authn_anon authn_default authn_file authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid deflate dir disk_cache env expires filter headers include info log_config logio mem_cache mime mime_magic negotiation proxy proxy_http rewrite setenvif speling status unique_id userdir usertrack vhost_alias" APACHE2_MPMS="prefork" CALLIGRA_FEATURES="kexi words flow plan 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" LINGUAS="en es" PHP_TARGETS="php5-3" RUBY_TARGETS="ruby18" SANE_BACKENDS="hp hp3500 hp3900 hp4200 hp5400 hp5590 hpljm1005 hpsj5s hs2p" 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, INSTALL_MASK, LANG, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
*** Bug 391441 has been marked as a duplicate of this bug. ***
I think a better solution would be to make "persistent" ebuilds/eclasses(not familiar with those though); meaning that you can select sys-kernel/git-sources in world file, but when emerging a specific kernel source it will record =sys-kernel/git-sources-<version> in the world file. Simple and perfect solution that can also work for java-vms and other packages to act like that.
(In reply to comment #14) As I noted in bug 198200, comment #69, emerge already supports SLOT atoms in the world file.
#15, i geuss you do not understand the point i was trying to make. I know emerge supports slot atoms, my point is that kernel ebuilds should record its own package as a slot atom in the world file so that when you have non slot kernel in the world file it will keep updating on emerge --update and keep all kernels, including the eselected kernel. We can create a use flag for this. The next step would be to warn/error the user when it tries to --deselect/--unmerge a '/usr/src/linux' linked kernel source. This will solve this bug.
I've thought of this again, and I'm no longer sure if interaction with eselect would be the proper solution to the problem: - Not only the slot corresponding to the eselected version may be special, but other ones too. For example, I could imagine that users would want to keep kernel sources for all versions currently bootable/installed on their system. Asking eselect for the active version is therefore only a partial solution for the problem. - Some slotted packages like (for example) gcc don't use eselect at all. Maybe a more general solution would be to allow a package's slots to be "sticky", i.e. once installed they wouldn't be targeted by depclean (except for the case of complete removal of the package).
IMHO, If you want to micro manage versions and keep a lot of them at hand use the version tags in the world file. If it is about the casual user (majority?) that does a kernel upgrade (without immediate reboot) then depclean should leave both the newest & currently active kernel alone. The currently active as it isn't ready to go..., the newest as it can be expected to be the next one to be used, but a reboot is not possible YET.
*** Bug 367611 has been marked as a duplicate of this bug. ***
(In reply to comment #19) > *** Bug 367611 has been marked as a duplicate of this bug. *** Uum, shouldn’t it be the other way around, since that is the generic bug, and this one is specific for one case? Will this end in another case of fixing the specific bug, and then disallowing the creation of a new bug for a generic fix, because that bug already exists, and was wrongly marked as a duplicate of the specific one? ;) That’s not a nice way of doing things. Please don’t do that.
Well, I still think that eselect should really be replaced by something done in-ebuild. Keep symlinks PM-controlled, and correct deps. Will require EAPI 5 SLOT deps though.
Well, EAPI 5 slot-operator deps only pull in the latest slot installed at build time, so they're not going to help people who want to eselect and older kernel slot and have it protected from depclean.
(In reply to comment #22) > Well, EAPI 5 slot-operator deps only pull in the latest slot installed at > build time, so they're not going to help people who want to eselect and > older kernel slot and have it protected from depclean. Don't we have something to record the slot which was used to build the package? But yeah, I was probably too quick, something smarter will be necessary.
(In reply to comment #23) > Don't we have something to record the slot which was used to build the > package? The spec says that it records the "best installed version": http://git.overlays.gentoo.org/gitweb/?p=proj/pms.git;a=commit;h=f9f7729c047300e1924ad768a49c660e12c2f906
*** Bug 454502 has been marked as a duplicate of this bug. ***
(In reply to C.J. Wijtmans from comment #16) > The next step would be to warn/error the user when it tries to > --deselect/--unmerge a '/usr/src/linux' linked kernel source. (In reply to Nico Baggus from comment #18) > If it is about the casual user (majority?) that does a kernel upgrade > (without immediate reboot) then depclean should leave both the newest & > currently active kernel alone. > > The currently active as it isn't ready to go..., the newest as it can be > expected to be the next one to be used, but a reboot is not possible YET. Just a note for users who want this; it's available in a porcelain layer here: http://weaver.gentooexperimental.org/update.html update has protected the first (/usr/src/linux) since before we had a git repo, and the latter (ie currently running kernel) since Feb 2009. (Unless the user configures it not to in /etc/update.) 'update' on its own, does a -C depclean run after the world emerge, and before revdep-rebuild. Should either of those packages come up, they're temporarily added to world, and then depclean is run, after the user has confirmed which ones they wish to keep (added to world file), or that they don't want to keep any of them (via a dialog selection.) HTH, not trying to stop progress on emerge itself; tho i do think some things are better handled in porcelain, or you end up with a bloated core app. ABI upgrades that FerringB mentioned on the list just before he retired, are a good example, which we implemented (/etc/warning) a few years ago for the expat mess. To do those right you typically need to run several commands, and eg emerge all packages that depend on foo, or list(x11-proto/) for xcb-1.4 (back in the day) before the main build, or after the package, followed by a revdep on a specific library, and so on; not something that emerge can, or even should, handle alone. They're much fewer and further between nowadays, thankfully, but when they come, they're doozies, as Harring described.
*** Bug 487126 has been marked as a duplicate of this bug. ***
*** Bug 198200 has been marked as a duplicate of this bug. ***
*** Bug 370439 has been marked as a duplicate of this bug. ***
If this is considered a major problem (i.e. it would be better to abort the cleanup than lose the active version), we could start deploying pkg_prerm() with appropriate checks in ebuilds.
Well yes, it is kindof a design flaw. Or perhaps portage doesnt find my kernel information because i am not using the genkernel tool? (after unemerging the kernel package).
*** Bug 686564 has been marked as a duplicate of this bug. ***
I'd like to add to this is: While a kernel source removal is harmless from the system stability point of view, the removal of the active gcc version (which will happen in case you have another more recent installed) might lead to major system problems.