eworm-de / mkinitcpio-ykfde

Full disk encryption with Yubikey (Yubico key)
GNU General Public License v3.0
109 stars 26 forks source link

[Arch Linux] [Bug] Unable to build or run mkinitcpio after updating json-c package #21

Closed b0o closed 6 years ago

b0o commented 6 years ago

I just ran a pacman update which, among other things, upgraded json-c from 0.12.1-1 to 0.13-1.

During the update, the mkinitcpio pacman hook was triggered, which failed with the following output:

:: Running post-transaction hooks...
(1/4) Updating linux initcpios...
==> Building image from preset: /etc/mkinitcpio.d/linux.preset: 'default'
  -> -k /boot/vmlinuz-linux -c /etc/mkinitcpio.conf -g /boot/initramfs-linux.img
==> Starting build: 4.14.10-1-ARCH
  -> Running build hook: [base]
  -> Running build hook: [systemd]
  -> Running build hook: [autodetect]
  -> Running build hook: [modconf]
  -> Running build hook: [block]
  -> Running build hook: [sd-vconsole]
  -> Running build hook: [keyboard]
  -> Running build hook: [ykfde]
==> ERROR: binary dependency `libjson-c.so.2' not found for `/usr/lib/ykfde/worker'
==> ERROR: binary dependency `libjson-c.so.2' not found for `/usr/lib/ykfde/worker'
  -> Running build hook: [sd-encrypt]
  -> Running build hook: [archlogo]
  -> Running build hook: [fsck]
  -> Running build hook: [filesystems]
  -> Running build hook: [sd-shutdown]
==> Generating module dependencies
==> Creating gzip-compressed initcpio image: /boot/initramfs-linux.img
==> WARNING: errors were encountered during the build. The image may not be complete.
==> Building image from preset: /etc/mkinitcpio.d/linux.preset: 'fallback'
  -> -k /boot/vmlinuz-linux -c /etc/mkinitcpio.conf -g /boot/initramfs-linux-fallback
==> Starting build: 4.14.10-1-ARCH
  -> Running build hook: [base]
  -> Running build hook: [systemd]
  -> Running build hook: [modconf]
  -> Running build hook: [block]
==> WARNING: Possibly missing firmware for module: wd719x
==> WARNING: Possibly missing firmware for module: aic94xx
  -> Running build hook: [sd-vconsole]
  -> Running build hook: [keyboard]
  -> Running build hook: [ykfde]
==> ERROR: binary dependency `libjson-c.so.2' not found for `/usr/lib/ykfde/worker'
==> ERROR: binary dependency `libjson-c.so.2' not found for `/usr/lib/ykfde/worker'
  -> Running build hook: [sd-encrypt]
  -> Running build hook: [archlogo]
  -> Running build hook: [fsck]
  -> Running build hook: [filesystems]
  -> Running build hook: [sd-shutdown]
==> Generating module dependencies
==> Creating gzip-compressed initcpio image: /boot/initramfs-linux-fallback.img
==> WARNING: errors were encountered during the build. The image may not be complete.
error: command failed to execute correctly

Here's the full pacman -Syu output:

