Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 667752 - sys-kernel/dracut-046-r1: initramfs is missing ld symlink
Summary: sys-kernel/dracut-046-r1: initramfs is missing ld symlink
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: ARM64 Linux
: Normal normal (vote)
Assignee: Patrick McLean
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-10-04 18:20 UTC by Andrius Štikonas
Modified: 2018-10-09 19:23 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
dracut_debug (dracut_debug,17.54 KB, text/plain)
2018-10-04 19:38 UTC, Andrius Štikonas
Details
simplify ldd parsing logic (0001-dracut-install-simplify-ldd-parsing-logic.patch,1.05 KB, patch)
2018-10-04 20:49 UTC, Mike Gilbert
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andrius Štikonas 2018-10-04 18:20:04 UTC
The following symlink is missing in the generated image
/lib/ld-linux-aarch64.so.1 => /lib64/ld-linux-aarch64.so.1

048 has the same problem.

With this symlink missing, only static binaries can be executed, but even
/lib/systemd/systemd is not statically linked, so system does not boot.

Reproducible: Always

Steps to Reproduce:
I tried generating dracut initramfs on my rockpro64 system (based on rk3399)



For now I am using the following workaround

install_items="/lib/ld-linux-aarch64.so.1"
Comment 1 Mike Gilbert gentoo-dev 2018-10-04 18:26:42 UTC
@toolchain: Which path is canonical for the runtime linker on arm64?
Comment 2 Sergei Trofimovich (RETIRED) gentoo-dev 2018-10-04 19:01:28 UTC
As defined today gentoo installs things into /lib64 for 64-bit targets (multilib or not), defined by multilib_env().

Having said that gcc defaults to /lib on aarch64:

  gcc/config/aarch64/aarch64-linux.h
    #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1"

Same for clang:

  lib/Driver/ToolChains/Linux.cpp
    case llvm::Triple::aarch64:
      LibDir = "lib";
      Loader = "ld-linux-aarch64.so.1";

Thus I think having a /lib -> /lib64 symlink is the correct way to express it.
(It's also what crossdev happens to generate for me)
Comment 3 Mike Gilbert gentoo-dev 2018-10-04 19:26:57 UTC
Andrius: Can you reproduce this problem with dracut-0.48?

If that version works, we can just stabilize it.

If that version is also broken, can you run a quick test and attach the output?

mkdir /tmp/root
/usr/lib/dracut/dracut-install -l -a -D /tmp/root --debug /lib/systemd/systemd
Comment 4 Andrius Štikonas 2018-10-04 19:38:12 UTC
Created attachment 549400 [details]
dracut_debug

048 doesn't work. I already mentioned it in comment #0.

We don't need to stabilize yet anyway, this is arm64.
Comment 5 Mike Gilbert gentoo-dev 2018-10-04 19:49:12 UTC
dracut-install: ldd: '  /lib/ld-linux-aarch64.so.1 => /lib64/ld-linux-aarch64.so.1 (0x0000007f96631000)
dracut-install: '
dracut-install: dracut_install('/lib64/ld-linux-aarch64.so.1', '/lib64/ld-linux-aarch64.so.1')
dracut-install: dracut_install('/lib64/ld-2.26.so', '/lib64/ld-2.26.so')
dracut-install: dracut_install ret = 0
dracut-install: cp '/lib64/ld-2.26.so' '/tmp/root//lib64/ld-2.26.so'
dracut-install: cp ret = 0
dracut-install: dracut_install ret = 0
dracut-install: ln -s '..//lib64/ld-2.26.so' '/tmp/root//lib64/ld-linux-aarch64.so.1'
dracut-install: Lib install: '/lib64/ld-linux-aarch64.so.1'
dracut-install: dracut_install('/lib64/ld-linux-aarch64.so', '/lib64/ld-linux-aarch64.so')
dracut-install: dracut_install('//ld-linux-aarch64.so.1', '//ld-linux-aarch64.so.1')
dracut-install: dracut_install('//ld-linux-aarch64.so', '//ld-linux-aarch64.so')
Comment 6 Mike Gilbert gentoo-dev 2018-10-04 19:51:08 UTC
amd64 for comparison.

dracut-install: ldd: '  /lib64/ld-linux-x86-64.so.2 (0x00007f4d7955e000)
dracut-install: '
dracut-install: dracut_install('/lib64/ld-linux-x86-64.so.2', '/lib64/ld-linux-x86-64.so.2')
dracut-install: dracut_install('/lib64/ld-2.27.so', '/lib64/ld-2.27.so')
dracut-install: dracut_install ret = 0
dracut-install: cp '/lib64/ld-2.27.so' '/var/tmp/dracut.7pwXAX/initramfs/lib64/ld-2.27.so'
dracut-install: dracut_install ret = 0
dracut-install: ln -s 'ld-2.27.so' '/var/tmp/dracut.7pwXAX/initramfs/lib64/ld-linux-x86-64.so.2'
dracut-install: Lib install: '/lib64/ld-linux-x86-64.so.2'
dracut-install: dracut_install('/lib64/ld-linux-x86-64.so', '/lib64/ld-linux-x86-64.so')
dracut-install: dracut_install('//ld-linux-x86-64.so.2', '//ld-linux-x86-64.so.2')
dracut-install: dracut_install('//ld-linux-x86-64.so', '//ld-linux-x86-64.so')
Comment 7 Mike Gilbert gentoo-dev 2018-10-04 20:49:53 UTC
Created attachment 549402 [details, diff]
simplify ldd parsing logic

Please give this patch a try.
Comment 8 Andrius Štikonas 2018-10-04 21:11:39 UTC
(In reply to Mike Gilbert from comment #7)
> Created attachment 549402 [details, diff] [details, diff]
> simplify ldd parsing logic
> 
> Please give this patch a try.

It worked for me!
Comment 9 Mike Gilbert gentoo-dev 2018-10-05 13:44:13 UTC
Great, I have opened a pull request upstream.
Comment 10 Mike Gilbert gentoo-dev 2018-10-05 14:04:14 UTC
(In reply to Sergei Trofimovich from comment #2)
> Thus I think having a /lib -> /lib64 symlink is the correct way to express
> it.
> (It's also what crossdev happens to generate for me)

I think it would really make more sense to put the library where gcc expects it. I don't think it needs to exist in /lib64 at all.
Comment 11 Larry the Git Cow gentoo-dev 2018-10-09 19:23:56 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6093c44b4abfabbdd98b92aaf0faaf10c0646acc

commit 6093c44b4abfabbdd98b92aaf0faaf10c0646acc
Author:     Mike Gilbert <floppym@gentoo.org>
AuthorDate: 2018-10-09 19:23:34 +0000
Commit:     Mike Gilbert <floppym@gentoo.org>
CommitDate: 2018-10-09 19:23:34 +0000

    sys-kernel/dracut: simplify ldd parsing logic in dracut-install
    
    Closes: https://bugs.gentoo.org/667752
    Package-Manager: Portage-2.3.50_p14, Repoman-2.3.11_p21
    Signed-off-by: Mike Gilbert <floppym@gentoo.org>

 sys-kernel/dracut/dracut-048-r1.ebuild             | 154 +++++++++++++++++++++
 ...dracut-install-simplify-ldd-parsing-logic.patch |  41 ++++++
 2 files changed, 195 insertions(+)