Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 18394 - localmount not handling USB
Summary: localmount not handling USB
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Martin Schlemmer (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-03-28 15:18 UTC by Chuck Brewer
Modified: 2003-04-06 11:31 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Chuck Brewer 2003-03-28 15:18:07 UTC
localmount will handle the local fs' ,but it is not mounting my usbdevfs. I have
the appropriate kernel options and my usbcore is being modprobed by the script.
However it isnt mounting my system, and I have manually done mount -t usbdevfs
usbdevfs /proc/bus/usb with success,so I can verify it works, not being executed
by the script???
Comment 1 Martin Schlemmer (RETIRED) gentoo-dev 2003-03-30 02:35:58 UTC
What version of baselayout ?
Comment 2 Chuck Brewer 2003-03-30 04:09:00 UTC
I'm sorry. That info would probably be useful:) I'm running 1.8.6.4-r1 now, all that appears to have changed is the get KV stuff, which looks okay to me, but IM drinking right now:)
Comment 3 Martin Schlemmer (RETIRED) gentoo-dev 2003-03-30 04:42:55 UTC
Heh.  When you are sober again, try this patch I added to localmount in CVS
a week or so back:

-----------------------------------------------------------------------
Index: init.d/localmount
===================================================================
RCS file: /home/cvsroot/gentoo-src/rc-scripts/init.d/localmount,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- init.d/localmount	28 Feb 2003 15:45:35 -0000	1.15
+++ init.d/localmount	24 Mar 2003 14:09:41 -0000	1.16
@@ -1,7 +1,7 @@
 #!/sbin/runscript
 # Copyright 1999-2003 Gentoo Technologies, Inc.
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /home/cvsroot/gentoo-src/rc-scripts/init.d/localmount,v 1.15 2003/02/28 15:45:35 azarah Exp $
+# $Header: /home/cvsroot/gentoo-src/rc-scripts/init.d/localmount,v 1.16 2003/03/24 14:09:41 azarah Exp $
 
 
 depend() {
@@ -14,28 +14,38 @@
 	mount -at nocoda,nonfs,noproc,noncpfs,nosmbfs,noshm >/dev/null
 	eend $? "Some local filesystem failed to mount"
 
-	# Check what kernel we are running ...
-	if [ "$(get_KV)" -ge "$(KV_to_int '2.5.0')" ]
-	then
-		USBFS="usbfs"
-	else
-		USBFS="usbdevfs"
-	fi
-
-	# Cache whether USBFS is 
-	USBBOOL="$(egrep "${USBFS}" /proc/filesystems)"
-
-	# Mount usbdevfs if kernel have support
-	if [ -z "${USBBOOL}" ]
+	# Make sure we insert usbcore if its a module
+	if [ -f /proc/modules ]
 	then
 		# >/dev/null to hide errors from non-USB users
 		modprobe usbcore &>/dev/null
 	fi
-	if [ -n "${USBBOOL}" ] && \
+	
+	# Check what USB fs the kernel support.  Currently
+	# 2.5+ kernels, and later 2.4 kernels have 'usbfs',
+	# while older kernels have 'usbdevfs'.
+	local usbfs="$(awk '
+	  {
+	    # Since 'usbfs' is the newer one, always try to use it
+	    if ($2 == "usbfs")
+	      USBFS = "usbfs"
+	    # With my 2.4.20 kernel, 'usbdevfs' gets listed before 'usbfs',
+	    # but this might change, so only change USBFS if it was not already
+	    # set (and thus to 'usbfs').
+	    if (($2 == "usbdevfs") && (USBFS == ""))
+	      USBFS = "usbdevfs"
+	  }
+	
+	  END {
+	    if (USBFS != "")
+	      print USBFS
+	  }' /proc/filesystems)"
+
+	if [ -n "${usbfs}" ] && \
 	   [ -e /proc/bus/usb -a ! -e /proc/bus/usb/devices ]
 	then
-		ebegin "Mounting USB device filesystem (${USBFS})"
-		mount -t ${USBFS} ${USBFS} /proc/bus/usb &>/dev/null
+		ebegin "Mounting USB device filesystem (${usbfs})"
+		mount -t ${usbfs} none /proc/bus/usb &>/dev/null
 		eend $? "Failed to mount USB device filesystem"
 	fi
 
Comment 4 Chuck Brewer 2003-03-31 00:59:41 UTC
That patch kicks ass. A couple of small questions,though. I thought that usbfs was going to be held off till 2.5? This is what Im mounting now. Also is it preferred to mount usbfs as (dev type) none, where the old one had to be (dev type) usbdevfs? Or is this superior evolution?


Nice job on the patch:)Thanks:)
Comment 5 Martin Schlemmer (RETIRED) gentoo-dev 2003-03-31 13:18:16 UTC
Like the comment says, current 2.4 kernels have it as well.  It actually not
something new .. they just changed the name.  If you actually go into it,
you will see that both usbfs and usbdevfs are listed in /proc/filesystems.
Comment 6 Martin Schlemmer (RETIRED) gentoo-dev 2003-04-06 11:31:44 UTC
Fixed on CVS, will be in baselayout-1.8.6.5 shortly.