# Genkernel problem to generate initramfs

## Fulgurance

Hello, today, i update my kernel to 5.2.9, and after i have made my new kernel, i try to generate my initramfs, but i have a very strange problem with sandbox.

Look:

```
 zohran@msi-gs73vr-6rf  /boot  sudo genkernel --install initramfs                                            1 ↵  169  11:21:27

Mot de passe : 

!!! SELinux module not found. Please verify that it was installed.

!!! SELinux module not found. Please verify that it was installed.

* Gentoo Linux Genkernel; Version 4.0.0_beta12

* Using genkernel configuration from '/etc/genkernel.conf' ...

* Running with options: --install initramfs

* Working with Linux kernel 5.2.9-gentoo for x86_64

* Using kernel config file '/usr/share/genkernel/arch/x86_64/generated-config' ...

* Current kernel's LOCALVERSION is set to ''; Will ignore set --kernel-localversion value '-x86_64' because kernel was not build ...

* initramfs: >> Initializing ...

*         >> Appending devices cpio data ...

*         >> Appending base_layout cpio data ...

*         >> Appending auxilary cpio data ...

*         >> Appending blkid cpio data ...

*         >> Appending busybox cpio data ...

 * ACCESS DENIED:  open_wr:      /proc/thread-self/attr/fscreate

 * ACCESS DENIED:  open_wr:      /proc/thread-self/attr/fscreate

 * ACCESS DENIED:  open_wr:      /proc/thread-self/attr/fscreate

 * --------------------------- ACCESS VIOLATION SUMMARY ---------------------------

 * LOG FILE: "/var/log/sandbox/sandbox-10462.log"

 * 

VERSION 1.0

FORMAT: F - Function called

FORMAT: S - Access Status

FORMAT: P - Path as passed to function

FORMAT: A - Absolute Path (not canonical)

FORMAT: R - Canonical Path

FORMAT: C - Command Line

F: open_wr

S: deny

P: /proc/thread-self/attr/fscreate

A: /proc/thread-self/attr/fscreate

R: /proc/16226/task/16226/attr/fscreate

C: cp -a busybox /var/tmp/genkernel/gk.1SExccHY/busybox.qXS5eBjq/image/bin/ 

F: open_wr

S: deny

P: /proc/thread-self/attr/fscreate

A: /proc/thread-self/attr/fscreate

R: /proc/16229/task/16229/attr/fscreate

C: cp -a --target-directory=/var/tmp/genkernel/gk.1SExccHY/busybox.qXS5eBjq/image/configs /var/tmp/genkernel/gk.1SExccHY/busybox.qXS5eBjq/busybox-1.31.0/.config /var/tmp/genkernel/gk.1SExccHY/busybox.qXS5eBjq/busybox-1.31.0/.config.gk_orig 

F: open_wr

S: deny

P: /proc/thread-self/attr/fscreate

A: /proc/thread-self/attr/fscreate

R: /proc/16229/task/16229/attr/fscreate

C: cp -a --target-directory=/var/tmp/genkernel/gk.1SExccHY/busybox.qXS5eBjq/image/configs /var/tmp/genkernel/gk.1SExccHY/busybox.qXS5eBjq/busybox-1.31.0/.config /var/tmp/genkernel/gk.1SExccHY/busybox.qXS5eBjq/busybox-1.31.0/.config.gk_orig 

 * --------------------------------------------------------------------------------

* ERROR: create_initramfs(): append_data(): append_busybox(): populate_binpkg(): gkbuild(): Failed to create binpkg of busybox-1.31.0!

* Please consult '/var/log/genkernel.log' for more information and any

* errors that were reported above.

* 

* Report any genkernel bugs to bugs.gentoo.org and

* assign your bug to genkernel@gentoo.org. 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!
```

I have similar error when i try to emerge metasploit:

```
>>> Emerging (24 of 37) dev-ruby/metasploit-model-2.0.4::gentoo

 * metasploit-model-2.0.4.gem BLAKE2B SHA512 size ;-) ...                                                                     [ ok ]

>>> Unpacking source...

 * Running unpack phase for all ...

 * Unpacking .gem file... ...                                                                                                 [ ok ]

 * Uncompressing metadata ...                                                                                                 [ ok ]

 * Unpacking data.tar.gz ...                                                                                                  [ ok ]

>>> Source unpacked in /var/tmp/portage/dev-ruby/metasploit-model-2.0.4/work

>>> Preparing source in /var/tmp/portage/dev-ruby/metasploit-model-2.0.4/work ...

 * Running prepare phase for all ...

 * Running prepare phase for all ...

 * Running source copy phase for ruby24 ...

 * Running prepare phase for ruby24 ...

fatal: not a git repository (or any parent up to mount point /var)

Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

 * ACCESS DENIED:  open_wr:      /usr/lib64/ruby/gems/2.4.0/bundler.lock

Resolving dependencies...

Using rake 12.3.3

Following files may not be writable, so sudo is needed:

  /usr/bin

  /usr/lib64/ruby/gems/2.4.0

  /usr/lib64/ruby/gems/2.4.0/gems

  /usr/lib64/ruby/gems/2.4.0/specifications

Using i18n 0.7.0

Using minitest 5.11.3

Using thread_safe 0.3.6

Using tzinfo 1.2.5

Using activesupport 4.2.11.1

Using builder 3.2.3

Using erubis 2.7.0

Using nokogiri 1.10.3

Using rails-deprecated_sanitizer 1.0.3

Using rails-dom-testing 1.0.8

Using crass 1.0.4

Using loofah 2.2.3

Using rails-html-sanitizer 1.0.4

Using actionview 4.2.11.1

Using rack 1.6.11

Using rack-test 0.6.3

Using actionpack 4.2.11.1

Using activemodel 4.2.11.1

Using bundler 1.17.3

Using thor 0.20.3

Using railties 4.2.11.1

Using metasploit-model 2.0.4 from source at `.`

Bundle complete! 1 Gemfile dependency, 23 gems now installed.

Use `bundle info [gemname]` to see where a bundled gem is installed.

fatal: not a git repository (or any parent up to mount point /var)

Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

The Gemfile's dependencies are satisfied

>>> Source prepared.

 * --------------------------- ACCESS VIOLATION SUMMARY ---------------------------

 * LOG FILE: "/var/log/sandbox/sandbox-26726.log"

 * 

VERSION 1.0

FORMAT: F - Function called

FORMAT: S - Access Status

FORMAT: P - Path as passed to function

FORMAT: A - Absolute Path (not canonical)

FORMAT: R - Canonical Path

FORMAT: C - Command Line

F: open_wr

S: deny

P: /usr/lib64/ruby/gems/2.4.0/bundler.lock

A: /usr/lib64/ruby/gems/2.4.0/bundler.lock

R: /usr/lib64/ruby/gems/2.4.0/bundler.lock

C: /usr/bin/ruby24 -S bundle install --local 

 * --------------------------------------------------------------------------------

>>> Failed to emerge dev-ruby/metasploit-model-2.0.4, Log file:

>>>  '/var/tmp/portage/dev-ruby/metasploit-model-2.0.4/temp/build.log'

 * Messages for package dev-lang/ruby-2.5.5:

 * 

 * To switch between available Ruby profiles, execute as root:

 *      eselect ruby set ruby(23|24|...)

 * 

 * Messages for package dev-ruby/rubygems-3.0.6:

 * 

 * To switch between available Ruby profiles, execute as root:

 *      eselect ruby set ruby(23|24|...)

 * 

 * GNU info directory index is up-to-date.
```

Emerge info:

```
 zohran@msi-gs73vr-6rf  /usr/src/linux  emerge --info                                                          ✔  171  11:26:39

Portage 2.3.72 (python 2.7.16-final-0, default/linux/amd64/17.1/no-multilib/hardened/selinux, gcc-9.2.0, glibc-2.29-r4, 5.2.8-gentoo x86_64)

=================================================================

System uname: Linux-5.2.8-gentoo-x86_64-Intel-R-_Core-TM-_i7-6700HQ_CPU_@_2.60GHz-with-gentoo-2.6

KiB Mem:    16305260 total,  11136268 free

KiB Swap:   20971516 total,  20971516 free

Timestamp of repository gentoo: Mon, 19 Aug 2019 08:30:01 +0000

Head commit of repository gentoo: d38f44d64ae09bd4272db0ec7b08ef285072f034

sh bash 5.0_p9

ld GNU ld (Gentoo 2.32 p2) 2.32.0

app-shells/bash:          5.0_p9::gentoo

dev-java/java-config:     2.2.0-r4::gentoo

dev-lang/perl:            5.30.0::gentoo

dev-lang/python:          2.7.16::gentoo, 3.6.9::gentoo

dev-util/cmake:           3.15.2::gentoo

sys-apps/baselayout:      2.6-r1::gentoo

sys-apps/openrc:          0.41.2::gentoo

sys-apps/sandbox:         2.18::gentoo

sys-devel/autoconf:       2.13-r1::gentoo, 2.69-r4::gentoo

sys-devel/automake:       1.16.1-r1::gentoo

sys-devel/binutils:       2.32-r1::gentoo

sys-devel/gcc:            9.1.0-r1::gentoo, 9.2.0::gentoo

sys-devel/gcc-config:     2.0::gentoo

sys-devel/libtool:        2.4.6-r5::gentoo

sys-devel/make:           4.2.1-r4::gentoo

sys-kernel/linux-headers: 5.2::gentoo (virtual/os-headers)

sys-libs/glibc:           2.29-r4::gentoo

Repositories:

gentoo

    location: /var/db/repos/gentoo

    sync-type: rsync

    sync-uri: rsync://rsync.gentoo.org/gentoo-portage

    priority: -1000

    sync-rsync-verify-jobs: 1

    sync-rsync-verify-metamanifest: yes

    sync-rsync-extra-opts: 

    sync-rsync-verify-max-age: 24

fulgurance-overlay

    location: /var/lib/layman/fulgurance-overlay

    sync-type: laymansync

    sync-uri: https://github.com/Fulgurance/fulgurance-overlay.git

    masters: gentoo

    priority: 50

ACCEPT_KEYWORDS="amd64 ~amd64"

ACCEPT_LICENSE="@FREE"

CBUILD="x86_64-pc-linux-gnu"

CFLAGS="-march=skylake -O2 -pipe -mmovbe -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -mpopcnt -mavx -mavx2 -maes -mpclmul -mfsgsbase -mrdrnd -mfma -mbmi -mbmi2 -mf16c -mrdseed -madx -mprefetchwt1 -mclflushopt -mxsavec -mxsaves"

CHOST="x86_64-pc-linux-gnu"

CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/config /usr/share/gnupg/qualified.txt"

CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"

CXXFLAGS="-march=skylake -O2 -pipe -mmovbe -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -mpopcnt -mavx -mavx2 -maes -mpclmul -mfsgsbase -mrdrnd -mfma -mbmi -mbmi2 -mf16c -mrdseed -madx -mprefetchwt1 -mclflushopt -mxsavec -mxsaves"

DISTDIR="/var/cache/distfiles"

ENV_UNSET="DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR"

FCFLAGS="-march=skylake -O2 -pipe -mmovbe -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -mpopcnt -mavx -mavx2 -maes -mpclmul -mfsgsbase -mrdrnd -mfma -mbmi -mbmi2 -mf16c -mrdseed -madx -mprefetchwt1 -mclflushopt -mxsavec -mxsaves"

FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs candy config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch preserve-libs protect-owned sandbox selinux sesandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"

FFLAGS="-march=skylake -O2 -pipe -mmovbe -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -mpopcnt -mavx -mavx2 -maes -mpclmul -mfsgsbase -mrdrnd -mfma -mbmi -mbmi2 -mf16c -mrdseed -madx -mprefetchwt1 -mclflushopt -mxsavec -mxsaves"

GENTOO_MIRRORS="ftp://ftp.free.fr/mirrors/ftp.gentoo.org/ http://ftp.free.fr/mirrors/ftp.gentoo.org/ http://gentoo.modulix.net/gentoo/ http://gentoo.mirrors.ovh.net/gentoo-distfiles/ https://mirrors.soeasyto.com/distfiles.gentoo.org/ http://mirrors.soeasyto.com/distfiles.gentoo.org/ ftp://mirrors.soeasyto.com/distfiles.gentoo.org/"

LANG="fr_FR.UTF-8"

LDFLAGS="-Wl,-O1 -Wl,--as-needed"

LINGUAS="fr fr_FR"

MAKEOPTS="-j9"

PKGDIR="/var/cache/binpkgs"

PORTAGE_CONFIGROOT="/"

PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"

PORTAGE_TMPDIR="/var/tmp"

USE="X acl acpi alsa amd64 bzip2 compat crypt cryptsetup custom-cflags custom-optimization cxx dbus device-mapper dhcpcd dri dri3 elogind experimental ffmpeg git glamor gstreamer hardened iconv initramfs ipv6 jpeg kde libtirpc lvm mp3 mp4 ncurses networkmanager nls nptl ogg open_perms opengl openmp pam pcre peer_perms phonon pie png policykit pulseaudio readline seccomp selinux semantic-desktop split-usr ssl ssp tiff ubac udev udisks unconfined unicode vaapi vdpau vorbis vulkan wayland wifi wireless xattr xtpax zlib" ABI_X86="64" ALSA_CARDS="hda-intel" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx avx2 f16c fma3 mmx mmxext pclmul popcnt sse sse2 sse3 ssse3 sse4_1 sse4_2" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="efi-64" INPUT_DEVICES="libinput keyboard mouse" KERNEL="linux" L10N="fr fr-FR" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" NETBEANS_MODULES="apisupport cnd groovy gsf harness ide identity j2ee java mobility nb php profiler soa visualweb webcommon websvccommon xml" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-2" POSTGRES_TARGETS="postgres10 postgres11" PYTHON_SINGLE_TARGET="python3_6" PYTHON_TARGETS="python2_7 python3_6" RUBY_TARGETS="ruby24 ruby25" USERLAND="GNU" VIDEO_CARDS="intel i965 nvidia" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"

Unset:  CC, CPPFLAGS, CTARGET, CXX, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
```

----------

## costis

Hello. Have you managed to solve the error? I receive the same since yesterday for 5.3.4 and I never ever had an error with genkernel.

Edit: In my case, this is solved now. Perhaps some environment variable was playing funny with genkernel. 

After 

```
# su -
```

in the same terminal the problem disappeared. (!!!)[/code]

----------

## Maitreya

I have the same and that "su -" does not work for me.

----------

## Whissi

Are you using SELinux (https://bugs.gentoo.org/show_bug.cgi?id=697074)?

----------

