Difference between revisions of "Devnodes"
(Created page with '= Exporting devices through devnodes = You can export devices from the Hardware Node (HN) to the container (CT) by using the devnodes flag: <pre> $ vzctl set 1024 --devnodes tt…') |
(added category) |
||
(5 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
= Exporting devices through devnodes = | = Exporting devices through devnodes = | ||
− | You can export devices from the Hardware Node (HN) to the container (CT) by using the devnodes flag: | + | You can export devices from the Hardware Node (HN) to the container (CT) by using the devnodes flag, here for example for a serial port adaptor (/dev/ttyUSB0): |
<pre> | <pre> | ||
$ vzctl set 1024 --devnodes ttyUSB0:rw --save | $ vzctl set 1024 --devnodes ttyUSB0:rw --save | ||
</pre> | </pre> | ||
+ | |||
+ | <pre> | ||
+ | # vzctl enter 1024 | ||
+ | entered into CT 1024 | ||
+ | root@1024 / [1]# screen /dev/ttyUSB0 57600 8N1 | ||
+ | [detached from 17017.pts-0.1024] | ||
+ | root@1024 / [2]# ls -al /dev/ttyUSB0 | ||
+ | crw-r----- 1 root root 188, 0 Apr 17 15:36 /dev/ttyUSB0 | ||
+ | </pre> | ||
+ | |||
+ | If you remove suddenly the device, vzctl will complain and continue: | ||
+ | |||
+ | <pre> | ||
+ | # vzctl enter 1024 | ||
+ | Incorrect device name /dev/ttyUSB0: No such file or directory | ||
+ | Invalid value for DEVNODES=ttyUSB0:rw, skipped | ||
+ | entered into CT 1024 | ||
+ | root@1024 / [1]# | ||
+ | </pre> | ||
+ | |||
+ | Inside the container, you can set a different owner than root, thereby regulating internal access privileges possibly differently from the host system. | ||
+ | |||
+ | = List of successfull exported devices = | ||
+ | |||
+ | * /dev/ttyUSB0 | ||
+ | * /dev/i2c-* (tested through i2c-parport) | ||
+ | * /dev/net/tun | ||
+ | |||
+ | [[Category:HOWTO]] |
Latest revision as of 06:31, 7 June 2015
Exporting devices through devnodes[edit]
You can export devices from the Hardware Node (HN) to the container (CT) by using the devnodes flag, here for example for a serial port adaptor (/dev/ttyUSB0):
$ vzctl set 1024 --devnodes ttyUSB0:rw --save
# vzctl enter 1024 entered into CT 1024 root@1024 / [1]# screen /dev/ttyUSB0 57600 8N1 [detached from 17017.pts-0.1024] root@1024 / [2]# ls -al /dev/ttyUSB0 crw-r----- 1 root root 188, 0 Apr 17 15:36 /dev/ttyUSB0
If you remove suddenly the device, vzctl will complain and continue:
# vzctl enter 1024 Incorrect device name /dev/ttyUSB0: No such file or directory Invalid value for DEVNODES=ttyUSB0:rw, skipped entered into CT 1024 root@1024 / [1]#
Inside the container, you can set a different owner than root, thereby regulating internal access privileges possibly differently from the host system.
List of successfull exported devices[edit]
- /dev/ttyUSB0
- /dev/i2c-* (tested through i2c-parport)
- /dev/net/tun