#lxc conf for SkyConnect - solved

1 messages · Page 1 of 1 (latest)

atomic thunder
#
arch: amd64
cores: 4
features: fuse=1,mount=nfs
hostname: lifthouse
memory: 6096
nameserver: 10.15.15.57 10.15.15.59 10.15.9.1
net0: name=eth0,bridge=vmbr0,gw=10.15.9.1,hwaddr=7E:35:35:8B:D4:4B,ip=10.15.9.30/24,ip6=dhcp,tag=2,type=veth
onboot: 1
ostype: ubuntu
rootfs: local:103/vm-103-disk-0.raw,size=50G
searchdomain: dzsec.net
startup: order=3,up=300
swap: 6096
lxc.cgroup.devices.allow: c 189,* rwm
lxc.mount.entry: /dev/bus/usb/003/004 dev/bus/usb/003/004 none  bind,optional,create=file
lxc.mount.entry: /dev/bus/usb/001/007 dev/bus/usb/001/020 none bind,optional,create=file
lxc.mount.entry: /dev/serial/by-id/usb-Nabu_Casa_SkyConnect_v1.0_e0917b89c15aed1193d3ed165820eef3-if00-port0  dev/serial/by-id/usb-Nabu_Casa_SkyConnect_v1.0_e0917b89c15aed1193d3ed165820eef3-if00-port0 none bind,optional,create=dir lxc.mount.entry: /dev/ttyUSB0 dev/ttyUSB0 none bind,optional,create=file
~
#

I can see the device in the LXC now: ls /dev/serial/by-id/usb-Nabu_Casa_SkyConnect_v1.0_e0917b89c15aed1193d3ed165820eef3-if00-port0

#

but the sky connect is still not detected

#

lots of googling suggests that people have it working in a VM but not LXC

round drum
#

Why is it dir? /dev/serial/by-id/usb-Nabu_Casa_SkyConnect_v1.0_e0917b89c15aed1193d3ed165820eef3-if00-port0 is a symlink

atomic thunder
#

good catch... should be file, right ?

round drum
#

Yep

atomic thunder
#

testing

round drum
#

If not try the settings from my link. It also mounts the whole /dev/serial/by-id so no need to put anything specific in there

atomic thunder
#

I'll try that next... that felt a little like overkill though, right?

#

although create=file still doesnt work

round drum
#

Yes but you can always dial it back later once you got it working

atomic thunder
#

testing

round drum
atomic thunder
#

yes

#

well, no... it doesnt show up as a tty device, at least not in a recognizable way

round drum
#

What do the commands say?

atomic thunder
#

added the ttyUSB0

#lxc.mount.entry%3A /dev/serial/by-id/usb-Nabu_Casa_SkyConnect_v1.0_e0917b89c15aed1193d3ed165820eef3-if00-port0  dev/serial/by-id/usb-Nabu_Casa_SkyConnect_v1.0_e0917b89c15aed1193d3ed165820eef3-if00-port0 none bind,optional,create=file
arch: amd64
cores: 4
features: fuse=1,mount=nfs
hostname: lifthouse
memory: 6096
nameserver: 10.15.15.57 10.15.15.59 10.15.9.1
net0: name=eth0,bridge=vmbr0,gw=10.15.9.1,hwaddr=7E:35:35:8B:D4:4B,ip=10.15.9.30/24,ip6=dhcp,tag=2,type=veth
onboot: 1
ostype: ubuntu
rootfs: local:103/vm-103-disk-0.raw,size=50G
searchdomain: dzsec.net
startup: order=3,up=300
swap: 6096
lxc.cgroup.devices.allow: c 189,* rwm
lxc.mount.entry: /dev/bus/usb/003/004 dev/bus/usb/003/004 none  bind,optional,create=file
lxc.mount.entry: /dev/bus/usb/001/007 dev/bus/usb/001/020 none bind,optional,create=file
lxc.mount.entry: /dev/serial/by-id  dev/serial/by-id  none bind,optional,create=dir
lxc.mount.entry: /dev/ttyUSB0       dev/ttyUSB0       none bind,optional,create=file
#

bingo! Just showed up!

#

thank you!

#

lxc conf for SkyConnect - solved

#

well... it showed up in HA but then erred "failed to probe USB device"

round drum
#

Also check lsusb -vt and journalctl -b0 -k -g "(tty[0-2]|serial).
It might have something to do with the allow things

atomic thunder
#
╰─○ sudo lsusb -vt
/:  Bus 04.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/2p, 10000M
    ID 1d6b:0003 Linux Foundation 3.0 root hub
/:  Bus 03.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/2p, 480M
    ID 1d6b:0002 Linux Foundation 2.0 root hub
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/2p, 480M
    ID 1d6b:0002 Linux Foundation 2.0 root hub
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/8p, 480M
        ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
        |__ Port 2: Dev 3, If 0, Class=Wireless, Driver=btusb, 12M
            ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
        |__ Port 2: Dev 3, If 1, Class=Wireless, Driver=btusb, 12M
            ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
        |__ Port 2: Dev 3, If 2, Class=Application Specific Interface, Driver=, 12M
            ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/2p, 480M
    ID 1d6b:0002 Linux Foundation 2.0 root hub
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/6p, 480M
        ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
        |__ Port 5: Dev 9, If 0, Class=Vendor Specific Class, Driver=cp210x, 12M
            ID 10c4:ea60 Silicon Labs CP210x UART Bridge
        |__ Port 6: Dev 4, If 0, Class=Hub, Driver=hub/6p, 480M
            ID 413c:a001 Dell Computer Corp. Hub
            |__ Port 5: Dev 6, If 0, Class=Mass Storage, Driver=usb-storage, 480M
                ID 0624:0252 Avocent Corp. Virtual SD card reader
            |__ Port 1: Dev 5, If 2, Class=Human Interface Device, Driver=usbhid, 480M
                ID 0624:0249 Avocent Corp. Virtual Keyboard/Mouse
            |__ Port 1: Dev 5, If 0, Class=Human Interface Device, Driver=usbhid, 480M
                ID 0624:0249 Avocent Corp. Virtual Keyboard/Mouse
            |__ Port 1: Dev 5, If 1, Class=Human Interface Device, Driver=usbhid, 480M
                ID 0624:0249 Avocent Corp. Virtual Keyboard/Mouse
round drum
#

This might not be enough, the right "id" or wrong syntax

lxc.cgroup.devices.allow: c 189,* rwm

Disclaimer, I just started using LXC passthrough yesterday .

atomic thunder
#

that's what I've used successfully with other passthrough devices

round drum
#

