Proxmox/Alternative.md

51 lines
2.6 KiB
Markdown
Raw Normal View History

2021-08-23 11:25:49 +02:00
## Zigbee2MQTT Device Pass Through ##
2021-08-20 01:36:21 +02:00
2021-08-12 18:30:57 +02:00
**Alternative method to pass devices to LXC:**
2021-08-23 01:14:33 +02:00
2021-08-23 11:20:04 +02:00
In the Proxmox web shell run (replace `105` with your zigbee2mqtt lxc Id)
2021-08-12 18:30:57 +02:00
```
2021-08-23 01:14:12 +02:00
nano /etc/pve/lxc/105.conf
2021-08-12 18:30:57 +02:00
```
2021-08-23 01:14:12 +02:00
replace the last 4 lines
```
lxc.cgroup2.devices.allow: c 188:* rwm
2021-08-23 01:17:59 +02:00
lxc.mount.entry: /dev/serial/by-id dev/serial/by-id none bind,optional,create=dir
2021-08-23 01:14:12 +02:00
lxc.mount.entry: /dev/ttyUSB0 dev/ttyUSB0 none bind,optional,create=file
lxc.mount.entry: /dev/ttyACM0 dev/ttyACM0 none bind,optional,create=file
```
2021-08-23 01:21:44 +02:00
with these 4 lines (change `cgroup2` to `cgroup` for PVE6)
2021-08-23 01:14:12 +02:00
```
lxc.cgroup2.devices.allow: a
lxc.cap.drop:
lxc.autodev: 1
lxc.hook.autodev: bash -c 'for char_dev in $(find /sys/dev/char -regextype sed -regex ".*/1:1" -o -regex ".*/4:\([3-9]\|[1-5][0-9]\|6[0-3]\)" -o -regex ".*/4:\(6[4-9]\|[7-9][0-9]\|1[0-9][0-9]\|2[0-4][0-9]\|25[0-5]\)" -o -regex ".*/10:200" -o -regex ".*/116:.*" -o -regex ".*/166:.*" -o -regex ".*/180:\([0-9]\|1[0-5]\)" -o -regex ".*/188:.*" -o -regex ".*/189:.*" -o -regex ".*/24[0-2]:.*"); do dev="/dev/$(sed -n "/DEVNAME/ s/^.*=\(.*\)$/\1/p" ${char_dev}/uevent)"; mkdir -p $(dirname ${LXC_ROOTFS_MOUNT}${dev}); for link in $(udevadm info --query=property $dev | sed -n "s/DEVLINKS=//p"); do mkdir -p ${LXC_ROOTFS_MOUNT}$(dirname $link); cp -dpR $link ${LXC_ROOTFS_MOUNT}${link}; done; cp -dpR $dev ${LXC_ROOTFS_MOUNT}${dev};done;'
```
2021-08-23 01:40:27 +02:00
Save and exit the editor with "Ctrl+O", "Enter" and "Ctrl+X"
2021-08-23 01:14:12 +02:00
Reboot the LXC
2021-08-13 03:12:08 +02:00
________________________________________________________________________________________________________________________________________
2021-08-23 11:20:04 +02:00
## ZHA Device Pass Through ##
In the Proxmox web shell run (replace `105` with your home assistant container lxc Id)
```
nano /etc/pve/lxc/105.conf
```
2021-08-23 11:41:48 +02:00
add these 2 lines to the bottom
2021-08-23 11:20:04 +02:00
```
lxc.autodev: 1
lxc.hook.autodev: bash -c 'for char_dev in $(find /sys/dev/char -regextype sed -regex ".*/1:1" -o -regex ".*/4:\([3-9]\|[1-5][0-9]\|6[0-3]\)" -o -regex ".*/4:\(6[4-9]\|[7-9][0-9]\|1[0-9][0-9]\|2[0-4][0-9]\|25[0-5]\)" -o -regex ".*/10:200" -o -regex ".*/116:.*" -o -regex ".*/166:.*" -o -regex ".*/180:\([0-9]\|1[0-5]\)" -o -regex ".*/188:.*" -o -regex ".*/189:.*" -o -regex ".*/24[0-2]:.*"); do dev="/dev/$(sed -n "/DEVNAME/ s/^.*=\(.*\)$/\1/p" ${char_dev}/uevent)"; mkdir -p $(dirname ${LXC_ROOTFS_MOUNT}${dev}); for link in $(udevadm info --query=property $dev | sed -n "s/DEVLINKS=//p"); do mkdir -p ${LXC_ROOTFS_MOUNT}$(dirname $link); cp -dpR $link ${LXC_ROOTFS_MOUNT}${link}; done; cp -dpR $dev ${LXC_ROOTFS_MOUNT}${dev};done;'
```
Save and exit the editor with "Ctrl+O", "Enter" and "Ctrl+X"
Reboot the LXC