Pacman: error while loading shared libraries: libxml2.so.2: cannot open shared object file: No such file or directory

I recently was trying to update using garuda-update it was complaining about libxml. A thread here suggested running cleanup. I did so and it removed an old electron32 package. The update started, but then it never actually extracted the packages.

Now I’m stuck arch-chrooted into my system via a live USB as I couldn’t boot into my snapshots or normally.

Every time I try to run garuda-update, I see the following:
pacman: error while loading shared libraries: libxml2.so.2: cannot open shared object file: No such file or directory

Another thread elsewhere suggested: pacman --root /mnt --cache /mnt/var/cache/pacman/pkg -S libxml2-legacy pacman --root /mnt --cache /mnt/var/cache/pacman/pkg -Sy archlinux-keyring pacman --root /mnt --cache /mnt/var/cache/pacman/pkg -Scc
But I get the same error.

I tried running paru and get the same error, except it says paru: error...

Have also tried simply to run pacman -S libxml2 or libxml2-legacy. Always the same error. Any suggestions how to get things cooperating via the chroot?

I ran garuda-inxi from within chroot, here’s my output:

12System:
12Kernel 6.13.5-zen1-1-zen 12arch x86_64 12bits 64 12compiler gcc 12v 14.2.1 12clocksource tsc
12avail hpet,acpi_pm 12parameters BOOT_IMAGE=/boot/vmlinuz-x86_64 lang=en_US keytable=us tz=UTC
misobasedir=garuda root=miso:LABEL=GARUDA_DR460NIZED_BROADWING quiet systemd.show_status=1
checksum=y driver=nonfree nouveau.modeset=0 i915.modeset=1 radeon.modeset=1
12Desktop KDE Plasma 12v ERR-101 12tk Qt 12v N/A 12tools 12avail hypridle,hyprlock 12dm SDDM
12Distro Arch Linux
12Machine:
12Type Desktop 12Mobo System76 12model Thelio Mira 12v thelio-mira-r3 12serial N/A
12uuid 035e02d8-04d3-05e4-9c06-bb0700080009 12UEFI System76 12v F5d Z5 12date 10/07/2022
12CPU:
12Info 12model AMD Ryzen 9 7950X 12socket AM5 12bits 64 12type MT MCP 12arch Zen 4 12gen 4 12level v4 12note check
12built 2022+ 12process TSMC n5 (5nm) 12family 0x19 (25) 12model-id 0x61 (97) 12stepping 2
12microcode 0xA601209
12Topology 12cpus 1x 12dies 2 12clusters 2x1 12cores 16 12threads 32 12tpc 2 12smt enabled 12cache 12L1 1024 KiB
12desc d-16x32 KiB; i-16x32 KiB 12L2 16 MiB 12desc 16x1024 KiB 12L3 64 MiB 12desc 2x32 MiB
12Speed (MHz) 12avg 3010 12min/max 400/5881 12boost enabled 12base/boost 4500/5850 12scaling
12driver amd-pstate-epp 12governor powersave 12volts 1.3 V 12ext-clock 100 MHz 12cores 121 3010 122 3010 123 3010
124 3010 125 3010 126 3010 127 3010 128 3010 129 3010 1210 3010 1211 3010 1212 3010 1213 3010 1214 3010 1215 3010
1216 3010 1217 3010 1218 3010 1219 3010 1220 3010 1221 3010 1222 3010 1223 3010 1224 3010 1225 3010 1226 3010 1227 3010
1228 3010 1229 3010 1230 3010 1231 3010 1232 3010 12bogomips 287450
12Flags avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 svm
12Vulnerabilities <filter>
12Graphics:
12Device-1 NVIDIA GA102 [GeForce RTX 3080 Ti] 12vendor eVga.com. 12driver nvidia 12v 570.124.04
12non-free 550-570.xx+ 12status current (as of 2025-04; EOL~2026-12-xx) 12arch Ampere 12code GAxxx
12process TSMC n7 (7nm) 12built 2020-2023 12pcie 12gen 1 12speed 2.5 GT/s 12lanes 16 12link-max 12gen 4
12speed 16 GT/s 12ports 12active none 12off DP-4,DP-5,HDMI-A-2 12empty DP-6 12bus-ID 01:00.0
12chip-ID 10de:2208 12class-ID 0300
12Device-2 Advanced Micro Devices [AMD/ATI] Raphael 12vendor Gigabyte 12driver amdgpu 12v kernel
12arch RDNA-2 12code Navi-2x 12process TSMC n7 (7nm) 12built 2020-22 12pcie 12gen 4 12speed 16 GT/s 12lanes 16
12ports 12active none 12empty DP-1, DP-2, DP-3, HDMI-A-1, Writeback-1 12bus-ID 15:00.0
12chip-ID 1002:164e 12class-ID 0300 12temp 43.0 C
12Device-3 AVerMedia Live Streamer CAP 4K 12driver snd-usb-audio,usbhid,uvcvideo 12type USB 12rev 3.0
12speed 5 Gb/s 12lanes 1 12mode 3.2 gen-1x1 12bus-ID 8-2:2 12chip-ID 07ca:1113 12class-ID 0300
12serial <filter>
12Display unspecified 12server X.org 12v 1.21.1.16 12with Xwayland 12v 24.1.6 12driver
12gpu nvidia,nvidia-nvswitch 12display-ID :0
12Monitor-1 DP-4 12model AOC AG493US3R4 12serial <filter> 12built 2023 12res 3840x1080 12dpi 82 12gamma 1.2
12size 1192x335mm (46.93x13.19") 12diag 1238mm (48.7") 12modes 12max 3840x1080 12min 640x480
12Monitor-2 DP-5 12model Samsung LS28AG700N 12serial <filter> 12built 2022 12res 3840x2160 12dpi 152
12gamma 1.2 12size 632x360mm (24.88x14.17") 12diag 734mm (28.9") 12ratio 16:9 12modes 12max 3840x2160
12min 640x480
12Monitor-3 HDMI-A-2 12model HDMI 12built 2023 12res 1920x1080 12gamma 1.2 12size 344x195mm (13.54x7.68")
12modes 12max 1920x1080 12min 640x480
12API EGL 12v 1.5 12hw 12drv amd radeonsi 12platforms 12surfaceless 12drv radeonsi 12inactive gbm,wayland,x11
12API OpenGL 12v 4.6 12vendor mesa 12v 25.0.5-arch1.1 12note incomplete (EGL sourced) 12renderer AMD
Radeon Graphics (radeonsi raphael_mendocino LLVM 19.1.7 DRM 3.61 6.13.5-zen1-1-zen)
12API Vulkan 12Message No Vulkan data available.
12Info 12Tools 12api clinfo, eglinfo, glxinfo, vulkaninfo 12de kscreen-console,kscreen-doctor
12gpu nvidia-settings,nvidia-smi 12wl wayland-info 12x11 xdpyinfo, xprop, xrandr
12Audio:
12Device-1 NVIDIA GA102 High Definition Audio 12vendor eVga.com. 12driver snd_hda_intel 12v kernel 12pcie
12gen 1 12speed 2.5 GT/s 12lanes 16 12link-max 12gen 4 12speed 16 GT/s 12bus-ID 01:00.1 12chip-ID 10de:1aef
12class-ID 0403
12Device-2 Advanced Micro Devices [AMD/ATI] Rembrandt Radeon High Definition Audio
12driver snd_hda_intel 12v kernel 12pcie 12gen 4 12speed 16 GT/s 12lanes 16 12bus-ID 15:00.1 12chip-ID 1002:1640
12class-ID 0403
12Device-3 Advanced Micro Devices [AMD] Family 17h/19h/1ah HD Audio 12vendor Gigabyte
12driver snd_hda_intel 12v kernel 12pcie 12gen 4 12speed 16 GT/s 12lanes 16 12bus-ID 15:00.6 12chip-ID 1022:15e3
12class-ID 0403
12Device-4 RODE Microphones RODECaster Pro II 12driver hid-generic,snd-usb-audio,usb-storage,usbhid
12type USB 12rev 2.0 12speed 480 Mb/s 12lanes 1 12mode 2.0 12bus-ID 1-1:2 12chip-ID 19f7:0072 12class-ID 0300
12serial <filter>
12Device-5 AVerMedia Live Streamer CAP 4K 12driver snd-usb-audio,usbhid,uvcvideo 12type USB 12rev 3.0
12speed 5 Gb/s 12lanes 1 12mode 3.2 gen-1x1 12bus-ID 8-2:2 12chip-ID 07ca:1113 12class-ID 0300
12serial <filter>
12API ALSA 12v k6.13.5-zen1-1-zen 12status kernel-api 12tools N/A
12Server-1 sndiod 12v N/A 12status off 12tools aucat,midicat,sndioctl
12Server-2 PipeWire 12v 1.4.2 12status off 12with 121 pipewire-pulse 12status off 122 wireplumber 12status off
123 pipewire-alsa 12type plugin 124 pw-jack 12type plugin 12tools pactl,pw-cat,pw-cli,wpctl
12Network:
12Device-1 Realtek RTL8125 2.5GbE 12vendor Gigabyte 12driver r8169 12v kernel 12pcie 12gen 2 12speed 5 GT/s
12lanes 1 12port e000 12bus-ID 0d:00.0 12chip-ID 10ec:8125 12class-ID 0200
12IF enp13s0 12state up 12speed 1000 Mbps 12duplex full 12mac <filter>
12Device-2 MEDIATEK MT7922 802.11ax PCI Express Wireless Network Adapter 12driver mt7921e 12v kernel
12pcie 12gen 2 12speed 5 GT/s 12lanes 1 12bus-ID 0e:00.0 12chip-ID 14c3:0616 12class-ID 0280
12IF wlp14s0 12state down 12mac <filter>
12Info 12services No services found.
12Bluetooth:
12Device-1 MediaTek Wireless_Device 12driver btusb 12v 0.8 12type USB 12rev 2.1 12speed 480 Mb/s 12lanes 1
12mode 2.0 12bus-ID 3-7:3 12chip-ID 0e8d:0616 12class-ID e001 12serial <filter>
12Report btmgmt 12ID hci0 12rfk-id 0 12state down 12bt-service N/A 12rfk-block 12hardware no 12software no
12address N/A
12Drives:
12Local Storage 12total 991.27 GiB 12used 925.51 GiB (93.4%)
12ID-1 /dev/nvme0n1 12maj-min 259:0 12vendor Samsung 12model SSD 980 PRO 1TB 12size 931.51 GiB 12block-size
12physical 512 B 12logical 512 B 12speed 63.2 Gb/s 12lanes 4 12tech SSD 12serial <filter> 12fw-rev 5B2QGXA7
12temp 41.9 C 12scheme GPT
12SMART yes 12health PASSED 12on 37d 23h 12cycles 370 12read-units 233,785,913 [119 TB]
12written-units 66,935,442 [34.2 TB]
12ID-2 /dev/sdb 12maj-min 8:16 12vendor Samsung 12model Flash Drive 12size 59.75 GiB 12block-size
12physical 512 B 12logical 512 B 12type USB 12rev 2.1 12spd 480 Mb/s 12lanes 1 12mode 2.0 12tech SSD
12serial <filter> 12fw-rev 1100 12scheme MBR
12SMART Message Unknown USB bridge. Flash drive/Unsupported enclosure?
12Partition:
12ID-1 / 12raw-size 931.22 GiB 12size 931.22 GiB (100.00%) 12used 925.51 GiB (99.4%) 12fs btrfs
12block-size 4096 B 12dev /dev/nvme0n1p2 12maj-min 259:2
12ID-2 /boot 12raw-size 300 MiB 12size 299.4 MiB (99.80%) 12used 608 KiB (0.2%) 12fs vfat
12block-size 512 B 12dev /dev/nvme0n1p1 12maj-min 259:1
12Swap:
12Kernel 12swappiness 133 (default 60) 12cache-pressure 100 (default) 12zswap no
12ID-1 swap-1 12type zram 12size 61.94 GiB 12used 0 KiB (0.0%) 12priority 100 12comp zstd
12avail lzo-rle,lzo,lz4,lz4hc,deflate,842 12max-streams 32 12dev /dev/zram0
12Sensors:
12System Temperatures 12cpu 46.5 C 12mobo 38.0 C 12gpu amdgpu 12temp 43.0 C
12Fan Speeds (rpm) N/A
12Info:
12Memory 12total 64 GiB 12note est. 12available 61.94 GiB 12used 8.29 GiB (13.4%)
12Processes 0 12Power 12uptime 31m 12states freeze,mem,disk 12suspend deep 12avail s2idle 12wakeups 0
12hibernate platform 12avail shutdown, reboot, suspend, test_resume 12image 24.74 GiB 12Init systemd
12v 257 12default graphical 12tool systemctl
12Packages 12pm pacman 12pkgs 0 12tools octopi,pacseek,paru 12pm flatpak 12pkgs 0 12Compilers 12clang 19.1.7
12gcc 15.1.1 12alt 13 12Client Unknown Client: kworker/u131:0-hci 12inxi 3.3.38
pacman: error while loading shared libraries: libxml2.so.2: cannot open shared object file: No such file or directory
Garuda ():
head: cannot open '/var/log/pacman.log' for reading: No such file or directory
System install date:
Last full system update: 2025-04-27
Is partially upgraded:   No
Relevant software:       snapper NetworkManager connman
Windows dual boot:       No/Undetected
Running in chroot, ignoring command 'list-units'
Failed units:

Try

sudo pacman -S libxml2-legacy

It works here :slight_smile:

Summary
sgs@mokka-y9 in ~ as 🧙 took 8s721ms
󰛓 ❯ speedtest++
speedtest++: error while loading shared libraries: libxml2.so.2: cannot open shared object file: No such file or directory

sgs@mokka-y9 in ~ as 🧙
[] 󰛓  ls /usr/lib/libxml2*
lrwxrwxrwx    - root 27 Apr 00:57  /usr/lib/libxml2.so -> libxml2.so.16
lrwxrwxrwx    - root 27 Apr 00:57  /usr/lib/libxml2.so.16 -> libxml2.so.16.0.2
.rwxr-xr-x 1,3M root 27 Apr 00:57  /usr/lib/libxml2.so.16.0.2

sgs@mokka-y9 in ~ as 🧙
󰛓 ❯ sudo pacman -S libxml2-legacy
Abhängigkeiten werden aufgelöst …
Nach in Konflikt stehenden Paketen wird gesucht …

Paket (1)             Neue Version  Netto-Veränderung  Größe des Downloads

extra/libxml2-legacy  2.13.8-1               1,70 MiB             0,59 MiB

Gesamtgröße des Downloads:             0,59 MiB
Gesamtgröße der installierten Pakete:  1,70 MiB

:: Installation fortsetzen? [J/n]
:: Pakete werden empfangen …
libxml2-legacy-2.13.8-1-x86_64                                                        600,6 KiB  2,41 MiB/s 00:00 [--------------------------------------------------------------------] 100%
(1/1) Schlüssel im Schlüsselbund werden geprüft                                                                    [--------------------------------------------------------------------] 100%
(1/1) Paket-Integrität wird überprüft                                                                              [--------------------------------------------------------------------] 100%
(1/1) Paket-Dateien werden geladen                                                                                 [--------------------------------------------------------------------] 100%
(1/1) Auf Dateikonflikte wird geprüft                                                                              [--------------------------------------------------------------------] 100%
(1/1) Verfügbarer Festplattenspeicher wird ermittelt                                                               [--------------------------------------------------------------------] 100%
:: Pre-transaction-Hooks werden gestartet …
(1/2) Rejecting pacman transaction if running in snapshot...
(2/2) Performing snapper pre snapshots for the following configurations...
==> root: 99
:: Paketänderungen werden verarbeitet …
(1/1) Installiert wird libxml2-legacy                                                                              [--------------------------------------------------------------------] 100%
:: Post-transaction-Hooks werden gestartet …
(1/6) Arming ConditionNeedsUpdate...
(2/6) Foreign/AUR package notification
=> No foreign/AUR packages found.
(3/6) Orphaned package notification...
=> No orphans found.
(4/6) Checking for .pacnew and .pacsave files...
.pac* files found:
/etc/hosts.pacnew
/etc/pacman.d/mirrorlist.pacnew
Please check and merge
(5/6) Performing snapper post snapshots for the following configurations...
==> root: 100
(6/6) Syncing all file systems...

sgs@mokka-y9 in ~ as 🧙 took 5s979ms
󰛓 ❯ speedtest++
SpeedTest++ version 1.15
Speedtest.net command line interface
Info: https://github.com/taganaka/SpeedTest
Fixed: https://github.com/gglluukk/SpeedTest
Author: Francesco Laurita <francesco.laurita@gmail.com>

IP: "5.147.49.189" ("Vodafone West GmbH") Location: [51.2217, 6.77616]
Finding fastest server... 10 Servers online

Server: Düsseldorf speedtest.dg-sys.net:8080 by Deutsche-Glasfaser (0.463814 km from you): 19 ms
Ping: 19 ms.
Jitter: 0 ms.
Determine line type (2) ........................
Fiber / Lan line type detected: profile selected fiber

Testing download speed (32) ...........................................................................................................................................................................................................................................................
Download: 980.56 Mbit/s
Testing upload speed (12) .................................................................................
Upload: 52.81 Mbit/s
1 Like

I’ve tried that. When I do so I just get the following:

[root@garuda-dr460nized /]# sudo pacman -S libxml2-legacy
pacman: error while loading shared libraries: libxml2.so.2: cannot open shared object file: No such file or directory
[root@garuda-dr460nized /]#

Even trying to query to see what’s using libxml2.so.2 I can’t:

[root@garuda-dr460nized /]# pacman -Qi libxml2
pacman: error while loading shared libraries: libxml2.so.2: cannot open shared object file: No such file or directory

Here’s a hacky solution (though I have used similar myself), download the static linked pacman binary and run it to complete the upgrade.
You’ll have to search to find it, because I’d have to search to find it, and you’re the one that needs it :wink:

Found it, but since I’m in the chroot I don’t think I can do that. It says using makepkg while root can mess up the system and so I can’t do it.

There is a binary pre-built (or there would be no point in it).
Been a few years since I needed it, but I think you can just ftp or http transfer it down.

This does not work because pacman is not the cause, but libxml2.so.2 is missing (therefore the system does not boot anymore) - libxml2.so.2 is just a symlink to libxml2.so.x.xx.x.

First check which version of libxml2 is existing under /usr/lib/, current would be libxml2.so.16.0.2. Then create a symlink (from the tty or live.iso/chroot):

Change to the directory:

cd /usr/lib/

Then create a symlink to the existing libxml2.so.x.xx.x (replace x.xx.x with the existing version):

sudo ln -s libxml2.so.x.xx.x libxml2.so.2

then reboot

reboot

Then Linux should boot again without issues.

2 Likes

Yes, my thought was get the statically linked pacman package, then you can upgrade xml safely.
Yet another way to crack the walnut.

This did get me a different error, but I don’t think I can reboot as I think the update that was running messed up after it. So tried to install libxml2-legacy and tried garuda-update both show the following:

sh-5.2# sudo pacman -S libxml2-legacy
pacman: /usr/lib/libxml2.so.2: no version informa
tion available (required by /usr/lib/libarchive.s
o.13)
pacman: /usr/lib/libxml2.so.2: no version informa
tion available (required by /usr/lib/libarchive.s
o.13)
pacman: /usr/lib/libxml2.so.2: no version informa
tion available (required by /usr/lib/libarchive.s
o.13)
pacman: /usr/lib/libxml2.so.2: no version informa
tion available (required by /usr/lib/libarchive.s
o.13)
pacman: /usr/lib/libxml2.so.2: no version informa
tion available (required by /usr/lib/libarchive.s
o.13)
pacman: symbol lookup error: /usr/lib/libarchive.
so.13: undefined symbol: UTF8Toisolat1, version L
IBXML2_2.4.30

For context I ran:

sudo ln -s libxml2.so.16.0.2 libxml2.so.2

As that’s the version that all the symlinks were pointing to.

Please, no pictures from terminal.

Did you check

I got now with -legacy

ls /usr/lib/libxml2*
lrwxrwxrwx    - root 27 Apr 00:57  /usr/lib/libxml2.so -> libxml2.so.16
lrwxrwxrwx    - root  2 Mai 03:42  /usr/lib/libxml2.so.2 -> libxml2.so.2.13.8
.rwxr-xr-x 1,4M root  2 Mai 03:42  /usr/lib/libxml2.so.2.13.8
lrwxrwxrwx    - root 27 Apr 00:57  /usr/lib/libxml2.so.16 -> libxml2.so.16.0.2
.rwxr-xr-x 1,3M root 27 Apr 00:57  /usr/lib/libxml2.so.16.0.2

No pictures from terminal? I’m using ~~~, will use triple `

But yes, I see: this:

sh-5.2# ls -la /usr/lib/libxml2*
lrwxrwxrwx 1 root root      13 Apr 26 17:57 /usr/lib/libxml2.so -> libxml2.so.16
lrwxrwxrwx 1 root root      17 Apr 26 17:57 /usr/lib/libxml2.so.16 -> libxml2.so.16.0.2
-rwxr-xr-x 1 root root 1293256 Apr 26 17:57 /usr/lib/libxml2.so.16.0.2

When I try to install libxml2-legacy this is what I get:

sh-5.2# sudo pacman -S libxml2-legacy
pacman: error while loading shared libraries: libxml2.so.2: cannot open shared object file: No such file or directory

Ahhah, try adding a ‘ln -s libxml2.so.16 libxml2.so.2’ (I may have those arguments backwards…I tend to do that) (will test and edit to confirm or deny if I’m dyslexic in remembering)
Yes, I was backwards…fixing. Fixed.

I hate doing this stuff…because you will probably need to undo it later.

Please see above. Pacman: error while loading shared libraries: libxml2.so.2: cannot open shared object file: No such file or directory - #9 by vashinator7

I had tried this and it produced a different set of errors. I have since removed the symlink. But

Ok, sorry if I repeated something you had tried, but it looked likely at the time.

I understand. It at least got a change of error message, but unsure of the approach from there.

What kind of error?

Stop fiddling with pacman and garuda-update, it won`t work until the libxml2 stuff is fixed.

If you have set the symlink correctly, then do that:

1 Like

I ran this and rebooted.

I then got a message that it couldn’t find the linux zen (or LTS) kernel file depending on what i pick. Trying to use a snapshot leads me into a tty where it just says the console is locked and to press enter to continue. Pressing Enter results in the same message.

Like I mentioned, the update that caused the error in the first place failed. So I think I have to run garuda-update or install kernel headers or something before I reboot.

Any other suggestions on what I can do? It doesn’t seem like I can make any progress outside the live USB environment since I don’t believe I can get to an actual TTY without the kernel stuff.

I suspect that the symlink was deleted during the cleanup or by the failed system update.

Most likely due to the failed update.
Try to boot again normally (no snapshot) until the error message about missing kernel appears and try to open a tty. If that works, then log in and try to reinstall the missing kernel and headers (or try garuda-update). At this point you will see if pacman works again or not.
If you cannot open a tty, then try the whole thing from the live environment.

No luck getting to a TTY.

Back in the live usb, I used garuda-chroot to get back into my local install. I then added the symlink:

cd /usr/lib
ln -s libxml2.so.16.0.2 libxml2.so.2

I did notice previously that I put it in the wrong place. I may try another reboot, but I don’t see how this would get me past the missing kernel. Going to try it.

From there running garuda-update or really any pacman command gives me this:

pacman: /usr/lib/libxml2.so.2: no version information available (required by /usr/lib/libarchive.so.13)
pacman: /usr/lib/libxml2.so.2: no version information available (required by /usr/lib/libarchive.so.13)
pacman: /usr/lib/libxml2.so.2: no version information available (required by /usr/lib/libarchive.so.13)
pacman: /usr/lib/libxml2.so.2: no version information available (required by /usr/lib/libarchive.so.13)
pacman: /usr/lib/libxml2.so.2: no version information available (required by /usr/lib/libarchive.so.13)
pacman: symbol lookup error: /usr/lib/libarchive.so.13: undefined symbol: UTF8Toisolat1, version LIBXML2_2.4.30

Most likely due to the failed update.

I suspect this is the core of the issue at this point, I just can’t get past the libxml2 error to fix it.

Yep, that’s exactly what you should do after fixing the symlink. This is necessary to get pacman running to fix the rest of the failed update.