Hello,
I had an issue while updating my system with pamac and the computer turned off while updating, which resulted in me not being able to boot. I was following the steps reported at this page and was able to chroot properly and mount the partition. However, when I try to pacman -Syyu
or pamac upgrade
I get:
error while loading shared libraries: /usr/lib/libcurl.so.4: file too short
I tried looking for solutions online but can’t really do anything without either pacman or pamac. As far as I can tell, curl by itself seems to work. What can I do to fix this? I would obviously prefer restoring my old system, but in case I have to reinstall I would also like to know how to get my data back before doing so after mounting the partition.
Thanks for the help, and let me know if anything else is needed!
Small update, I tried to follow https://wiki.archlinux.org/title/Pacman at 3.7.3 to manually reinstall the library with
tar -xvpwf /var/cache/pacman/pkg/libcurl-compat-8.9.1-1-x86_64.pkg.tar.zst -C / --exclude .PKGINFO --exclude .INSTALL --exclude .MTREE --exclude .BUILDINFO
However with this I get:
zstd: error while loading shared libraries: /usr/lib/liblz4.so.1: file too short
I don’t know how to manually install this one since there isn’t a .zst for it in the cache folder
Within chroot reinstall all broken packages with
pacman -S {broken-package} --overwrite '*'
Of course, replace {broken-package} with the real package name. You could start with
pacman -S curl lz4 --overwrite '*'
as they own /usr/lib/libcurl.so.xxx and /usr/lib/liblz4.so.xxx.
Afterwards, try to update as usual and reboot.
Thanks,
this gives me the same issue, e.g.
pacman: error while loading shared libraries: /usr/lib/libcurl.so.4: file too short
is there another way I can reinstall them?
I see, it affects pacman as it’s a dependency of it. Try pacman-static:
https://wiki.archlinux.org/title/Pacman#Using_pacman-static
1 Like
How can I install pacman-static? I can pamac install pacman-static
outside of chroot and I verified that it works, but as soon as I reactivate chroot I don’t see the command anymore. Both pamac and pacman don’t work in chroot because of the same issue.
Have a look here:
https://pkgbuild.com/~morganamilo/pacman-static/x86_64/
Pre-compiled binaries are located here:
https://pkgbuild.com/~morganamilo/pacman-static/x86_64/bin/
Commands:
wget https://pkgbuild.com/~morganamilo/pacman-static/x86_64/bin/pacman-static
chmod +x pacman-static
./pacman-static -Syyu curl lz4 pacman
(within chroot environment)
1 Like
pacman-static
is probably the easier way and the better option
but there is, of course, another:
tar -xvpwf /var/cache/pacman/pkg/libcurl-compat-8.9.1-1-x86_64.pkg.tar.zst -C / --exclude .PKGINFO --exclude .INSTALL --exclude .MTREE --exclude .BUILDINFO
pacman - ArchWiki
You are here trying to replace files, but you are trying to use the defunct system to do it.
It should work when you adapt the command so that you don’t need to be chrooted.
Just use the live system itself.
Mount the system /
(to /mnt
for instance)
and adapt the command
so that you can use the live system to do the task of extracting the .tar.zst package to where it belongs.
For me, personally, it would be much easier to just use a file manager (I’d use mc
as I always do).
but if you’d rather use the command line
the adapted command,
after you mounted your /
partition to /mnt
would look like:
tar -xvpwf /mnt/var/cache/pacman/pkg/libcurl-compat-8.9.1-1-x86_64.pkg.tar.zst -C /mnt --exclude .PKGINFO --exclude .INSTALL --exclude .MTREE --exclude .BUILDINFO
and it would work for the defunct liblz4.so
too in the same way
I’d just do it by hand (mc
) …
I got pacman-static in chroot, but this still fails to install curl with many errors of the sort
curl: /usr/share/man/man3/libcurl.3.gz exists in filesystem
I can pastebin the whole output if needed. Sorry if I need a lot of guidance, but on this one I don’t really know what I’m doing/how this works, so it’s hard for me to interpret errors. Do I need to remove some curl installation before reinstalling?
Use the --overwrite switch like in the example:
Thanks, that seems to have worked. Although at the end of the command I get
:: Running post-transaction hooks...
(1/1) Refreshing PackageKit...
Error connecting: Could not connect: No such file or directory
error: command failed to execute correctly
pacman is no longer complaining about curl/lz4, so I’m guessing that’s fine? I’m now having the same error with /usr/lib/libxml2.so.2
, in general how can I know which packages to reinstall given the missing libs? E.g. now with ./pacman-static -S xml2 --overwrite '*'
I simply get package not found.
pacman -F libxml2.so
will give you the package name, the name of the package which contains that file
in this case the name is:
libxml2
pacman -F libxml2.so
core/libxml2 2.12.5-1 [Installiert: 2.13.3-1]
usr/lib/libxml2.so
multilib/lib32-libxml2 2.12.5-1 [Installiert: 2.13.3-1]
usr/lib32/libxml2.so
Thanks! Pacman is now working within chroot, but now if I try to finish the update (e.g. pacman -Syyu
) it still fails with similar issues:
systemd-libs: /usr/include/libudev.h exists in filesystem
and many more. Do I also need to overwrite here?
If it already exists, you may not have to overwrite it.
But as you can’t know whether that file is either the previous one (possibly the old and therefore the wrong version)
or whether it is the new one, which is there, but corrupted (too short …)
I’d say:
yes, overwrite
But a .h (header file) is not that critical.
I’d overwrite … so that pacman is happy.
I see. I’ll just note that it isn’t just header files, but also stuff like
systemd-libs: /usr/lib/libsystemd.so exists in filesystem
systemd-libs: /usr/share/man/man3/sd_bus_add_fallback.3.gz exists in filesystem
which seems more important hahahah. Should I backup some stuff from the old system just in case? I don’t know how wrong things could go
And after that, it’s just pacman -Syyu --overwrite'*'
I’m assuming?
I could not tell you what “some stuff” - having a backup is always a good idea.
But by now you have done so much already that you should just follow through and finish the job.
Thanks I will try to at least back up some things for safety and then try to see if that works!
Yes, I suspected as much. So what else should I do? Simply try to update normally and overwrite every package that gives issues one by one until the update runs?
Would be more safe if you don’t want to risk being forced to reinstall.