# [Freenas] Rename usb serial device in jail



## Artix (Dec 15, 2017)

Hello,

I use a jail on freenas 11.1-STABLE for home automation (home-assistant)

I have 2 serial usb device used on this jail and i'm having problem with naming.

This two device are named /dev/cuaU[0-1] but i'm not able to persist the name between restart or disconnect of the device.

I tried to investigate devd rules and it work nicely in the freenas system.

in file /dev/devd/zstick.conf


```
attach 1000 {
        match "vendor" "0x0658";
        match "product" "0x0200";
        action "ln -sf /dev/cua$ttyname /dev/zstick";
};

notify 1000 {
  match "subsystem" "DEVICE";
  match "type" "DETACH";
  match "vendor" "0x0658";
  match "product" "0x0200";
  action "rm /dev/zstick";
};
```
In the jail I tried the following solution :

In jail /dev/devd/zstick.conf --> Cannot do this in the jail because devd is not running.
In freenas /dev/devfs.rules unhide zstick --> not working, /dev/zstick is only a symbolic link so devfs won't mount it in the jail
Only dirty solution i see is create a symbolic link from freenas devd

```
/mnt/tank/jails/home_assistant/dev/zstick -> /mnt/tank/jails/home_assistant/dev/cuaU*
```

Is there a way to make devfs know about /dev/zstick and make the unhide thing work ?

Another less dirty solution ?

Thanks for your help !


----------



## SirDice (Dec 15, 2017)

Artix said:


> I use a jail on FreeNAS


PC-BSD, FreeNAS, NAS4Free, and all other FreeBSD Derivatives


----------



## Artix (Dec 15, 2017)

SirDice said:


> PC-BSD, FreeNAS, NAS4Free, and all other FreeBSD Derivatives


Hello,

Didn't mean to post on the wrong forum.

I search for this question for 2 days now, and all my search have lead to post in the freebsd forum.

Thought it was a freebsd question more than a freenas one.

Edited my post title and I will post on freenas forum.


----------



## SirDice (Dec 15, 2017)

Yeah, ask there first. If you get nowhere there it's fine if you come back to this one. The "problem" is that FreeNAS is heavily modified and customized, what would work on FreeBSD may not work on FreeNAS. Because some things are set up quite differently.


----------



## fornost (Jan 22, 2020)

I think this is actually a quite good question in relation to stock FreeBSD. I'm trying to achieve exactly the same goal on 12.1: I have a specific USB device which I would like to: a) give a fixed name so that userland would see it under the same name regardless of other USB devices plugged in or removed and b) make this (and only this) USB device available in a jail. So far I couldn't get any further than Artix and it looks like there's no clean solution to this problem.

Artix' post on FreeNAS forum has no solutions either.

I'll greatly appreciate any ideas.
Thank you!


----------

