You are not logged in.

#1 2004-03-13 19:24:57

Win
Member
Registered: 2004-03-04
Posts: 155

Kernel 2.6.4 Hotplug (USB) Setup Error

The hotplug package script /etc/hotplug/usb.agent produces an error around line 144 as the hotplug system is being set up.

The relevant codes appears to be the following:

    # we could be running before usb populated these attributes...
    if [ ! -f $SYSFS/$DEVPATH/bNumConfigurations ]; then
    # FIXME wait till they appear, or N seconds elapse
    sleep 2
    fi

    # this could care about changing the default config, or warning
    # when the user hooked a fast device up so it runs slowly.
    TMP=$(cat $SYSFS/$DEVPATH/bNumConfigurations)
    if [ $TMP -ne 1 -a $ACTION = 'add' ]; then
    mesg Keeping default configuration with $SYSFS/$DEVPATH
    fi

The final "if" test fails because $TMP has not been assigned any value.  That is because the file $SYSFS/$DEVPATH/bNumConfigurations dies not exist (yet).  The "if" test before this code provides a short pause to give USB a chance to set the relevant attributes.  FYI: I've tried adding a much longer pause (up to 10), but this doesn't help.

BTW:  I've see this problem consistently on one machine; but only once on the very first boot for another machine, and never again.  A third machine has never ever displayed this problem.

The only USB-specific module I install is usb_storage, configured in the MODULES list in rc.conf (this is the case on all machines).

Are there any suggestions for how to further analyze and correct this problem?

Thanks.

Win

Offline

#2 2004-03-13 19:33:33

dp
Member
From: Zürich, Switzerland
Registered: 2003-05-27
Posts: 3,378
Website

Re: Kernel 2.6.4 Hotplug (USB) Setup Error

post a bug @ bugs.archlinux.org


The impossible missions are the only ones which succeed.

Offline

#3 2004-03-13 19:38:48

Xentac
Forum Fellow
From: Victoria, BC
Registered: 2003-01-17
Posts: 1,797
Website

Re: Kernel 2.6.4 Hotplug (USB) Setup Error

My guess is that you're using a custom kernel config.

The chunk of code that you pointed to is within another if block 'if [ "$PRODUCT" = "" ]; then'.  The comment before it says that per-device new events don't have a $PRODUCT (so they won't run into this error) it's only the per-interface events that will go into that chunk of code.

It's looking like all of this code assumes that you're using sysfs.  I don't have sysfs mounted on my machine and I don't ever see that error message.  It also has a FIXME in there that would seem to fix the problem once it's implemented.

What should we do about it exactly?  It's a bug in the usb,agent script included with hotplug, we didn't write it.


I have discovered that all of mans unhappiness derives from only one source, not being able to sit quietly in a room
- Blaise Pascal

Offline

#4 2004-03-13 20:01:33

Win
Member
Registered: 2004-03-04
Posts: 155

Re: Kernel 2.6.4 Hotplug (USB) Setup Error

Hi Xentac.

This is a standard, plain-vanilla Arch Linux install with the off-the-shelf Arch hotplug package.  I haven't done a kernel compile/re-compile or deviated from the standard filesystem setups (I use reiserfs).

BTW: I don't find any "/sys" directory in my file system either (i.e., the value given in the usb.agent script for DEVFS).

Thanks.

Win

Offline

#5 2004-03-14 04:12:42

Win
Member
Registered: 2004-03-04
Posts: 155

Re: Kernel 2.6.4 Hotplug (USB) Setup Error

Well, I've done a bit more research on the 2.6 kernel series wrt hotplug and USB devices.  The situation is much, much more complex than I had thought.

Here's a quick summary:

1. For hotplug to work properly with USB handling within the 2.6.x kernel series, the following must be available:

    * sysfs -- compiled by default into Linux-2.6.x
    * sysfsutils-0.4.0 or later
    * hotplug-2004_01_05 or later
    * udev-016 or later

2. This would mean for Arch Linux: A number of changes must be made to (at least) the rc.sysinit and rc.shutdown.  In particular,:

     * There must be a /sys directory
     * This must be mounted: mount -t sysfs none /sys
     * There must be another item in fstab:  none  /sys   sysfs  defaults  0  0
     * The entire devfs basis for Arch Linux must be replaced by udev.

Once a system has been booted with this infrastructure in place and the appropriate modules loaded (esp., hotplug), the usb devices will be found under /sys/bus/usb.

In sum: the default Arch Linux setup and related instructions for the 2.4.x kernel series will NOT work for the 2.6.x series if the user wants to use hotplug.

This will require some signficant engineering and testing effort for Arch Linux to make a full transition to the 2.6.x kernel series.

Regards,

Win

Offline

#6 2004-03-14 09:32:34

