dasshio
dasshio copied to clipboard
Dasshio script failing when pressing Dash button - IndexError: Layer [ARP] not found
I set up Dasshio version 0.3.0 in Hass.io supervisor version 121 on an Ubuntu 16.04 host. When I configure a button and then press it, I get the results below:
2018-07-31 18:52:35,229 | INFO | Reading config file: /data/options.json
2018-07-31 18:52:35,230 | INFO | Starting sniffing...
Traceback (most recent call last):
File "/dasshio.py", line 27, in arp_display
mac = pkt[ARP].hwsrc.lower()
File "/usr/lib/python3.6/site-packages/scapy/packet.py", line 966, in __getitem__
raise IndexError("Layer [%s] not found" % lname)
IndexError: Layer [ARP] not found
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/dasshio.py", line 149, in <module>
count=0)
File "/usr/lib/python3.6/site-packages/scapy/sendrecv.py", line 783, in sniff
if stop_filter and stop_filter(p):
File "/dasshio.py", line 29, in arp_display
mac = pkt[Ether].src.lower()
File "/usr/lib/python3.6/site-packages/scapy/packet.py", line 966, in __getitem__
raise IndexError("Layer [%s] not found" % lname)
IndexError: Layer [Ether] not found
I have the same Problem, with nearly the same setup: Dasshio 0.3.1 in Hass.io supervisor 125 on an Ubuntu 16.04.
Is there a solution for it ?
Or is it possible to downgrade to 0.21 because that version worked without problems?
For what it's worth, I have since upgraded to Dasshio 0.3.1 and Hassio supervisor 125 as well, and it still doesn't work for me.
I had previously set up another Hassio instance (Which had DNS issues) on Ubuntu 17.10, and Dasshio is working in that setup. My current workaround is to keep Dasshio running on that host, but sending commands to the Ubuntu 16.04 instance (Which works perfectly otherwise)
I think is because the code has change from the version 0.2.1. I downgrade and it worked for me as a custom plugin.
On Wed, 15 Aug 2018, 23:06 The Astropath, [email protected] wrote:
For what it's worth, I have since upgraded to Dasshio 0.3.1 and Hassio supervisor 125 as well, and it still doesn't work for me.
I had previously set up another Hassio instance (Which had DNS issues) on Ubuntu 17.10, and Dasshio is working in that setup. My current workaround is to keep Dasshio running on that host, but sending commands to the Ubuntu 16.04 instance (Which works perfectly otherwise)
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/danimtb/dasshio/issues/44#issuecomment-413336957, or mute the thread https://github.com/notifications/unsubscribe-auth/ACCX7IUcpOY1pyVJJVcsO_bcXKK-UsDRks5uRI1UgaJpZM4VpjQ6 .
I've determined the cause of the problem and half determined a work-around, but not entirely sure how to get it actually working. Let me outline everything that I've determined:
By entering the Dasshio container and manually executing the dasshio.py, I was able to determine that the "sniff" function was picking up every packet that was hitting the network interface and not filtering out packets that don't match the specified filter.
I was able to find this issue: https://github.com/secdev/scapy/issues/393 Which mentions that the filter gets installed by tcpdump. Trying to manually run tcpdump gave me the following output:
bash-4.4# tcpdump
Error loading shared library libcrypto.so.43: Permission denied (needed by /usr/sbin/tcpdump)
Error loading shared library libpcap.so.1: Permission denied (needed by /usr/sbin/tcpdump)
Error relocating /usr/sbin/tcpdump: EVP_CIPHER_CTX_new: symbol not found
Error relocating /usr/sbin/tcpdump: EVP_CIPHER_iv_length: symbol not found
Error relocating /usr/sbin/tcpdump: pcap_create: symbol not found
Error relocating /usr/sbin/tcpdump: pcap_dump_ftell: symbol not found
Error relocating /usr/sbin/tcpdump: bpf_dump: symbol not found
Error relocating /usr/sbin/tcpdump: pcap_compile: symbol not found
Error relocating /usr/sbin/tcpdump: pcap_dump_close: symbol not found
Error relocating /usr/sbin/tcpdump: pcap_datalink_name_to_val: symbol not found
Error relocating /usr/sbin/tcpdump: MD5_Update: symbol not found
Error relocating /usr/sbin/tcpdump: pcap_tstamp_type_val_to_description: symbol not found
Error relocating /usr/sbin/tcpdump: pcap_set_snaplen: symbol not found
Error relocating /usr/sbin/tcpdump: pcap_snapshot: symbol not found
Error relocating /usr/sbin/tcpdump: pcap_list_tstamp_types: symbol not found
Error relocating /usr/sbin/tcpdump: MD5_Final: symbol not found
Error relocating /usr/sbin/tcpdump: EVP_get_cipherbyname: symbol not found
Error relocating /usr/sbin/tcpdump: pcap_list_datalinks: symbol not found
Error relocating /usr/sbin/tcpdump: EVP_CIPHER_CTX_free: symbol not found
Error relocating /usr/sbin/tcpdump: pcap_stats: symbol not found
Error relocating /usr/sbin/tcpdump: pcap_breakloop: symbol not found
Error relocating /usr/sbin/tcpdump: pcap_open_offline: symbol not found
Error relocating /usr/sbin/tcpdump: OPENSSL_add_all_algorithms_noconf: symbol not found
Error relocating /usr/sbin/tcpdump: pcap_close: symbol not found
Error relocating /usr/sbin/tcpdump: pcap_dump_open: symbol not found
Error relocating /usr/sbin/tcpdump: pcap_datalink_val_to_name: symbol not found
Error relocating /usr/sbin/tcpdump: pcap_dump: symbol not found
Error relocating /usr/sbin/tcpdump: pcap_tstamp_type_val_to_name: symbol not found
Error relocating /usr/sbin/tcpdump: pcap_open_offline_with_tstamp_precision: symbol not found
Error relocating /usr/sbin/tcpdump: pcap_lookupnet: symbol not found
Error relocating /usr/sbin/tcpdump: pcap_set_immediate_mode: symbol not found
Error relocating /usr/sbin/tcpdump: pcap_lib_version: symbol not found
Error relocating /usr/sbin/tcpdump: SSLeay_version: symbol not found
Error relocating /usr/sbin/tcpdump: pcap_statustostr: symbol not found
Error relocating /usr/sbin/tcpdump: pcap_geterr: symbol not found
Error relocating /usr/sbin/tcpdump: pcap_setfilter: symbol not found
Error relocating /usr/sbin/tcpdump: pcap_setdirection: symbol not found
Error relocating /usr/sbin/tcpdump: EVP_Cipher: symbol not found
Error relocating /usr/sbin/tcpdump: pcap_set_buffer_size: symbol not found
Error relocating /usr/sbin/tcpdump: pcap_set_rfmon: symbol not found
Error relocating /usr/sbin/tcpdump: pcap_freealldevs: symbol not found
Error relocating /usr/sbin/tcpdump: EVP_CipherInit_ex: symbol not found
Error relocating /usr/sbin/tcpdump: pcap_can_set_rfmon: symbol not found
Error relocating /usr/sbin/tcpdump: pcap_tstamp_type_name_to_val: symbol not found
Error relocating /usr/sbin/tcpdump: pcap_findalldevs: symbol not found
Error relocating /usr/sbin/tcpdump: pcap_free_tstamp_types: symbol not found
Error relocating /usr/sbin/tcpdump: pcap_set_timeout: symbol not found
Error relocating /usr/sbin/tcpdump: pcap_freecode: symbol not found
Error relocating /usr/sbin/tcpdump: pcap_loop: symbol not found
Error relocating /usr/sbin/tcpdump: pcap_strerror: symbol not found
Error relocating /usr/sbin/tcpdump: pcap_set_tstamp_type: symbol not found
Error relocating /usr/sbin/tcpdump: EVP_CIPHER_CTX_block_size: symbol not found
Error relocating /usr/sbin/tcpdump: OBJ_NAME_add: symbol not found
Error relocating /usr/sbin/tcpdump: pcap_datalink: symbol not found
Error relocating /usr/sbin/tcpdump: pcap_dump_flush: symbol not found
Error relocating /usr/sbin/tcpdump: MD5_Init: symbol not found
Error relocating /usr/sbin/tcpdump: pcap_datalink_val_to_description: symbol not found
Error relocating /usr/sbin/tcpdump: pcap_free_datalinks: symbol not found
Error relocating /usr/sbin/tcpdump: pcap_set_tstamp_precision: symbol not found
Error relocating /usr/sbin/tcpdump: pcap_activate: symbol not found
Error relocating /usr/sbin/tcpdump: pcap_set_promisc: symbol not found
Error relocating /usr/sbin/tcpdump: pcap_set_datalink: symbol not found
Which obviously seems bad (And yes, I verified that I was root, so the lack of permission seemed odd)
Further searching to determine why tcpdump might not be working lead me to the following issue: https://github.com/moby/moby/issues/14140 In which this is mentioned as "likely an AppArmor issue" (A ha! That sort of makes sense!). A temporary workaround is described in the discussion to try moving tcpdump to "/usr/local/bin" (and then run "hash -r" to rehash your path). I did so, and manually ran the dasshio script. It worked! The button press was detected, but since the script that was run during the container creation crashed, the container died.
So there's some sort of privilege issue being caused by AppArmor that is preventing tcpdump from being executed in /usr/sbin/ but not in /usr/local/bin/.
What I'm not sure about (being a Docker noob) is how to move the tcpdump binary in the container and make that permanent until the issue gets resolved properly. Ideas?
It took a bit of fiddling, but I've forked the Dasshio repository and gotten things working for me. The only real differences between 0.3.1 and my version is that the add-on generates the Docker image on the fly (instead of using a published image) and moves the tcpdump binary to /usr/bin during creation. I changed some of the add-on text as well just to make it explicitly clear that this is a work-around version, and isn't really a permanent solution.
If you're encountering the issue described here, you should be able to add my repository to your Hass.io add-on store, and install the add-on that way. My repository is: https://github.com/theastropath/dasshio
I would love to not have to keep my fork up to date, so hopefully a proper fix gets added to the main repository eventually!
So, looking at the @theastropath workaround it seems easy to add it. I have been running this version in RPI for a long time and now I run it inside an Ubuntu 18 an it working without issue.
I am willing to make the workaround suggested but would like to know if any of you found another way of making it work without the IndexError: Layer [ARP] not found
Thanks!
It took a bit of fiddling, but I've forked the Dasshio repository and gotten things working for me. The only real differences between 0.3.1 and my version is that the add-on generates the Docker image on the fly (instead of using a published image) and moves the tcpdump binary to /usr/bin during creation. I changed some of the add-on text as well just to make it explicitly clear that this is a work-around version, and isn't really a permanent solution.
If you're encountering the issue described here, you should be able to add my repository to your Hass.io add-on store, and install the add-on that way. My repository is: https://github.com/theastropath/dasshio
I would love to not have to keep my fork up to date, so hopefully a proper fix gets added to the main repository eventually!
It's working on Ubunut 16.04 and latest hassio without crash.
Thank you.
@danimtb I believe the other (proper) solution would be to figure out how AppArmor needs to be configured to allow tcpdump to run in its current location. That being said, I have absolutely no understanding of how AppArmor really works, so I can't provide much insight. I think just moving tcpdump is the easy/good enough solution.
I have been experiencing the crashing issue as well so please implement this workaround. Or did you already? I checked the releases page of your github and the other guys fork and they both say Aug was latest but your posts are only 25 days old. Where is your latest code lol am I missing it?
There were some minor changes (documentation, IIRC) to the base version around when I made the workarounds in my fork. If you are experiencing the "Layer [ARP] not found" crash, I would recommend using my fork for the time being, then switch back to the original version once the workaround has been implemented there. You should be able to just copy the configuration from my version and just dump it into the base version once you need to make the switch.