I'm trying to run modules-update in a chrooted environment with a different kernel than the running. When calling "modules-update -v" I get: * Updating /etc/modprobe.conf ... modprobe: Can't open dependencies file /lib/modules/2.6.14-gentoo/modules.dep (No such file or directory) * Warning: could not generate /etc/modprobe.conf! [ !! ] When calling "modules-update -v --assume-kernel=2.4.14-gentoo-r5" (an older and non-exising kernel) nothing at all seems to happen. (?!) When calling "modules-update -v --assume-kernel=2.6.14-gentoo-r5", which is actually the correct kernel, I get: * Error: modules-update called with --assume-kernel flag, but * generate-modprobe.conf doesn't understand it. You need to * install >=module-init-tools-3.0-r2 Yet I do have the latest version of module-init.tools, which is 3.2.2 atm. ------ # emerge info (inside chroot, with "env-update && source /etc/profile"): Portage 2.1_pre2 (default-linux/x86/2005.1, gcc-3.3.6, glibc-2.3.5-r3, 2.6.14-gentoo i686) ================================================================= System uname: 2.6.14-gentoo i686 unknown Gentoo Base System version 1.12.0_pre12 dev-lang/python: 2.3.5-r2, 2.4.2 sys-apps/sandbox: 1.2.17 sys-devel/autoconf: 2.13, 2.59-r7 sys-devel/automake: 1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r1 sys-devel/binutils: 2.16.1-r1 sys-devel/libtool: 1.5.22 virtual/os-headers: 2.6.11-r3 ACCEPT_KEYWORDS="x86 ~x86" AUTOCLEAN="yes" CBUILD="i686-pc-linux-gnu" CFLAGS="-O2 -march=i686 -pipe" CHOST="i686-pc-linux-gnu" CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/kde/3/share/config /usr/lib/X11/xkb /usr/share/config /var/qmail/control" CONFIG_PROTECT_MASK="/etc/gconf /etc/splash /etc/terminfo /etc/env.d" CXXFLAGS="-O2 -march=i686 -pipe" DISTDIR="/usr/portage/distfiles" FEATURES="autoconfig distlocks sandbox sfperms strict" GENTOO_MIRRORS="ftp://sunsite.informatik.rwth-aachen.de/pub/Linux/gentoo http://linux.rz.ruhr-uni-bochum.de/download/gentoo-mirror/ ftp://mirror.nutsmaas.nl/gentoo/" LINGUAS="de" MAKEOPTS="-j2" PKGDIR="/usr/portage/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" SYNC="rsync://rsync.de.gentoo.org/gentoo-portage" USE="x86 X alsa apm arts audiofile avi berkdb bitmap-fonts bzip2 crypt cups eds emboss encode expat fam foomaticdb fortran gdbm gif gnome gpm gstreamer gtk gtk2 idn imlib ipv6 jpeg kde lcms libg++ libwww mad mikmod mng motif mp3 mpeg ncurses nls ogg oggvorbis opengl oss pam pcre pdflib perl png python qt quicktime readline sdl spell ssl tcpd tiff truetype truetype-fonts type1-fonts udev usb vorbis xml2 xmms xv zlib elibc_glibc kernel_linux linguas_de userland_GNU" Unset: ASFLAGS, CTARGET, LANG, LC_ALL, LDFLAGS, PORTDIR_OVERLAY
btw, a workaround for this is creating a symlink to the target kernel directory with the name of the running kernel, e.g (in my case) cd /lib/modules ln -s 2.6.14-gentoo-r5 2.6.14-gentoo
I have the current stable init-tools, 3.2.1 but get the message * Warning: could not generate /etc/modprobe.conf at boot time. However, there are a few differences to the reporter's notes in my case. 1) I do not get a [!!] but an [ok] on the console 2) The error does NOT occur if I manually run modules-update at a console prompt and properly updates modprobe.conf. The warning only shows at boot time. modprobe.conf is NOT updated at boot time and there is a corresponding .old file in /etc. 3) I tried the modules-update -v command the reporter used, but that causes an error in this version. 4) generate-modules.conf does NOT run properly Running generate-modprobe.conf yields only two strange messages while parsing modules. mars peter # generate-modprobe.conf modprobe: QM_MODULES: Function not implemented Warning: not translating path[toplevel]=/lib/modules/2.6 ........ [ after this, all modules seem to parse properly ] And, modprobe.conf is not updated. It only updates from modules-update and only after boot, not during the boot sequence. System information: mars peter # emerge info Portage 2.0.53 (default-linux/x86/2005.0, gcc-3.4.4, glibc-2.3.5-r2, 2.6.14-gentoo-r5 i686) ================================================================= System uname: 2.6.14-gentoo-r5 i686 AMD Athlon(tm) XP 2800+ Gentoo Base System version 1.6.14 dev-lang/python: 2.4.2 sys-apps/sandbox: 1.2.12 sys-devel/autoconf: 2.13, 2.59-r6 sys-devel/automake: 1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r1 sys-devel/binutils: 2.16.1 sys-devel/libtool: 1.5.20 virtual/os-headers: 2.6.11-r3 ACCEPT_KEYWORDS="x86" AUTOCLEAN="yes" CBUILD="i686-pc-linux-gnu" CFLAGS="-O2 -march=i686 -fomit-frame-pointer" CHOST="i686-pc-linux-gnu" CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3.4/env /usr/kde/3.4/share/config /usr/kde/3.4/shutdown /usr/kde/3/share/config /usr/lib/X11/xkb /usr/share/config /var/qmail/control" CONFIG_PROTECT_MASK="/etc/gconf /etc/splash /etc/terminfo /etc/env.d" CXXFLAGS="-O2 -march=i686 -fomit-frame-pointer" DISTDIR="/mnt/src/distfiles" FEATURES="autoconfig distlocks sandbox sfperms strict" GENTOO_MIRRORS="http://mirror.datapipe.net/gentoo ftp://gentoo.mirrors.tds.net/gentoo ftp://206.75.217.180/" MAKEOPTS="-j2" PKGDIR="/usr/portage/packages" PORTAGE_TMPDIR="/mnt/src/var/tmp" PORTDIR="/mnt/src/portage" PORTDIR_OVERLAY="/mnt/src/local/portage" SYNC="rsync://rsync.gentoo.org/gentoo-portage" USE="x86 X alsa apm arts artswrappersuid audiofile avi berkdb bitmap-fonts bzip2 cdr crypt cups curl eds emboss encode esd exif expat fam flac foomaticdb fortran gd gdbm gif glut gnome gpm gstreamer gtk gtk2 idn imagemagick imlib ipv6 java jpeg kde lcms ldap libg++ libwww mad mikmod mng motif mp3 mpeg mysql ncurses nls offensive ogg oggvorbis opengl oss pam pcre pdflib perl png python qt quicktime readline recode samba sdl slang spell ssl svga tcltk tcpd tiff truetype truetype-fonts type1-fonts udev vorbis win32codecs xine xml2 xmms xscreensaver xv zlib userland_GNU kernel_linux elibc_glibc" Unset: ASFLAGS, CTARGET, LANG, LC_ALL, LDFLAGS, LINGUAS hth
As a follow up, I think I may see my problem. I have /var and /tmp mounted on a different partition than /. As a result, during the boot sequence, the modprobe.conf is done prior to the mounting of the /var and /tmp partition. As a result, when generate-modprobe.conf tries to write the temporary file to /tmp, it fails. MODPROBECONF=`mktemp /tmp/modprobe.XXXXXX || tempfile || echo /tmp/modprobe.$$` In my case, at this point in the boot sequence, there is no /tmp. It gets mounted later. Perhaps a resolution would be to add a test for /tmp or to use a different location for the temp file?
that doesnt make any sense unless you have your / explicitly set to readonly just because /tmp hasnt been mounted doesnt mean it doesnt exist on /
/tmp is a symlink to the partition that it and /var reside on. The /tmp-/var partition is not mounted when generate-modprobe.conf runs. /dev/hda5 / reiserfs noatime 1 1 /dev/hda6 /mnt/tmp reiserfs noatime 1 1 /dev/hda2 none swap sw 0 0 peter@mars ~ $ ls -ld /* drwxr-xr-x 2 root root 3680 Jan 6 13:36 /bin drwxr-xr-x 3 root root 1048 Jan 6 11:17 /boot drwxr-xr-x 18 root root 14060 Jan 8 06:22 /dev drwxr-xr-x 75 root root 5088 Jan 8 06:11 /etc drwxr-xr-x 5 root root 1024 Oct 21 07:44 /home drwxr-xr-x 9 root root 3936 Jan 5 06:45 /lib drwxr-xr-x 14 root root 360 Jan 5 07:18 /mnt drwxr-xr-x 9 root root 264 Dec 30 16:02 /opt dr-xr-xr-x 126 root root 0 Jan 8 01:11 /proc drwx------ 24 root root 1448 Jan 8 06:23 /root drwxr-xr-x 2 root root 4272 Jan 6 13:36 /sbin drwxr-xr-x 10 root root 0 Jan 8 01:11 /sys lrwxrwxrwx 1 root root 12 Jan 6 11:07 /tmp -> /mnt/tmp/tmp drwxr-xr-x 13 root root 496 Dec 30 16:02 /usr lrwxrwxrwx 1 root root 12 Jan 5 07:42 /var -> /mnt/tmp/var peter@mars /mnt/tmp $ ls -l total 1 drwxrwxrwt 15 root root 592 Jan 8 06:28 tmp drwxr-xr-x 12 root root 312 Jan 5 07:37 var Note, the permissions on tmp are proper. --- I got this idea from this article, Partitioning in Action: http://www.gentoo.org/doc/en/articles/partitioning-p2.xml generate-modprobe.conf is the only one that creates a temp file in the boot sequence that I can see. HTH
OK, I was correct. In systems where /tmp is mounted separately from root, it is mounted later in the boot sequence, and _after_ generate-modprobe.conf runs. generate-modprobe.conf fails when it can't create the temp file. The following patch against module-init-tools-3.2.1 adds a simple test to see if /tmp is writable. If not, mktemp will create a temp file in / instead of /tmp. --- /sbin/generate-modprobe.conf 2006-01-08 10:09:32.000000000 -0500 +++ /tmp/generate-modprobe.conf 2006-01-08 10:09:32.000000000 -0500 @@ -32,7 +32,15 @@ # Set up output if specified. if [ $# -eq 1 ]; then exec > $1; fi -MODPROBECONF=`mktemp /tmp/modprobe.XXXXXX || tempfile || echo /tmp/modprobe.$$` +# test if /tmp is writable. Useful if user mounts +# tmp in a different partition. This will prevent +# the warning that modprobe.conf could not be created + +TMPDIR=/tmp +if [ ! -w /tmp ] ; then + TMPDIR="" +fi +MODPROBECONF=`mktemp $TMPDIR/modprobe.XXXXXX || tempfile || echo $TMPDIR/modprobe.$$` trap "rm -f $MODPROBECONF" 0 modprobe_abort() Works for me, at least :)
I am getting this when I try a modules-update --assume-kernel: # modules-update --assume-kernel=2.6.15-gentoo-r1 grep: unrecognized option `--assume-kernel' Usage: grep [OPTION]... PATTERN [FILE]... Try `grep --help' for more information. * Error: modules-update called with --assume-kernel flag, but * generate-modprobe.conf doesn't understand it. You need to * install >=module-init-tools-3.0-r2 Looking at the source of modules-update, it appears the problem is here: ! grep -qe -- --assume-kernel /sbin/generate-modprobe.conf The -- isn't needed ad -e is created for patterns that start with -, changing it to the following fixes the problem: ! grep -qe --assume-kernel /sbin/generate-modprobe.conf
Created attachment 78203 [details, diff] patch to make /sbin/generate-modprobe.conf try "modprobe" before "modprobe.old" If the currently running kernel does not have a modules directory on the currently running image, generate-modprobe.conf dies with this message: modprobe: Can't open dependencies file /lib/modules/2.6.14-gentoo-r3/modules.dep (No such file or directory) Failed to to run modprobe. Giving up. It appears to be because the script tries /sbin/modprobe.old before trying the current /sbin/modprobe, this patch seems to fix the problem.
Created attachment 78205 [details] saner patch I just realized that that patch will make it ignore the --stdin parameter, this one is a bit better, sorry about the bugspam.
added the --/-e grep fix to svn
(In reply to comment #6) > OK, I was correct. In systems where /tmp is mounted separately from root, it is > mounted later in the boot sequence, and _after_ generate-modprobe.conf runs. > generate-modprobe.conf fails when it can't create the temp file. Any movement on this issue? A different workaround? -MODPROBECONF=`mktemp /tmp/modprobe.XXXXXX || tempfile || echo /tmp/modprobe.$$` +# test if /tmp is writable. Useful if user mounts +# tmp in a different partition. This will prevent +# the warning that modprobe.conf could not be created + +TMPDIR=/tmp +if [ ! -w /tmp ] ; then + TMPDIR="" Hardcoding /tmp is a problem. Especially with the mktemp command above. You need to assign TMPDIR a valid and mounted location as I did. HTH
Comment on attachment 78205 [details] saner patch no, `modprobe -c` is not the same as `modprobe.old -c` when using module-init-tools
> When calling "modules-update -v --assume-kernel=2.4.14-gentoo-r5" (an older > and non-exising kernel) nothing at all seems to happen. (?!) fixed in svn so it'll warn now: root@vapier 0 sbin # ./modules-update -v --assume-kernel=2.4.14-gentoo-r5 * The dir '/lib/modules/2.4.14-gentoo-r5' doesn't exist, skipping call to depmod
Created attachment 78424 [details] modules-update > When calling "modules-update -v --assume-kernel=2.6.14-gentoo-r5", which is > actually the correct kernel, I get: > > * Error: modules-update called with --assume-kernel flag, but > * generate-modprobe.conf doesn't understand it. You need to > * install >=module-init-tools-3.0-r2 > > Yet I do have the latest version of module-init.tools, which is 3.2.2 atm. can you try the attached modules-update and see if it works for you ?
(In reply to comment #14) > can you try the attached modules-update and see if it works for you ? I did, and I'm sorry I have to tell you it still doesn't work. ---- SNIP ---- laboratory ~ # modules-update --assume-kernel=2.6.15-gentoo-r1 -v * Updating /etc/modprobe.conf ... modprobe: Can't open dependencies file /lib/modules/2.6.14-gentoo/modules.dep (No such file or directory) modprobe: Can't open dependencies file /lib/modules/2.6.14-gentoo/modules.dep (No such file or directory) * Warning: could not generate /etc/modprobe.conf! [ !! ] ---- SNIP ---- I think the problem is in line 90 KV=${ASSUME_KV:-$(uname -r)} because putting a echo ${ASSUME_KV} directly in front of it outputs the correct (i.e. the --assume-kernel) kernel, while the above variable assignment seems to take the `uname -r` kernel, regardless of ASSUME_KV. I'm sorry I cannot resolve the above expression in order to tell if it contains a syntax error. Could you possibly try to set KV diffently? That might solve the prob. (However, this bug is not really a blocker, as the linking workaround still works fine.)
The attached modules-update fixes that message, but I still get gentoo-current ~ # modules-update --assume-kernel=2.6.15-gentoo-r1 * Updating /etc/modprobe.conf ... * Warning: could not generate /etc/modprobe.conf! [ !! ] Adding the generate-modprobe.conf patch I attached earlier fixes this.
(In reply to comment #16) > The attached modules-update fixes that message, but I still get > > gentoo-current ~ # modules-update --assume-kernel=2.6.15-gentoo-r1 > * Updating /etc/modprobe.conf ... > * Warning: could not generate /etc/modprobe.conf! [ !! ] > > Adding the generate-modprobe.conf patch I attached earlier fixes this. > Yes, the "saner patch" fixed it for me, too. :) btw, forget my last message about ${ASSUME_KV}, it works perfectly (as "echo ${KV}" shows).
> Adding the generate-modprobe.conf patch I attached earlier fixes this. just because you didnt see any warning/error messages doesnt mean it worked why dont you read my comment #12 again
(In reply to comment #18) > > Adding the generate-modprobe.conf patch I attached earlier fixes this. > > just because you didnt see any warning/error messages doesnt mean it worked > > why dont you read my comment #12 again Yes, sir... you were right. It reports success, but it only creates an empty modprobe.conf. :-/
Please also do not forget comment #11. If /tmp is mounted on a different partition than /, generate-modprobe.conf will fail. TIA
baselayout-1.12.0_pre19+ should have this fixed