Bug 52100 - cold-plugging does not work because of missing /etc/init.d/hotplug or wrong rc.sysinit order
cold-plugging does not work because of missing /etc/init.d/hotplug or wrong r...
Status: CLOSED WORKSFORME
Product: Red Hat Linux
Classification: Retired
Component: hotplug (Show other bugs)
7.3
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Trond Eivind Glomsrxd
Brock Organ
http://linux-hotplug.sourceforge.net/...
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2001-08-20 11:26 EDT by Aleksey Nogin
Modified: 2007-04-18 12:36 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2002-03-26 11:39:22 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Aleksey Nogin 2001-08-20 11:26:39 EDT
If my USB printer is plugged in at boot time, it would not be recognized
and printer module would not be loaded. However, if I try
plugging/unplugging or turning it off/on after the machine is booted, it is
recognized properly. Also, if I manually rmmod all usb-related drivers and
then manually re-run the USB section on rc.sysinit, the printer will be
recognized.

Reproducable: always.

Boot messages:

Aug 19 13:38:30 home kernel: Adding Swap: 345356k swap-space (priority -1)
Aug 19 13:38:30 home kernel: usb.c: registered new driver usbdevfs
Aug 19 13:38:30 home kernel: usb.c: registered new driver hub
Aug 19 13:38:31 home kernel: usb-uhci.c: $Revision: 1.259 $ time 05:09:56
Aug 14 2001
Aug 19 13:38:31 home kernel: usb-uhci.c: High bandwidth mode enabled
Aug 19 13:38:31 home kernel: usb-uhci.c: USB UHCI at I/O 0xff80, IRQ 11
Aug 19 13:38:31 home kernel: usb-uhci.c: Detected 2 ports
Aug 19 13:38:31 home kernel: usb.c: new USB bus registered, assigned bus
number 1
Aug 19 13:38:31 home kernel: hub.c: USB hub found
Aug 19 13:38:31 home kernel: hub.c: 2 ports detected
Aug 19 13:38:31 home kernel: usb-uhci.c: v1.251:USB Universal Host
Controller Interface driver
Aug 19 13:38:31 home kernel: hub.c: USB new device connect on bus1/2,
assigned device number 2
Aug 19 13:38:31 home kernel: usb.c: USB device 2 (vend/prod 0x3f0/0x317) is
not claimed by any active driver.
Aug 19 13:38:31 home kernel: EXT3 FS 2.4-0.9.6, 11 Aug 2001 on sd(8,1),
internal journal  

If I unmount /proc/bus/usb and rmmod usb-uhci usbcore and then do modprobe
usbcore; mount -t usbdevfs usbdevfs /proc/bus/usb; modprobe usb-uhci then I
see:

Aug 20 08:55:59 home kernel: usb.c: registered new driver usbdevfs
Aug 20 08:55:59 home kernel: usb.c: registered new driver hub
Aug 20 08:57:03 home kernel: usb-uhci.c: $Revision: 1.259 $ time 05:09:56
Aug 14 2001
Aug 20 08:57:03 home kernel: usb-uhci.c: High bandwidth mode enabled
Aug 20 08:57:03 home kernel: usb-uhci.c: USB UHCI at I/O 0xff80, IRQ 11
Aug 20 08:57:03 home kernel: usb-uhci.c: Detected 2 ports
Aug 20 08:57:03 home kernel: usb.c: new USB bus registered, assigned bus
number 1
Aug 20 08:57:03 home kernel: hub.c: USB hub found
Aug 20 08:57:03 home kernel: hub.c: 2 ports detected
Aug 20 08:57:03 home kernel: usb-uhci.c: v1.251:USB Universal Host
Controller Interface driver
Aug 20 08:57:03 home kernel: hub.c: USB new device connect on bus1/2,
assigned device number 2
Aug 20 08:57:03 home kernel: usb.c: USB device 2 (vend/prod 0x3f0/0x317) is
not claimed by any active driver.
Aug 20 08:57:05 home kernel: usb.c: registered new driver usblp
Aug 20 08:57:05 home kernel: printer.c: usblp0: USB Bidirectional printer
dev 2 if 0 alt 1
Aug 20 08:57:05 home kernel: printer.c: v0.8:USB Printer Device Class driver
Aug 20 08:57:05 home kernel: usb.c: registered new driver hid
Aug 20 08:57:05 home kernel: usb.c: registered new driver hiddev
Aug 20 08:57:05 home kernel: hid-core.c: v1.8 Andreas Gal, Vojtech Pavlik
<vojtech@suse.cz>
Aug 20 08:57:05 home kernel: hid-core.c: USB HID support drivers

If after I've booted I trunf printer off and on, I see:

Aug 20 11:20:35 home kernel: usb.c: USB disconnect on device 2
Aug 20 11:20:53 home kernel: hub.c: USB new device connect on bus1/2,
assigned device number 3
Aug 20 11:20:53 home kernel: usb.c: USB device 3 (vend/prod 0x3f0/0x317) is
not claimed by any active driver.
Aug 20 11:20:55 home kernel: usb.c: registered new driver usblp
Aug 20 11:20:55 home kernel: printer.c: usblp0: USB Bidirectional printer
dev 3 if 0 alt 1
Aug 20 11:20:55 home kernel: printer.c: v0.8:USB Printer Device Class driver
Aug 20 11:20:56 home kernel: usb.c: registered new driver hid
Aug 20 11:20:56 home kernel: usb.c: registered new driver hiddev
Aug 20 11:20:56 home kernel: hid-core.c: v1.8 Andreas Gal, Vojtech Pavlik
<vojtech@suse.cz>
Aug 20 11:20:56 home kernel: hid-core.c: USB HID support drivers 

I use a slightly modified printer module - see bug 50218.
See also bug 44760 "move usb initialization to initrd" for some other
USB-on-boot related issues.
Comment 1 Bill Nottingham 2001-08-20 14:16:03 EDT
As a printer is not a necessary-for-boot service, I don't intend to add any code
to initscripts for it (ideally, there shouldn't be *any* code in initscripts for
USB, it should all be hotplug).

Did this work in 7.1?
Comment 2 Aleksey Nogin 2001-08-20 14:46:17 EDT
> As a printer is not a necessary-for-boot service, I don't intend to add any code
> to initscripts for it

May be I didn't state my problem clear enough - if the printer is plugged in and
turned on when the machine is rebooted, the printer will not be recognized at
any point during or *after* the boot process. This means that I have to do
things *manually* if I want to be able to use my printer.

> Did this work in 7.1?

As it turned out, between the time I got the printer and the time I started
upgrading to RC1, I never rebooted, so I have no idea...
Comment 3 Aleksey Nogin 2001-08-20 14:56:47 EDT
P.S. I do not think this is a hotplug issue. Hotplug does everything correctly
if I plug printer after the machine is booted (see the 3rd log from my initial
report).

The question I would like to ask - at which point should I expect the printer
driver to be loaded if I am booting the system with printer plugged in and
turned on?

One possible answer - it should happen when USB core modules are first loaded
(as shown in my 2nd log in initial report). But that would mean that hotplug
should be ready to go (all sysctls, etc should be done) before usb modules are
loaded, which is not the case for rc.sysinit in current initscripts.
Are there any better answers to this question?
Comment 4 Bill Nottingham 2001-08-20 15:20:37 EDT
hotplug is supposed to handle the cold-plug cases too; that's why it's a hotplug
problem. The code is in initscripts *only* for the things you'd need to use
the console if something bad happens (fsck failure, etc.)
Comment 5 Trond Eivind Glomsrxd 2001-08-27 12:51:51 EDT
Please try hotplug-2001_04_24-11 from http://people.redhat.com/teg/
Comment 6 Trond Eivind Glomsrxd 2001-09-12 10:57:44 EDT
Reported fixed in that version.
Comment 7 Aleksey Nogin 2001-10-03 12:21:19 EDT
Unfortunatelly, this problem still exists in Enigma (which has
hotplug-2001_04_24-11).

Boot messages (grep -i usb /var/log/messages):

Oct  2 19:40:04 home rc.sysinit: Mounting USB filesystem:  succeeded
Oct  2 19:40:04 home rc.sysinit: Initializing USB controller (usb-uhci):  succeeded
Oct  2 19:44:20 home kernel: usb.c: registered new driver usbdevfs
Oct  2 19:44:20 home kernel: usb.c: registered new driver hub
Oct  2 19:44:20 home kernel: usb-uhci.c: $Revision: 1.259 $ time 17:18:11 Sep  6
2001
Oct  2 19:44:20 home kernel: usb-uhci.c: High bandwidth mode enabled
Oct  2 19:44:20 home kernel: usb-uhci.c: USB UHCI at I/O 0xff80, IRQ 11
Oct  2 19:44:21 home kernel: usb-uhci.c: Detected 2 ports
Oct  2 19:44:21 home kernel: usb.c: new USB bus registered, assigned bus number 1
Oct  2 19:44:21 home kernel: hub.c: USB hub found
Oct  2 19:44:21 home kernel: usb-uhci.c: v1.251:USB Universal Host Controller
Interface driver
Oct  2 19:44:21 home kernel: hub.c: USB new device connect on bus1/2, assigned
device number 2
Oct  2 19:44:21 home kernel: usb.c: USB device 2 (vend/prod 0x3f0/0x317) is not
claimed by any active driver.

After manual "modprobe printer":
Oct  3 12:08:30 home kernel: usb.c: registered new driver usblp
Oct  3 12:08:30 home kernel: printer.c: usblp0: USB Bidirectional printer dev 2
if 0 alt 1
Oct  3 12:08:30 home kernel: printer.c: v0.8:USB Printer Device Class driver
Comment 8 Aleksey Nogin 2001-10-27 22:06:21 EDT
Where and how is cold-plugging supposed to be initiated? According to the
hotplug home page, it is supposed to be done by /etc/rc.d/init.d/hotplug;
hotplug's man page also talks about /etc/init.d/hotplug, but the hotplug RPM
does not include any init.d sripts!
Comment 9 Trond Eivind Glomsrxd 2001-10-27 22:10:03 EDT
Initialization of the USB-controller is done in the rc.sysinit scripts.
Comment 10 Aleksey Nogin 2001-10-27 22:57:36 EDT
You are missing the point!
Yes, initialization of USB *controller* is done in rc.sysinit. However, when the
USB *controller* is initialized it does not yet know about the USB *devices*, so
if a device is plugged in before the controller is initialized, the device
driver is not loaded.