Mr Green
Forum Fellow
From: U.K.
Registered: 2003-12-21
Posts: 5,893
Website

Re: Kernel 2.6.4 Hotplug (USB) Setup Error

Hi,

If you are using hotplug in the way you say which modules can you use i.e. echi uchi,ochi ....USB 2.0 ?

I am interested to know  :?

Mr Green


Mr Green

Offline

#7 2004-03-15 03:58:13

Win
Member
Registered: 2004-03-04
Posts: 155

Re: Kernel 2.6.4 Hotplug (USB) Setup Error

Hi Mr Green.

I haven't been able to set up hotplugging under kernel 2.6.4 completely (specifically, using udev).

What I have now doesn't require loading any additional USB driver modules since these appear to be compiled into the default 2.6.4 kernel.

However, there do appear to be some errors in the hotplug scripts; and some changes that need to be made to the filesystem; and to the files /etc/rc.sysinit and /etc/fstab.

filesystem change:

mkdir /sys

/etc/fstab addition:

none                   /sys      sysfs     defaults               0      0

The first is needed for the hotplug scripts to generate and operate with DEVFS entries.

/etc/rc.sysinit addition:

/bin/mount /proc
/bin/mount /sys
/bin/mount -a -t nonfs,nosmbfs,noncpfs

The second line is placed between the two surround lines.

Finally, a whole series of changes need to be made to three /etc/hotplug files:

/etc/hotplug/usb.agent
/etc/hotplug/scsi.agent
/etc/hotplug/firmware.agent

In each of these files, all expressions of the form:

$SYSFS/$DEVPATH

have been changed to:

${SYSFS}${DEVPATH}

because an inappropriate leading '/' on DEVPATH causes the files to be not found in these scripts, leading to a number of errors.  I tried unsuccessfully to find the source of $DEVPATH to make the change there (i.e., remove the offending leading '/').  (Perhaps someone among the Arch Linux users can help out here.)

At this point, the hotplug scripts at least behave properly at boot up and when devices (e.g., my USB memory stick) are plugged in/unplugged.

But I haven't gotten to making them automount/autounmount the devices.

Regards,

Win

Offline

#8 2004-03-15 04:51:07

dp
Member
From: Zürich, Switzerland
Registered: 2003-05-27
Posts: 3,378
Website

Re: Kernel 2.6.4 Hotplug (USB) Setup Error

i've opened 3 bugs to make hotplug working under kernel26:

the main bug:
http://bugs.archlinux.org/index.php?do=details&id=550

the sysfs bug:
http://bugs.archlinux.org/index.php?do=details&id=551

the udev bug:
http://bugs.archlinux.org/index.php?do=details&id=552

@Win: please add your resources where you got this information there to this bugs, to help migrating to hotplug under kernel 2.6


The impossible missions are the only ones which succeed.

Offline

#9 2004-03-15 09:26:01

Mr Green
Forum Fellow
From: U.K.
Registered: 2003-12-21
Posts: 5,893
Website

Re: Kernel 2.6.4 Hotplug (USB) Setup Error

emmmm /sys is not in my fstab.....or commented out ......

I am running 2.6.3 I have dir /sys  :?  running hotplug....????

Will make changes when upgrade to 2.6.4..(when its fixed smile )

Mr Green....

win please keep me posted if you get USB 2.0 working.....(pretty please)


Mr Green

Offline

#10 2004-03-15 13:39:30

Win
Member
Registered: 2004-03-04
Posts: 155

Re: Kernel 2.6.4 Hotplug (USB) Setup Error

Hi dp.

As I mentioned earlier, the kernel developers envision a tight coupling between hotplug, sysfs, and udev in kernel 2.6.x+.  That doesn't mean that a system MUST tightly integrate them, but there are some compelling arguments.  It seems that the main product issue for Arch Linux -- and I don't know how real this issue is today -- is the availability of device drivers working tightly with this kernel triplet.

Here are the most important references I found relating to hotplug and kernel 2.6.x:

There is a very good series of high-level articles written by William van Hagen of TimeSys about embedded Linux that discusses migrating to the 2.6.x kernel from various points of view.  This entire series is a good jumping-off point for understanding what needs to be done to work with the 2.6.x kernel.  The most relevant articles to the hotplugging subsystem are:

Migrating to Linux kernel 2.6 -- Part 2: Migrating device drivers to Linux kernel 2.6: http://linuxdevices.com/articles/AT4389927951.html

"The Linux 2.6 kernel introduces a new, unified framework for device drivers, which requires changes to custom device drivers that you may have developed to run under earlier versions of the Linux kernel. The new driver model provides a framework for full and complete support for device Plug and Play and power management by defining the interfaces that these subsystems can use when communicating with individual drivers. The new driver framework provides a much cleaner separation of responsibilities between buses and drivers. The 2.6 Linux kernel also introduces the sysfs filesystem to provide a hierarchical view of each system's device tree (and to prevent further overloading of the proc filesystem)."

