Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 895550 - sys-kernel/genkernel: fails to build initramfs using app-alternatives/cpio[libarchive]
Summary: sys-kernel/genkernel: fails to build initramfs using app-alternatives/cpio[li...
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: genkernel (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Genkernel Maintainers
Depends on:
Reported: 2023-02-20 15:29 UTC by Nick Doyle
Modified: 2023-02-21 20:18 UTC (History)
0 users

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


Note You need to log in before you can comment on or make changes to this bug.
Description Nick Doyle 2023-02-20 15:29:16 UTC
With the recent stabilization of app-alternatives, I've started using libarchive as my implementation of cpio. (app-alternatives/cpio with USE="-gnu libarchive").

Genkernel uses cpio when building initramfs images. In doing so, it uses a GNU-spicific option that is not available in the libarchive implementation: --force-local

Usage of this option is found in the latest version of Genkernel here:

Genkernel should succeed with all app-alternatives/cpio implementations or, if that is impossible, it should depend on a specific implementation that has the features it needs.

Reproducible: Always

Steps to Reproduce:
`genkernel all` or `genkernel initramfs`
Actual Results:  
# genkernel --luks --lvm --no-zfs initramfs
* Gentoo Linux Genkernel; Version 4.2.6
* Using genkernel configuration from '/etc/genkernel.conf' ...
* Running with options: --luks --lvm --no-zfs initramfs

* Working with Linux kernel 6.1.12-gentoo-x86_64 for x86_64
* Using kernel config file '/etc/kernels/kernel-config-6.1.12-gentoo-x86_64' ...

* initramfs: >> Initializing ...
*         >> Appending devices cpio data ...
cpio: Option --force-local is not supported
Brief Usage:
  List:    cpio -it < archive
  Extract: cpio -i < archive
  Create:  cpio -o < filenames > archive
  Help:    cpio --help
* ERROR: Failed to append devices to cpio!
* Please consult '/var/log/genkernel.log' for more information and any
* errors that were reported above.
* Report any genkernel bugs to and
* assign your bug to Please include
* as much information as you can in your bug report; attaching
* '/var/log/genkernel.log' so that your issue can be dealt with effectively.
* Please do *not* report kernel compilation failures as genkernel bugs!

Expected Results:  
Successful generation of initramfs.
Comment 1 Nick Doyle 2023-02-20 18:14:39 UTC
Another facet of this bug is that genkernel depends on app-arch/cpio, which provides `gcpio` but not `cpio`, but calls `cpio` instead of `gcpio` without depending on app-alternatives/cpio, which is what provides the `cpio` symlink to the chosen implementation.

Ideally, genkernel would depend on app-alternatives/cpio instead of app-arch/cpio and use `cpio` in a portable way. Another less optimal solution (IMO), would be to continue depending on app-arch/cpio and calling `gcpio` instead of `cpio` so that at least the dependencies are correct.