I ran into some troubles with Gentoo and glibc over the weekend. Here’s what fixed it, in case it helps anyone out in the future.
Why it broke:
Someone upgraded glibc from 2.6 to 2.9_p20081201. It’s masked, and what’s worse, installing it moves the old glibc libraries from /usr/lib to /usr/local/lib, which is a most un-Gentoo location.
Additionally, the famous e2fsprogs circular bug occurred, which can be fixed by following these steps:
quickpkg com_err ss e2fsprogs && emerge -uDNf world && emerge -C com_err ss e2fsprogs && emerge e2fsprogs && emerge -uDN world && revdep-rebuild #(if necessary)
However, having a new glibc breaks the e2fsprogs emerge with the following message:
- /usr/local/lib/libdl.so.2: undefined reference to `_dl_tls_get_addr_soft@GLIBC_PRIVATE‘
- The ebuild environment file is located at ‘/var/tmp/portage/sys-fs/e2fsprogs-1.41.3/temp/environment‘.
- A complete build log is located at ‘/var/tmp/portage/sys-fs/e2fsprogs-1.41.3/temp/build.log‘.
- collect2: ld returned 1 exit status
- make[2]: *** [debugfs] Error 1
- make[2]: Leaving directory `/var/tmp/portage/sys-fs/e2fsprogs-1.41.3/work/e2fsprogs-1.41.3/debugfs’
- make[1]: *** [all-progs-recursive] Error 1
- make[1]: Leaving directory `/var/tmp/portage/sys-fs/e2fsprogs-1.41.3/work/e2fsprogs-1.41.3‘
- make: *** [all] Error 2
- ERROR: sys-fs/e2fsprogs-1.41.3 failed.
- Call stack:
- ebuild.sh, line 49: Called src_compile
- environment, line 2449: Called die
- The specific snippet of code:
- emake COMPILE_ET=compile_et MK_CMDS=mk_cmds || die;
- The die message:
- (no error message)
- If you need support, post the topmost build error, and the call stack if relevant.
So, I asked on #gentoo but got no answer. Not because they didn’t help, but because it stumped them as well. So here’s my fix.
Symbolically link /usr/local/lib/libdl.so.2 to /lib64/libdl.so.2. Then emerge e2fsprogs. This will fix the problem.
ln -snf /lib64/libdl.so.2 /usr/local/lib/libdl.so.2
emerge e2fsprogs
Note that, after this, /usr/local/lib/libdl.so.2 will point to /usr/local/lib/libdl.so as before. Portage fixes this every time it runs, so emerge everything except for e2fsprogs before this fix, then emerge e2fsprogs and you can boot again. So to summarize:
If you upgrade glibc and this breaks the e2fsprogs compilation, temporarily make libdl.so.2 point to the new libdl.so.2 and e2fsprogs will compile. This will restore the core utilites such as fsck and mount, thereby letting you boot again.