Migrating to Linux kernel 2.6 -- Part 3: Using the 2.6 kernel with your current system: http://linuxdevices.com/articles/AT5793467888.html

"Many of the new capabilities present in the Linux 2.6 kernel, especially at the device driver and system software levels, require parallel changes in the administrative utilities that interact with them. 2.6-based systems require new startup scripts that must understand new module naming conventions, use new configuration files, and use new 2.6 features such as the sysfs filesystem. The sysfs filesystem is a virtual filesystem that maintains a hierarchical view of all of the devices in use on your system, much as the proc filesystem provides for processes and status information. The sysfs filesystem is designed to be used internally by your Linux system, but the 2.6 kernel also provides integrated support for new types of filesystems for storing user data."

UDEV Primer
http://webpages.charter.net/decibelshel … rimer.html

"What is UDEV?

In a nutshell UDEV is an replacement of DEVFS in user-space using sysfs and /sbin/hotplug. It will create and destroy /dev entries based on the current system configuration. It does this by watching the /sbin/hotplug events on the system, and reading information about these events from sysfs.

Udev works entirely in user-space, using /sbin/hotplug calls that the kernel makes whenever a device is added or removed from the kernel. All naming policy, and permission control is done in user-space.

Some links to read for more information. (Will add more later, just throwing this together right now.)

http://ftp.kernel.org/pub/linux/utils/kernel/hotplug/udev-FAQ"

Offline

#11 2004-03-15 13:47:44

Mr Green
Forum Fellow
From: U.K.
Registered: 2003-12-21
Posts: 5,893
Website

Re: Kernel 2.6.4 Hotplug (USB) Setup Error

Win, u know some stuff....why u not running the show  smile

So are you saying that 2.6.4 works or that it needs more work?

hotplug has several issues mainly USB 2.0 ehci etc....

Is it a question of running before able to walk ?

Mr Green

(looking forward to your next article)


Mr Green

Offline

#12 2004-03-15 14:16:45

dp
Member
From: Zürich, Switzerland
Registered: 2003-05-27
Posts: 3,378
Website

Re: Kernel 2.6.4 Hotplug (USB) Setup Error

@ Win: thank you a lot for this data and links --- great work collecting these infos together

Mr Green wrote:

Is it a question of running before able to walk ?

we already run ... stopping for learning to walk the right way is a matter that has to be thinked first very well, before we try walking ... if you run and want to walk, then you have to think first to not to fall down :-)

hotplug+sysfs are starting to itch, but the trouble is not here (you can still boot 2.6 without heavy problems :-) ) ... it will perhaps come in future, but that's why we should be prepared for it (the "must-have upgrade" once it comes in hopefully far future :-) )

if the kernel developers decided that they want to use a tight coupling between hotplug, sysfs and udev in 2.6, the os has to addapt if it want to use 2.6.


The impossible missions are the only ones which succeed.

Offline

#13 2004-03-15 18:02:47

Win
Member
Registered: 2004-03-04
Posts: 155

Re: Kernel 2.6.4 Hotplug (USB) Setup Error

Hi Mr Green.

dp makes the basic point: Arch Linux WILL work -- in a good, but still incomplete way -- without making these changes.  You can get devices to work by hook or by crook using devfs and (as I've done, for example, with my scanner) with a less-than-optimal-but-still-capable hotplug and sysfs combination, but ultimately Arch Linux will need to align itself to the direction that the kernel is taking.  This means that the udev, sysfs, and hotplug triumvirate will inevitably be the rule.

Regards,

Win

Offline

#14 2004-03-15 18:45:19

Mr Green
Forum Fellow
From: U.K.
Registered: 2003-12-21
Posts: 5,893
Website

Re: Kernel 2.6.4 Hotplug (USB) Setup Error

Hi win

I will be following your threads with great interest...

your humble servant...

Mr Green


Mr Green

Offline

#15 2004-03-31 00:09:55

lilsirecho
Veteran
Registered: 2003-10-24
Posts: 5,000

Re: Kernel 2.6.4 Hotplug (USB) Setup Error

big_smile  smile


I should add that this subject of USB functional problems in 2.6.4 as described in the posts is applicable in considering the use of IEEE1394 devices as well, especially as to the application of hotplug.


Prediction...This year will be a very odd year!
Hard work does not kill people but why risk it: Charlie Mccarthy
A man is not complete until he is married..then..he is finished.
When ALL is lost, what can be found? Even bytes get lonely for a little bit!     X-ray confirms Iam spineless!

Offline

Board footer

Powered by FluxBB