[Bug 1958594] Re: Boot error: libgcc_s.so.1 must be installed for pthread_exit to work
Launchpad Bug Tracker
1958594 at bugs.launchpad.net
Wed Feb 9 04:40:18 UTC 2022
This bug was fixed in the package initramfs-tools - 0.140ubuntu12
---------------
initramfs-tools (0.140ubuntu12) jammy; urgency=medium
* Force copy pthread and libgcc_s libraries via a stub binary.
To avoid circular shared library dependencies between compiler and
libc, libpthreads chooses to dlopen libgcc_s, instead of linking
against it. However, we have no way to parse/know what it
needs. And even when we hardcode to include libgcc_s1, we don't
have a way to know which libgcc_s1 is needed on a given system and
from which path to include it. But there is a hook-function to
copy a binary and all of its shared library dependencies. Thus
create a stub empty executable, with shared linking against
pthreads and gcc_s1 and always include it in the initrd. This way
at initrd creation time, ldd is used to correctly resolve these
shared library dependencies and correctly copy them into the
initrd. This removes hardcoding paths as to where these libraries
must be copied from on the host. LP: #1958594 LP: #1880853
* For net boot include most of net/usb modules, except niche modems. LP:
#1950996
* Cherry-pick updated merge request !26 to support xz compressed
firmware. Uncompressed firmware is preffered, with a fallback to use
compressed firmware files. LP: #1942260
* Cherry-pick updated merge request !51 to decompress compressed kernel
modules for boot speed performance. LP: #1932329
-- Dimitri John Ledkov <dimitri.ledkov at canonical.com> Tue, 08 Feb 2022
20:43:02 +0000
** Changed in: initramfs-tools (Ubuntu Jammy)
Status: Fix Committed => Fix Released
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to initramfs-tools in Ubuntu.
https://bugs.launchpad.net/bugs/1958594
Title:
Boot error: libgcc_s.so.1 must be installed for pthread_exit to work
Status in initramfs-tools package in Ubuntu:
Fix Released
Status in initramfs-tools source package in Jammy:
Fix Released
Bug description:
[Bug description]
On a jammy installation, which was upgraded from focal, after a full-
upgrade and a reboot,
I enter the LUKS password to decrypt the disk. Then I get the
following error:
libgcc_s.so.1 must be installed for pthread_exit to work
After the error is shown, the system asks for the password again
(which never works, always throwing the same error).
[Root cause]
I was able to decrypt the disk with the same password by booting from
a live usb. Which allowed further investigation.
The error shown in the LUKS password prompt menu comes from
https://github.com/bminor/glibc/blob/glibc-2.34/nptl/pthread_exit.c#L31-L32, which indeed shows that pthread_exit fails when libgcc_s.so.1 is missing.
From
https://git.launchpad.net/ubuntu/+source/initramfs-tools/tree/hook-functions?h=import/0.140ubuntu10#n260,
we noticed that libgcc_s.so.1 is only copied if
1) copy_exec is called for a binary directly linked to libgcc_s.so.1, or
2) copy_exec is called for a binary linked to libpthread
The cryptsetup initramfs hook, calls copy_exec for /sbin/cryptsetup,
which is linked to libargon2.so.1, which is linked to libpthread.so.0.
This covers case (2) above. As a consequence, libgcc_s.so.1 is copied
to the initrd image and the error reported here is not seen.
However, since glibc 2.34, libpthread is shipped within glibc, and the
binaries are no longer linked to libpthread.so.0. As a consequence, an
argon2 package built with glibc 2.32 will no longer be linked to
libpthread.so.0 and libgcc_s.so.1 will no longer be copied to the
initrd image. Triggering the reported error.
This can be verified in these two argon2 builds, from the same
sources, but with different glibc versions:
https://launchpad.net/ubuntu/+source/argon2/0~20171227-0.2build21.04.0/+build/21066610
https://launchpad.net/ubuntu/+source/argon2/0~20171227-0.2build22/+build/22255217
Still lvm2 is a seeded package, which Recommends thin-provisioning-
tools. thin-provisioning-tools ships a initramfs hook that calls
copy_exec for /usr/sbin/pdata_tools, which is directly linked to
libgcc_s.so.1. This covers the case (1) above and should suffice to
ensure the boot process works properly.
Since thin-provisioning-tools is just a recommends for lvm2, it could
be removed from the system (and indeed, for some reason, was not
present in my focal=>jammy installation). In this case, a new kernel
installation should trigger the reported error.
[Reproducer]
- Install jammy with a LUKS encrypted disk
- remove thin-provisioning-tools
- perform a full-upgrade (make sure the kernel was upgraded or run update-initramfs manually)
- reboot and verify you can no longer get past the decrypt password prompt screen
[Workaround]
A workaround for anyone affected would be to install thin-
provisioning-tools and run update-initramfs.
[Impact]
Users upgrading from focal to jammy will eventually be locked out of
their systems in case they are using LUKS encryption.
[Additional information]
While this issue is similar to
https://bugs.launchpad.net/ubuntu/+source/initramfs-tools/+bug/1861757,
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=950254, and
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=950551,
This is a different bug, with a different root cause.
Thanks to sergiodj for the pairing session on the root cause analysis.
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/initramfs-tools/+bug/1958594/+subscriptions
More information about the foundations-bugs
mailing list