You are not logged in.

#1 2024-12-21 18:39:40

ChrisKayKos
Member
Registered: 2024-12-21
Posts: 12

[SOLVED] System libraries mismatch | libstdc++.so mismatch

I was following OSDev's tutorial on making an OS from scratch. While trying to build a cross-compiler for i686 targets, somehow this GCC compiler and binutils ended up as my system's compiler and linker.
I have pacman-static thankfully and i ran `pacman -S gcc`, but that also implicitly created a mismatch with the libraries i assume.
I tried many other pacman-static commands after that like `pacman-static -Syu` and `pacman-static -Syu $(pacman-static -Qqn)`. None of which worked.
Now almost all dynamically linked programs don't work (pacman, firefox, vscode, nodejs, etc.).
Here are the error logs of pacman, firefox:
`pacman: symbol lookup error: /usr/lib/libicuuc.so.75: undefined symbol: _ZNSt18condition_variable4waitERSt11unique_lockISt5mutexE, version GLIBCXX_3.4.30`
`/usr/lib/firefox/firefox: symbol lookup error: /usr/lib/firefox/firefox: undefined symbol: _ZSt20__throw_length_errorPKc, version GLIBCXX_3.4`

How can I synchronize/fix my system without a fresh re-install?
Any help is appreciated.

Last edited by ChrisKayKos (2024-12-23 13:22:22)

Offline

#2 2024-12-21 19:02:50

seth
Member
Registered: 2012-09-03
Posts: 61,650

Re: [SOLVED] System libraries mismatch | libstdc++.so mismatch

None of which worked.

Please don't paraphrase, https://bbs.archlinux.org/viewtopic.php?id=57855

I assume your shell doesn't work itfp?

Boot the install iso, mount the intallation root into /mnt (and optionally the boot partition into /mnt/boot) do NOT chroot!! into the system but

LC_ALL=C pacman --root=/mnt -Qkk |& grep -v ', 0 altered files' | grep -v backup > /tmp/howbadisit.txt
cat /tmp/howbadisit.txt | curl -F 'file=@-' 0x0.st

If it's like _really_ bad, you can also re-install all packages

pacman --root=/mnt --cachedir=/mnt/var/cache/pacman/pkg -Syu $(pacman --root=/mnt -Qqn)

Offline

#3 2024-12-21 19:11:30

ChrisKayKos
Member
Registered: 2024-12-21
Posts: 12

Re: [SOLVED] System libraries mismatch | libstdc++.so mismatch

Sorry for the paraphrasing, i am kinda anxious. I tested compiling and running a simple c++ program. The default linking gcc does doesn't have a problem. But when I linked with raylib, glfw didn't work correctly.
Could you explain what the commands you sent do? Especially the first 1. And why pacman-static can't do these? I thought pacman-static could help here to speed up, at least that's what  my naivety thinks.
BTW i still have access to the system as i have not shut it down yet, i dont know if i had made that clear before.
Thanks

Last edited by ChrisKayKos (2024-12-21 19:14:59)

Offline

#4 2024-12-21 19:32:19

seth
Member
Registered: 2012-09-03
Posts: 61,650

Re: [SOLVED] System libraries mismatch | libstdc++.so mismatch

The Qkk checks package integrity, the greps filter out some noise . but you don't have any reason to trust that explanation either, do you?
=> man pacman

The problem likely isn't pacman-static. You've not revealed the nature of "None of which worked." but you either had issues with the subshell or alpm hooks.
Either way, using the pacman from the iso side-steps any defects on the target system and just fixes it offline.

Offline

#5 2024-12-22 19:10:10

ChrisKayKos
Member
Registered: 2024-12-21
Posts: 12

Re: [SOLVED] System libraries mismatch | libstdc++.so mismatch

Sorry for the delay, I just saw that you said that you assume my shell doesn't work. Actually, I have kept my laptop alive for 2 days and the bash shell works. I also have access to the web with Vivaldi browser.

