Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 496262 - sys-apps/portage: `emerge @module-rebuild` doesn't work from /etc/kernel/postinst.d/
Summary: sys-apps/portage: `emerge @module-rebuild` doesn't work from /etc/kernel/post...
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-12-28 12:26 UTC by Alex Efros
Modified: 2014-01-01 18:34 UTC (History)
2 users (show)

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


Attachments
nvidia-drivers build.log (x11-drivers:nvidia-drivers-331.20:20131228-211037.log,41.98 KB, text/plain)
2013-12-28 21:15 UTC, Alex Efros
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Efros 2013-12-28 12:26:14 UTC
When I run `module-rebuild rebuild` from command line it works ok, but when it executed automatically while `make install` from /etc/kernel/postinst.d/ it fail with this error:

# make install
sh /usr/src/linux-3.11.7-hardened-r1/arch/x86/boot/install.sh 3.11.7-hardened-r1 arch/x86/boot/bzImage \
	System.map "/boot"
run-parts: executing /etc/kernel/postinst.d/modules 3.11.7-hardened-r1 /boot/vmlinuz-3.11.7-hardened-r1
** Preparing to merge modules:
** Packages which I will emerge are:
	=x11-drivers/nvidia-drivers-331.20
	=app-emulation/virtualbox-modules-4.2.18
5 4 3 2 1 
 * ARCH is not set... Are you missing the '/etc/portage/make.profile'
 * symlink? Is the symlink correct? Is your portage tree complete?
run-parts: /etc/kernel/postinst.d/modules exited with return code 1

Here is my profile link:
# ls -l /etc/portage/make.profile
lrwxrwxrwx 1 root root 47 дек.  22 23:09 /etc/portage/make.profile -> ../../usr/portage/profiles/hardened/linux/amd64
# eselect profile show
Current /etc/portage/make.profile symlink:
  hardened/linux/amd64
Comment 1 Samuli Suominen (RETIRED) gentoo-dev 2013-12-28 13:36:48 UTC
Use 'emerge -av @module-rebuild' instead since sys-kernel/module-rebuild is a dead package that shouldn't be used anymore wrt bug 410739
Comment 2 Alex Efros 2013-12-28 14:27:39 UTC
(In reply to Samuli Suominen from comment #1)
> Use 'emerge -av @module-rebuild' instead since sys-kernel/module-rebuild is
> a dead package that shouldn't be used anymore wrt bug 410739

Doesn't work either (I've tried module-rebuild 0.5 and 0.7):

# make install
sh /usr/src/linux-3.11.7-hardened-r1/arch/x86/boot/install.sh 3.11.7-hardened-r1 arch/x86/boot/bzImage \
	System.map "/boot"
run-parts: executing /etc/kernel/postinst.d/modules 3.11.7-hardened-r1 /boot/vmlinuz-3.11.7-hardened-r1

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild   R    ] app-emulation/virtualbox-modules-4.2.18  USE="pax_kernel" 0 kB
[ebuild   R    ] x11-drivers/nvidia-drivers-331.20  USE="X (multilib) pax_kernel tools -acpi" 0 kB

Total: 2 packages (2 reinstalls), Size of downloads: 0 kB

Would you like to merge these packages? [Yes/No] 
 * ARCH is not set... Are you missing the '/etc/portage/make.profile'
 * symlink? Is the symlink correct? Is your portage tree complete?
