# Problems with udev-event

## Kensai

Ok, I have googled and searched the forum for this and can't find an answer. I installed gentoo from livecd 2006 after a year using FreeBSD only so although I have been 2 years into Linux now I feel a little loss again. I am using ~x86 with latest udev 87. While booting it says udevd-event[2097] find_free_number: %e is deprecated and will be removed Don't use it. Now the question is how I don't use it and what I don't need to use? Any one can enlighten me in this matter?

-Thanks  :Wink: 

EDIT: that message I get after *Letting udev proccess events [ok]

----------

## Ferdinando

Same here; seems harmless though. I think we'll just have to wait until someone fixes the default udev rules: there are a lot of tutorials around the net on how to modify those rules, but I know very little about that.

Bye

----------

## Kensai

Ohh well maybe is just a matter of a emerge --sync and emerge -uavtDN world and etc-update. HEHE I hope. Well I should not worry I'm back in the gentoo world and this is an everyday issue having to wait for fixes thats why we run ~x86.  :Laughing: 

----------

## Ferdinando

 *Kensai wrote:*   

> Well I should not worry I'm back in the gentoo world and this is an everyday issue having to wait for fixes thats why we run ~x86. 

 

Yep, I have an ~x86 system because I hope I'll be able to submit a fix, sooner or later  :Very Happy:  Anyway, that just gives me the opportunity to report bugs, and that's useful too; in this case, though, I don't know if it's worth it, since the developers probably already know that. Personally I think I'll give them a week or so, and then eventually report it.

Bye

----------

## Kensai

Well if nobody has reported it you might report it, I haven't done that because I'm not that good at it. Well I know some devs that don't fix a thing until they see the bug filed and sometimes even though they knew about it.

----------

## Ferdinando

BTW, the problem seems to be related to the progressive number of cdrom devices:

```
# grep '%e' /etc/udev/rules.d/*

/etc/udev/rules.d/50-udev.rules:ENV{ID_CDROM}=="?*",            SYMLINK+="cdrom%e", GROUP="cdrom"

/etc/udev/rules.d/50-udev.rules:ENV{ID_CDROM_CD_RW}=="?*",      SYMLINK+="cdrw%e"

/etc/udev/rules.d/50-udev.rules:ENV{ID_CDROM_DVD}=="?*",        SYMLINK+="dvd%e"

/etc/udev/rules.d/50-udev.rules:ENV{ID_CDROM_DVD_R}=="?*",      SYMLINK+="dvdrw%e"
```

But the udev man page doesn't give any info on how to change that string.

Bye

----------

## Kensai

I see, Looks like thats work for the devs.  :Sad: 

----------

## cheatah

Im having the same warning on startup.

----------

## wuja

 *Ferdinando wrote:*   

> ... how to change..

 

Edit /etc/udev/rules.d/50-udev.rules end delete "%e". 

```
#ENV{ID_CDROM}=="?*",           SYMLINK+="cdrom%e", GROUP="cdrom"

#ENV{ID_CDROM_CD_RW}=="?*",     SYMLINK+="cdrw%e"

#ENV{ID_CDROM_DVD}=="?*",       SYMLINK+="dvd%e"

#ENV{ID_CDROM_DVD_R}=="?*",     SYMLINK+="dvdrw%e"

ENV{ID_CDROM}=="?*",           SYMLINK+="cdrom", GROUP="cdrom"

ENV{ID_CDROM_CD_RW}=="?*",     SYMLINK+="cdrw"

ENV{ID_CDROM_DVD}=="?*",       SYMLINK+="dvd"

ENV{ID_CDROM_DVD_R}=="?*",     SYMLINK+="dvdrw"
```

----------

## Ferdinando

 *wuja wrote:*   

> Edit /etc/udev/rules.d/50-udev.rules end delete "%e".

 

Well, in my box that works, but doesn't that cause problems if one has more than one cdrom?

Just asking, since, as I've said, I know very little about udev rules.

Bye

----------

## wuja

No problem. I have CDROM and CDR/DVD. They mount now not as /media/hdX or /media/cdrecorder but /mnt/cdrom and /mnt/dvd.

(Sorry for my english)

----------

## The Mountain Man

 *wuja wrote:*   

>  *Ferdinando wrote:*   ... how to change.. 
> 
> Edit /etc/udev/rules.d/50-udev.rules end delete "%e". 
> 
> ```
> ...

 

This fixed it for me.  Thanks.

----------

## Andreas Hartmann

Hi,

it works on my box, too (having a dvdrw only), but it will not work for those people having two devices of the same type, eg. two dvd writers as there would be only one dvdrw symlink to the last (or first?) dvd writer.

Using the number given by the kernel (%n) instead of %e should work for pcs with SCSI/S-ATA drives if you have two devices of the same type, but else the code above is ok, I think.

----------

## Kensai

Late reply but secure. thanks very much for the fix.

----------

## drphibes

I put a patch up here https://bugs.gentoo.org/show_bug.cgi?id=127815 creating udev-087-r1, 

which does nothing more than flip off that annoying warning.

I doubt it will make it into the portage tree, but the "fix" of removing %e breaks things here since

I have multiple cd/dvd devices.   The effect I get is that the last device processed gets the one and 

only symlink and that's no good.

----------

## BitJam

I have two cd drives (hdb and hdc) and I also get those %e warnings.

In addition, my two cdroms seem to get randomly assigned to /dev/cdrom and /dev/cdrom1.   I don't care how the system wishes to make these assignments as long as the assignment is consistent.  Do I really need to write local rules in order to get this to work consistently?

----------

## Paapaa

Hmm, I think the correct solution is to replace %e with %n, which is documented. Could someone with multiple drives test it? It did work with my single CD drive.

Here is the bug report.

----------

## agent_jdh

 *Paapaa wrote:*   

> Hmm, I think the correct solution is to replace %e with %n, which is documented. Could someone with multiple drives test it? It did work with my single CD drive.

 

According to one of the posts in that bugzilla link above, the %n method doesn't quite work properly (although how not working was not specified...)

----------

## BitJam

 *Paapaa wrote:*   

> Hmm, I think the correct solution is to replace %e with %n, which is documented. Could someone with multiple drives test it? It did work with my single CD drive.
> 
> Here is the bug report.

 

As someone already noted, someone didn't like the %n idea because it didn't properly distinguish between ide and scsi cdrom drives (I think).  I just tried it with my two ide cdrom drives and got the following unsatisfactory results:

```
$ ls -l /dev/cd*

lrwxrwxrwx  1 root root      3 Apr  4 16:19 /dev/cdrom -> hdc

lrwxrwxrwx  1 root root      3 Apr  4 16:19 /dev/cdrom1 -> hdc

lrwxrwxrwx  1 root root      3 Apr  4 16:19 /dev/cdrom2 -> hdb

lrwxrwxrwx  1 root root      3 Apr  4 16:19 /dev/cdrw -> hdc

lrwxrwxrwx  1 root root      3 Apr  4 16:19 /dev/cdrw1 -> hdc

brw-rw----  1 root cdrom 24, 0 Feb 13 17:03 /dev/cdu535
```

The dvds are worse:

```
$ ls -l /dev/dvd*

lrwxrwxrwx  1 root root 3 Apr  4 16:19 /dev/dvd -> hdc

lrwxrwxrwx  1 root root 3 Apr  4 16:19 /dev/dvd1 -> hdc
```

As I said before, I was not pleased with the %e results either because it seemed to assign hdb and hdc to cdrom and cdrom1 at random.

I've gotten the best results so far with using the %e's (despite the warning messages) and the following local rules (which I turned off to try %n):

```
KERNEL=="hdb" SYSFS{removable}=="1" SYMLINK+="cdrom"

KERNEL=="hdb" SYSFS{removable}=="1" SYMLINK+="dvd"

KERNEL=="hdc" SYSFS{removable}=="1" SYMLINK+="cdrom1"

KERNEL=="hdc" SYSFS{removable}=="1" SYMLINK+=""dvd1"
```

When I commented out the %e rules in 50-udev.rules and just used my local rules then I was unable to access either cdrom drive even through /dev/hd{b,c} which seemed a little strange to me.

BTW: I have been rebooting to when I try a new rule set.  Is this necessary or is there an easier way?

----------

## drphibes

%e remains perfectly usable -- remember, deprecated does not mean obsolete.  I am using the small

udev-087-r1 patch on bugzilla to quiet the warnings and _forgetting_ about this for the time being.   

The upstream maintainers do not even have a solution decided upon yet.

I think it was sloppy to mark udev-087 stable for x86, knowing that deprecation warnings would start spewing

out all over the place.  All it does is cause people to start chasing around looking for something to fix, as if we 

all had nothing better to do.

Stick with %e and wait for them to announce the new alternative.  Next problem.

----------

## anz

I have similar troubles:

after updating udev to udev-087 during booting following messages appear:

```
udev-event[6833]: match_rule: MODALIAS is deprecated, use ENV{MODALIAS} or SYSFS{modalias} instead

udev-event[6833]: udev-rules-apply-format: $modalias is deprecated, use $env{MODALIAS} or $sysfs{modalias} instead

```

I 've removed the "%e" in /etc/udev/rules.d/50-udev.rules as described above. Then during booting, same error message but with another code:

udev-event[6836] instead udev-event[6833] ...

Trying to safety unmount any usb stick, camera with the konqueror->media works only as root. After trying konqueror crahses ...

The same happens at the shell - trying to unmount a usb stick as users results in a 

```
/dev/sda1 is not in the fstab (and you are not root)
```

A pumount /dev/sda1 as user leads to a

```
Error: device /dev/sda1 was not mounted by you
```

(but works as root)

CD/DVD mounting and unmounting works as normal user in shell or with kde without troubles.

But in /usr/share/hal/fdi/90defaultpolicy/storage-policy.fdi

```
<merge key="storage.policy.default.mount_option.users" type="bool">true</merge>
```

is set ...   :Shocked: 

... any hints?

Installed versions:

 *Quote:*   

> sys-apps/hal-0.5.5.1-r3
> 
> sys-apps/ivman-0.6.8
> 
> sys-apps/dbus-0.60-r4
> ...

 

Sorry for my question, but I am too stupid to encrypt the error message around the udev-event.

----------

## drphibes

In addition to the boot warnings, I now notice a flurry of udev-087 messages when I poweroff the computer.   

They appear just after all the services have reported shutting down and just before the screen goes out -- 

only for a moment, so I can't quite read them.

----------

## mirojira

 *drphibes wrote:*   

> In addition to the boot warnings, I now notice a flurry of udev-087 messages when I poweroff the computer.   
> 
> 

 

The same messages during start up and shut down.

----------

## hoschi

I've here the same problems with "udev".

----------

## Kensai

so nobody has got a work around on which is a great replacement for %e?

----------

## BitJam

I tried writing local rules for my particular hardware setup and even that failed to work consistently.  Finally, I've put code in /etc/conf.d/local.start to remove the symlinks and recreate them manually.

When I tried to just comment out the %e lines and replace them with my own local rules then the symlinks were there but the devices no longer worked.   :Sad: 

----------

## bhav2007

As I understand it, the reason that the %e flag is deprecated, and the reason why it seems to assign devices 'at random' is that this flag just picks the lowest number not already taken, and therefore will give different results based on when the device is created (and maybe will cause problems if the two devices are created at the same time). Its a race condition.

Also, I think that the only flag anologous to %e is something like %n,  which is the kernel's number for the device; however, this number isn't meant for this purpose and is not guaranteed to be unique for all the devices which might be created by a particular rule.

The udev developers seem to be suggesting that individual users are not supposed to be 'fixing' this error, because it is up to the maintainer of the udev rule files for gentoo to figure out how he wants to assign unique cdrom (or whatever) device names without just picking the lowest available number with %e. Therefore, this problem isn't completely trivial.

 *Quote:*   

> When I tried to just comment out the %e lines and replace them with my own local rules then the symlinks were there but the devices no longer worked. 

 

I don't think you are supposed to change the udev rule files. You should create your own, with a name like "01-udev-custom.rules" which will run before the other rule files (rule files are run in order of their file names). That way, if your rules don't match what you wanted, udev will still create the node regularly. I have no idea if this will stop the error message, but from the looks of it I would guess that it will not appear if udev matches your rules and never gets to the ones with '%e' in them.

----------

## BitJam

 *bhav2007 wrote:*   

>  *Quote:*   When I tried to just comment out the %e lines and replace them with my own local rules then the symlinks were there but the devices no longer worked.  
> 
> I don't think you are supposed to change the udev rule files. You should create your own, with a name like "01-udev-custom.rules" which will run before the other rule files (rule files are run in order of their file names). That way, if your rules don't match what you wanted, udev will still create the node regularly.

 

In the first paragraph of my post I had said I had tried that and it didn't work.  I then tried commenting out the %e lines to see if that helped things but it made them worse.

Besides, this is Gentoo, if I had wanted to run a distribution with "no user serviceable parts inside" I would be using Ubuntu.

 *Quote:*   

>  I have no idea if this will stop the error message, but from the looks of it I would guess that it will not appear if udev matches your rules and never gets to the ones with '%e' in them.

 

Nope.  If the rules are there, you will get the warnings whether they are needed or not.  How can udev know what the lines that contain %e are supposed to do without reading them?  The error is produced when the lines are read, not when they are applied, and certainly not just when the lines are matched.

----------

## evoweiss

 *Kensai wrote:*   

> so nobody has got a work around on which is a great replacement for %e?

 

Hi, I posted a pretty simple work-around to the following  thread.

Hope it's useful.

Alex

----------

## Slalomsk8er

 :Shocked:  1/4 of a year later and still the same problem WTF!!!

Does some one knows if it is the gentoo devs or the upstream devs that does not like us to play with the rules.

And why do the upstream devs depreciate %e with out a sane substitute?

I do not like to see this error any longer and will now write my own rules for my drives  :Twisted Evil: 

But it is a shame that some thing simple like a flag to assign unique indexes seams to be to much work to fix so they will simply depreciate it.

I think this is a basic thing and with out it the hole udev get useless and as some one posted above or in a other thread you can dump udev and let the local.start script create the links  :Evil or Very Mad: Last edited by Slalomsk8er on Thu Jun 29, 2006 1:14 pm; edited 1 time in total

----------

## furanku

From udev's changelog:

 *Quote:*   

> udev-094 (28 Jun 2006)
> 
>   28 Jun 2006; Martin Schlemmer <azarah@gentoo.org> +files/udev.rules-094,
> 
>   +files/seq_node.sh, +udev-094.ebuild:
> ...

 

----------

## Slalomsk8er

Thanks, I updated it now but I think I will have to wait till next day to see if it worked  :Wink: 

----------

## Kensai

Oh yeah I got that, just forgot about my post. Version 094 of udev is the fist in Gentoo to adress this.

----------

## cyberpatrol

udev-094 removes the "%e is deprecated" message but it still assigns the symlinks randomly.

Most of the time my DVD drive which is on hdb and shall have the symlinks cdrom and dvd gets the symlinks cdrom1 and dvd1 and my DVD-RW burner which is on hdc and shall have the symlinks cdrw and dvdrw gets the the symlinks cdrom, dvd, cdrw and dvdrw as it was already with the last udev version without seq_node.sh.

And what's even worse with the new udev version and the seq_node.sh is that my own local rules which I set in 01-local.rules like someone has suggested somewhere in this forum aren't applied anymore.

These are/were my local rules:

```
BUS="ide", KERNEL="hdb", NAME="%k", SYMLINK="cdrom dvd"

BUS="ide", KERNEL="hdc", NAME="%k", SYMLINK="cdrw dvdrw"
```

Renaming 01-local.rules to 99-local.rules doesn't work.

----------

## PaulBredbury

Should be:

```
BUS=="ide", KERNEL=="hdb", NAME="%k", SYMLINK="cdrom dvd"

BUS=="ide", KERNEL=="hdc", NAME="%k", SYMLINK="cdrw dvdrw"
```

The change is the double equals sign after BUS and KERNEL (C-style comparison vs assignation).

----------

## cyberpatrol

Thank you! This got my local rules working again.

But nevertheless such local rules shouldn't be necessary.

The links should rather automatically be set correctly.

I think either it's a bug in udev or in the kernel because this is the output of cdrom_id for my drives:

```
# /sbin/cdrom_id --export /dev/hdb

ID_CDROM=1

ID_CDROM_DVD=1

ID_CDROM_MRW=1

ID_CDROM_MRW_W=1

# /sbin/cdrom_id --export /dev/hdc

ID_CDROM=1

ID_CDROM_CD_R=1

ID_CDROM_CD_RW=1

ID_CDROM_DVD=1

ID_CDROM_DVD_R=1

ID_CDROM_DVD_RAM=1

ID_CDROM_MRW=1

ID_CDROM_MRW_W=1

ID_CDROM_RAM=1
```

I guess the variables are set by the kernel.

I don't know but if e.g. ID_CDROM and ID_CDROM_DVD would only be set for CD-ROM or DVD drives and not for CD-RW and DVD-RW burners then these variables wouldn't be set twice and the problem should be solved.

I don't know if this could be implemented into the kernel, udev or whatever is responsible for these variables.

----------

## beatryder

 *Quote:*   

> I do not like to see this error any longer and will now write my own rules for my drives 

 

Thats what I did, even before this whole %e is depricated. The funny thing here is that all you people are freaking out about this warning, when all it is doing is telling you that some day in the future it will not work. Trust the devs on this one, when the time comes that the %e does not work anymore they will find a fix, or patch, or update the configs when the time comes.

(sorry if that was gibberish, I just got up from a 4 hour sleep  :Razz:  )

----------

## Kensai

Yeah! devs work at the right time always with patience.  :Laughing: 

----------