I am posting back because I feel kind of insecure rebooting and losing the last remains of my machine. Once I had a partial upgrade and tried to rebooted to re installed the packages from a USB stick, I somehow messed up the EFI partition and the kernel couldn't work.

So I am kindly asking, if there is a way to do it without re-booting? I can provide you with my system info. If you have free time ofc.

Thank you.

Offline

#6 2024-12-22 19:47:20

loqs
Member
Registered: 2014-03-06
Posts: 18,354

Re: [SOLVED] System libraries mismatch | libstdc++.so mismatch

Adjusting seth's commands to use pacman-static for the running system (assumes grep cat and curl as well as pacman-static work):

LC_ALL=C pacman-static -Qkk |& grep -v ', 0 altered files' | grep -v backup > /tmp/howbadisit.txt
cat /tmp/howbadisit.txt | curl -F 'file=@-' 0x0.st

Offline

#7 2024-12-22 20:21:53

ChrisKayKos
Member
Registered: 2024-12-21
Posts: 12

Re: [SOLVED] System libraries mismatch | libstdc++.so mismatch

loqs wrote:
LC_ALL=C pacman-static -Qkk |& grep -v ', 0 altered files' | grep -v backup > /tmp/howbadisit.txt
cat /tmp/howbadisit.txt | curl -F 'file=@-' 0x0.st

I tried this and

sudo pacman-static --cachedir=var/cache/pacman/pkg/ -Syu $(pacman-static --root=/mnt -Qqn)

.
Apparently 0x0.st is banned in my country because it returns 451 Unavailable For Legal Reasons
As for re installing all packages I got this:

error: could not open file var/cache/pacman/pkg/download-LBdjFA/linux-6.12.6.arch1-1-x86_64.pkg.tar.zst.part: No such file or directory
error: failed to setup a download payload for linux-6.12.6.arch1-1-x86_64.pkg.tar.zst
warning: failed to retrieve some files
error: failed to commit transaction (failed to retrieve some files)
Errors occurred, no packages were upgraded.

Last edited by ChrisKayKos (2024-12-22 20:22:17)

Offline

#8 2024-12-22 20:40:05

seth
Member
Registered: 2012-09-03
Posts: 61,650

Re: [SOLVED] System libraries mismatch | libstdc++.so mismatch

As for re installing all packages I got this:

Does "pacman-static --disable-sandbox …" help w/ that?
Did you get other errors beforehand?

Can you reach termbin?

cat /tmp/howbadisit.txt | nc termbin.com 9999

Actually, I have kept my laptop alive for 2 days and the bash shell works.

Running processes will not be affected by damaged files on disk, can you run a nested shell, ie

/bin/bash

from inside the active bash?

I am posting back because I feel kind of insecure rebooting and losing the last remains of my machine. Once I had a partial upgrade and tried to rebooted to re installed the packages from a USB stick, I somehow messed up the EFI partition and the kernel couldn't work.

The good thing is that you're not alone. loqs is here, I'm here and in doubt there's at least half a dozen other users competent enough - we'll carry you through this.
Plus you already made the mistake to not mount the EFI partition (or mount it into the wrong location), so you're gonna gonna make /that/ mistake again wink