run-parts: /etc/kernel/postinst.d/modules exited with return code 1
make[1]: *** [install] Ошибка 1
make: *** [install] Ошибка 2
Comment 3 Samuli Suominen (RETIRED) gentoo-dev 2013-12-28 14:56:38 UTC
arg. converting this bug to be explicitely about sys-apps/portage's @module-rebuild. thus, no longer blocks bug 410739. sys-kernel/module-rebuild is no p.masked and going away.
Comment 4 Samuli Suominen (RETIRED) gentoo-dev 2013-12-28 14:57:52 UTC
You should post 'emerge --info' (or otherwise we don't know from which Portage version the used @module-rebuild feature is being used from)
Comment 5 Alex Efros 2013-12-28 15:06:06 UTC
Portage 2.2.7 (hardened/linux/amd64, gcc-4.7.3, glibc-2.16.0, 3.11.2-hardened x86_64)
=================================================================
System uname: Linux-3.11.2-hardened-x86_64-Intel-R-_Core-TM-_i7-2600K_CPU_@_3.40GHz-with-gentoo-2.2
KiB Mem:     8162352 total,    401504 free
KiB Swap:    4200960 total,   4149196 free
Timestamp of tree: Sat, 28 Dec 2013 10:15:01 +0000
ld GNU ld (GNU Binutils) 2.23.2
app-shells/bash:          4.2_p45
dev-java/java-config:     2.1.12-r1
dev-lang/python:          2.7.5-r3, 3.3.2-r2
dev-util/cmake:           2.8.11.2
dev-util/pkgconfig:       0.28
sys-apps/baselayout:      2.2
sys-apps/openrc:          0.12.4
sys-apps/sandbox:         2.6-r1
sys-devel/autoconf:       2.13, 2.69
sys-devel/automake:       1.11.6, 1.13.4
sys-devel/binutils:       2.23.2
sys-devel/gcc:            4.7.3-r1
sys-devel/gcc-config:     1.7.3
sys-devel/libtool:        2.4.2
sys-devel/make:           3.82-r4
sys-kernel/linux-headers: 3.9 (virtual/os-headers)
sys-libs/glibc:           2.16.0
Repositories: gentoo perl-experimental-snapshots gamerlay powerman local
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /opt/upsmon-usb/EXT/DownOS /opt/upsmon-usb/EXT/JSystem /service /usr/inferno/keydb /usr/inferno/lib /usr/inferno/services /usr/share/config /usr/share/gnupg/qualified.txt /var/log /var/qmail/alias /var/qmail/control"
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=native -O2 -pipe"
DISTDIR="/usr/portage-distfiles"
EMERGE_DEFAULT_OPTS="--with-bdeps=y --autounmask-write=y --backtrack=15"
FCFLAGS="-march=native -O2 -pipe"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms strict test unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync webrsync-gpg xattr"
FFLAGS="-march=native -O2 -pipe"
GENTOO_MIRRORS="http://gentoo.iteam.net.ua/ http://tux.rainside.sk/gentoo/ http://trumpetti.atm.tut.fi/gentoo/ http://gentoo.inode.at/"
LANG="ru_RU.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j8"
PKGDIR="/usr/portage-packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_EXTRA_OPTS="--exclude ChangeLog --delete-excluded"
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"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/var/lib/layman/perl-experimental-snapshots /var/lib/layman/gamerlay /var/lib/layman/powerman /usr/local/portage"
SYNC="rsync://rsync3.ua.gentoo.org/gentoo-portage"
USE="X a52 aac alac alsa amd64 avx bash-completion berkdb bzip2 caps cdda cddb cli cracklib crypt cxx dbus dri drm dts dvb dvd egl flac fontconfig gallium gdbm gif gles2 gnutls gpg hardened iconv icu id3tag idn ipv6 jpeg jpeg2k justify libnotify mac mad matroska mbox mmx mng modules mp3 mpeg mudflap multilib musepack mysql ncurses network-cron nls nptl nsplugin ogg opengl openmp openvg pam pax_kernel pcre perl png qt3support readline session spell sse sse2 sse3 sse4_1 sse4_2 ssl ssse3 svg tcpd theora tiff truetype unicode urandom vdpau vim-syntax vorbis wavpack x264 xattr xosd xv xvid xvmc zlib" ABI_X86="64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="log_config vhost_alias autoindex alias rewrite dir deflate filter mime negotiation auth_basic authn_file authz_host authz_user authz_groupfile cgi actions headers env setenvif" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en ru" NGINX_MODULES_HTTP="access auth_basic autoindex browser charset empty_gif fastcgi geo gzip limit_conn limit_req map memcached proxy referer rewrite scgi split_clients ssi upstream_ip_hash userid uwsgi fancyindex" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-3" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_3" QEMU_SOFTMMU_TARGETS="x86_64 i386" QEMU_USER_TARGETS="x86_64 i386" RUBY_TARGETS="ruby19 ruby18" USERLAND="GNU" VIDEO_CARDS="nvidia nouveau" 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:  CPPFLAGS, CTARGET, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, USE_PYTHON
Comment 6 Sebastian Luther (few) 2013-12-28 16:28:53 UTC
Please replace "emerge @module-rebuild" with "emerge --info" in /etc/kernel/postinst.d/ and post the output.

I guess there's something in the environment that confuses emerge.
Comment 7 Alex Efros 2013-12-28 17:10:37 UTC
Actually, only difference is in LDFLAGS:

# diff /tmp/[12]
4,5c4,5
< KiB Mem:     8162352 total,    265176 free
< KiB Swap:    4200960 total,   4148988 free
---
> KiB Mem:     8162352 total,    285816 free
> KiB Swap:    4200960 total,   4148756 free
41c41
< LDFLAGS="-m elf_x86_64"
---
> LDFLAGS="-Wl,-O1 -Wl,--as-needed"
Comment 8 Sebastian Luther (few) 2013-12-28 17:47:23 UTC
The problem is that the environment contains ARCH="x86". This gets picked up by emerge at some point and it notices that this doesn't make sense on an amd64 system.

As a workaround add "unset ARCH" before calling emerge.
Comment 9 Alex Efros 2013-12-28 21:14:45 UTC
(In reply to Sebastian Luther (few) from comment #8)
> As a workaround add "unset ARCH" before calling emerge.

This helps, virtualbox-modules builds ok, but nvidia-drivers fails with strange errors - I'll attach log.
Comment 10 Alex Efros 2013-12-28 21:15:24 UTC
Created attachment 366392 [details]
nvidia-drivers build.log
Comment 11 Sebastian Luther (few) 2013-12-29 07:36:55 UTC
Well, there's probably more stuff in the env that interferes with the build.

What you're doing here is to run a build system (the kernel's) which calls emerge, which calls another build system.
As build systems tend to export all sorts of variables, it's not surprising that this doesn't work.

If you really want it work, you'll need to figure out which other variables need to be unset. (Use "set" to see which are set.)

In general, I'd say this is just not supported and expected to break.