Expand
:: Synchronizing package databases...
 core                                         126.8 KiB   433K/s 00:00 [-------------
 extra                                       1642.4 KiB   570K/s 00:03 [-------------
 community                                      4.3 MiB  1248K/s 00:03 [-------------
 multilib                                     168.6 KiB  12.7M/s 00:00 [-------------
:: Starting full system upgrade...
resolving dependencies...
looking for conflicting packages...

Package (7)                        Old Version  New Version  Net Change  Download Siz

extra/bind-tools                   9.11.2-2     9.11.2-3      -0.01 MiB       1.59 Mi
core/cryptsetup                    2.0.0-1      2.0.0-2        0.00 MiB       0.33 Mi
community/girara                   0.2.8-1      0.2.8-2        0.00 MiB       0.06 Mi
core/json-c                        0.12.1-1     0.13-1         0.05 MiB       0.04 Mi
extra/lcms                         1.19-5       1.19-6        -0.05 MiB       0.14 Mi
extra/libmagick6                   6.9.9.27-1   6.9.9.31-1     0.00 MiB       2.11 Mi
community/python-websocket-client  0.45.0-1     0.46.0-1       0.00 MiB       0.06 Mi

Total Download Size:    4.34 MiB
Total Installed Size:  17.51 MiB
Net Upgrade Size:      -0.02 MiB

:: Proceed with installation? [Y/n]
:: Retrieving packages...
 json-c-0.13-1-x86_64                          44.9 KiB   276K/s 00:00 [-------------
 cryptsetup-2.0.0-2-x86_64                    384.8 KiB   483K/s 00:01 [-------------
 bind-tools-9.11.2-3-x86_64                  2016.9 KiB   634K/s 00:03 [-------------
 lcms-1.19-6-x86_64                             2.1 MiB   626K/s 00:03 [-------------
 libmagick6-6.9.9.31-1-x86_64                   4.2 MiB   695K/s 00:06 [-------------
 girara-0.2.8-2-x86_64                          4.3 MiB   694K/s 00:06 [-------------
 python-websocket-client-0.46.0-1-any           4.3 MiB   690K/s 00:06 [-------------
(7/7) checking keys in keyring                                         [-------------
(7/7) checking package integrity                                       [-------------
(7/7) loading package files                                            [-------------
(7/7) checking for file conflicts                                      [-------------
(7/7) checking available disk space                                    [-------------
:: Processing package changes...
(1/7) upgrading json-c                                                 [-------------
(2/7) upgrading bind-tools                                             [-------------
(3/7) upgrading cryptsetup                                             [-------------
(4/7) upgrading girara                                                 [-------------
(5/7) upgrading lcms                                                   [-------------
(6/7) upgrading libmagick6                                             [-------------
(7/7) upgrading python-websocket-client                                [-------------
:: Running post-transaction hooks...
(1/4) Updating linux initcpios...
==> Building image from preset: /etc/mkinitcpio.d/linux.preset: 'default'
  -> -k /boot/vmlinuz-linux -c /etc/mkinitcpio.conf -g /boot/initramfs-linux.img
==> Starting build: 4.14.10-1-ARCH
  -> Running build hook: [base]
  -> Running build hook: [systemd]
  -> Running build hook: [autodetect]
  -> Running build hook: [modconf]
  -> Running build hook: [block]
  -> Running build hook: [sd-vconsole]
  -> Running build hook: [keyboard]
  -> Running build hook: [ykfde]
==> ERROR: binary dependency `libjson-c.so.2' not found for `/usr/lib/ykfde/worker'
==> ERROR: binary dependency `libjson-c.so.2' not found for `/usr/lib/ykfde/worker'
  -> Running build hook: [sd-encrypt]
  -> Running build hook: [archlogo]
  -> Running build hook: [fsck]
  -> Running build hook: [filesystems]
  -> Running build hook: [sd-shutdown]
==> Generating module dependencies
==> Creating gzip-compressed initcpio image: /boot/initramfs-linux.img
==> WARNING: errors were encountered during the build. The image may not be complete.
==> Building image from preset: /etc/mkinitcpio.d/linux.preset: 'fallback'
  -> -k /boot/vmlinuz-linux -c /etc/mkinitcpio.conf -g /boot/initramfs-linux-fallback
==> Starting build: 4.14.10-1-ARCH
  -> Running build hook: [base]
  -> Running build hook: [systemd]
  -> Running build hook: [modconf]
  -> Running build hook: [block]
==> WARNING: Possibly missing firmware for module: wd719x
==> WARNING: Possibly missing firmware for module: aic94xx
  -> Running build hook: [sd-vconsole]
  -> Running build hook: [keyboard]
  -> Running build hook: [ykfde]
==> ERROR: binary dependency `libjson-c.so.2' not found for `/usr/lib/ykfde/worker'
==> ERROR: binary dependency `libjson-c.so.2' not found for `/usr/lib/ykfde/worker'
  -> Running build hook: [sd-encrypt]
  -> Running build hook: [archlogo]
  -> Running build hook: [fsck]
  -> Running build hook: [filesystems]
  -> Running build hook: [sd-shutdown]
==> Generating module dependencies
==> Creating gzip-compressed initcpio image: /boot/initramfs-linux-fallback.img
==> WARNING: errors were encountered during the build. The image may not be complete.
error: command failed to execute correctly
(2/4) Cleaning pacman cache...
removed '/var/cache/pacman/pkg/cryptsetup-1.7.5-1-x86_64.pkg.tar.xz'
==> finished: 1 packages removed (disk space saved: 240.84 KiB)
==> no candidate packages found for pruning
(3/4) Creating temporary files...
(4/4) Arming ConditionNeedsUpdate...

Attempting to install either mkinitcpio-ykfde or mkinitcpio-ykfde-git from the AUR fails with the following output:

Expand
:: resolving dependencies...
:: looking for inter-conflicts...

AUR Packages  (1)         Old Version  New Version

aur/mkinitcpio-ykfde-git               latest                    

:: Proceed with installation? [Y/n] 
:: Retrieving package(s)...
:: mkinitcpio-ykfde-git build files are up-to-date -- skipping
:: Checking mkinitcpio-ykfde-git integrity...
==> Making package: mkinitcpio-ykfde-git 0.6.4.r0.g95f195c-1 (Wed Jan  3 18:46:12 PST 2018)
==> Retrieving sources...
  -> Updating mkinitcpio-ykfde git repo...
Fetching origin
==> Validating source files with sha256sums...
    mkinitcpio-ykfde ... Skipped
:: Building mkinitcpio-ykfde-git package(s)...
==> Making package: mkinitcpio-ykfde-git 0.7.3.r2.g38f9628-1 (Wed Jan  3 18:46:13 PST 2018)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> WARNING: Using existing $srcdir/ tree
==> Starting pkgver()...
==> Removing existing $pkgdir/ directory...
==> Starting build()...
cp config.def.h config.h
make -C bin worker
make[1]: Entering directory '/home/maddy/.cache/pacaur/mkinitcpio-ykfde-git/src/mkinitcpio-ykfde/bin'
gcc -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt -std=gnu11 -O2 -fPIC -Wall -Werror -liniparser -lkeyutils -lykpers-1 -lyubikey -lsystemd -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -Wl,-z,now -Wl,-z,relro -pie -o worker worker.c
/usr/bin/ld: warning: libjson-c.so.2, needed by /usr/lib/gcc/x86_64-pc-linux-gnu/7.2.1/../../../../lib/libykpers-1.so, not found (try using -rpath or -rpath-link)
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.1/../../../../lib/libykpers-1.so: undefined reference to `json_tokener_parse'
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.1/../../../../lib/libykpers-1.so: undefined reference to `json_object_get_type'
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.1/../../../../lib/libykpers-1.so: undefined reference to `json_object_new_string'
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.1/../../../../lib/libykpers-1.so: undefined reference to `json_object_get_string'
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.1/../../../../lib/libykpers-1.so: undefined reference to `json_object_new_object'
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.1/../../../../lib/libykpers-1.so: undefined reference to `json_object_to_json_string_ext'
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.1/../../../../lib/libykpers-1.so: undefined reference to `json_object_get_int'
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.1/../../../../lib/libykpers-1.so: undefined reference to `json_object_new_int'
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.1/../../../../lib/libykpers-1.so: undefined reference to `json_object_get_boolean'
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.1/../../../../lib/libykpers-1.so: undefined reference to `json_object_object_add'
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.1/../../../../lib/libykpers-1.so: undefined reference to `json_object_object_get_ex'
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.1/../../../../lib/libykpers-1.so: undefined reference to `json_object_put'
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.1/../../../../lib/libykpers-1.so: undefined reference to `json_object_new_boolean'
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:14: worker] Error 1
make[1]: Leaving directory '/home/maddy/.cache/pacaur/mkinitcpio-ykfde-git/src/mkinitcpio-ykfde/bin'
make: *** [Makefile:16: bin/worker] Error 2
==> ERROR: A failure occurred in build().
    Aborting...
:: failed to build mkinitcpio-ykfde-git package(s)

Any help would be appreciated. I'm a bit afraid to reboot now in case my existing initramfs doesn't work anymore.

b0o commented 6 years ago

I've temporarily worked around this by restoring libjson-c.so.2.0.2 from a backup:

sudo cp /.snapshots/@.20180103T180000-0800/usr/lib/libjson-c.so.2.0.2 /usr/lib/
sudo ln -s /usr/lib/libjson-c.so.2.0.2 /usr/lib/libjson-c.so.2

I'm assuming this package just needs to be updated to use the new version of libjson-c.

eworm-de commented 6 years ago

The executable /usr/lib/ykfde/worker does not link against libjson-c.so:

% objdump -p /usr/lib/ykfde/worker | grep NEEDED
  NEEDED               libiniparser.so.1
  NEEDED               libkeyutils.so.1
  NEEDED               libykpers-1.so.1
  NEEDED               libyubikey.so.0
  NEEDED               libsystemd.so.0
  NEEDED               libc.so.6

Neither does /usr/lib/libykpers-1.so:

% objdump -p /usr/lib/libykpers-1.so | grep NEEDED
  NEEDED               libyubikey.so.0
  NEEDED               libusb-1.0.so.0
  NEEDED               libpthread.so.0
  NEEDED               libc.so.6

I guess your package yubikey-personalization (which provides /usr/lib/libykpers-1.so) is borked. What does pacman -Qi yubikey-personalization tell you?

b0o commented 6 years ago

I'm using yubikey-personalization-git:

Name            : yubikey-personalization-git
Version         : 1.18.0.r19.g0a5ed60-1
Description     : Yubico YubiKey Personalization library and tool - git checkout
Architecture    : x86_64
URL             : https://github.com/Yubico/yubikey-personalization
Licenses        : BSD
Groups          : None
Provides        : ykpers  yubikey-personalization
Depends On      : libusb  yubico-c-client
Optional Deps   : None
Required By     : mkinitcpio-ykfde-git  yubikey-personalization-gui-git
Optional For    : None
Conflicts With  : ykpers  yubikey-personalization
Replaces        : None
Installed Size  : 199.00 KiB
Packager        : Unknown Packager
Build Date      : Tue 12 Dec 2017 08:24:27 AM PST
Install Date    : Tue 12 Dec 2017 08:24:28 AM PST
Install Reason  : Explicitly installed
Install Script  : No
Validated By    : None
eworm-de commented 6 years ago

Try to rebuild that first or install yubikey-personalization from [community].

eworm-de commented 6 years ago

I guess this is fixed? Please reopen if you are still suffering issues.

b0o commented 6 years ago

@eworm-de Yes, rebuilding yubikey-personalization-git fixed the issue, thank you!