Gentoo Archives: gentoo-user

From: Alexander Puchmayr <alexander.puchmayr@×××××××.at>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Emerge -u -k package install order - broken system [SOLVED]
Date: Tue, 07 Sep 2021 07:31:50
Message-Id: 2037573.PIDvDuAF1L@zeus
In Reply to: [gentoo-user] Emerge -u -k package install order - broken system by Alexander Puchmayr
1 Am Montag, 6. September 2021, 16:33:32 CEST schrieb Alexander Puchmayr:
2 > Hi there,
3 >
4 > I just tried to upgrade a older installation via binary packages and this
5 > broke my system. After around 25 packages of almost 300 it stopped with
6 > error and failing packages.
7 >
8 > $ emerge
9 > Failed to validate a sane '/dev'.
10 > bash process substitution doesn't work; this may be an indication of a
11 > broken '/dev/fd'.
12 > $ ls -l /dev/fd/
13 > insgesamt 0
14 > lrwx------ 1 root root 64 6. Sep 14:18 0 -> /dev/pts/0
15 > lrwx------ 1 root root 64 6. Sep 14:18 1 -> /dev/pts/0
16 > lrwx------ 1 root root 64 6. Sep 14:18 2 -> /dev/pts/0
17 > lr-x------ 1 root root 64 6. Sep 14:18 3 -> /proc/27261/fd
18 >
19 > --> looks allright, but:
20 >
21 > $ bash
22 > bash: /lib64/libc.so.6: version `GLIBC_2.33' not found (required by /lib64/
23 > libreadline.so.8)
24 >
25 > --> system broken(!), cannot start any shell anymore, cannot install
26 > anything anymore and it's obvious that the system is bricked after reboot
27 > or even when the ssh session I'm logged in is closed.
28 >
29 > It seems like as if sys-libs/readline-8.1_p1-r1-1:0/8::gentoo is installed
30 > *before* installing a suitable glibc, breaking any binary that has the
31 > useflag readline (including bash).
32 >
33 > Two questions:
34 > How do I get out of this mess?
35 > Why does portage not work in correct package order? Portage bug?
36
37 The problem was caused by a newly compiled sys-libs/readline as binary
38 package. The package itself was compiled on my buildhost by a emerge -auvDN
39 world, and when readline was compiled, the latest glibc-2.33 was already
40 installed on the buildhost, hence the readline packet had a (implicit)
41 dependency to >=glibc-33. Portage does not seem to be aware of that (the glibc
42 version is not a dependency of readline), so portage did not care and install
43 it at some suitable position later. From the time on that readline was emerged
44 from that binary package, all programs linked with it have now that implicit
45 dependency of >=glibc-2.33, which is not yet installed (which was 2.28). Bang!
46
47 HOW TO FIX THIS BREAKAGE:
48
49 For the system recovery I was lucky to have a backup of the old packages, so I
50 could extract the readline-tbz2-package file to the temporary directly and copy
51 the so files to /usr/local/lib64 (I chose /usr/local/ to avoid overwriting the
52 package files)
53
54 Ls -l /usr/local/lib64/
55 insgesamt 368
56 lrwxrwxrwx 1 root root 15 6. Sep 14:53 libhistory.so -> libhistory.so.8
57 lrwxrwxrwx 1 root root 17 6. Sep 15:04 libhistory.so.8 -> libhistory.so.
58 8.0
59 -rwxr-xr-x 1 root root 47368 6. Sep 14:53 libhistory.so.8.0
60 lrwxrwxrwx 1 root root 16 6. Sep 14:53 libreadline.so -> libreadline.so.8
61 lrwxrwxrwx 1 root root 18 6. Sep 15:04 libreadline.so.8 ->
62 libreadline.so.8.0
63 -rwxr-xr-x 1 root root 325464 6. Sep 14:53 libreadline.so.8.0
64
65 Then, I created a ld.so.conf config file to ensure that /usr/local/lib is at
66 *first* place:
67
68 echo "/usr/local/lib64" >/etc/ld.so.conf.d/10-temporary-fix.conf
69 ldconfig
70
71 Notes:
72 * The config file *must* end with .conf
73 * Although /usr/local/lib64 is already in the ld.so.conf file, this step is
74 necessary to get it at first place; otherwise it is after /lib64 and /usr/
75 lib64, and ld.so finds the non-working version first
76 * setting LD_LIBRARY_PATH does not work as ebuild does not forward the
77 environment variables from the calling process.
78
79 Test it with ldd /usr/bin/bash -- no errors shall be reported, and the
80 readline library shall show the /usr/local/lib64 path.
81
82 Now, I could emerge glibc-2.33 the usual way (emerge -avk1 glibc), and then
83 afterwards remove the temporary ld.so.conf file
84
85 rm /etc/ld.so.conf.d/10-temporary-fix.conf
86 ldconfig
87
88 Test again with ldd /usr/bin/bash -- the new readline library from /usr/lib64
89 and /lib64 shall now be used.
90 Now, the libraries from /usr/local/lib can be removed safely.
91
92 System recovered!
93
94 Best regards,
95 Alex