In a normal hotplug operation the cold plugging (e.g. recognition of the devices
that are already plugged in) of USB devices is performed by
/etc/hotplug/usb.rc start
which, in turn, is supposed to be called from
/etc/init.d/hotplug startUnfortunatelly, /etc/init.d/hotplug is *missing* from
the hotplug package!

The first paragraph of the "How do these Hotplug Tools work?" section of the
HotPlug Overview - http://linux-hotplug.sourceforge.net/?selected=overview states:

 There is a "hotplug" system service (/etc/rc.d/init.d/hotplug) that's invoked
during system booting, which handles initialization including "coldplugging" by
invoking /etc/hotplug/type.rc files for each type the system supports. These
types include usb, pci for PCI and Cardbus, net for networking, and so on; these
types are defined by the Linux kernel.
Comment 11 Bill Nottingham 2001-10-28 00:08:37 EDT
I do believe the documentation is wrong. /etc/init.d/hotplug should not be
necessary. As your messages note, it recognized the printer fine; why it
didn't find the right driver is a separate problem.
Comment 12 Trond Eivind Glomsrxd 2001-10-28 10:20:46 EST
USB devices are detected/hotplugged when the USB controller is initialized -
which is what the hotplug init script does. We need USB keyboards active before
this, and thus it's initialized in rc.sysinit. Why your device isn't detected
properly I'm not sure, but as you can see from the logs it's trying.
Comment 13 Aleksey Nogin 2001-10-28 10:41:00 EST
I disagree. I do not think it's really trying. If you think the documentation is
wrong, please tell me *exactly* at what point during the boot process and *using
which mechanism* is the cold-plugging supposed to work. 

What you've said so far seems to imply the answer "when the USB controller is
initialized in rc.sysinit" and "using the hotplug" which can not be true since
the hotplug sysctl goes *after* USB initialization in rc.sysinit, so hoplug
subsystem is not active when the USB controller is initialized.
Comment 14 Aleksey Nogin 2002-01-03 13:00:31 EST
teg> USB devices are detected/hotplugged when the USB controller is initialized -
teg> which is what the hotplug init script does.

But how can hotplug init script do anything when *it's missing from the RPM*?

Comment 15 Aleksey Nogin 2002-01-03 13:16:16 EST
See also bug 55332 for another instance of this problem.
Comment 16 Trond Eivind Glomsrxd 2002-01-03 13:20:08 EST
Because the kernel calls /sbin/hotplug (or whatever you tell it in
/proc/sys/kernel/hotplug )
Comment 17 Aleksey Nogin 2002-01-03 13:58:39 EST
teg> Because the kernel calls /sbin/hotplug (or whatever you tell it in
teg> /proc/sys/kernel/hotplug )

But does not this mean that we are coming back to this being an rc.sysinit
problem? Currently rc.sysinit loads usb core modules *before* it does "sysctl -w
kernel.hotplug", so how could this work?

Again, this comes to the same question I haven't seen any answer to - at what
exact point in the bootup process do you want coldplugging to happen? Before
that question is answered, it's impossible to say what script is responsible for
making sure this really happens and so far you seem to be just bouncing this
back and forth, essentially saying "it's not my script that is responsible for
that, it somebody else's"...
Comment 18 Bill Nottingham 2002-03-25 23:56:20 EST
Cold plugging should work as hotplug events are generated by the kernel when the
USB controller is initialized; hence, it goes through the normal hotplug
mechanisms, hence, no init script is needed. The bug is elsewhere.
Comment 19 Aleksey Nogin 2002-03-26 03:32:06 EST
> Cold plugging should work as hotplug events are generated by the kernel when the
> USB controller is initialized; hence, it goes through the normal hotplug
> mechanisms, 

How would it work if hotplug sysctl goes *after* USB initialization is sysinit?
(We are going in circles! I am essentially repeating what I've already said in
my comments from 2001-10-28 10:41:00).

Also, I remember hearing about some problems with the hotplug scripts not doing
the right thing when /usr is not mounted - could that be a problem?
Comment 20 Bill Nottingham 2002-03-26 11:39:17 EST
Because before the sysctl happens, the value of kernel.hotplug is the default,
'/sbin/hotplug'. (Yes, the sysctl is somewhat redundant.)

Comment 21 Trond Eivind Glomsrxd 2002-04-11 15:04:17 EDT
It works on the cases I've tested... including usb-storage, webcams etc.

Note You need to log in before you can comment on or make changes to this bug.