random-archer / mkinitcpio-systemd-tool

Provisioning tool for systemd in initramfs (systemd-tool)
https://www.archlinux.org/packages/community/any/mkinitcpio-systemd-tool/
Other
113 stars 27 forks source link

Can't unlock partition with LUKS2 #28

Closed hell-g closed 4 years ago

hell-g commented 4 years ago

I set up a new Arch Linux system with root disk encryption using an unencrypted boot partition and a root partition with LUKS2 encryption. After the successful installation of the base system, I started to setup remote unlocking using mkinitcpio-systemd-tool. The problem is, that the device does not get unlocked and then the switch root fails. In the emergency console I was able to run the systemd-cryptsetup command manually, which aborted with the error: libgcc_s.so.1 must be installed for pthread_cancel to work

I found a discussion about a similar problem on the Arch Linux bug tracker. After adding "FILES=(/usr/lib/libgcc_s.so.1)" to /etc/mkinitcpio.conf, the unlocking works and the boot process finishes without errors.

Could you have a look, if this can be solved without the workaround? Thank you for this cool and very handy tool!

Andrei-Pozolotin commented 4 years ago
  1. it seems libgcc_s.so.1 is a dependency for some luks2 features

  2. in that case it should be explicitly added with a config stanza:

    # luks2 support
    InitrdBinary=/usr/lib/libgcc_s.so.1 optional=yes

    to the initrd-cryptsetup.service https://github.com/random-archer/mkinitcpio-systemd-tool/blob/master/initrd-cryptsetup.service

similar to dependencies for initrd-network.service https://github.com/random-archer/mkinitcpio-systemd-tool/blob/master/initrd-network.service#L52

  1. this dependency is not auto discovered from declaration:
    InitrdBinary=/usr/lib/systemd/systemd-cryptsetup

    by the standard mkinitcpio functions, because "it is not there" via ldd:

    ldd /usr/lib/systemd/systemd-cryptsetup
        linux-vdso.so.1 (0x00007ffdd4395000)
        libc.so.6 => /usr/lib/libc.so.6 (0x00007ff3b23d1000)
        libsystemd-shared-243.so => /usr/lib/systemd/libsystemd-shared-243.so (0x00007ff3b2127000)
        libcryptsetup.so.12 => /usr/lib/libcryptsetup.so.12 (0x00007ff3b20b8000)
        /lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x00007ff3b260b000)
        librt.so.1 => /usr/lib/librt.so.1 (0x00007ff3b20ad000)
        libcap.so.2 => /usr/lib/libcap.so.2 (0x00007ff3b20a6000)
        libacl.so.1 => /usr/lib/libacl.so.1 (0x00007ff3b209b000)
        libgcrypt.so.20 => /usr/lib/libgcrypt.so.20 (0x00007ff3b1f7b000)
        libip4tc.so.2 => /usr/lib/libip4tc.so.2 (0x00007ff3b1f71000)
        libkmod.so.2 => /usr/lib/libkmod.so.2 (0x00007ff3b1f58000)
        libmount.so.1 => /usr/lib/libmount.so.1 (0x00007ff3b1ef8000)
        libseccomp.so.2 => /usr/lib/libseccomp.so.2 (0x00007ff3b1eaf000)
        libidn2.so.0 => /usr/lib/libidn2.so.0 (0x00007ff3b1e8e000)
        liblzma.so.5 => /usr/lib/liblzma.so.5 (0x00007ff3b1e64000)
        liblz4.so.1 => /usr/lib/liblz4.so.1 (0x00007ff3b1e42000)
        libblkid.so.1 => /usr/lib/libblkid.so.1 (0x00007ff3b1dec000)
        libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007ff3b1dca000)
        libuuid.so.1 => /usr/lib/libuuid.so.1 (0x00007ff3b1dc1000)
        libdevmapper.so.1.02 => /usr/lib/libdevmapper.so.1.02 (0x00007ff3b1d68000)
        libssl.so.1.1 => /usr/lib/libssl.so.1.1 (0x00007ff3b1cd6000)
        libcrypto.so.1.1 => /usr/lib/libcrypto.so.1.1 (0x00007ff3b1a05000)
        libargon2.so.1 => /usr/lib/libargon2.so.1 (0x00007ff3b19fb000)
        libdl.so.2 => /usr/lib/libdl.so.2 (0x00007ff3b19f6000)
        libjson-c.so.4 => /usr/lib/libjson-c.so.4 (0x00007ff3b19e4000)
        libattr.so.1 => /usr/lib/libattr.so.1 (0x00007ff3b19dd000)
        libgpg-error.so.0 => /usr/lib/libgpg-error.so.0 (0x00007ff3b19b8000)
        libz.so.1 => /usr/lib/libz.so.1 (0x00007ff3b199e000)
        libunistring.so.2 => /usr/lib/libunistring.so.2 (0x00007ff3b181c000)
        libudev.so.1 => /usr/lib/libudev.so.1 (0x00007ff3b17f1000)
        libm.so.6 => /usr/lib/libm.so.6 (0x00007ff3b16ab000)