Persistant USB names

Hi guys,

I’m running a raspberry pi 3 with hassio and two connected devices, a MySensors gateway and a Aeotec Z-Wave gateway. Both are connected to USB. Whenever the pi boots the names of the two USB devices are arbitrarily ttyUSB0 and ttyUSB1.

In regular Linux (at least in ubuntu) it is possible to set up udev rules to ensure that each device gets you same device name every time. This makes the whole system set and forget since any poem corruption will see the thing boots and restore operation when the power returns. How it is now, however, is that there is a very good chance that the two device names have been swapped upon boot which means that nothing will work.

Is there a way to do something similar to the udev rules on the hassio platform?

Or is the only solution to revert back to raspbian and install hass the old-fashioned way?

Having the same trouble… :frowning_face:

I chickened out and solved it by dumping hassio, installing rasping, and using the all in one installer to get it running again. I could then use the use udev rules.

TBH I don’t blame you, I’m now a big fan of the docker setup (after being talked into taking a look at it). But this is a real showstopper. It kind of defeats the purpose of one-click update etc. I just pressed hassio’s update button and when it fired up again, I lost my Z-Stick to a different device name.

1 Like

What I did was ssh to the host and ran ls -al /dev/serial/by-id. That will list all of your serial devices and their symlinks to the /dev/tty* device. Just update your Home Assistant config to point to the correct device using /dev/serial/by-id/DEVICENAME and you should be good to go.

12 Likes

:+1: that’s it. Thank you for your help. Very much appreciated!

2 Likes

This is the manual fix but how to create a udev rule on a read-only filesystem to make it stick?

You see if i run ls -al /dev/serial/by-id then it just says

core-ssh:~# ls -al /dev/serial/by-id
ls: /dev/serial/by-id: No such file or directory

I am SSH in as root.
do i need to navigate to another folder before running this? or am i missing something?

I actually dont have the serial folder in /dev

core-ssh:/dev# ls
char     init     null     random   stdin    urandom
fd       kmsg     ptmx     shm      stdout   zero
full     mqueue   pts      stderr   tty

You have to ssh to the hassio host OS, not the ssh addon. Refer to https://home-assistant.io/developers/hassio/debugging/ for instructions.

Lol dammit. ok that makes sense now. i did wonder why i would be seeing something different to everyone else.

Is there a specific type of key i should be generating. I ahve created a ssh-1 RSA key. uploaded it and using the private key through putty i cannot login. gives me an error “disconnected no supported authentication methods available”

I got it finally.

if you save the public key from puttygen then the file has lines in it. which doesnt work. if you copy and paste the key into the file on one line then it works.

ill make a video at some point soon to explain it all in case anyone needs it in the future.

Been playing with hassbian for awhile, just switch to hass.io. I did have my zwave running on /dev/ttyACM0 and now it is /dev/ttyACM1.

I was trying to get rid of my zwave Linear garage door. Got tired of the barrier issue and wanted to play with OpenGarage. After removing the node and it kept showing in configuration, I restarted HASS. When it came back up the zwave did not configure. It did not configure because now it is showing as ACM1 instead of ACM0. I found the ACM1 by following instructions on locating the zwave controller with Hass.io. Is this expected.
While running hassbain I did use udev to add a rule to make it /dev/zwave.
Reading down this thread I saw where it looks like you can do the same by using the host ssh to get around docker. Is this correct?

I have made this an issue on github.
https://github.com/home-assistant/hassio/issues/261
I have the same trouble with a DSMR and RFXTRX. I believe this breaks all installations that have more that 2 or more devices that use ttyUSBX.

Thanks for filing it. It is very annoying. I too would like to see this fixed.

1 Like

Having issues where usb zwave stick changes from ACM0 to ACM1 on reboot.

If I follow you correctly, with the “ls -al /dev/serial/by-id” output as below, would my config then be “/dev/serial/by-id/usb-0658_0200-if00”?

drwxr-xr-x 2 root root 60 Feb  8 23:08 .
drwxr-xr-x 4 root root 80 Feb  8 23:08 ..
lrwxrwxrwx 1 root root 13 Feb  8 23:08 usb-0658_0200-if00 -> ../../ttyACM0

I’m sorry but running hass.io you can’t run this command in the docker.

1 Like

I’m running HASSBIAN, and “/dev/serial/by-id/usb-0658_0200-if00” seems to do the job, after multiple reboots, zwave still functional.

Thanks

I updated from 0.66 to 0.68 and now /dev/serial/by-id/foo doesn’t work any more anybody else has the problem? I also opened an issue under:

https://github.com/home-assistant/hassio/issues/456

Still working for me with 0.68.1 on a PI 3B.

Okay, than maybe it’s due to a change und docker itself. Thx for the info