jails Creating a devfs link inside (thin)jail

Hi,
I've set up a thinjail in which I want to run ntpd.
To improve the ntpd accuracy, I want to use a gps receiver with pps.
I managed to pass the /dev/cuau0 device without problems into the jail, but ntpd expects /dev/gps0 to read the gps receivers messages from.
But I can't manage to create the link inside the jail.

My devfs.rules I am using looks like this:
Code:
# cat /etc/devfs.rules 
[devfsrules_jail_ntp=51]
add include $devfsrules_hide_all
add include $devfsrules_unhide_basic
add include $devfsrules_unhide_login
add include $devfsrules_jail
add path pf unhide
add path cuau0 unhide
add path gps0 unhide
add path pps0 unhide

What I tried:
1. Manually creating the link inside the jail:
Code:
# jexec -u root ntp
root@ntp:/ # cd /dev/
root@ntp:/dev # ls
cuau0   fd      null    pf      pts     random  stderr  stdin   stdout  urandom zero    zfs
root@ntp:/dev # ln -s cuau0 gps0
ln: gps0: Operation not permitted

2. Adding the following line to the devfs.rules of the host
Code:
add path cuau0 link gps0 unhide

3. Putting the following in /etc/devfs.conf of the jail:
Code:
link cuau0 gps0

None of these made /dev/gps0 show up in the jail...
What is the correct way to create a devfs link inside a jail?
 
for those devfs rules (numbered 51) to apply to a jail, you have to have devfs_ruleset="51"; in the jail config. configure that on the host and start the jail with that option and you should be golden.

the symlink should just be cosmetic. if you can't get that to apply, tell ntpd to work with cuau0 instead.
 
Thanks for the hint, maybe I should have mentioned that I have configured the ruleset to be applied in the jail config.
cuau0 shows up as expected inside the jail, but the linked gps0 does not (using the ruleset and adding 'link cuau0 gps0' to the devfs.conf inside the jail additionally).

Is it even possible to configure ntpd to use anything else than /dev/gps* ?
To use the gps as time source, I would add
Code:
server 127.127.20.0
to the ntpd config.
I thought ntpd expects /dev/gps0 and don't know any config option to change that.
 
The syntax doesn't require setting the path pattern in single quotes, also, it makes no difference if they are set.

I am testing the issue since yesterday, some linked /dev nodes are not unhidden in the jail, I can't tell why.

Test setup: bhyve VM, host /etc/devfs.conf
Code:
link  cuau0  gps0
Code:
 # service devfs restart

 # ls -l /dev/cuau0  /dev/gps0
crw-rw----  1 uucp dialer 0x38 Mar 30 13:13 /dev/cuau0
lrwxr-xr-x  1 root wheel     5 Mar 30 13:13 /dev/gps0 -> cuau0

Host /etc/devfs.rules
Code:
[devfsrules_jail_ntp=51]
add include $devfsrules_hide_all
add include $devfsrules_unhide_basic
add include $devfsrules_unhide_login
add include $devfsrules_jail
add path 'gps0' unhide

Jail: note unhidden 'gps0' appears as 'cuau0'. Setting add path cuau0 unhide as well to /etc/devfs.rules doesn't change the outcome:
Rich (BB code):
 # ls  -l  /dev
total 1
crw-rw----  1 uucp dialer   0x38 Mar 30 11:13 cuau0
dr-xr-xr-x  2 root wheel     512 Mar 30 11:16 fd
dr-xr-xr-x  2 root wheel     512 Mar 30 11:16 input
crw-rw-rw-  1 root wheel    0x14 Mar 30 11:22 null
crw-r--r--  1 root wheel     0x4 Mar 30 11:13 random
lrwxr-xr-x  1 root wheel       4 Mar 30 11:16 stderr -> fd/2
lrwxr-xr-x  1 root wheel       4 Mar 30 11:16 stdin -> fd/0
lrwxr-xr-x  1 root wheel       4 Mar 30 11:16 stdout -> fd/1
lrwxr-xr-x  1 root wheel       6 Mar 30 11:16 urandom -> random
crw-rw-rw-  1 root wheel    0x15 Mar 30 11:13 zero
crw-rw-rw-  1 root operator 0x4f Mar 30 11:13 zfs
Apparently the linked /dev/gps0 node is not unhidden but the source node /dev/cuau0.

On the other hand, other linked nodes are unhidden like stderr/stdin/stdout/urandom. I don't know which configuration must be set to unhide devfs.conf linked nodes.
 
Back
Top