-
Notifications
You must be signed in to change notification settings - Fork 15
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
udev mapping rule doesn't allow container to start #14
Comments
I would ask about how But trying to be helpful here, Have you tried using the In the second example, the
Quotes from https://github.com/merbanan/rtl_433#running
and
|
I appreciate the help. Again I wasn't sure if this was rtl-433 related or the container. Figured since it's going to be a limitation on the container (ie having to change what device is passed through) I'd raise it here but I have no issue going over to rtl-433 if that's the right spot to go. Correct I'm running rtl-sdr, here's my docker-compose snippet:
I did try to play with the -d flag but even trying to use the serial number |
There's also A quick search turned some interesting leads that I would investigate: |
Thank you for those links. I tried them and still had no luck. Going to give up for now as I don't restart all that often so hopefully it isn't a bit issue. I'll keep trying though. |
I currently have it setup so that the sdr device is always assigned |
How did you do that? udev rule mapping it to that path? All I'm looking for is consistency between reboots, the specific path doesn't matter to me. |
The more I dig into this topic the more I realise I'm lucky 😅. In my case I just have the sdr device connected to the Pi4 port (don't remember which one exactly), I do not restart it at all and it seems to have not been renumerated for the past year or so.
Nothing, I just not touch the PI at all, I know it's not a solution but so far (about a year) It has kept its id. The doc mentions that
But unfortunately I do not know where and how to access them. Quote from Linux
|
Sorry I haven't had time to keep working on this. Interestingly I rebooted my server by accident this morning and everything came back up fine. So it may not be as big an issue as I thought. |
@hertzg @FuzzyMistborn I have found that this works. It seems rtl_433 works it out devices: - /dev/bus/usb |
Interesting. That definitely would work. My other issue that's more particular to me is that I run things inside linux containers (LXC) so I have to pass through devices to the container. I'd prefer not to pass every USB device through for security reasons. But that's a clever solution. |
I'm using this on a pi 4 using docker compose. Not quite the same.
Charles Godwin
…________________________________
From: Fuzzy ***@***.***>
Sent: Saturday, May 29, 2021 7:29:56 PM
To: hertzg/rtl_433_docker ***@***.***>
Cc: Charles W Godwin ***@***.***>; Comment ***@***.***>
Subject: Re: [hertzg/rtl_433_docker] udev mapping rule doesn't allow container to start (#14)
Interesting. That definitely would work. My other issue that's more particular to me is that I run things inside linux containers (LXC) so I have to pass through devices to the container. I'd prefer not to pass every USB device through for security reasons. But that's a clever solution.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub<#14 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AE6AIH2I3FZBB6OA5OZUISTTQF2HJANCNFSM44UCVXGA>.
|
Following up on the quote from kernel about "stable" ids. I was able to only find |
I have read an article that discusses how to do it for USB serial devices. I use it for a RS485 dongle but it doesn't seem to work for this application. Want to read it, I can dig it up |
i know this is closed, but @FuzzyMistborn i was able to get udev rules working. File called:
your vendor and product might be different, just use Then in my docker compose i have just mapping my static path to a normal /bus/usb path within the container and it was able to find it no problem. |
I tried it and didn't work. I get this in my log
docker-compose.yml has
|
once you make the rule file did you reload them? Edit: and also, make sure you rebuild the container, not just restart it. if none of that works for you then i'm not too sure, it is working for me here. |
And my docker-compose
And logs upon starting container
|
My current situation and my solution to this issue: In my case I have two of the same type of devices attached to a host that is running docker, and I use
In my case the devices might be mounted with any bus/id pair and I let The only downside is that I am exposing the whole
You can see an alternatate solution with a startup contributed by a user: #45 |
Sorry to revive this, but I had the same error as you. Your docker-compose mapping uses usb/001/003 and your physical device is attached at usb/001/005. If you change the mapping to use 005 instead, then it works. This doesn't really make sense to me because now even with udev rules it's still dependent on what the host device path is, which kinda defeats the purpose. In my case, my device was on usb/003/008 and I had to use that exact path in the docker device mapping otherwise I'd get the error -4. |
@viperk1 There are few easy options without digging too much into details:
All of them have different ups and downs but are viable options, depends on your preference / limitations / level of paranioa. |
I found a solution that allows to expose only the needed device. rtl433 requires the device to be accessible via the /dev/bus/usb/XXX/YYY path, however it is possible to create a symlink from this path to the static path while running in a container, so that we don't need any scripts that change docker-compose.yml before actually calling docker-compose.
We need |
I suggest adding the entrypoint script with a workaround. |
Would be nice if a more proper solution could be found for this. I believe it has something to do with the host passing meta info to the container. If you lsusb inside the container, it reads out the info from the host. Not the device being bound. I tried adding MODE="0666" and GROUP="dialout", but the error -4 remained leading me to believe it's not a permission issue, but rather a derivatives of how program detects the available usb devices. |
In April I investigated this issue by trying to understand device detection code using strace and libusb source. As I remember libusb can't be asked to use particular udev device path. And you are right that it is device list detection issue. |
@gwisp2 i was able to get this working, thank you for your efforts! I also learned about Dockerfiles as an added bonus! |
Edit: just wanted to add that it doesn’t appear that command arguments via the compose file can be passed with this method. Based on some googling, maybe due to using the shell form of Entrypoint? Anyways, I was able to get things working using a .conf file (with my MQTT server) if anyone else has the same issue. Alternatively, maybe these could be set via env variables? |
They can, I pass parameters in my docker-compose.
Command is arguments to entrypoint script (or just a path to executable with arguments if entrypoint script is not defined). |
Didn’t work for me. I even added an echo to your script and rebuilt the image and it’s not printing any variables for $@. Again it works with the .conf file but I’m not sure what the issue is. |
Today I noticed that it doesn't work, lol. Probably I wanted to test that events were sent to mqtt but I was too lazy to do that and after a while I lost interest in tinkering home automation and forgot about that. The problem is with ENTRYPOINT instruction. When a string X is passed to it then docker replaces it to ["sh", "-c", "X"]. To avoid that use the following ENTRYPOINT. entrypoint.sh has +x permission and a shebang line so it can be executed directly. ENTRYPOINT ["/opt/entrypoint.sh"] |
Not sure if this is an RTL_433 issue or a docker issue, but to get around the issue where the
/dev/bus/usb
path changes I'm trying to create a udev rule to map the device id to/dev/rtl433
and then pass that through to the container. However, the container doesn't seem to like that as I get this error:I suspect it's because RTL_433 is set to look for something on the /dev/bus/usb path. When I try to map
/dev/rtl433
to something like..../dev/bus/usb/001/004
I get this instead:If I map it to the match USB path of /dev/bus/usb it works. Which kinda defeats the point of a udev rule. Is there a way around this?
The text was updated successfully, but these errors were encountered: