Laptop behaves strangely, libffi.so.8: invalid ELF header?

Hello, laptop has been running well for months. Do all updates, btrfs, and occasionally balance. But recently, it has been behaving strangely, only after suspend/resume. What happens is, all menus become unresponsive (cannot open menus, cannot run anything, can’t even ALT-F4 something closed.) It’s not frozen; previously running tasks keep running. Can interact with tray apps, such as volume just fine. Sunday this happened, and I tried CTRL-ALT-F2 but I couldn’t type anything in to log in. Today this happened and I tried CTRL-ALT-F2, and was able to successfully log in, but then tried and got the following:

Manjaro Linux 6.1.0-1-MANJARO (Latitude3540) (tty2)

Latitude3540 login: me
Password: 
Last login: Sun Nov 6 16:19:15 on tty2
me@Latitude3540 ~ $ sudo reboot now
[sudo] password for me: 
reboot: error while loading shared libraries: /usr/lib/libffi.so.8: invalid ELF header

I’m not sure if libffi.so has been corrupted or not, but there have not been any other odd things or errors until now. It gets worse: to shut the system off, I tapped the power button, which normally shuts it down. This time however, it gave a kernel panic - not syncing: Attempted to kill init1 exitcode=0x00007f00. Upon reboot, the mouse is completely unresponsive, but I can open a terminal with super-t.

Any ideas what I can check and try? Thank you.

Ok I noticed for some reason my kernel version seemed odd:

me@Latitude3540 /dev $ uname -a
Linux Latitude3540 6.1.0-1-MANJARO #1 SMP PREEMPT_DYNAMIC Mon Oct 24 08:15:47 UTC 2022 x86_64 GNU/Linux

And I was somehow running kernel 6.1.0rc2-1, which I don’t usually install dev kernels… reverted to 6.0.6-1 and everything seems fine. My mistake; thanks for looking.

This is very strange…
It’s like you have a 32 bit library instead of a 64 one (or something)…

What does his command gives you?

pacman -Qi libffi

For me it’s

Name            : libffi
Version         : 3.4.4-1
Description     : Portable foreign function interface library
Architecture    : x86_64
URL             : https://sourceware.org/libffi/
Licenses        : MIT
Groups          : None
Provides        : libffi.so=8-64
Depends On      : glibc
Optional Deps   : None
Required By     : ghc-libs  glib2  guile  lib32-libffi  libp11-kit  llvm-libs
                  python  python2  python2-gobject2  ruby  thunderbird
                  tracker3  wayland
Optional For    : None
Conflicts With  : None
Replaces        : None
Installed Size  : 95.59 KiB
Packager        : David Runge <dvzrv@archlinux.org>
Build Date      : Mon 24 Oct 2022 10:35:58 AM EEST
Install Date    : Wed 02 Nov 2022 04:06:25 PM EET
Install Reason  : Installed as a dependency for another package
Install Script  : No
Validated By    : Signature

Do you have any differences?

Also, the file is

ls -la /usr/lib/libffi.so.8

which should give you

lrwxrwxrwx 1 root root 15 Oct 24 10:35 /usr/lib/libffi.so.8 -> libffi.so.8.1.2

Is this link correct?

Finally…

# file /usr/lib/libffi.so.8
/usr/lib/libffi.so.8: symbolic link to libffi.so.8.1.2

# file /usr/lib/libffi.so.8.1.2
/usr/lib/libffi.so.8.1.2: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=5c6b22b6624dd486a0783dfe74fee085b626b573, stripped

If there is any difference would suggest reinstalling libffi

sudo rm -rf /var/cache/pacman/pkg/libffi*
sudo pacman -S libffi
sudo reboot

Hope that help…

Hi sng, thanks for helping. Yes, my values match these exactly when using kernel 6.0.6-1. Something about the 6.1.0-1rc2-1 kernel doesn’t play well with this laptop for some reason. I still don’t know how it got installed. Let this be a lesson to not install beta kernels unless equipped to debug them. :slight_smile:

1 Like