Unable to run in Console only mode or as background daemon mode: vhclientmipsel on openwrt router - USB Client

Found USB Server to be very useful program, however i faced a problem.

On my openwrt MIPS router, I am able to get run vhusbdmipsel - as USB Server.
However unable to run vhclientmipsel - as USB Client on the same router.

Both Console only mode or as background daemon mode does work.
the executable are store at /usr/bin/vhusbd, set chmod +x

./vhclientmipsel -n
./vhclientmipsel -t list

Message returns: "An existing client is not running. Start the client first so it can be connected to"

Wonder if Michael can help? Or any past version of vhclientmipsel that I can try?
Thanks

#2

have a look in logread. Seems like you probably dont have vhci_hcd (USB/IP) compiled into the kernel or a module. The virtualhere client uses that driver

#3

Thank you Michael, what to look for in logread?

I am using openwrt chaos calmer 15.05.01, for this kernel, only 2 related USBIP package are kmod-usbip & kmod-usbip-client are installed; vhci_hcd not found installation nor kernel add-on contain download for vhci_hcd. So where can i get the correct version of vhci_hcd to install?

#4

You need to build openwrt yourself and include those kernel modules in the make menuconfig configuration

#5

Michael thk you earlier to help troubleshoot - now I managed to include those 2 kernel modules on my router, now router is running as
USB Client (vhclientmipsel)

/dev# lsmod | grep vhci
--------------------------------------------
usb_common 1740 2 vhci_hcd
usbcore 119492 35 vhci_hcd
usbip_core 4848 1 vhci_hcd
vhci_hcd 12227 0 [permanent]

So my scenario is this:
Android Phone - running USB Server (USB thumbdrive) --> Router - as USB Client

vhclientmipsel -t "USE,localhost.1002".
ok
vhclientmipsel -t "LIST"
--------------------------------------------
VirtualHere Client IPC, below are the available devices:
(Value in brackets = address, * = Auto-Use)

Openwrt (localhost:7575)
--> USB 2.0 SD/MMC READER (localhost.1002) (In-use by you)

Auto-Find currently on
Auto-Use All currently off
Reverse Lookup currently off
Reverse SSL Lookup currently off
VirtualHere Client not running as a service

---
/dev# lsusb
--------------------------------------------
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

As you can see, on Router USB Client does not show-up usb thumbdrive, thus no way to mount it.
(when connect directly to Router USB port, this thumbdrive shows up as USB device, successfully mounted)

Can you help advice?

#6

When you try to connect the device via virtualhere on the client side. Run

logread

and see what message it says.

#7

Thk Michael for advicing, here you go:

--------------------------------------------
/www# /usr/bin/vhusbd/vhclientmipsel_v4.5.9 -t "LIST"
--------------------------------------------

VirtualHere Client IPC, below are the available devices:
(Value in brackets = address, * = Auto-Use)

WhiteKnight-Truth (localhost:7575)
--> USB 2.0 SD/MMC READER (localhost.1002)

Auto-Find currently on
Auto-Use All currently off
Reverse Lookup currently off
Reverse SSL Lookup currently off
VirtualHere Client not running as a service
--------------------------------------------
/www# /usr/bin/vhusbd/vhclientmipsel_v4.5.9 -t "USE,localhost.1002"
--------------------------------------------

OK
--------------------------------------------
/www# /usr/bin/vhusbd/vhclientmipsel_v4.5.9 -t "LIST"
--------------------------------------------

VirtualHere Client IPC, below are the available devices:
(Value in brackets = address, * = Auto-Use)

WhiteKnight-Truth (localhost:7575)
--> USB 2.0 SD/MMC READER (localhost.1002) (In-use by you)

Auto-Find currently on
Auto-Use All currently off
Reverse Lookup currently off
Reverse SSL Lookup currently off
VirtualHere Client not running as a service
--------------------------------------------
/www# logread
--------------------------------------------
on Oct 1 22:20:35 2018 kern.alert VirtualHere Client: VirtualHere Client 4.5.9 starting (Compiled: Sep 24 2018 15:12:00)
Mon Oct 1 22:20:35 2018 kern.alert VirtualHere Client: Using config at /root/.vhui
Mon Oct 1 22:20:35 2018 kern.alert VirtualHere Client: IPC available at /tmp/vhclient
Mon Oct 1 22:20:35 2018 kern.alert VirtualHere Client: Auto-find using Bonjour - on
Mon Oct 1 22:20:35 2018 kern.alert VirtualHere Client: Auto-find using Bonjour SSL - on
Mon Oct 1 22:20:36 2018 kern.alert VirtualHere Client: VirtualHere USB Server Trial Edition (192.168.2.236:7575)
Mon Oct 1 22:21:04 2018 kern.info kernel: [ 250.810000] vhci_hcd vhci_hcd: rhport(0) sockfd(11) devid(4) speed(3) speed_str(high-speed)

--------------------------------------------
/www# lsusb
--------------------------------------------

Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

#8

I think you need to use a distribution newer than chaos calmer. I think your uspip driver has a bug in it. Use the latest code possible or build the distribution from git if you can

#9

I found and try installing 18.06 which is the latest, insmod usbip it ran fine, insmod usbip-client - hangs the whole router.

Do you happen to know which after chaos calmer distribution is the usbip fixed?

#10

Ok that is quite surprising, usbip modules work fine on intel and arm e.g pi, but i havent actually tried it on mipsel.

You dont need to insmod anything, just run the virtualhere client and see what happens. Did you try that first. Dont need to insmod usbip-client.

#11

usbip & usbip-client kernel modules are consider optional on openwrt, need to install via opkg and insmod to activate use them.

Maybe if you can help by try out on mipsel to see which after chaos calmer version works. Really appreciate.

#12

Ok ill give this a test in the next few days with my mipsel gl-inet mt300nv2 router...

#13

Ok it does work, i did this for my gl-inet mt300nv2 router so you should do the same for your openwrt build

git pull <latest openwrt>
make menuconfig go to Kernel Modules -> USB Support -> Press Space to put an asterix next to kmod-usbip and kmod-usbip-client
esc->save
make -j <num of cpus;>
write the openwrt firmware to your router
wget http://www.virtualhere.com/sites/defaults/files/usbclient/vhusbdmipsel
chmod +x ./vhclientmipsel
./vhclientmipsel -n
./vhclientmipsel -t list
./vhclientmipsel -t "USE,...."

I did this on my gl-inet mt300nv2 running

Linux CloudHub_43e992 4.14.63 #0 Thu Aug 16 07:51:15 2018 mips GNU/Linux

and then the usb stick appeared connected to my gl-mt300nv2 even though the stick was plugged into another virtualhere server

And incidentally i could then use the stick via the VirtualHere server again running on the gl-inet mt300nv2 to re-share the device to another client! I just had to disable usb reset by right clicking on the device and selecting "Custom Event Handler..." and entering "onReset.$VENDOR_ID$.$PRODUCT_ID$="

So it worked like this

VirtualHere running on MR3020 with usb stick plugged in-> Wifi->GL-INET MT300NV2 running virtualhere client (and server) -> Wifi -> Windows 10 64-bit . The usb stick could mount and be read/written to like normal. So this proves it does work. I had to reshare the stick from the mt300nv2 because the mt300nv2 doesnt have usb storage drivers compiled into it so the usb disk couldnt be mounted.

However if you want to use your usb device on your router you will need to compile in whatever drivers are needed to actually use the device. E.g usb-storage if its a usb stick etc.

#14

Appreciate Michael for extra effort to build openwrt firmware for your gl-inet mt300nv2 & test out the client function.

1 question now: could you advice me which Linux distro and version you used to build the firmware, I can mimic as close as possible to your setup, this helpfully will reduce issues as I build openwrt for router.

#15

git clone https://github.com/lede-project/source.git
#16

Michael, what i mean was the parent Linux OS which you use to build Lede.

#17

OK it was ubuntu 18.04 64-bit however its not relevant because lede/openwrt builds its own toolchain before it compiles the image so its not connected with anything on the compilation host

#18

git pull

Michael, as a reference, what did you use for ?

#19

git pull <latest openwrt>

Michael, as a reference, what did you use for <latest openwrt>?

#22

git clone https://github.com/lede-project/source.git
cd source
make menuconfig
make -jnumberofcpus

to update:

cd source
git pull
make menuconfig
make -jnumberofcpus
#23

Thks Michael for the hand-holding, this is what is showing on my ubuntu-18.04.1 64bit:

