Skip to content

Instantly share code, notes, and snippets.

@awesomebytes
Last active November 18, 2019 08:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save awesomebytes/bf9e8dc9ad0487f59eb018d8eceb88ab to your computer and use it in GitHub Desktop.
Save awesomebytes/bf9e8dc9ad0487f59eb018d8eceb88ab to your computer and use it in GitHub Desktop.
Fix gentoo prefix bootstrap at 18/11/19

The problem:

net-misc/rsync is not in the system when trying to bootstrap in stage3 sys-kernel/linux-headers. This brings to error:

2019-11-17T13:48:54.0711845Z   HDRINST usr/include/asm/unistd_64.h
2019-11-17T13:48:54.0900577Z   INSTALL /tmp/gentoo/var/tmp/portage/sys-kernel/linux-headers-5.3-r1/image/tmp/gentoo//usr/include/../include
2019-11-17T13:48:54.0923314Z /tmp/gentoo/tmp/bin/bash: rsync: command not found
2019-11-17T13:48:54.0938612Z Makefile:1201: recipe for target 'headers_install' failed
2019-11-17T13:48:54.0939015Z make: *** [headers_install] Error 127
2019-11-17T13:48:54.0955078Z  * ERROR: sys-kernel/linux-headers-5.3-r1::gentoo failed (install phase):
2019-11-17T13:48:54.0972600Z  *   emake failed
2019-11-17T13:48:54.0993393Z  * 
2019-11-17T13:48:54.1017178Z  * If you need support, post the output of `emerge --info '=sys-kernel/linux-headers-5.3-r1::gentoo'`,
2019-11-17T13:48:54.1037408Z  * the complete build log and the output of `emerge -pqv '=sys-kernel/linux-headers-5.3-r1::gentoo'`.
2019-11-17T13:48:54.1059925Z  * The complete build log is located at '/tmp/gentoo/var/tmp/portage/sys-kernel/linux-headers-5.3-r1/temp/build.log'.
2019-11-17T13:48:54.1082801Z  * The ebuild environment file is located at '/tmp/gentoo/var/tmp/portage/sys-kernel/linux-headers-5.3-r1/temp/environment'.
2019-11-17T13:48:54.1109129Z  * Working directory: '/tmp/gentoo/var/tmp/portage/sys-kernel/linux-headers-5.3-r1/work/linux-5.3'
2019-11-17T13:48:54.1130936Z  * S: '/tmp/gentoo/var/tmp/portage/sys-kernel/linux-headers-5.3-r1/work/linux-5.3'
2019-11-17T13:48:54.3123154Z 
2019-11-17T13:48:54.3124567Z >>> Failed to emerge sys-kernel/linux-headers-5.3-r1, Log file:

Workaround

To bootstrap net-misc/rsync we need to have dev-util/pkgconfig.

Then we find an error emerging net-misc/rsync that needs patching... the error is:

 * QA Notice: the following files use invalid (possible non-prefixed) shebangs:
 *   tmp/gentoo/etc/init.d/rsyncd:/sbin/openrc-run (script rsyncd installed in PATH but interpreter /sbin/openrc-run not found)
 * ERROR: net-misc/rsync-3.1.3::gentoo failed:
 *   Aborting due to QA concerns: invalid shebangs found
 * 
 * Call stack:
 *   misc-functions.sh, line 1263:  Called install_qa_check
 *   misc-functions.sh, line  138:  Called source 'install_symlink_html_docs'
 *            05prefix, line  138:  Called install_qa_check_prefix
 *            05prefix, line  134:  Called die
 * The specific snippet of code:
 *   		die "Aborting due to QA concerns: invalid shebangs found"

Which basically means $EPREFIX/etc/init.d/rsyncd has as a shebang /sbin/openrc-run, effectively out of prefix.

Right now to patch that (cause I don't know where should this be done and how) I add before emerging the rest:

sed -i "s@sbin@${ED%/}/sbin@g" "${ED%/}"/etc/init.d/rsyncd

To line 74 of $EPREFIX/var/db/repos/gentoo/net-misc/rsync/rsync-3.1.3.ebuild.

So bootstrap-prefix.sh just before sys-kernel/linux-headers needs:

                        dev-util/pkgconfig
                        net-misc/rsync

The block of code inside of bootstrap_stage3() at line 1863 looking like:

sed -i '74i\ \ \ \ \ \ \ \ sed -i "s@sbin@${ED%/}/sbin@g" "${ED%/}"/etc/init.d/rsyncd' $EPREFIX/var/db/repos/gentoo/net-misc/rsync/rsync-3.1.3.ebuild 
cd $EPREFIX/var/db/repos/gentoo/net-misc/rsync
ebuild $EPREFIX/var/db/repos/gentoo/net-misc/rsync/rsync-3.1.3.ebuild manifest
                pkgs=(
                        sys-apps/baselayout
                        sys-apps/gentoo-functions
                        app-portage/elt-patches
                        dev-util/pkgconfig
                        net-misc/rsync
                        sys-kernel/linux-headers
                        sys-libs/glibc
                )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment