Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 173144 - emerge --depclean blew away most of the system & libraries
Summary: emerge --depclean blew away most of the system & libraries
Status: RESOLVED NEEDINFO
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core - Interface (emerge) (show other bugs)
Hardware: x86 Linux
: High critical (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-04-02 14:46 UTC by Hari Sekhon
Modified: 2007-04-04 18:02 UTC (History)
1 user (show)

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


Attachments
emerge log covering the depclean that severely broke my server (emerge.log,10.28 KB, text/plain)
2007-04-04 08:27 UTC, Hari Sekhon
Details
this is my exact make.conf (make.conf,465 bytes, text/plain)
2007-04-04 11:03 UTC, Hari Sekhon
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Hari Sekhon 2007-04-02 14:46:43 UTC
I change my use flags to add "-cups", then did emerge -av samba to recompile it before removing cups. I then did emerge --depclean to get rid of cups but unfortunately it destroyed most of the system.

It broke ssh, login, pam, shadow, init, e2fsprogs, postfix, perl, ntp, subversion, trac, apache, even ls had broken lib dependencies!


Reproducible: Didn't try
Comment 1 Dan 2007-04-02 22:14:08 UTC
Did you read the instructions? especially the pretty red text telling you to run emerge --deep --update --newuse world before running depclean and to run revdep-rebuild after?
Comment 2 Hari Sekhon 2007-04-03 08:44:46 UTC
you mean this bit:

*** WARNING ***  As a safety measure, depclean will not remove any packages
*** WARNING ***  unless *all* required dependencies have been resolved.  As a
*** WARNING ***  consequence, it is often necessary to run 
*** WARNING ***  `emerge --update --deep world` prior to depclean.

hmmm, let's see, so this would stop it from removing Init, the first and most dependent package of all linux operating systems?

I haven't changed any other use flag other than -cups, and I did the same thing on 10 other servers without this problem. According to that message, it should have removed only packages with no dependencies.

If anyone tries telling me that Init is not depended on by packages on a machine, especially one running so many services and even "ls" itself ends up broken from missing dependencies, I would have to laugh.

I didn't do an emerge deep update world, usually cos this breaks things on gentoo as the "stable" packages move too fast for continuous usage and it will likely mean some downtime to make newer versions work again. Did I mention this is a server?

In fairness perhaps I should have, but in fairness, there should have been no need since the packages weren't touch since installation last year.
Comment 3 Dan 2007-04-03 15:36:52 UTC
Did you run revdep-rebuild after?
Comment 4 Hari Sekhon 2007-04-03 15:47:59 UTC
I wish I could have!

It would't run, ssh wouldn't work, going to the console, login wouldn't work, rebooting, single user mode wouldn't work there was no single user mode, chrooting it, ls wouldn't work, missing libraries.

The system was severely screwed. It took me several chroots in to emerge enough packages just to get the thing to boot and then 2fsprogs wouldn't work, so down again etc etc.

running a revdep-rebuild from inside the chroot didn't work either.
Comment 5 Jakub Moc (RETIRED) gentoo-dev 2007-04-04 07:11:28 UTC
Cool; so - what exactly is broken? Which used dependencies were removed? Where are the revdep-rebuild logs, don't see them attached anywhere here. 
Comment 6 Hari Sekhon 2007-04-04 08:27:35 UTC
Created attachment 115417 [details]
emerge log covering the depclean that severely broke my server
Comment 7 Hari Sekhon 2007-04-04 08:29:14 UTC
(In reply to comment #5)
> Cool; so - what exactly is broken? Which used dependencies were removed? Where
> are the revdep-rebuild logs, don't see them attached anywhere here. 
> 

Perhaps you haven't been reading, the whole system broken to the point where nothing worked.

Check out the list of things depclean removed from my system. Do you think it's ok to removed INIT? How about PAM?

Let's see, no ssh, no console login, no fsck, no single user mode, no booting, no ls, no working!

The server ended up not being able to do anything and I spent several hours recovering it to the point of getting one or two critical services back up (mail).

Even after a recovery session chrooting in revdep-rebuild didn't help, it's usually one of the first things I do when I think there may be a breakage in deps.


I've attached the relevent portion of my emerge log (No use flags were changed other than adding -cups to USE in make.conf).
Comment 8 Jakub Moc (RETIRED) gentoo-dev 2007-04-04 09:07:50 UTC
Uhm, you had AUTOCLEAN=no set in make.conf?
Comment 9 Hari Sekhon 2007-04-04 11:03:04 UTC
Created attachment 115427 [details]
this is my exact make.conf

this hasn't changed in almost a year, except for the -cups which I recently added.

I then did an "equery d cups" and saw only samba so I then went and did and "emerge -av samba".

then I did the disastrous "emerge --depclean"

and hey presto, one blown up server.
Comment 10 Jakub Moc (RETIRED) gentoo-dev 2007-04-04 11:11:49 UTC
Shrug; the log you've attached only shows unmerging pretty outdated stuff which has mostly been removed from the tree. You should also post emerge --info.
Comment 11 Hari Sekhon 2007-04-04 11:28:56 UTC
# emerge --info
Portage 2.1.2.2 (default-linux/x86/2006.0, gcc-3.4.6, glibc-2.5-r0, 2.6.16-gentoo-r12 i686)
=================================================================
System uname: 2.6.16-gentoo-r12 i686 Intel(R) Pentium(R) 4 CPU 3.00GHz
Gentoo Base System release 1.12.9
Timestamp of tree: Wed, 04 Apr 2007 04:30:05 +0000
dev-lang/python:     2.4.3-r4
dev-python/pycrypto: 2.0.1-r5
sys-apps/sandbox:    1.2.17
sys-devel/autoconf:  2.13, 2.61
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10
sys-devel/binutils:  2.16.1-r3
sys-devel/gcc-config: 1.3.14
sys-devel/libtool:   1.5.22
virtual/os-headers:  2.6.17-r2
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -march=prescott -pipe -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc"
CONFIG_PROTECT_MASK="/etc/env.d /etc/gconf /etc/php/apache1-php5/ext-active/ /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/terminfo"
CXXFLAGS="-O2 -march=prescott -pipe -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FEATURES="distlocks metadata-transfer sandbox sfperms strict"
GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/linux/distributions/gentoo"
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://gentoo-mirror/gentoo-portage"
USE="alsa apache2 apm arts authdaemond berkdb bitmap-fonts cli cracklib crypt dri eds emboss encode esd foomaticdb fortran gdbm gif gpm gstreamer gtk2 iconv imlib ipv6 isdnlog jpeg libg++ libwww logrotate mad maildir midi mikmod motif mp3 mpeg ncurses nls nptl ogg opengl oss pam pcre perl png pppd python qt3 qt4 quicktime readline reflection sdl session spell spl syslog tcpd truetype truetype-fonts type1-fonts valias vhosts vorbis x86 xml xorg xv 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="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" USERLAND="GNU" VIDEO_CARDS="apm ark ati chips cirrus cyrix dummy fbdev glint i128 i740 i810 imstt mga neomagic nsc nv rendition s3 s3virge savage siliconmotion sis sisusb tdfx tga trident tseng v4l vesa vga via vmware voodoo"
Unset:  CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, LDFLAGS, LINGUAS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PORTDIR_OVERLAY
Comment 12 Marius Mauch (RETIRED) gentoo-dev 2007-04-04 13:15:25 UTC
(In reply to comment #7)
> Check out the list of things depclean removed from my system. Do you think it's
> ok to removed INIT? How about PAM?

Neither was removed according to the logfile you provided. Even if this issue has caused you major problems, please be exact when describing it and don't resort to rhetorics.

> The server ended up not being able to do anything and I spent several hours
> recovering it to the point of getting one or two critical services back up
> (mail).
> 
> Even after a recovery session chrooting in revdep-rebuild didn't help, it's
> usually one of the first things I do when I think there may be a breakage in
> deps.

Well, unfortunately by fixing the server you probably killed the only chance of analyzing this issue as we can't really reproduce your complete system state which would be necessary.

> I've attached the relevent portion of my emerge log (No use flags were changed
> other than adding -cups to USE in make.conf).

Which only tells what it did, but not why which is the interesting part. Also the packages you reported as broken aren't listed in there, so I _guess_ that runtime linkage got broken somehow as you didn't specify the type of breakage either, only something about "broken lib dependencies" with ls, but without knowing *which* library deps were broken it's near impossible to get a clue about what exactly went wrong.

As harsh as it may sound, but without more information there is nothing we can do about this, at least some useful error messages are needed. Closing for now, if you can remember/reproduce any of the errors and give as a more detailed description (exact error messages would be the best) feel free to reopen this bug.
Comment 13 Hari Sekhon 2007-04-04 13:23:35 UTC
I'm sorry but everyone in the company noticed since this is the mail server, intranet server, svn server, and a raft of other things important services... I had to get it back up as quick as possible.

I know that emerge log is quite bit and therefore not easy to see so I did a find on it and voila, I found the pam and init I previously referred to as examples:

1175518165: === Unmerging... (sys-libs/pam-0.78-r3)
1175518167:  >>> unmerge success: sys-libs/pam-0.78-r3

and

1175518201: === Unmerging... (sys-apps/sysvinit-2.86-r3)
1175518202:  >>> unmerge success: sys-apps/sysvinit-2.86-r3

sorry I didn't make note of the libs that some things wanted like "ls" but I was panicking to get this thing back up and chrooting etc as fast as my fingers could take me...

Sorry to be a pain, I do love gentoo and this is the first real problem I've ever had with it in several years of usage. Keep up the good work. It would be nice if you could find the cause of this, I understand that it would have been better to do an emerge -eD world first but like I said, I did use equery to find what depended on the package cups before recompiling that and then doing the depclean.
Comment 14 Jakub Moc (RETIRED) gentoo-dev 2007-04-04 13:41:42 UTC
(In reply to comment #13)
> 1175518165: === Unmerging... (sys-libs/pam-0.78-r3)
> 1175518167:  >>> unmerge success: sys-libs/pam-0.78-r3

Current stable is 0.78-r5 on x86. -r3 has been removed 

> 1175518201: === Unmerging... (sys-apps/sysvinit-2.86-r3)
> 1175518202:  >>> unmerge success: sys-apps/sysvinit-2.86-r3

Current stable is 2.86-r8 on x86; -r3 was removed 3 months ago.

So, those were the latest versions you had installed? Seriously? Reopening this bug without providing any additional information whatsoever will just make people angry and will not get you anywhere.
Comment 15 Hari Sekhon 2007-04-04 14:16:36 UTC
could you clarify to me that being removed from portage means that it should be removed from the system by depclean?

is that right?

I reopened the bug because I thought I had found something you had overlooked in the emerge.log. 

If you are saying that as soon as something is removed from portage depclean will remove it, even if it is depended on by other things?

Is this intentional or a bug?

If it's intentional then perhaps I am at fault for using Gentoo? Is Gentoo not suitable for stable server usage? Should I be pushing Debian more? That would be a shame because I've found everything else about gentoo very good.

Also I've had this server under a year now so it's not like the thing is ancient like a lot of servers...

Admittingly I am using a standard profile instead of the server profile because I think that and the desktop profile weren't ready at the time I installed this server (could be wrong), although I'm not sure that makes any difference.

I'm still struggling to understand how come depclean removed so much stuff that was depended on...
Comment 16 Marius Mauch (RETIRED) gentoo-dev 2007-04-04 16:40:32 UTC
(In reply to comment #14)
> (In reply to comment #13)
> > 1175518165: === Unmerging... (sys-libs/pam-0.78-r3)
> > 1175518167:  >>> unmerge success: sys-libs/pam-0.78-r3
> 
> Current stable is 0.78-r5 on x86. -r3 has been removed 
> 
> > 1175518201: === Unmerging... (sys-apps/sysvinit-2.86-r3)
> > 1175518202:  >>> unmerge success: sys-apps/sysvinit-2.86-r3
> 
> Current stable is 2.86-r8 on x86; -r3 was removed 3 months ago.
> 
> So, those were the latest versions you had installed? Seriously?

Jakub: so could you explain to me what that has to do with this issue?

(In reply to comment #15)
> I reopened the bug because I thought I had found something you had overlooked
> in the emerge.log. 

Indeed, I overlooked those, but that wasn't really the information we would need to analyze this as it's still about the "what" rather than the "why". Basically we'd have to know the depgraph portage used when you ran that `emerge --depclean` and then figure out why the unmerged packages weren't included in it. But that's pretty much impossible by now unless you have a backup of /var/db/pkg from directly before (or after) running `emerge --depclean`.

> If you are saying that as soon as something is removed from portage depclean
> will remove it, even if it is depended on by other things?

Just ignore that part of Jakubs comment.
Comment 17 Hari Sekhon 2007-04-04 16:56:56 UTC
ok what you say is fair enough, I've been on the other end of trying to diagnose very difficult things and I know what it's like.

I understand that it will be difficult if not impossible to diagnose this without more info but I have given you everything I can, I have had to recompile the whole system that day as it's a critical service.

I'm guess most users don't run depclean so it may not show up so much either. If you do find out/think of something or have an idea I'd be interested to know it.

I probably won't run emerge --depclean for the rest of my life...
Comment 18 Zac Medico gentoo-dev 2007-04-04 17:26:33 UTC
(In reply to comment #17)
> I'm guess most users don't run depclean so it may not show up so much either.
> If you do find out/think of something or have an idea I'd be interested to know
> it.

Lots of people use it and consider it to be a crucial feature.  It was rewritten for portage-2.1.1 and had some additional improvements in portage-2.1.2.  It's now much better than it was in <=portage-2.1.

> I probably won't run emerge --depclean for the rest of my life...

I'm not sure what version of portage you were using at the time when you had the problem, but with >=portage-2.1.1 it is considered to be relatively safe (as long as you run revdep-rebuild afterwards).  It's best to use --pretend or --ask  so that you can review the list and make sure that it is sane before you proceed to uninstall anything.
Comment 19 Jakub Moc (RETIRED) gentoo-dev 2007-04-04 17:38:58 UTC
(In reply to comment #16)
> Jakub: so could you explain to me what that has to do with this issue?

Yeah sure, --depclean unmerging stuff like sys-libs/pam (w/ USE=pam set) or sys-devel/libperl only makes sense if you have multiple versions in the same slot installed simultaneously (a.k.a. when you've screwed w/ AUTOCLEAN before) or if you did stick such stuff into package.provided. 

There's really no sane way to get them out of depgraph otherwise, stuff in system depends on them.
Comment 20 Hari Sekhon 2007-04-04 18:02:46 UTC
I've never even seen or heard of AUTOCLEAN before and since I'm the only guy who admins the server, I'm sure it hasn't been done.

nor have I ever done provided or anything like that before.