Skip to contentSkip to conversation

question about raw(1)

DISCUSSION Ruediger Meier 4 participants 5 messages Jul 4, 2016 – Jul 8, 2016 Util-Linux package

lore
Share & tools
lore
#0 lore raw

Hi,

I'm just curious, would this always work?:

modprobe raw
raw /dev/raw/raw1 /dev/xyz

or should you wait for /dev/raw/rawctl after modprobe (udevadm settle or sleep)?

cu,
Rudi

#1 lore raw
Quoted 7 lines · Ruediger Meier

I'm just curious, would this always work?:

modprobe raw
raw /dev/raw/raw1 /dev/xyz

or should you wait for /dev/raw/rawctl after modprobe (udevadm settle or sleep)?

Interesting -- the modprobe manual page doesn't state explicitly whether or not the module initialization actions will be completed before modprobe returns.

Dale

maintainer
#2 lore raw
Quoted 8 lines · Dale R. Worley
Quoted 7 lines · Ruediger Meier

I'm just curious, would this always work?:

modprobe raw
raw /dev/raw/raw1 /dev/xyz

or should you wait for /dev/raw/rawctl after modprobe (udevadm settle or sleep)?

This is generic problem and I don't think for utils like raw(8) is there any elegant way how to wait for rawctl node.

IMHO the right solution is write robust scripts and expect "bad things" from your OS :-)

Quoted 3 lines

Interesting -- the modprobe manual page doesn't state explicitly whether or not the module initialization actions will be completed before modprobe returns.

Well, module initialization may also trigger uevent and the rest is userspace (udev) business. In this case things are completely out of kernel+modprobe control, so "module initialization done" is irrelevant information.

Karel

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com
#3 lore raw
Quoted 7 lines · Karel Zak
Quoted 6 lines · Dale R. Worley
Quoted 5 lines · Ruediger Meier

I'm just curious, would this always work?:

modprobe raw
raw /dev/raw/raw1 /dev/xyz

Quoted 8 lines
Quoted 2 lines
Quoted 2 lines

or should you wait for /dev/raw/rawctl after modprobe (udevadm settle or sleep)?

This is generic problem and I don't think for utils like raw(8) is there any elegant way how to wait for rawctl node.

IMHO the right solution is write robust scripts and expect "bad things" from your OS :-)

Yep, this was not a bug report. Just want to know how to write the script right.

It's about this openSUSE init script pull request
https://build.opensuse.org/request/show/405725

He removed the existing "sleep 2" after modprobe but I guess somebody had added that sleep for a good reason in past. Of course sleep is ugly, maybe "udevadm settle" would work too!? I simply don't know if udev or sleep would have any affect here at all. When testing locally the thing always works without any sleep. But this may not mean anything (as I've learned from ul test suite issues).

Quoted 10 lines
Quoted 3 lines

Interesting -- the modprobe manual page doesn't state explicitly whether or not the module initialization actions will be completed before modprobe returns.

Well, module initialization may also trigger uevent and the rest is userspace (udev) business. In this case things are completely out of kernel+modprobe control, so "module initialization done" is irrelevant information.

Karel

#4 lore raw
Quoted 9 lines · Ruediger Meier

It's about this openSUSE init script pull request
https://build.opensuse.org/request/show/405725

He removed the existing "sleep 2" after modprobe but I guess somebody had added that sleep for a good reason in past. Of course sleep is ugly, maybe "udevadm settle" would work too!? I simply don't know if udev or sleep would have any affect here at all. When testing locally the thing always works without any sleep. But this may not mean anything (as I've learned from ul test suite issues).

maybe use timeout(1) instead of waiting the full 2 seconds?

timeout 2 sh -c 'while [ ! -e /dev/raw/$rawdev ]; do sleep .1; done'

Still pretty ugly, but performs better. ;-)

Have a nice day,
Berny