Make sure to have access to a recent-ish (otherwise you'll run into a dated keyring) arch install iso.
The first thing you want to do is to fsck the partition before mounting it into /mnt, mount your boot and/or EFI partition.
Then see #2

Offline

#9 2024-12-23 09:18:23

ChrisKayKos
Member
Registered: 2024-12-21
Posts: 12

Re: [SOLVED] System libraries mismatch | libstdc++.so mismatch

Does "pacman-static --disable-sandbox …" help w/ that?
Did you get other errors beforehand?

I accidentaly typed pacman-static --root=/mnt on my machine lol. But still, after I fixed that, I would get errors (posted below). I tried to re install all pkgs before I opened the post and the same would happen

can you run a nested shell, ie

/bin/bash

from inside the active bash?

Yes I can! But i think there is something wrong, before when i used to double click links it would open them (i use urxvt). I dont think that has anything to do with that tho.

The good thing is that you're not alone. loqs is here, I'm here and in doubt there's at least half a dozen other users competent enough - we'll carry you through this.
Plus you already made the mistake to not mount the EFI partition (or mount it into the wrong location), so you're gonna gonna make /that/ mistake again wink

Lol, i am quite sure i will make screw up again, thanks for the help so far guys smile

The first thing you want to do is to fsck the partition before mounting it into /mnt, mount your boot and/or EFI partition.

I think what screwed up my EFI partition is that, either i chrooted into the system, or didn't unmount the filesystem, or i didnt mount neither the EFI partition nor the /boot.
Why did you say previously not to chroot?
Why do i have to mount the EFI or boot?

Here are the logs:

LC_ALL=C pacman-static -Qkk |& grep -v ', 0 altered files' | grep -v backup > /tmp/howbadisit.txt
cat /tmp/howbadisit.txt | curl -F 'file=@-' 0x0.st

running it:
https://termbin.com/wrpf

Re-installing pkgs & Further inspection:
https://termbin.com/i523

Offline

#10 2024-12-23 09:30:28

seth
Member
Registered: 2012-09-03
Posts: 61,650

Re: [SOLVED] System libraries mismatch | libstdc++.so mismatch

Why did you say previously not to chroot?

Because you're facing corrupted libraries on the installed system - the reliable way to fix that is offline, ie. without using that system at all.

Seems the only (major) issue is

warning: gcc-libs: /usr/lib/libstdc++.so.6 (Symlink path mismatch)
warning: gcc-libs: /usr/lib/libstdc++.so.6 (Modification time mismatch)

?

ls -l /usr/lib/libstdc*

Offline

#11 2024-12-23 09:39:24

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 8,824
Website

Re: [SOLVED] System libraries mismatch | libstdc++.so mismatch

Just for clarification:

ChrisKayKos wrote:

Why do i have to mount the EFI or boot?

You need to make sure the EFI system partition is mounted correctly before attempting to reinstall the packages because the kernel image needs to be stored under /boot/, which might be on the ESP.

Check /etc/fstab in the installed system to see what should be mounted where. Post the file here if you can't understand it.


Jin, Jîyan, Azadî

Offline

#12 2024-12-23 09:52:49

ChrisKayKos
Member
Registered: 2024-12-21
Posts: 12

Re: [SOLVED] System libraries mismatch | libstdc++.so mismatch

seth wrote:

ls -l /usr/lib/libstdc*

chrisk@chrisk-arch src(master) $ ls -l /usr/lib/libstdc* 
-rw-r--r-- 1 root root  6998160 Dec 14 12:06 /usr/lib/libstdc++.a
-rwxr-xr-x 1 root root      955 Dec 21 10:47 /usr/lib/libstdc++.la
-rw-r--r-- 1 root root      323 Dec 21 10:47 /usr/lib/libstdc++.modules.json
lrwxrwxrwx 1 root root       19 Dec 14 12:06 /usr/lib/libstdc++.so -> libstdc++.so.6.0.33
lrwxrwxrwx 1 root root       19 Dec 23 08:54 /usr/lib/libstdc++.so.6 -> libstdc++.so.6.0.34
-rwxr-xr-x 1 root root 22040176 Dec 14 12:06 /usr/lib/libstdc++.so.6.0.33
-rwxr-xr-x 1 root root   498704 Dec 21 10:47 /usr/lib/libstdc++.so.6.0.34
-rw-r--r-- 1 root root  1098178 Dec 14 12:06 /usr/lib/libstdc++exp.a
-rw-r--r-- 1 root root   797620 Dec 14 12:06 /usr/lib/libstdc++fs.a

Offline

#13 2024-12-23 10:00:45

seth
Member
Registered: 2012-09-03
Posts: 61,650

Re: [SOLVED] System libraries mismatch | libstdc++.so mismatch

-rwxr-xr-x 1 root root   498704 Dec 21 10:47 /usr/lib/libstdc++.so.6.0.34
-rwxr-xr-x 1 root root   498704 Dec 21 10:47 /usr/lib/libstdc++.so.6.0.34

wtf is that?

sudo ln -sf libstdc++.so.6.0.33 /usr/lib/libstdc++.so.6

Edit:

pacman -Qo /usr/lib/libstdc++.so.6.0.34

Last edited by seth (2024-12-23 10:01:10)

Offline

#14 2024-12-23 10:04:38

ChrisKayKos
Member
Registered: 2024-12-21
Posts: 12

Re: [SOLVED] System libraries mismatch | libstdc++.so mismatch

Head_on_a_Stick wrote:

Check /etc/fstab in the installed system to see what should be mounted where. Post the file here if you can't understand it.

/etc/fstab

chrisk@chrisk-arch ~ $ cat /etc/fstab 
# Static information about the filesystems.
# See fstab(5) for details.

# <file system> <dir> <type> <options> <dump> <pass>
# /dev/nvme0n1p3
UUID=e323702e-a372-4f2e-a494-4bf0c5fed266	/         	ext4      	rw,relatime,stripe=32	0 1

# /dev/nvme0n1p1
UUID=3984-9C20      	/boot     	vfat      	rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro	0 2

# /dev/nvme0n1p2
UUID=3ba09192-2038-4f0e-92d3-39cddb9df743	none      	swap      	defaults  	0 0

Inside the /boot directory there is a direcotry EFI with grub uefi inside

Head_on_a_Stick wrote:

You need to make sure the EFI system partition is mounted correctly before attempting to reinstall the packages because the kernel image needs to be stored under /boot/, which might be on the ESP.

Let's say I don't mount the kernel image, what could/would happen?

Offline

#15 2024-12-23 10:11:51

ChrisKayKos
Member
Registered: 2024-12-21
Posts: 12

Re: [SOLVED] System libraries mismatch | libstdc++.so mismatch

seth wrote:
sudo ln -sf libstdc++.so.6.0.33 /usr/lib/libstdc++.so.6

Everything works now! Nothing depended on 6.0.34 so it doesn't create any out-of-sync packages.
How did you know (except being a genius)?
6.0.34 is not backwards compatible?

Last edited by ChrisKayKos (2024-12-23 10:12:38)

Offline

#16 2024-12-23 10:13:48

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 8,824
Website

Re: [SOLVED] System libraries mismatch | libstdc++.so mismatch

ChrisKayKos wrote:

Let's say I don't mount the kernel image, what could/would happen?

The system would be rendered unbootable if you attempted to change the kernel version without the /boot/ partition being mounted.

So use

mount /dev/nvme0n1p3 /mnt
mount /dev/nvme0n1p1 /mnt/boot

Then proceed with the repairs under /mnt/.

Last edited by Head_on_a_Stick (2024-12-23 10:14:42)


Jin, Jîyan, Azadî

Offline

#17 2024-12-23 10:15:12

ChrisKayKos
Member
Registered: 2024-12-21
Posts: 12

Re: [SOLVED] System libraries mismatch | libstdc++.so mismatch

Head_on_a_Stick wrote:
ChrisKayKos wrote:

Let's say I don't mount the kernel image, what could/would happen?

The system would be rendered unbootable if you attempted to change the kernel version without the /boot/ partition being mounted.

So use

mount /dev/nvme0n1p3 /mnt
mount /dev/nvme0n1p1 /mnt/boot

Then proceed with the repairs under /mnt/.

Theoretically would there be a fix?

Offline

#18 2024-12-23 10:16:33

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 8,824
Website

Re: [SOLVED] System libraries mismatch | libstdc++.so mismatch

Just reinstall the kernel with the /boot/ partition correctly mounted. We see that sort of thing pretty regularly here.

EDIT: and please don't full-quote unnecessarily, it bloats the thread.

Last edited by Head_on_a_Stick (2024-12-23 10:17:14)


Jin, Jîyan, Azadî

Offline

#19 2024-12-23 10:17:01

seth
Member
Registered: 2012-09-03
Posts: 61,650

Re: [SOLVED] System libraries mismatch | libstdc++.so mismatch

6.0.34 is not backwards compatible?

The present comppilation isn't (see the filesize and the errors) - where did that thing come from tbw?

How did you know (except being a genius)?

Mileage.

Edit: Please always remember to mark resolved threads by editing your initial posts subject - so others will know that there's no task left, but maybe a solution to find.
Thanks.

Last edited by seth (2024-12-23 10:17:29)

Offline

#20 2024-12-23 10:29:26

ChrisKayKos
Member
Registered: 2024-12-21
Posts: 12

Re: [SOLVED] System libraries mismatch | libstdc++.so mismatch

seth wrote:

where did that thing come from tbw?

No idea lol. Probably by building gcc from source and installing it on my /usr/lib

Thank you everyone for everything! I fixed my machine and most importantly, learnt a lot of things because of your support smile smile

Offline

#21 2024-12-23 10:29:49

seth
Member
Registered: 2012-09-03
Posts: 61,650

Re: [SOLVED] System libraries mismatch | libstdc++.so mismatch

Oh, the genius almost forgot: the one in /usr/lib32 is also affected.

Offline

#22 2024-12-23 12:46:04

ChrisKayKos
Member
Registered: 2024-12-21
Posts: 12

Re: [SOLVED] System libraries mismatch | libstdc++.so mismatch

So, my genius actually solved the problem but failed to realize that while re installing all the pkgs, a partial upgrade occurred ( that's what I think at least ). Trying to boot into the system, I get "kernel not found" then I go to some sort of logs that say there is an offset in the kernel.

I saw another post with dealing with the same problem. The answer was to chroot into the machine then pacman -S linux.

Thanks to Head_on_a_Stick, I know I have to mount the boot too. My question now is, how to unmount properly? Do I just unmount /mnt, or do I have to do anything with /mnt/boot?

Offline

#23 2024-12-23 12:52:45

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 8,824
Website

Re: [SOLVED] System libraries mismatch | libstdc++.so mismatch

Why not try

umount /mnt

And see what it says if /mnt/boot/ is still mounted wink

Exiting the chroot and rebooting should un-mount everything automatically anyway.


Jin, Jîyan, Azadî

Offline

#24 2024-12-23 13:12:41

seth
Member
Registered: 2012-09-03
Posts: 61,650

Re: [SOLVED] System libraries mismatch | libstdc++.so mismatch

I get "kernel not found"

That's not a partial update and if you previously ran into pacman errors, nothing had been updated?

Offline

#25 2024-12-23 13:22:04

ChrisKayKos
Member
Registered: 2024-12-21
Posts: 12

Re: [SOLVED] System libraries mismatch | libstdc++.so mismatch

Head_on_a_Stick wrote:

Why not try

umount /mnt

And see what it says if /mnt/boot/ is still mounted wink

You are right! I got my system back. It was saying target busy when trying to unmount (ngl i sweated over that part), but i found out it was because of /boot being nested in the /mnt.
Thanks smile

seth wrote:

That's not a partial update and if you previously ran into pacman errors, nothing had been updated?

I am thinking that too. Unfortunately i didnt save the full logs.
My reason to believe it was caused by partial upgrade is that even though it downloaded & installed the packages, it couldn't build the kernel img as bsdcpio & other bsd commands were failing because of libstdc++

Last edited by ChrisKayKos (2024-12-23 13:23:21)

Offline

Board footer

Powered by FluxBB