Maybe check ls -lR /dev/bus/usb/* on the node. Apparently both 188 and 189 are possibilities. Mine are all 189. Not sure when 188 is chosen.

 188 char    USB serial converters
          0 = /dev/ttyUSB0    First USB serial converter
          1 = /dev/ttyUSB1    Second USB serial converter
            ...

 189 char    USB serial converters - alternate devices
          0 = /dev/cuusb0    Callout device for ttyUSB0
          1 = /dev/cuusb1    Callout device for ttyUSB1
            ...

https://www.kernel.org/doc/Documentation/admin-guide/devices.txt
I haven't seen that comma anywhere in the docs and can't test right now. Testing ZHA at the moment and have no other spare coordinator.

atomic thunder
#

acutally it looks like the little number changed ... it was /d/b/usb/001/007 and now it is ../009

#

ill edit the .conf and retest

#

im a little worried that it will continue to change...

round drum
#

Using /dev/bus shouldn't be necessary. I wouldn't use them

atomic thunder
#

copy that... /dev/serial/by-id prefereable?

round drum
#

/dev/serial/by-id stays the same as such it's preferred over /dev/tty* paths that might change on reboot or re-plug or if you have other serial devices.
If you use /dev/serial/by-id inside the LXC as well you have to change it in two places if you ever change the coordinator. You could mount /dev/serial/by-id to /dev/tty0 or even give it its own name but that might not be detected then. Not sure how HA enumerates/discovers the devices.

atomic thunder
#

still getting Failed to probe the usb device

#

starting to think this might not work in an lxc at all

#

going to test without mapping /dev/bus...

round drum
#

It's possible HA wants to enumerate the device(s) rather than just checking for existence of a device file

#

I'm done with my VM ZHA test now. Will try to reproduce it with HA core in a container now.

atomic thunder
#

on the node, /dev/serial/by-id/nabucasa.... is a link to /dev/ttyusb0

#

on the lxc it is not

atomic thunder
#

going to make sure everything is updated first...

round drum
#

Okay so I created a debian CT with the following

lxc.cgroup2.devices.allow: a
lxc.cap.drop:
lxc.cgroup2.devices.allow: c 188:* rwm
lxc.cgroup2.devices.allow: c 189:* rwm
lxc.mount.entry: /dev/serial/by-id  dev/serial/by-id  none bind,optional,create=dir
lxc.mount.entry: /dev/ttyUSB0       dev/ttyUSB0       none bind,optional,create=file
lxc.mount.entry: /dev/ttyUSB1       dev/ttyUSB1       none bind,optional,create=file
lxc.mount.entry: /dev/ttyACM0       dev/ttyACM0       none bind,optional,create=file
lxc.mount.entry: /dev/ttyACM1       dev/ttyACM1       none bind,optional,create=file

followed the docs here (aside from skipping user creation) and it works: https://www.home-assistant.io/installation/generic-x86-64#install-home-assistant-core
https://i.imgur.com/5fqJm7J.png
It required a chmod 777 /dev/serial/by-id/usb-Texas_Instruments_TI_CC2531_USB_CDC___0X00124B001CD4E4C7-if00 on the node to work.'You might need a udev rule to apply this after reboots and such.
Obviously you have to change it to your SkyConnect one. I'm just using the dreaded CC2531 for testing and sniffing.
Now I got this to work but LXC passthrough is pain, core is pain. I'd use another installation method to be honest.

atomic thunder
#

thank you!

#

chmod didn't change anything... still failed to probe device

round drum
#

I had to reboot the container. I cold booted it. Forgot to mention.

atomic thunder
#

I'm doing full shutdown / boots not just reboots

round drum
#

Well this is what worked for me 🤷
If you share your LXC config and the ls command outputs in the node and container I can look them over

atomic thunder
#

really? where in Proxmox did you find that UI to add a serial to an LXC?

round drum
#

I didn't. That's the ZHA UI in HA. I thought you used ZHA before

atomic thunder
#

ohhhh sorry was looking at the wrong thing

atomic thunder
#

its a permissions issue somewhere... root in the LXC can't access the device

round drum
atomic thunder
#

in the lxc:

╰─○ cat /dcat /dev/ttyUSB0 
cat: /dev/ttyUSB0: Operation not permitted
round drum
#

And the other 4 command outputs?

atomic thunder
#

the ls commands?

round drum
#

Yes. And the config

atomic thunder
#

FWIW I created a udev rule to map the device to /dev/skyconnect to make it easier...

╰─○ ls -l /dev/skyconnect 
crwxrwxrwx 1 root dialout 188, 0 Nov  6 19:32 /dev/skyconnect
╭─root at lifthouse in ~
╰─○ ls -l /dev/ttyUSB0   
crwxrwxrwx 1 root dialout 188, 0 Nov  6 19:32 /dev/ttyUSB0```

config:

arch: amd64
cores: 4
features: fuse=1,mount=nfs
hostname: lifthouse
memory: 6096
nameserver: 10.15.15.57 10.15.15.59 10.15.9.1
net0: name=eth0,bridge=vmbr0,gw=10.15.9.1,hwaddr=7E:35:35:8B:D4:4B,ip=10.15.9.30/24,ip6=dhcp,tag=2,type=veth
onboot: 1
ostype: ubuntu
rootfs: local:103/vm-103-disk-0.raw,size=50G
searchdomain: dzsec.net
startup: order=3,up=300
swap: 6096
lxc.cgroup.devices.allow: c 189,* rwm
lxc.cgroup.devices.allow: c 188,* rwm
lxc.mount.entry: /dev/bus/usb/003/004 dev/bus/usb/003/004 none bind,optional,create=file
lxc.mount.entry: /dev/skyconnect dev/skyconnect none bind,optional,create=file
lxc.mount.entry: /dev/ttyUSB0 dev/ttyUSB0 none bind,optional,create=file

#

echo 'SUBSYSTEM=="tty", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", SYMLINK+="skyconnect"' | tee /etc/udev/rules.d/99-usb-serial.rules

round drum
#

Why not keep it simple for now until it works? Introducing more variables is a bad idea. What about the ls commands of the node itself?

atomic thunder
#

on the host

lrwxrwxrwx 1 root root 7 Nov  6 12:32 /dev/skyconnect -> ttyUSB0
root@rockies:~# ls -l /dev/ttyUSB0
crwxrwxrwx 1 root dialout 188, 0 Nov  6 12:32 /dev/ttyUSB0
root@rockies:~#
atomic thunder
round drum
#

Everything looks okay linux permission wise but try with my LXC config. Interestingly your major is 188 rather than 189

atomic thunder
#

it has changed since we've been testing

#

it was 189

#

trying with yours, noting that you use lxc.cgroup2.devices.allow vs lxc.cgroup.devices.allow

round drum
#

I'm still suspicious of that allow line

#

Yeah I use PVE 8

atomic thunder
#

I do as well

#

well with your version of the config root can at least access the device

#

can so can my HA user

round drum
#

But can ZHA?

atomic thunder
#

testing

#

working so far...

#

I moved back to this:

cores: 4
features: fuse=1,mount=nfs
hostname: lifthouse
memory: 6096
nameserver: 10.15.15.57 10.15.15.59 10.15.9.1
net0: name=eth0,bridge=vmbr0,gw=10.15.9.1,hwaddr=7E:35:35:8B:D4:4B,ip=10.15.9.30/24,ip6=dhcp,tag=2,type=veth
onboot: 1
ostype: ubuntu
rootfs: local:103/vm-103-disk-0.raw,size=50G
searchdomain: dzsec.net
startup: order=3,up=300
swap: 6096
lxc.mount.entry: /dev/ttyUSB0       dev/ttyUSB0       none bind,optional,create=file
lxc.mount.entry: /dev/skyconnect dev/skyconnect none bind,optional,create=file
lxc.cgroup2.devices.allow: a
lxc.cap.drop:
lxc.cgroup2.devices.allow: c 188:* rwm
lxc.cgroup2.devices.allow: c 189:* rwm

just to see... and it seems to work

#

biggest difference is that you have this:

lxc.cap.drop:
lxc.cgroup2.devices.allow: c 188:* rwm
lxc.cgroup2.devices.allow: c 189:* rwm
#

and I was using lxc.cgroup.devices...

round drum
#

I told you to try my config 3~ hours ago and dial back once it works 😄

atomic thunder
#

should have! Thought some of your differences were enviroment-dependent

#

added a few sensors

#

thanks for all the help and patience!