http://www.politiker-stopp.de/gfx/politiker-stopp-print.png

Benjamin Schieder

[TECHSUCKS] LINUX /DEV WOES

2005 September 23 | 2 comments

Once upon a time, there was mkdev and a static list of entries in the /dev world and everything was fine.
Then there was the idea of automating some thing in the /dev world and devfs was creating. Everything was fine.
But soon some people got the opinion that devfs was too easy and the "just works" approach for users is a Bad Idea™. Thus udev was born and devfs attacked more emotionally than factually.

This is where this saga begins: Transitioning a working devfs-populated /dev world to the bane of udev.


The saga begins


So, as someone used to the "mount and it just works" way of doing things with devfs, I installed udev version 058. Compiled fine and installed fine. I read something about a mysterious monster called sysfs and grep'ed /proc/filesystems for it. I found the vile beast sleeping peacefully in its lair.
So far, so good.
udev came with a few binaries, udevd, udev and udevstart. The old mage README gave me faint hints that udevd was a userspace daemon usurping devfsd, udev is the knave of Sir hotplug and udevstart is announcing the arrival of each one.
Since I did not yet trust the Triumvirate to successfully conquer the /dev world I singlehandedly created the parallel universe of /udev by means of editing /etc/udev.conf, the evil archchancellor that controls every decision made by the Triumvirate.
Okay, so here was the first test for them, trying to conquer /udev. udevstart was told to fulfill its duty, and after a very short period of time he came back without saying a word and handed me a short piece of paper. On this paper there was written: "Return Code: 0", the traditional way of telling people that everything is fine and no problems where encountered.
Happy as a child in a candystore I went to the parallel universe of /udev... and found it empty! udevstart has not done its assigned duty!
Angrily I sent him again, knowing that the result would be the same. And lo, it
I asked the local minstrel /var/log/messages but he has never heard of anyone named udevstart or udev or udevd before.
And I thought to myself: If udevstart doesn't do its work, maybe he just is unmotivated by the absence of his master, udevd. Various begging and pleading to udevd by means of --help, -h, --usage failed to get me a response. The master just sat there, not responding, not returning. So I simply told him to go with udevstart by shooing him into the background and sending udevstart to anonunce his master again.
The result, however did not change.



The hidden cave of /sys


At this point I was in despair. Never would I reach the blessings of breaking the chains from the overlord devfs. Never would I be able to see the light that the High Priest GregKH preaches. Never would I...
But wait. There was something nagging at the back of my mind. This feeling that I've missed something.
I went over my notes again and found it! The hidden sidequest! The missing link! I needed to explore the hidden cave of /sys first!
The sidequest proved to be rather short. After a long-time inhabitant of the city of /bin, a noble Sir called mkdir and his assistant Mr. mount, showed me the entry to the hidden cave of /sys!
After this sidequest, even the Triumvirate of udevd, udev and udevstart finally acknowledged that I'm one step closer to the light and started taking up arms to populate the parallel universe of /udev.



Fightig ensues


And populating they did. But they went about it totally wrong! They had the names all messed up! Houses that used to be addressed as discs/disc0/part1 suddenly were called hda1! A small storage shed formerly known as cdroms/cdrom0 suddenly should be addressed as hdc!
I demanded an explanation for this mess. How would one be supposed to make a distinction between houses and storage sheds this way?
A fierce verbal fight between me and the Triumvirate ensued. I accused them of treachery to the state, of selfishness and going only for their own profit instead of humanity at large! I accused the High Priest GregKH a liar, and that his preachings of the light of udev which was supposed to be superior to the promises of devfs were just delusions for the masses!
The Triumvirate just smiled at me, being nonsensical and at some point starting to ignore me.

During my search for a resolution, the helpers of the archchancellor approached me. They called themselves /etc/udev/scripts/ide-devfs.sh, /etc/udev/scripts/scsi-devfs.sh and /etc/udev/rules/. I was delighted! Even though the Triumvirate did not want to hear about this, they could be forced to do my bidding.
In a night-and-fog action the archchancellors helpers and me made the Triumvirate create a parallel /udev universe that finally started to match our own /dev world.
But lo and behold, it looks as if one of the helpers - a young lad by the name of scsi-devfs.sh (as his friends called him) - was still untrained in the ways of this world. He did not know about the proper names for houses and storage sheds (discs/disc0/disc and cdroms/cdrom0).
It took me about half an hour to teach him and the help of an experienced senior by the name of Tobias 'th' Hintze to finetune his knowledge.
And that was when the parallel universe of /udev was a satisfying image of our own devfs controlled /dev world.



The enemy!


Now it was time for the Triumvirate to take over the real /dev world. The parallel universe of /udev was wiped out as fast as it was created and we made headway to the enemy: A fierce Boss Monster by the name of initrd which should be our entrypoint to conquering the /dev world.
And so, the Triumvirate, the archchancellor and his helpers travelled to the tower of mkinitrd where the fierce Boss Monster of initrd resided.
Together, we made some changes to the interiour design of the tower of mkinitrd and the fierce Boss Monster just ran away.
The road to the /dev world was free now. We created our own version of the fierce Boss Monster initrd to keep others from following us.



The rebellion


At this point, udevstart thought that a Triumvirate was not acceptable for him and inserted himself as supreme ruler. While on the road of initrd, he refused to obey udevd, udev or even the archchancellor or his helpers! He did no longer care about the way of addressing houses as discs/disc0/disc or storage sheds as cdroms/cdrom0 as the helpers called ide-devfs.sh and scsi-devfs.sh told him to.
An intriguing look at the Triumvirates members made me think: Their armor looked rusty and their boots rotten.
I decided to try to calm udevstart by replacing the rusty and rotten 058 armor by new and shiny 063 armor and that really pleased everyone.

Since then, /dev is... well, not really peacefully, but it is reigned by the Triumvirate.



Conclusion


Personally, I don't see udev fit to replace devfs yet. It doesn't "just work" and the default is still the very very old hd*, sd* naming scheme which is more than just inconvenient. And the first one to say: Unix is userfriendly, it's just picky about its friends" will get whacked with a blessed fireproof +4 cluestick!

EOF

Category: blog

Tags: TechSucks


2 Comments

From: Adam Richter
2006-09-01 08:25:10 +0200

{ide,raid,scsi}-devfs.sh were apparently removed from the udev-087 release
of March 7, 2006. The ChangeLog file for that version mentions "remove devfs rules and scripts."

From: blindcoder
2006-09-01 08:37:02 +0200

In ROCK Linux we have our own versions of those scripts because the udev supplied ones had some very bad stuff in them. Useless uses of cat and dependencies upon other scripts that weren't possible, #!/bin/sh even though they used bash semantics and stuff like that.
Anyway, a new ROCK Linux installer is underway which will not use the /dev/discs/ semantic anymore and /dev/md/* is handled by mdadm anyway.

Post a comment

All comments are held for moderation; basic HTML formatting is accepted.

Name: (required)
E-mail: (required, not published)
Website: (optional)
Comment: