# udev REFUSES to rename /dev/ttyUSB0 to /dev/ttyScope

## brainsalad

This line in /etc/udev/rules.d/99-scope-and-lightbox-serial-interfaces.rules used to work:

SUBSYSTEMS=="usb", DRIVERS=="usb", ATTRS{product}=="USB <-> Serial", ATTRS{manufacturer}=="FTDI", ATTRS{idVendor}=="0403", NAME="ttyScope"

With udev 197, this rule stopped working.  Udev does continue to match the device correctly: changing NAME to SYMLINK results in a symlink being created.  But udev won't rename the device.  It just won't do it.  I will not abide this.  THIS CAN NOT STAND!!!!!!!!!!!!!

The problem does not appear to be other udev rules interfering.  I know this because I tried deleting them all.  Nope.  Still /dev/ttyUSB0.

This has been sticking in my craw for too long, now.  I will tear the world in half and hurl the moon into the sun at noon CST Monday if I do not have this figured out by then.  All life in this solar system will be terminated, forever.  Ok, so I hope someone has a workaround.  Don't make me do it.

----------

## SamuliSuominen

 *brainsalad wrote:*   

> This line in /etc/udev/rules.d/99-scope-and-lightbox-serial-interfaces.rules used to work:
> 
> SUBSYSTEMS=="usb", DRIVERS=="usb", ATTRS{product}=="USB <-> Serial", ATTRS{manufacturer}=="FTDI", ATTRS{idVendor}=="0403", NAME="ttyScope"
> 
> With udev 197, this rule stopped working.  Udev does continue to match the device correctly: changing NAME to SYMLINK results in a symlink being created.  But udev won't rename the device.  It just won't do it.  I will not abide this.  THIS CAN NOT STAND!!!!!!!!!!!!!
> ...

 

DRIVERS=="usb" looks wrong. I'm not sure about using SUBSYSTEMS=="usb" either. Try something like this?

SUBSYSTEMS=="usb-serial", ATTRS{manufacturer}=="FTDI", ATTRS{idVendor}=="0403", NAME="ttyScope"

----------

## brainsalad

 *ssuominen wrote:*   

> 
> 
> DRIVERS=="usb" looks wrong. I'm not sure about using SUBSYSTEMS=="usb" either. Try something like this?
> 
> SUBSYSTEMS=="usb-serial", ATTRS{manufacturer}=="FTDI", ATTRS{idVendor}=="0403", NAME="ttyScope"

 

Thanks; I tried that line and some variations.  With SUBSYSTEMS=="usb" and SYMLINK+="ttyScope" a symlink is created.

Along the way, I finally spotted a key bit of info in dmesg:

```
[ 3654.304317] udevd[21230]: NAME="ttyScope" ignored, kernel device nodes can not be renamed; please fix it in /etc/udev/rules.d/99-scope-and-lightbox-serial-interfaces.rules:8
```

Ah ha!  "Kernel device nodes can not be renamed," eh?  Ok, udev.  Let's trust but verify:

```
# ls -l /dev/ttyUSB0

crw-rw---- 1 root uucp 188, 0 Mar  7 11:09 /dev/ttyUSB0

# mv -v /dev/ttyUSB0 /dev/ttyScope

‘/dev/ttyUSB0’ -> ‘/dev/ttyScope’

# ls -l /dev/ttyUSB0

ls: cannot access /dev/ttyUSB0: No such file or directory

# ls -l /dev/ttyScope

crw-rw---- 1 root uucp 188, 0 Mar  7 11:09 /dev/ttyScope

# screen /dev/ttyScope 9600

45 45 45 11 16  (it works)
```

Udev lied to me.  Udev is a fascist and won't let me do what I want because it thinks it knows better.  Udev's source code is getting PATCHED to remove this scumbag restriction.

----------

## SamuliSuominen

Is there something wrong with symlinking it, instead of moving it? It sounds better to me. The symlink, that is.

----------

## VoidMage

First of all, this is really old news (pre-systemd merge, IIRC).

Also, most likely that restriction was put for a good reason - most likely to prevent races.

----------