git clone https://github.com/lede-project/source.git [No errors]
cd source [Done]
git pull [Already up to date]
make menuconfig
[Long list of 'ok', but among these had failed:
Checking 'gcc'... failed.
Checking 'working-gcc'... failed.
Checking 'g++'... failed.
Checking 'working-g++'... failed.
Checking 'ncurses'... failed.
Checking 'awk'... failed.
Checking 'python'... failed.

ending shows:
/home/ubuntu18/Downloads/source/include/prereq-build.mk:156: recipe for target '/home/ubuntu18/Downloads/source/staging_dir/host/bin/mkhash' failed
Prerequisite check failed. Use FORCE=1 to override.
/home/ubuntu18/Downloads/source/include/toplevel.mk:167: recipe for target 'staging_dir/host/.prereq-build' failed
make: *** [staging_dir/host/.prereq-build] Error 1
]

Sorry for the above, Hope you have a great wkend!

#24

Oops ~ sorry, just came to mind ~ those failed, i shld install them , and see if it helps.

Hold-on 1st, will response back in a short-while.

#25

Ah-ha, by installing missing prog. modules - I managed to clear up all the failures, made good progress.

There are some warnings - I think i can ignore right? unless you think i need to look into it.
[WARNING: Makefile 'package/utils/busybox/Makefile' has a dependency on 'libpam', which does not exist
WARNING: Makefile 'package/utils/busybox/Makefile' has a build dependency on 'libpam', which does not exist
WARNING: Makefile 'package/network/utils/curl/Makefile' has a dependency on 'libgnutls', which does not exist
WARNING: Makefile 'package/network/utils/curl/Makefile' has a dependency on 'libopenldap', which does not exist
WARNING: Makefile 'package/network/utils/curl/Makefile' has a dependency on 'libidn2', which does not exist
WARNING: Makefile 'package/network/utils/curl/Makefile' has a dependency on 'libssh2', which does not exist
WARNING: Makefile 'package/boot/kexec-tools/Makefile' has a dependency on 'liblzma', which does not exist
WARNING: Makefile 'package/network/services/lldpd/Makefile' has a dependency on 'libnetsnmp', which does not exist
WARNING: Makefile 'package/network/utils/nftables/Makefile' has a dependency on 'jansson', which does not exist]

make menuconfig: Brings me to the menu for config, besides selecting Target System & Sub-target for my router, what other config selection i need to perform ? then how to complete this menuconfig?

make -jnumberofcpus: Does the jnumberofcpus refer to number of cpu processor on my router? or does it refers to cpu processors on my ubuntu (Intel Dual Core - 2 processors each core- gives 4 processors) ?

#26

I don't know what you need to select, you will have to research that on the internet for your router. j flag is number of CPUs to use when compiling, your Ubuntu PC cpus

#27

Michael, thk you for tracking this issue, after quite abit of effort I finally gotten the latest openwrt 18.06.1 running on my router:

root@openwrt:/www# lsmod | grep vhci
usb_common 2176 2 vhci_hcd,usbcore
usbcore 119376 5 vhci_hcd,ohci_platform,ohci_hcd,ehci_platform,ehci_hcd
usbip_core 4480 1 vhci_hcd
vhci_hcd 14672 0

root@openwrt:/www# /usr/bin/vhusbd/vhclientmipsel_v4.5.9 &
root@openwrt:/www# ps | grep vh
1852 root 16508 R /usr/bin/vhusbd/vhclientmipsel_v4.5.9
1854 root 1200 S grep vh
root@openwrt:/www# ps | grep vh
1856 root 1200 S grep vh
[1]+ Illegal instruction /usr/bin/vhusbd/vhclientmipsel_v4.5.9

Nothing interesting shows-up at logread:
Mon Nov 19 16:31:13 2018 daemon.info dnsmasq-dhcp[1631]: read /etc/ethers - 0 addresses
Mon Nov 19 16:31:15 2018 authpriv.info dropbear[1818]: Child connection from 192.168.3.154:6984
Mon Nov 19 16:31:16 2018 authpriv.notice dropbear[1809]: Password auth succeeded for 'root' from 192.168.3.154:6976

Preliminary info seems to point to some incompatible code error of vhclientmipsel encounter in openwrt 18.06.1