Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 738740 - sys-kernel/genkernel-4.1.0-r2: "wrong"/symlinked udev path breaks zfs initramfs
Summary: sys-kernel/genkernel-4.1.0-r2: "wrong"/symlinked udev path breaks zfs initramfs
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal normal
Assignee: Gentoo Genkernel Maintainers
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks:
 
Reported: 2020-08-23 20:07 UTC by Vincent Huisman
Modified: 2020-08-26 23:00 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vincent Huisman 2020-08-23 20:07:29 UTC
I am not exactly sure if this is specific to my machine or if it's arch-dependent. After upgrading to 4.1.0-r2 and fetching a new sys-kernel/gentoo-sources-5.4.60 today, I tried to build the initramfs using
$ genkernel --zfs --mdadm --install initramfs
I was greeted with the message:
ERROR: Something went wrong: Did not found any udev-related files for sys-fs/zfs!
and could not find anything useful in genkernel.log. Digging into gen_initramfs.sh I ran into commit 73689f8 where some udev stuff is added. The command "get_udevdir" returns "/lib/udev" for me, and "qlist -e sys-fs/zfs:0 | grep udev" gives me a bunch of "/lib/udev/..." entries. However, passing it through realpath, as happens in gen_initramfs.sh, changes those paths into "/lib64/udev/..." (because /lib is a symlink to /lib64 on my system) and the subsequent grep on /lib/udev returns nothing. I am not sure which logs or command outputs could be relevant for this but I think this report us sufficient on its own.

Passing the local udevdir variable through realpath before using it fixes the problem for me. I guess this is something that should happen in gen_funcs.sh get_udevdir before returning it. I assume this problem applies to the other very similar piece of code regarding sys-fs/multipath-tools as well.

Reproducible: Always
Comment 1 Thomas Deutschmann (RETIRED) gentoo-dev 2020-08-23 21:50:35 UTC
Which profile (eselect profile show) are you using?
Comment 2 Vincent Huisman 2020-08-23 22:02:11 UTC
# eselect profile show
Current /etc/portage/make.profile symlink:
  default/linux/amd64/17.0/hardened
Comment 3 Thomas Deutschmann (RETIRED) gentoo-dev 2020-08-23 22:34:27 UTC
Could you please test the following patch (just for zfs yet):

> --- a/gen_initramfs.sh
> +++ b/gen_initramfs.sh
> @@ -1021,10 +1021,10 @@ append_zfs() {
> 
>         copy_binaries "${TDIR}" /sbin/{mount.zfs,zdb,zfs,zpool}
> 
> -       local udevdir=$(get_udevdir)
> +       local udevdir="$(realpath "$(get_udevdir)")"
>         local udevdir_initramfs="/usr/lib/udev"
>         local udev_files=( $(qlist -e sys-fs/zfs:0 \
> -               | xargs --no-run-if-empty realpath \
> +               | xargs --no-run-if-empty realpath 2>/dev/null \
>                 | grep -E -- "^${udevdir}")
>         )
> 
>
Comment 4 Vincent Huisman 2020-08-24 00:20:23 UTC
That is almost identical to how I changed it myself, and it works fine.
Comment 5 Thomas Deutschmann (RETIRED) gentoo-dev 2020-08-24 01:23:24 UTC
Thank you for testing, but I think this one will be better (because in theory something in udev dir could be a symlink in which case we would skip the 'copy' but the symlink name could still be referenced in udev rule):

> @@ -1024,7 +1025,6 @@ append_zfs() {
>         local udevdir=$(get_udevdir)
>         local udevdir_initramfs="/usr/lib/udev"
>         local udev_files=( $(qlist -e sys-fs/zfs:0 \
> -               | xargs --no-run-if-empty realpath \
>                 | grep -E -- "^${udevdir}")
>         )

Can you confirm that this is still working for you?
Comment 6 Vincent Huisman 2020-08-24 09:48:28 UTC
That works too
Comment 7 Larry the Git Cow gentoo-dev 2020-08-24 11:45:43 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=34893756f574a8a51037e3290bbb58e03951eed2

commit 34893756f574a8a51037e3290bbb58e03951eed2
Author:     Thomas Deutschmann <whissi@gentoo.org>
AuthorDate: 2020-08-24 11:41:39 +0000
Commit:     Thomas Deutschmann <whissi@gentoo.org>
CommitDate: 2020-08-24 11:41:39 +0000

    gen_initramfs.sh: append_zfs(): don't check package file list with realpath
    
    Bug: https://bugs.gentoo.org/738740
    Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>

 gen_initramfs.sh | 1 -
 1 file changed, 1 deletion(-)
Comment 8 Thomas Deutschmann (RETIRED) gentoo-dev 2020-08-24 11:46:14 UTC
Thank you for the report and tests, will be part of next release.
Comment 9 Larry the Git Cow gentoo-dev 2020-08-26 23:00:29 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=66c1419df0c7adcd7a6436199f5229de8e6b8ece

commit 66c1419df0c7adcd7a6436199f5229de8e6b8ece
Author:     Thomas Deutschmann <whissi@gentoo.org>
AuthorDate: 2020-08-26 22:59:23 +0000
Commit:     Thomas Deutschmann <whissi@gentoo.org>
CommitDate: 2020-08-26 22:59:31 +0000

    sys-kernel/genkernel: bump to v4.1.1
    
    Closes: https://bugs.gentoo.org/738922
    Closes: https://bugs.gentoo.org/738740
    Package-Manager: Portage-3.0.4, Repoman-3.0.1
    Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>

 sys-kernel/genkernel/Manifest               |   3 +
 sys-kernel/genkernel/genkernel-4.1.1.ebuild | 303 ++++++++++++++++++++++++++++
 sys-kernel/genkernel/genkernel-9999.ebuild  |   5 +-
 3 files changed, 310 insertions(+), 1 deletion(-)