Score:2

How Mere Compiling Broke the System?

gh flag

I was attempting to just compile glibc version 2.31, by first installing the dependencies by running:

and then glibc as stated here:

mkdir /home/machine/Desktop/glibc-build

then change it to current directory:

cd /home/machine/Desktop/glibc-build

and after that execute configure from the source directory:

/home/machine/Desktop/glib-xxx/./configure --prefix=/usr

One of the user even mentioned

glibc IS YOUR operating system

But doing so indeed broke my system. First I lost typical linux terminal commands such as ls then after restarting my system I got:

kernel panic - not syncing: Attempted to kill init! exit code 0x00007f00

Question How does mere compiling broke my system? As I understand Ubuntu's glibc reside in /lib/ while I was merely trying to compile it in /usr/, so how did without replacing the systems glibc broke my system? Also my laptop doesnt show full error dump so is there any way to read full terminal output during booting as I cant access /var/ anymore?

My system is using Ubuntu 18.04.6 LTS

cn flag
Ray
I don't know the answer to your question. I know enough to definitely not attempt compiling glibc and putting it in `/usr`, though. You probably should have set the prefix to your home directory and see if anything broke first... On my system, when I type `which ls`, it says that it resides in `/usr/bin/ls`. When I do an `strace ls`, it does (unsuccessfully, though) look for things in `/usr`. Might not be important...but it wasn't a good idea to try...
user0193 avatar
gh flag
@guiverc thanks I was revising my question and got your comment
user0193 avatar
gh flag
@Ray its quite funny that someone in the [forum](https://www.linuxquestions.org/questions/linux-newbie-8/how-do-i-configure-glibc-in-a-separate-build-folder-447521/) mentioned not to rather put glibc in `/opt`
cc flag
These days, /lib is really /usr/lib (likewise bin and sbin), See ls -l / to see the links, so not really as separate as you thought.
hr flag
imho "mere compiling" should always be done without root privileges - that way, there's no possibility to overwrite important system components
Score:0
in flag

First, compiling glibc didn't break your system. installing glibc over top of the existing one did.

On many modern systems, /usr/lib and /lib have been merged, and even if that's not the case, many of the libraries are in /usr/lib and not in /lib.

If you are going to compile a custom glibc, you should install it in something like /opt/myglibc/ (or something in your home directory) or target it at a chroot environment, rather than installing in a system directory. It's not even safe to install it in /usr/local/ because that could also override the default glibc unless you edit the system ld.so configuration to remove /usr/local/lib.

st flag
I didn't know that `configure` also installs nowadays. The last time I built Glibc manually, installation was done by `make` using the `install` target.
user0193 avatar
gh flag
But I did not install glibc over the top of existing one because the I was unable to compile the complete glibc successfully. There was an error and it did not compile completely
user10489 avatar
in flag
I haven't looked at the build scripts, but if things broke, it sounds like at least some of it (or the dependencies you installed?) broke things.
user10489 avatar
in flag
Word of advise... never build as root. Build as user. Unless you are very very sure what you are doing, don't even install as root. Instead, install to a shadow directory and then chown it if you want. Most build systems support doing that. It's extra work, and much safer, but occasionally not worth the extra work. I hit one software that actually had an `rm -rf ` in its install script and wiped all my built dependencies, so I've been following this advise since.
hr flag
@user0193 it's hard to diagnose what happened without knowing exactly what source package you downloaded - the link in your question appears to go to the Debian glibc tracking page
user0193 avatar
gh flag
@steeldriver I actually downloaded the glibc version `2.31-13+deb11u4` but regardless of the version, mere compiling the way I did shouldn't actually break the system but since its broken, it looks like Ubuntu 18.04.6 LTS have put glibc in `/usr` rather then in `/opt`
user10489 avatar
in flag
Yes, Ubuntu (any version) puts glibc in /usr. My point was that if *you* compile glibc, you should put your special version in /opt
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.