Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin crash (terminate called after throwing an instance of std::invalid_argument) #12

Closed
lukaszolek opened this issue Feb 9, 2021 · 48 comments

Comments

@lukaszolek
Copy link

I upgraded HA, Supervisor and KNXD to the newest versions and I get following error.

KNXD config:

  • interface: usb
  • address: 0.0.1
  • client_address: 0.0.2:8
  • device: /dev/ttyAMA0
[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 00-banner.sh: executing... 
-----------------------------------------------------------
 Add-on: KNXD daemon
 KNXD daemon you can use to create a KNX/IP gateway via TPUART or USB bus adapters
-----------------------------------------------------------
 Add-on version: 0.3.7
 You are running the latest version of this add-on.
 System: Home Assistant OS 5.11  (armv7 / raspberrypi4)
 Home Assistant Core: 2021.2.1
 Home Assistant Supervisor: 2021.02.5
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
[cont-init.d] 00-banner.sh: exited 0.
[cont-init.d] 01-log-level.sh: executing... 
[cont-init.d] 01-log-level.sh: exited 0.
[cont-init.d] 2-init-config: executing... 
[cont-init.d] 2-init-config: exited 0.
[cont-init.d] done.
[services.d] starting services
terminate called after throwing an instance of 'std::invalid_argument'
  what():  stoi
[services.d] done.
terminate called after throwing an instance of 'std::invalid_argument'
  what():  stoi
terminate called after throwing an instance of 'std::invalid_argument'
  what():  stoi
terminate called after throwing an instance of 'std::invalid_argument'
  what():  stoi
terminate called after throwing an instance of 'std::invalid_argument'
  what():  stoi
terminate called after throwing an instance of 'std::invalid_argument'
  what():  stoi
@da-anda
Copy link
Owner

da-anda commented Feb 9, 2021

well, the knxd version itself did not change between 0.3.6 and 0.3.7, so it can't really be knxd related. I only switched the base image to the new Github container repository hosted ones and fixed a runtime issue because those new base images missed two libs that knxd required.
Still on OS 5.10 myself though, will update to 5.11 later today and see if the issue is showing up on my end as well. Can't reproduce so far though, but I also don't use the USB interface but TPUART.

@da-anda
Copy link
Owner

da-anda commented Feb 9, 2021

hmm, no issues on my end on 5.11. Are you sure your device ttyAMA0 is needing the USB interface? For me this device is TPUART

@lukaszolek
Copy link
Author

You're right, after update I lost my original configuration and needed to recreate it. I had problems with "device" parameter earlier, and I found that I needed to leave it empty to start working: https://community.home-assistant.io/t/knxd-add-on-covert-your-knx-usb-interface-into-an-ip-interface-that-can-be-used-by-ha/38108/35

Now I updated it as before, however it still throws errors:

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 00-banner.sh: executing... 
-----------------------------------------------------------
 Add-on: KNXD daemon
 KNXD daemon you can use to create a KNX/IP gateway via TPUART or USB bus adapters
-----------------------------------------------------------
 Add-on version: 0.3.7
 You are running the latest version of this add-on.
 System: Home Assistant OS 5.11  (armv7 / raspberrypi4)
 Home Assistant Core: 2021.2.2
 Home Assistant Supervisor: 2021.02.6
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
[cont-init.d] 00-banner.sh: exited 0.
[cont-init.d] 01-log-level.sh: executing... 
[cont-init.d] 01-log-level.sh: exited 0.
[cont-init.d] 2-init-config: executing... 
[cont-init.d] 2-init-config: exited 0.
[cont-init.d] done.
[services.d] starting services
libusb: error [get_usbfs_fd] libusb couldn't open USB device /dev/bus/usb/001/003, errno=1
[services.d] done.

@da-anda
Copy link
Owner

da-anda commented Feb 9, 2021

is /dev/bus/usb/001/003 actually the correct device? Please check in the supervisor hardware info which of the USB devices reported there is the correct one for you and then enter this device path in the config. It's quite likely that due to the OS and supervisor changes the devices reported to the containers changed and knxd now has difficulties to find the correct one

@lukaszolek
Copy link
Author

Thanks for the hint - I did't know where to check it. However, it seems that the address is correct:

  - name: 1-1.3
    sysfs: >-
      /sys/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.3
    dev_path: /dev/bus/usb/001/003
    subsystem: usb
    by_id: null
    attributes:
      BUSNUM: '001'
      DEVNAME: /dev/bus/usb/001/003
      DEVNUM: '003'
      DEVPATH: >-
        /devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.3
      DEVTYPE: usb_device
      DRIVER: usb
      ID_BUS: usb
      ID_FOR_SEAT: usb-platform-fd500000_pcie-pci-0000_01_00_0-usb-0_1_3
      ID_MODEL: KNX-USB_Data_Interface
      ID_MODEL_ENC: KNX-USB\x20Data\x20Interface
      ID_MODEL_ID: '0022'
      ID_PATH: 'platform-fd500000.pcie-pci-0000:01:00.0-usb-0:1.3'
      ID_PATH_TAG: platform-fd500000_pcie-pci-0000_01_00_0-usb-0_1_3
      ID_REVISION: '0102'
      ID_SERIAL: Gira_Giersiepen_GmbH___Co._KG_KNX-USB_Data_Interface
      ID_USB_INTERFACES: ':030000:'
      ID_VENDOR: Gira_Giersiepen_GmbH___Co._KG
      ID_VENDOR_ENC: Gira\x20Giersiepen\x20GmbH\x20\x26\x20Co.\x20KG
      ID_VENDOR_ID: 135e
      MAJOR: '189'
      MINOR: '2'
      PRODUCT: 135e/22/102
      SUBSYSTEM: usb
      TAGS: ':seat:'
      TYPE: 0/0/0
      USEC_INITIALIZED: '2323226'

@da-anda
Copy link
Owner

da-anda commented Feb 9, 2021

great, my interface now also craps out as it terminates the connection every couple seconds

@da-anda
Copy link
Owner

da-anda commented Feb 9, 2021

ok, I had accidentally selected the wrong device on my end. So it's still working fine on my end.

Sorry, but no idea what's wrong for you. It could be related to the recent supervisor changes and how they forward devices to containers/add-ons. But no idea how to test/fix this since I don't own a KNX USB-interface, only an UART one, so I can't test anything here. Debugging of the issue would have to be done by someone with such a device.

@da-anda
Copy link
Owner

da-anda commented Feb 9, 2021

since I am flying blindfolded I can only do some guesses. A dev from the HA addon_dev discord mentioned that the add-on might need udev now, which I added. If you want you can check out this branch https://github.com/da-anda/hass-io-addons/tree/test to the /addons share of your RPI and give it a try.

@lukaszolek
Copy link
Author

Is it possible to add it with the Supervisor?

@da-anda
Copy link
Owner

da-anda commented Feb 9, 2021

if you do what I said, then yes, it will show up in the supervisor as local add-on. You will see it twice then, once locally from your device and once from my Github repo, so don't be confused.

@lukaszolek
Copy link
Author

I can see a local addon, however after clicking "Install", it starts spinning, but install does not finish.
Where can I find detailed logs of knxd addon?

@mariwing
Copy link

mariwing commented Feb 9, 2021

I have same USB error and same usb address reported by the supervisor.

  - name: 1-1.1
    sysfs: >-
      /sys/devices/platform/soc/ffe09000.usb/ff500000.usb/xhci-hcd.0.auto/usb1/1-1/1-1.1
    dev_path: /dev/bus/usb/001/003
    subsystem: usb
    by_id: null
    attributes:
      BUSNUM: '001'
      DEVNAME: /dev/bus/usb/001/003
      DEVNUM: '003'
      DEVPATH: >-
        /devices/platform/soc/ffe09000.usb/ff500000.usb/xhci-hcd.0.auto/usb1/1-1/1-1.1
      DEVTYPE: usb_device
      DRIVER: usb
      ID_BUS: usb
      ID_MODEL: KNX-USB_Data_Interface
      ID_MODEL_ENC: KNX-USB\x20Data\x20Interface
      ID_MODEL_ID: '0024'
      ID_REVISION: '0101'
      ID_SERIAL: 135e_KNX-USB_Data_Interface
      ID_USB_INTERFACES: ':030000:'
      ID_VENDOR: 135e
      ID_VENDOR_ENC: 135e
      ID_VENDOR_ID: 135e
      MAJOR: '189'
      MINOR: '2'
      PRODUCT: 135e/24/101
      SUBSYSTEM: usb
      TYPE: 0/0/0
      USEC_INITIALIZED: '785999796854'

Running https://github.com/da-anda/hass-io-addons/tree/test as a local addon instead of the error message from #12 (comment) I get this:

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 00-banner.sh: executing... 
-----------------------------------------------------------
 Add-on: KNXD daemon
 KNXD daemon you can use to create a KNX/IP gateway via TPUART or USB bus adapters
-----------------------------------------------------------
 Add-on version: 0.3.7
 You are running the latest version of this add-on.
 System: Home Assistant OS 5.11  (aarch64 / odroid-n2)
 Home Assistant Core: 2021.2.2
 Home Assistant Supervisor: 2021.02.6
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
[cont-init.d] 00-banner.sh: exited 0.
[cont-init.d] 01-log-level.sh: executing... 
[cont-init.d] 01-log-level.sh: exited 0.
[cont-init.d] 2-init-config: executing... 
exec: fatal: unable to exec bash
: No such file or directory
[cont-init.d] 2-init-config: exited 127.
[cont-finish.d] executing container finish scripts...
[cont-finish.d] 99-message.sh: executing... 
-----------------------------------------------------------
                Oops! Something went wrong.

 We are so sorry, but something went terribly wrong when
 starting or running this add-on.
 
 Be sure to check the log above, line by line, for hints.
-----------------------------------------------------------
[cont-finish.d] 99-message.sh: exited 0.
[cont-finish.d] done.
[s6-finish] waiting for services.
[s6-finish] sending all processes the TERM signal.

Thank your for working on this, I really hope you can get it fixed. I can test more if you have any more ideas.

@da-anda
Copy link
Owner

da-anda commented Feb 9, 2021

so a dev over at the HA discord did a change to the supervisor which might fix the issue, but no guarantee. So please give it a try with the just released supervisor 2021.02.7

edit: for this you will have to join the beta channel of the supervisor

@da-anda
Copy link
Owner

da-anda commented Feb 9, 2021

I can see a local addon, however after clicking "Install", it starts spinning, but install does not finish.
Where can I find detailed logs of knxd addon?

it will take quite some time, because it has to compile everything. I might look into pre-building the container at some point, but cross compiling is still out of my league. I'm no linux expert and all I do is searching the web for answers and hope things work out.

edit: logs about the installation process of any add-on can be found in the supervisor logs. So go to supervisor -> system and scroll down to the logs. Start and finish of an installation will be shown there, also any errors that might have occured. But as said, the installation can take some time since it will be compiled.

@da-anda
Copy link
Owner

da-anda commented Feb 9, 2021

@mariwing your second log shows the add-on version 0.3.7 while the one in the test branch is 0.3.8. No idea what went wrong on your end there.

@mariwing
Copy link

mariwing commented Feb 9, 2021

I know what happened, forgot to checkout test branch. Sorry about that! Here is the (very similar) log for 0.3.8

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 00-banner.sh: executing... 
-----------------------------------------------------------
 Add-on: KNXD daemon
 KNXD daemon you can use to create a KNX/IP gateway via TPUART or USB bus adapters
-----------------------------------------------------------
 Add-on version: 0.3.8
 You are running the latest version of this add-on.
 System: Home Assistant OS 5.11  (aarch64 / odroid-n2)
 Home Assistant Core: 2021.2.2
 Home Assistant Supervisor: 2021.02.6
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
[cont-init.d] 00-banner.sh: exited 0.
[cont-init.d] 01-log-level.sh: executing... 
[cont-init.d] 01-log-level.sh: exited 0.
[cont-init.d] 2-init-config: executing... 
exec: fatal: unable to exec bash
: No such file or directory
[cont-init.d] 2-init-config: exited 127.
[cont-finish.d] executing container finish scripts...
[cont-finish.d] 99-message.sh: executing... 
-----------------------------------------------------------
                Oops! Something went wrong.

 We are so sorry, but something went terribly wrong when
 starting or running this add-on.
 
 Be sure to check the log above, line by line, for hints.
-----------------------------------------------------------
[cont-finish.d] 99-message.sh: exited 0.
[cont-finish.d] done.
[s6-finish] waiting for services.
[s6-finish] sending all processes the TERM signal.

With regards to the supervisor beta mentioned; do you think I should test this with this version of the addon or the 0.3.7 version?

By the way; nice with the new device selector dropdown on this 0.3.8 version!

@lukaszolek
Copy link
Author

@da-anda Thank you for your efforts!

Unfortunately, the 0.3.8 from the test branch still throws errors:

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 00-banner.sh: executing... 
-----------------------------------------------------------
 Add-on: KNXD daemon
 KNXD daemon you can use to create a KNX/IP gateway via TPUART or USB bus adapters
-----------------------------------------------------------
 Add-on version: 0.3.8
 You are running the latest version of this add-on.
 System: Home Assistant OS 5.11  (armv7 / raspberrypi4)
 Home Assistant Core: 2021.2.2
 Home Assistant Supervisor: 2021.02.6
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
[cont-init.d] 00-banner.sh: exited 0.
[cont-init.d] 01-log-level.sh: executing... 
[cont-init.d] 01-log-level.sh: exited 0.
[cont-init.d] 2-init-config: executing... 
[cont-init.d] 2-init-config: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
terminate called after throwing an instance of 'std::invalid_argument'
  what():  stoi
terminate called after throwing an instance of 'std::invalid_argument'
  what():  stoi

@mariwing
Copy link

mariwing commented Feb 9, 2021

Hello again and thank you for continous support.

I went ahead and upgraded to superviso 2020.02.7. Still the same error unfortunately:

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 00-banner.sh: executing... 
-----------------------------------------------------------
 Add-on: KNXD daemon
 KNXD daemon you can use to create a KNX/IP gateway via TPUART or USB bus adapters
-----------------------------------------------------------
 Add-on version: 0.3.8
 You are running the latest version of this add-on.
 System: Home Assistant OS 5.11  (aarch64 / odroid-n2)
 Home Assistant Core: 2021.2.2
 Home Assistant Supervisor: 2021.02.7
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
[cont-init.d] 00-banner.sh: exited 0.
[cont-init.d] 01-log-level.sh: executing... 
[cont-init.d] 01-log-level.sh: exited 0.
[cont-init.d] 2-init-config: executing... 
exec: fatal: unable to exec bash
: No such file or directory
[cont-init.d] 2-init-config: exited 127.
[cont-finish.d] executing container finish scripts...
[cont-finish.d] 99-message.sh: executing... 
-----------------------------------------------------------
                Oops! Something went wrong.

 We are so sorry, but something went terribly wrong when
 starting or running this add-on.
 
 Be sure to check the log above, line by line, for hints.
-----------------------------------------------------------
[cont-finish.d] 99-message.sh: exited 0.
[cont-finish.d] done.
[s6-finish] waiting for services.
[s6-finish] sending all processes the TERM signal.

@da-anda
Copy link
Owner

da-anda commented Feb 9, 2021

@lukaszolek you likely selected the wrong device there, like ttyAMA0 or so, which is wrong in your case. 0.3.8 uses the device selector option now, so it should be easier for you to find the correct one. (I unfortunately can't limit it to only devices that make sense since it could either list USB or tty devices, but never both when I apply restrictions)

@mariwing quite odd. It seems to have issues writing the config file. Do you by any chance have any custom config applied which might have been messed up by the new settings UI? Other then that, I'm kinda out of ideas.

As for the supervisor - it should not matter which version you test with the new supervisor version (which appears to be in public release now)

@lukaszolek
Copy link
Author

@da-anda, my config looks like:
image

@da-anda
Copy link
Owner

da-anda commented Feb 9, 2021

@lukaszolek ok, odd. I had the very same error message when I had used the wrong interface, which is why suspected it might be wrong. Out of ideas now, sorry. But hey, at least one step further on your end

@mariwing argh, had hoped 2021.2.7 would have fixed it. Please check your config (probably best in RAW mode) to see if the UI mode messed something up. If not, then I'm also out of ideas in your case

@mariwing
Copy link

mariwing commented Feb 9, 2021

@mariwing argh, had hoped 2021.2.7 would have fixed it. Please check your config (probably best in RAW mode) to see if the UI mode messed something up. If not, then I'm also out of ideas in your case

Sorry for my ignorance, but could you point me in the right directon how to access this file? I assume it is inside the container and I don't know how to access that unfortunately

@da-anda
Copy link
Owner

da-anda commented Feb 9, 2021

no, in the add-on config of the supervisor management panel you can switch between UI and RAW yaml mode (use the dotted menu indicator on the right side of the config options panel).

Once your container is booting again (which it currently likely doesn't due to the error during startup) you can SSH into the container by doing the following:

  • first SSH into the OS (not a SSH add-on)
  • then exit the automatically started HomeAssistant console by writing login
  • once on bash of the actual OS, you can go into the container via docker exec -it addon_local_knxd /bin/bash (this is the command to go into the local addon version, not the one from my repository since that has a different name)
  • you are now inside the container and your bash prompt prefix should have changed from just # to root@local-knxd:/$
  • inside the container you can see the content of the generate config file via cat /etc/knxd.ini

@mariwing
Copy link

mariwing commented Feb 9, 2021

I see, now I learned a lot of new stuff today. The raw view looks ok to me, so I don't think I have any hint on what to do next (since the container don't start). For now I have reinstated my old Pi3 knxd gateway and I will keep an eye on this addon and retry it down the road.

Thank you for your patience in explaing and trying to help 👍

@da-anda
Copy link
Owner

da-anda commented Feb 10, 2021

@lukaszolek could it be an issues with the new kernel that the latest HAOS update brought? Could you maybe test downgrading the OS to the previous version and see if the issue is gone?

@lukaszolek
Copy link
Author

@da-anda it would be difficult for me to make a downgrade right now, however I'm sure it could be with the latest HAOS, because knxd stopped working right after the upgrade I've made.

@da-anda
Copy link
Owner

da-anda commented Feb 10, 2021

to rule out an issue with the switch from the dockerhub based add-on base-images to the new ones on github CR, you could try to install the old 0.3.6 version of the add-on locally. If this one also doesn't work, we at least know it's not related to a change I made.

@da-anda
Copy link
Owner

da-anda commented Feb 10, 2021

also, if you want, you could try to SSH into the add-on container like described above and check the generated config in /etc/knxd.ini. Once inside the container you could also try to give your USB device global write permissions to see if that might help.

@lukaszolek
Copy link
Author

This is my /etc/knxd.ini from the addon_local_knxd container:

[main]
addr = 0.0.1
client-addrs = 0.0.2:8
connections = server,A.tcp,interface
logfile = /dev/stdout

[A.tcp]
server = knxd_tcp

[server]
server = ets_router
tunnel = tunnel
router = router
discover = true
name = knxd

[interface]
driver = usb
device = /dev/bus/usb/001/003

send-timeout = 3000
filters = 

Trying to give write permissions:

root@local-knxd:/$ ls /dev/bus/usb/001/003 -la
crw-rw-r--    1 root     root      189,   2 Dec 16 18:25 /dev/bus/usb/001/003
root@local-knxd:/$ chmod a+w /dev/bus/usb/001/003
chmod: /dev/bus/usb/001/003: Read-only file system

@lukaszolek
Copy link
Author

This is my /etc/knxd.ini from the addon_local_knxd container:

[main]
addr = 0.0.1
client-addrs = 0.0.2:8
connections = server,A.tcp,interface
logfile = /dev/stdout

[A.tcp]
server = knxd_tcp

[server]
server = ets_router
tunnel = tunnel
router = router
discover = true
name = knxd

[interface]
driver = usb
device = /dev/bus/usb/001/003

send-timeout = 3000
filters = 

Trying to set write permissions:

root@local-knxd:/$ ls /dev/bus/usb/001/003 -la
crw-rw-r--    1 root     root      189,   2 Dec 16 18:25 /dev/bus/usb/001/003
root@local-knxd:/$ chmod a+w /dev/bus/usb/001/003
chmod: /dev/bus/usb/001/003: Read-only file system

@da-anda
Copy link
Owner

da-anda commented Feb 10, 2021

hmm, config seems fine on a glance. Then sorry, no idea what else to try. Since knxd is run as root user, it shouldn't be a permission issue. Feel free to mess around inside the docker container as much as you like - once you restart it, it will be back to it's initial state, so you can't really mess things up. The docker image is based on alpine, so you can install additional libraries via apk add NAMEOFLIB etc - maybe some additional stuff is required now for USB to work. Sorry to leave you a bit in the dark here, but I am myself clueless and all I can do is to search the internet

@da-anda
Copy link
Owner

da-anda commented Feb 10, 2021

oh, you could probably try to run knxd via it's command line arguments instead of the ini file in order to see if you can get it to work somehow with the usb device. See knxd --help for the options or the documentation on their github for which params are available

@da-anda
Copy link
Owner

da-anda commented Feb 10, 2021

a friend mentioned that it might help if you just reboot the host OS. Might be worth a try I guess.

@lukaszolek
Copy link
Author

to rule out an issue with the switch from the dockerhub based add-on base-images to the new ones on github CR, you could try to install the old 0.3.6 version of the add-on locally. If this one also doesn't work, we at least know it's not related to a change I made.

This is what I get when downgraded to 0.3.6:

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] done.
[services.d] starting services
[services.d] done.
libusb: error [get_usbfs_fd] libusb couldn't open USB device /dev/bus/usb/001/003, errno=1

@da-anda
Copy link
Owner

da-anda commented Feb 10, 2021

hmm, so also USB connection issues like others reported on the forums. So seems to be related to the new supervisor and probably also OS then

@lukaszolek
Copy link
Author

Do you think add-on protection mode can play role?

@lukaszolek
Copy link
Author

I tried to execute knxd directly in the container, however the same problem here:

bash-5.1# knxd -e 0.0.1 -E 0.0.2:10 -D -T -R -S -b usb:
knxd: invalid option -- e
libusb: error [get_usbfs_fd] libusb couldn't open USB device /dev/bus/usb/001/003, errno=1

@lukaszolek
Copy link
Author

@da-anda I managed to solve the problem for 0.3.6.
After adding:
"full_access": true
to the config.json, end disabling protection mode it started working.

However, doing the same in test branch resulted in the same error as in the beginning:

terminate called after throwing an instance of 'std::invalid_argument'
  what():  stoi

@da-anda
Copy link
Owner

da-anda commented Feb 10, 2021

@lukaszolek I just pushed a change to my test branch. I added usb:true to the config.json which already might do the trick. I'd like to refrain from requiring full HW access. I also changed the way knxd.ini is created, but that shouldn't matter for your issue, but might fix the issue @mariwing had.
For the changes to be picked up (if you already have 0.3.8 installed) you likely have to uninstall the add-on first and then re-install it. A simple recompile won't do since HA is caching the config.json of installed add-ons and won't update it unless the version number also changes

@lukaszolek
Copy link
Author

I've updated to newest 0.3.8 from the test branch, but it still trows the same error.

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 00-banner.sh: executing... 
-----------------------------------------------------------
 Add-on: KNXD daemon
 KNXD daemon you can use to create a KNX/IP gateway via TPUART or USB bus adapters
-----------------------------------------------------------
 Add-on version: 0.3.8
 You are running the latest version of this add-on.
 System: Home Assistant OS 5.11  (armv7 / raspberrypi4)
 Home Assistant Core: 2021.2.2
 Home Assistant Supervisor: 2021.02.6
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
[cont-init.d] 00-banner.sh: exited 0.
[cont-init.d] 01-log-level.sh: executing... 
[cont-init.d] 01-log-level.sh: exited 0.
[cont-init.d] 2-init-config: executing... 
usb[cont-init.d] 2-init-config: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
terminate called after throwing an instance of 'std::invalid_argument'
  what():  stoi
terminate called after throwing an instance of 'std::invalid_argument'
  what():  stoi
terminate called after throwing an instance of 'std::invalid_argument'
  what():  stoi

@da-anda
Copy link
Owner

da-anda commented Feb 10, 2021

can you verify in /mnt/data/supervisor/addons.json that the local knxd addon is using the usb: true config option? That's where HA caches these it seems. If you apply changes there you need to restart the supervisor for them to take effect on next add-on start.

I suppose that running knxd via command line parameters in this build also still doesn't work? I'm asking because while searching the entire knxd source code, the only mention of stoi seems to be related to parsing the ini file.

@da-anda
Copy link
Owner

da-anda commented Feb 10, 2021

we could also try downgrading the base images of the add-on to alpine 3.12 since those also recently got bumped to 3.13. If you like, you could try switching the base image by modifying build.json and replace :stable with :3.12 and then recompile

@da-anda
Copy link
Owner

da-anda commented Feb 11, 2021

@lukaszolek I downgraded the add-on base-image to 3.12 and did one additional change in the config.json. Mind trying the latest version of the test branch once more? Thanks.

@da-anda
Copy link
Owner

da-anda commented Feb 11, 2021

@mariwing would you mind testing as well? Apparently there are some bugs in Alpine 3.13, so I hope your issue is gone now as well in the test branch

@da-anda
Copy link
Owner

da-anda commented Feb 11, 2021

sorry, made a mistake earlier. Now it's correctly switched to Alpine 3.12

@da-anda
Copy link
Owner

da-anda commented Feb 11, 2021

a user on the forum tested the addon with Alpine 3.12 and reported it working. So I pushed a 0.4 release now, which should hopefully fix the issue. @mariwing if your issue still persists, please open a new ticket. Btw - I added a debug loglevel setting for KNXD now, which hopefully helps with debugging future issues. You can set it to loglevel debug to hopefully see which component of knxd is throwing the error in case the issue still persists.

@da-anda da-anda closed this as completed Feb 11, 2021
@da-anda
Copy link
Owner

da-anda commented Feb 12, 2021

@mariwing version 0.4.1 should now also fix your issue

@mariwing
Copy link

Thank you, I have reverted back to using a separate rpi for knxd for now. In an effort to pay back for your efforts on this (thank you again) I tried to install and run your latest version. It does indeed no longer give the configuration file error that I struggled with the other day 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants