ccsnet Posted July 24, 2021 Share Posted July 24, 2021 OK - some progress - rebooted and I can now start my VMs but getting: Quote Following are missing or not loaded: usbip_host module vhci_hcd module. Given that I thought hook edits where automatic now I did not expect this so need to do some further reading (unless some one has a quick answer ?). T Quote Link to comment
SimonF Posted July 24, 2021 Author Share Posted July 24, 2021 (edited) 3 minutes ago, ccsnet said: OK - some progress - rebooted and I can now start my VMs but getting: Given that I thought hook edits where automatic now I did not expect this so need to do some further reading (unless some one has a quick answer ?). T Which plugin are you using. Only USB manager auto adds. Do you need the usbip functions? Those messages are not for the hooks file. Edited July 24, 2021 by SimonF Quote Link to comment
ccsnet Posted July 24, 2021 Share Posted July 24, 2021 (edited) 3 minutes ago, SimonF said: Which plugin are you using. Only USB manager auto adds. Do you need the usbip functions? Hi - thanks for coming back to me - USB Manager only as I do not need the IP features. Enable USB on Dashboard and Enable USB Manager Hotplug on VM page are enabled. Enable USBIP is disabled however I have played with the settings before hand. T Edited July 24, 2021 by ccsnet Quote Link to comment
SimonF Posted July 24, 2021 Author Share Posted July 24, 2021 (edited) 2 minutes ago, ccsnet said: Hi - thanks for coming back to me - USB Manager only as I do not need the IP features. T Change to enable usbip to disable in settings and those messages will disappear. content://com.android.chrome.FileProvider/images/screenshot/16271305008562117425920.png Edited July 24, 2021 by SimonF Quote Link to comment
ccsnet Posted July 24, 2021 Share Posted July 24, 2021 Hi Simon - thanks... I found that a reboot was also needed to remove the messages which might have been the bit throwing me off. Thanks again for jumping in to help. Terran PS Love the photo - MK based ? Quote Link to comment
ccsnet Posted July 24, 2021 Share Posted July 24, 2021 (edited) Hi @SimonF - one last question - is it possible to map the same USB device to two VMs ie so I can have multiple VMs but shut one down for another and it knows to auto connect eg keyboards and mice ? T Edited July 24, 2021 by ccsnet Quote Link to comment
SimonF Posted July 24, 2021 Author Share Posted July 24, 2021 45 minutes ago, ccsnet said: Hi @SimonF - one last question - is it possible to map the same USB device to two VMs ie so I can have multiple VMs but shut one down for another and it knows to auto connect eg keyboards and mice ? T Not possible to have two device maps but you can have one Dev and one port map. Dev is actioned first and they can be for diff vms Quote Link to comment
SimonF Posted July 24, 2021 Author Share Posted July 24, 2021 (edited) 5 hours ago, ccsnet said: Hi @SimonF - one last question - is it possible to map the same USB device to two VMs ie so I can have multiple VMs but shut one down for another and it knows to auto connect eg keyboards and mice ? T I wasn't able to do a screen grab earlier of an example Here is an example of a Ubuntu and Window 10 machines. Edited July 24, 2021 by SimonF Quote Link to comment
ccsnet Posted July 24, 2021 Share Posted July 24, 2021 43 minutes ago, SimonF said: I wasn't able to do a screen grab earlier of an example Here is an example of a Ubuntu and Window 10 machines. Thanks @SimonF - really happy with this plug in... well done. T Quote Link to comment
SimonF Posted July 24, 2021 Author Share Posted July 24, 2021 7 minutes ago, ccsnet said: Thanks @SimonF - really happy with this plug in... well done. T Thanks Quote Link to comment
SimonF Posted August 1, 2021 Author Share Posted August 1, 2021 2021.08.01 Released. Quote Link to comment
batesman73 Posted August 10, 2021 Share Posted August 10, 2021 Hi there, I'm very happy about your plugin as I requested usbip 2 years ago I can manually connect my device to the unraid server (conected to an RPi with an USB-Serial Adapter) and use it within a docker container. But I need to configure the USB Port in UNRAID via "stty" before using it. Long story short .. Is there a way to "mount" that usb device --> configure the ttyUSB device --> start the docker container in that order automatically ? THX Quote Link to comment
SimonF Posted August 10, 2021 Author Share Posted August 10, 2021 7 hours ago, batesman73 said: mount When you say mount do you mean attach button on remote USBIP hosts. Once the dev is attached you could use a udev rule to do the other actions. I could look at an option to run a script when a new device is detected/removed as a future enhancement. Also can look at an option to auto attach if found. Quote Link to comment
batesman73 Posted August 11, 2021 Share Posted August 11, 2021 Hi. thanks for the response. "mount" does, of course, mean attaching the device. You're right, UDEV could help to init the configuration. But I still need to attach the device on boot (or start of array/dockers). I didn't see that option, or is there one. I think most people using usbip would love to have this option. I belive the most coomon use case would be a usb device connected to RPi (or similar) which ist constantly running and connect it to a server in the closet or basement. For now I think i will create two scripts for boot and shutdown. Quote Link to comment
SimonF Posted August 11, 2021 Author Share Posted August 11, 2021 4 hours ago, batesman73 said: I didn't see that option, or is there one. There is currently no option. Will have to look at a process to check every x mins as there will not be a event to trigger. Running a process when connected will be more straight forward as I already use udev for the usb devices Not able to look until the weekend. Quote Link to comment
batesman73 Posted August 12, 2021 Share Posted August 12, 2021 Hi, it's currently almost running with my 2 scripts. But if you would include some of the needed steps as described I would appreciate that Altough it's not related to USBiP ... One thing I currently don't know is how to change user permissions inside the container for that USB-Device which is mapped inside. Of course I can log into the container and enter CHMOD. But ho can I do that automatically ? Any hints ? Quote Link to comment
SimonF Posted August 12, 2021 Author Share Posted August 12, 2021 4 minutes ago, batesman73 said: Hi, it's currently almost running with my 2 scripts. But if you would include some of the needed steps as described I would appreciate that Altough it's not related to USBiP ... One thing I currently don't know is how to change user permissions inside the container for that USB-Device which is mapped inside. Of course I can log into the container and enter CHMOD. But ho can I do that automatically ? Any hints ? You should be able to change on the host as i.e. chmod xxx /dev/ttyusb.... Quote Link to comment
batesman73 Posted August 12, 2021 Share Posted August 12, 2021 Hi, it's not that the "container" doesn't have access to the device. I'm using a PHP/Apache container. I think the "www" user doesn't have access to it within the container. After "chmod 777" within the container i can then send my command through the device. However.... Now is everything running as it should. I put "docker exec Apache-PHP bash -c "chmod 777 /dev/ttyUSB0" in my script which I run to connect the device via usbip to unraid an configure the serial port. Just added a few seconds of sleep to it after array starts. MY hopes would are that it could be possible to enter this already in the template when mapping the device. But I don't know how. At least when rebooting the server everything starts automatically 🙂 Quote Link to comment
SimonF Posted August 14, 2021 Author Share Posted August 14, 2021 On 8/12/2021 at 9:29 AM, batesman73 said: Hi, it's not that the "container" doesn't have access to the device. I'm using a PHP/Apache container. I think the "www" user doesn't have access to it within the container. After "chmod 777" within the container i can then send my command through the device. However.... Now is everything running as it should. I put "docker exec Apache-PHP bash -c "chmod 777 /dev/ttyUSB0" in my script which I run to connect the device via usbip to unraid an configure the serial port. Just added a few seconds of sleep to it after array starts. MY hopes would are that it could be possible to enter this already in the template when mapping the device. But I don't know how. At least when rebooting the server everything starts automatically 🙂 Hi I am only a basic docker users, but can you not add that in the extra parms section in the template? I am guessing you have --device=/dev/ttyUSB0 in there already? I am looking at adding the auto attach options and thinking on how to link to specific devices, would you be willing to share the info below? also the scripts you have created so I can see the process you are using. PM me the info if you don't want to post here. Quote Link to comment
ich777 Posted August 14, 2021 Share Posted August 14, 2021 23 minutes ago, SimonF said: I am guessing you have --device=/dev/ttyUSB0 in there already? @batesman73 just a suggestion from my side, actually because it's a little more convenient I think, do it like this if you want to add a device to a contianer: In the Docker template click on: Change the "Config Type" to: "Device" (Optional) give it a Name As value use the device path: "/dev/ttyUSB0" Click on "Add" Click on "Apply" Enjoy 1 Quote Link to comment
SimonF Posted August 14, 2021 Author Share Posted August 14, 2021 (edited) 21 minutes ago, ich777 said: want to add a device to a contianer I have learnt something new today, didn't know that option existed. Thanks. Any suggestions for the other question about permissions of dev in the container? Edited August 14, 2021 by SimonF 1 Quote Link to comment
SimonF Posted August 14, 2021 Author Share Posted August 14, 2021 On 8/12/2021 at 9:29 AM, batesman73 said: Hi, it's not that the "container" doesn't have access to the device. I'm using a PHP/Apache container. I think the "www" user doesn't have access to it within the container. After "chmod 777" within the container i can then send my command through the device. However.... Now is everything running as it should. I put "docker exec Apache-PHP bash -c "chmod 777 /dev/ttyUSB0" in my script which I run to connect the device via usbip to unraid an configure the serial port. Just added a few seconds of sleep to it after array starts. MY hopes would are that it could be possible to enter this already in the template when mapping the device. But I don't know how. At least when rebooting the server everything starts automatically 🙂 Are you using user scripts for the starting at boot? Quote Link to comment
batesman73 Posted August 14, 2021 Share Posted August 14, 2021 I tried via extra Parameters AND the ICH 777 suggested way already before. It has the same effect However. that doesn't solve my problem. I need to change the permission for the device within the container. Maybe there is way to specify that in another way. but for now I use I like I wrote in my last post. However here's what I use for my personal needs. I know it could be partly solved also via autostart on the (usbip-)servers side but I had some problems in the past so I start/stop the demon and attach it everytime again. Start Script: #!/bin/bash modprobe vhci-hcd ssh root@dietpi 'sudo modprobe usbip_host; sudo usbipd -D; sudo usbip bind -b 1-1.3' sleep 0.5 /usr/sbin/usbip attach -r dietpi -b 1-1.3 sleep 0.5 stty -F /dev/ttyUSB0 ospeed 300 ispeed 300 -ignpar cs8 -cstopb -echo sleep 20 docker exec Apache-PHP bash -c "chmod 777 /dev/ttyUSB0" Stop Script: #!/bin/bash /usr/sbin/usbip detach -p 00 ssh root@dietpi 'sudo /usr/sbin/usbip unbind -b 1-1.3' Quote Link to comment
ich777 Posted August 14, 2021 Share Posted August 14, 2021 36 minutes ago, batesman73 said: I tried via extra Parameters AND the ICH 777 suggested way already before. It has the same effect Exactly, the same effect but more convenient... Don't followed the whole conversation, why do you need to set the permissions, what container is it? Is there some kind of hook that you can execute on the start of the container. Also wouldn't it be much easier to add the user that uses the USB device to the tty group like: adduser YOURUSER dialout so you actually don't need to set the permissions? Is the root user the user who needs the serial connection? Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.