SSH with internet through USB not working for minimal image of BBB

Hi all,

I am new to BBB. This is a long time haunting problem for me.

For my applications some GUI libraries need to be installed in BBB.
For getting maximum space for installing packages, I am using a 16GB SD card - load the image in SD card and boot from SD card.

If I use the latest debian jessie image bone-debian-8.7-lxqt-4gb-armhf-2017-03-19-4gb.img from https://beagleboard.org/latest-images,
the maximum rootfs size available is only 4GB.

Expanding RootFS for 16GB is not possible with this image.

So as per link https://eewiki.net/display/linuxonarm/BeagleBone+Black#BeagleBoneBlack-SetupmicroSDcard, Bootloader, Kernel and RootFS images are prepared and loaded into the SD card.

But in this procedure the RootFS used is minimal. (obtained from the link -https:``//rcn-ee.com/rootfs/eewiki/minfs/debian-8.7-minimal-armhf-2017-03-02.tar.xz )

This minimal image is finely working. ssh through Ethernet port is working fine. But ssh through USB port (Internet through USB) is not working.

openssh-client and openssh-server are already installed.

Is there some more packages to be installed for ssh through USB?

The command ip addr for Ubuntu 16.04 host shows the following messages:

sajeevank@sajeevank-Vostro-3559:~$ ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: enp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 28:f1:0e:36:1c:63 brd ff:ff:ff:ff:ff:ff
inet 192.168.2.5/24 brd 192.168.2.255 scope global enp3s0
valid_lft forever preferred_lft forever
inet6 fe80::2af1:eff:fe36:1c63/64 scope link
valid_lft forever preferred_lft forever
3: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 1c:ba:8c:a2:ed:72 brd ff:ff:ff:ff:ff:ff
inet 192.168.0.2/24 brd 192.168.0.255 scope global dynamic eth0
valid_lft 83757sec preferred_lft 83757sec
inet6 fe80::9445:1600:d383:baf8/64 scope link
valid_lft forever preferred_lft forever
4: wlp2s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000
link/ether e4:02:9b:03:8a:90 brd ff:ff:ff:ff:ff:ff
sajeevank@sajeevank-Vostro-3559:~$

The command ip addr for BBB target shows the following messages:

debian@arm:~$ ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,DYNAMIC,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 88:c2:55:96:44:cd brd ff:ff:ff:ff:ff:ff
inet 192.168.2.31/24 brd 192.168.2.255 scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::8ac2:55ff:fe96:44cd/64 scope link
valid_lft forever preferred_lft forever
3: usb0: <NO-CARRIER,BROADCAST,MULTICAST,DYNAMIC,UP> mtu 1500 qdisc pfifo_fast master tether state DOWN group default qlen 1000
link/ether 88:c2:55:96:44:cf brd ff:ff:ff:ff:ff:ff
inet 192.168.7.2/30 brd 192.168.7.3 scope global usb0
valid_lft forever preferred_lft forever
4: usb1: <BROADCAST,MULTICAST,DYNAMIC,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master tether state UP group default qlen 1000
link/ether 1c:ba:8c:a2:ed:73 brd ff:ff:ff:ff:ff:ff
inet6 fe80::1eba:8cff:fea2:ed73/64 scope link
valid_lft forever preferred_lft forever
5: tether: <BROADCAST,MULTICAST,DYNAMIC,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 1c:ba:8c:a2:ed:73 brd ff:ff:ff:ff:ff:ff
inet 192.168.0.1/24 brd 192.168.0.255 scope global tether
valid_lft forever preferred_lft forever
inet6 fe80::34f7:7fff:fe2c:50e2/64 scope link
valid_lft forever preferred_lft forever
debian@arm:~$

The /etc/networl/interfaces is as follows in Ubuntu Host:

auto lo
iface lo inet loopback

auto enp3s0
iface enp3s0 inet dhcp

The /etc/networl/interfaces is as follows in BBB Target:

auto lo
iface lo inet loopback

iface usb0 inet static
address 192.168.7.2
netmask 255.255.255.252
network 192.168.7.0
gateway 192.168.7.1

I can ssh, BBB through Ethernet port now. But my application required this Ethernet port. So my idea is use Ethernet port for Application and USB port for SSH.

So for proceeding with this work,

I need to get either

SSH through USB feature in minimal image

or

expansion capability for latest normal image (expansion to 8GB or 16GB size)

or

availability of a rootfs.tar.gz image which also contains SSH through USB feature

Please help me finding out any one of these.

Thanks in advance for the help.

Thanks & Regards,
Sajeevan.K

Documented right here:

https://eewiki.net/display/linuxonarm/BeagleBone+Black#BeagleBoneBlack-usbgadget

Regards,

Hi Robert C Nelson,

Thank You for the reply.

Sorry for my ignorance.

I got the “usb gadget” section in the same webpage. Thank You.

Thanks & Regards,
Sajeevan.K

Hi Robert C Nelson,

I followed the usb gadget" section in https://eewiki.net/display/linuxonarm/.
The result is as follows.

  1. sudo apt-get install udhcpd

debian@arm:~$ sudo apt-get install udhcpd
[sudo] password for debian:
Reading package lists… Done
Building dependency tree
Reading state information… Done
udhcpd is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
debian@arm:~$

  1. change in /etc/network/interfaces

done

  1. temp script
    sudo ./beaglebone-black-g-ether-load.sh
    [ ok ] Restarting udhcpd (via systemctl): udhcpd.service.
    debian@arm:~$ /etc/network/interfaces

But still the problem is not solved.

The lsmod command in BBB terminal gives the following results:


usb_f_acm
u_serial
usb_f_ecm
usb_f_rndis
u_ether

Note 1:- usb_f_mass_storage is absent (But this is present for latest SD card image )

Note 2:- The command ip addr is not showing usb0 with address 192.168.7.1 in Ubuntu Host terminal.
But the command ip addr is showing usb0 with address 192.168.7.2 in BBB Target terminal

Note 3:- ping 192.168.7.2 & 192.168.7.1 are not working in desktop. ping 192.168.7.1 is not working in BBB.But ping 192.168.7.2 is working in BBB.

Please suggest the solutions to make it working.

Thanks in advance for the help.

Thanks & Regards,
Sajeevan.K

On Thu, 13 Apr 2017 03:26:39 -0700 (PDT), sajeevan k
<sajeevank@laxven.com> declaimed the
following:

Note 2:- The command ip addr is not showing usb0 with address 192.168.7.1
in Ubuntu Host terminal.
            But the command ip addr is showing usb0 with address
192.168.7.2 in BBB Target terminal

Note 3:- ping 192.168.7.2 & 192.168.7.1 are not working in desktop. ping
192.168.7.1 is not working in BBB.But ping 192.168.7.2 is working in BBB.

Please suggest the solutions to make it working.

  Based on my interpretations, there is nothing wrong with the BBB.

  The problem appears to be that your host desktop is not detecting a
"network" connection on whatever port (it may not be USB0) to which the BBB
cable is connected.

  192.168.7.1 is the IP address that the host is supposed to define for
its end of the connection, once it detects a BBB and loads the proper
driver.

  Do you have the suitable drivers installed on the host side? (in a very
simplistic description, as I understand the base USB protocol: when you
connect the BBB, the host senses a new device, asks it for its maker/device
codes, matches those up with drivers, and connects the drivers to the
device -- one of those drivers would be the network interface using
192.168.7.1 locally, attempting to talk to 192.168.7.2 remote).

Hi Dennis Lee,

Thank You for the reply and support.

With the same Ubuntu Desktop, with the same BBB, if I just replace the SD card, ssh through USB port is working.

Here I have two SD cards. One with minimal image
( prepared from rootfs obtained from

https:``//rcn-ee.com/rootfs/eewiki/minfs/debian-8.7-minimal-armhf-2017-03-02.tar.xz

``

On Thu, 13 Apr 2017 21:40:27 -0700 (PDT), sajeevan k
<sajeevank@laxven.com> declaimed the
following:

Here I have two SD cards. One with minimal image
( prepared from rootfs obtained from
https:
//rcn-ee.com/rootfs/eewiki/minfs/debian-8.7-minimal-armhf-2017-03-02.tar.xz

,

bootloader and kernel as per the procedure in
https://eewiki.net/display/linuxonarm/BeagleBone+Black#BeagleBoneBlack-SetupmicroSDcard.

With this SD card, ssh through USB port is not working.

The other SD card is having the latest image
"bone-debian-8.7-lxqt-4gb-armhf-2017-03-19-4gb.img" from
https://beagleboard.org/latest-images. In this SD card, the total image is
written with software "mksub" or "Startup Disk Creator".

With this SD card, ssh through USB port is working.

  Out of curiosity -- since that is the full X-window environment
version... Does the Jessie IoT release just below that one function with
SSH<>USB? It would, at least, be closer in terms of package lists (the
compressed file is half the size of the lxqt image, though that does still
make it 3X the size of your minimal...

  From your earlier description the minimal is setting up an IP for USB
connection -- but it is not enumerating to the host as a network device.
That probably means needing kernel driver modules of some form, so that
when the host probes the USB bus, the device responds with the codes for
network device. Building kernels is something out of my realm (heck, the
device tree is still a cryptic mish-mash to me). Comparing device trees
might reveal something...

  Don't recall if this site was mentioned in the prior messages...
https://developer.ridgerun.com/wiki/index.php/How_to_use_USB_device_networking
(granted -- that is focused on using the RidgeRun SDK to do the
development, but might identify some of what is needed).

  For a different board: http://linux-sunxi.org/USB_Gadget/Ethernet

  PI-Zero -- appears to assume the needed parts are in the SD card, and
just needs to be enabled:
https://learn.adafruit.com/turning-your-raspberry-pi-zero-into-a-usb-gadget/ethernet-gadget

  And another one -- Since I've not built kernels, I'm only guessing that
the "config" section is some sort of file/menu for selecting options...
https://blackfin.uclinux.org/doku.php?id=linux-kernel:usb-gadget:ethernet

Hi Dennis Lee,

Thank You very much for the guidance.

Based on the information provided by You, once more I built Kernel. Earlier I was using default kernel build Configuration. This time I changed some values as per http://processors.wiki.ti.com/index.php/UserGuideUsbDriver_PSP_04_02_00_07.

But still lsmod | grep usb_f* shows the same results as previous.

So I tried to include the modules g_mass_storage. It was successful. I also included the module g_multi. So with this now lsmod | grep usb_f* shows the following

debian@arm:~$ lsmod | grep usb_f*
usb_f_mass_storage 40983 2 g_mass_storage,g_multi
usb_f_acm 7202 2
u_serial 11889 3 usb_f_acm
usb_f_ecm 9635 2
usb_f_rndis 22162 3 g_multi
u_ether 11743 3 usb_f_ecm,g_multi,usb_f_rndis
libcomposite 42938 21 usb_f_ecm,g_mass_storage,usb_f_acm,usb_f_mass_storage,g_multi,usb_f_rndis
debian@arm:~$

But even after this ssh debian@192.168.7.2 is not working.

So I reboot and checked. But after rebooting, all this newly added modules disappears.

How can I include the modules in such a way that, it is available even after reboot?

I feel, if the Beaglebone drive appears, in Ubuntu Host, if BBB connect to it through USB cable, then ssh debian@192.168.7.2 also will work. But so far Beaglebone drive does not appear.

With the addition of all the required modules, now there is no difference between minimal image and the latest image (in terms of usb gadget). Why still ssh through USB not working?

Thanks in advance for the help.

Thanks & Regards,
Sajeevan.K

On Mon, 17 Apr 2017 23:30:50 -0700 (PDT), sajeevan k
<sajeevank@laxven.com> declaimed the
following:

So I reboot and checked. But after rebooting, all this newly added modules
disappears.

How can I include the modules in such a way that, it is available even
after reboot?

  Again, we are beyond my actual experience -- this is just an
hypothesis...

  Did you recreate the, uhm from memory, initramfs (or whatever the files
loaded by u-boot are called) containing your added modules? Did you build
the added modules has kernal built-in objects, or as loadable objects --
the latter would require running some command during start-up (systemctrl?
my experience is still the initd system)?

I feel, if the Beaglebone drive appears, in Ubuntu Host, if BBB connect to
it through USB cable, then ssh debian@192.168.7.2 also will work. But so
far Beaglebone drive does not appear.

  Even having the file system is no guarantee... file system and network
interfaces are separate enumerations on the USB bus.

Hi Dennis Lee,

Q: Did you build the added modules has kernal built-in objects, or as loadable objects ?

Also I am working on systemctrl and initd systems.

Initially I included all the loadable modules(g_mass_storage, usb_f_mass_storage and g_multi) in
/etc/modules-load.d/modules.conf

Then after reboot it is showing the following message:

[FAILED] Failed to start Load Kernel Modules
see ‘systemctl status systemd-modules-load.service’ for details.

systemctl status systemd-modules-load.service shows the following errors

debian@arm:~$ systemctl status systemd-modules-load.service
● systemd-modules-load.service - Load Kernel Modules
Loaded: loaded (/lib/systemd/system/systemd-modules-load.service; static; ven
Active: failed (Result: exit-code) since Sat 2016-05-21 22:31:30 UTC; 10 mont
Docs: man:systemd-modules-load.service(8)
man:modules-load.d(5)
Main PID: 103 (code=exited, status=1/FAILURE)

Warning: Journal has been rotated since unit was started. Log output is incomple
lines 1-8/8 (END)…skipping…
● systemd-modules-load.service - Load Kernel Modules
Loaded: loaded (/lib/systemd/system/systemd-modules-load.service; static; ven
Active: failed (Result: exit-code) since Sat 2016-05-21 22:31:30 UTC; 10 mont
Docs: man:systemd-modules-load.service(8)
man:modules-load.d(5)
Main PID: 103 (code=exited, status=1/FAILURE)

Warning: Journal has been rotated since unit was started. Log output is incomple

Hi Dennis,

Regarding this issue, now I included all the modules associated with Ethernet CDC as built in modules.

(For this I selected Ethernet CDC as USB Gadget driver, instead of M(Module), Y(Include) is selected for USB Gadget driver )

When I search for all build in modules with filters, it is showing the following results

debian@arm:/etc/network$ cat /lib/modules/$(uname -r)/modules.builtin | grep usb_f*
kernel/drivers/power/supply/axp20x_usb_power.ko
kernel/drivers/usb/gadget/function/usb_f_ecm.ko
kernel/drivers/usb/gadget/function/usb_f_ecm_subset.ko
kernel/drivers/usb/gadget/function/usb_f_rndis.ko
kernel/drivers/usb/musb/musb_hdrc.ko
kernel/drivers/usb/musb/musb_dsps.ko
kernel/drivers/usb/musb/musb_am335x.ko
debian@arm:/etc/network$

debian@arm:/etc/network$ cat /lib/modules/$(uname -r)/modules.builtin | grep g_ether
kernel/drivers/usb/gadget/legacy/g_ether.ko

debian@arm:/etc/network$ cat /lib/modules/$(uname -r)/modules.builtin | grep u_ether
kernel/drivers/usb/gadget/function/u_ether.ko

That means the modules g_ether, u_ether, usb_f_rndis, usb_f_ecm etc. are there and active in BBB.

Also /etc/network/interfaces is as follows.

auto lo
iface lo inet loopback

iface usb0 inet static
address 192.168.7.2
netmask 255.255.255.252
network 192.168.7.0
gateway 192.168.7.1

But still ssh debian@192.168.7.2 is not working. Is there anything more to be done for that?

Thanks in advance for the help.

Thanks & Regards,
Sajeevan.K

On Thu, 20 Apr 2017 06:06:04 -0700 (PDT), sajeevan k
<sajeevank@laxven.com> declaimed the
following:

*But still ssh debian@192.168.7.2 is not working. Is there anything more to
be done for that?Thanks in advance for the help.Thanks & Regards,Sajeevan.K*

  We are past the point where I can even make suggestions (everything I
find on Google seems oriented to USB as host, not client -- eg:
http://www.linux-usb.org/USB-guide/c607.html )

  The only thing left that I can think of is that you might need some of
the USB OTG functionality included...

Hi Dennis & Robert,

Thank You for Your guidance.

Finally I could make it working.
It is working in the kernel image in which “Ethernet CDC” is included as Built in module.(Used Y(include) instead of M(Module))

But rather than that, I think the issue was caused by some basics. Today morning I did the following.
One of these may be the reason for working.

  1. sudo apt-get update
  2. sudo apt-get install build-essential
  3. sudo apt-get install linux-headers-4.10.11-bone1
    4) Then in the /etc/network/interfaces of Ubuntu host I added the following lines

auto enp0s20f0u2
iface enp0s20f0u2 inet static

address 192.168.7.1
netmask 255.255.255.252
network 192.168.7.0
gateway 192.168.7.2

( where ```enp0s20f0u2 was the name of the interface coming when BBB is connected through USB port in Host system )`

  1. sudo ifconfig enp0s20f0u2 192.168.7.1 netmask 255.255.255.252
  2. sudo ifconfig enp0s20f0u2 up

I am new to both Linux and BBB. Expecting Your further support.

Thanks & Regards,
Sajeevan.K

On Thu, 20 Apr 2017 23:50:17 -0700 (PDT), sajeevan k
<sajeevank@laxven.com> declaimed the
following:

4) Then in the /etc/network/interfaces of Ubuntu host I added the following
lines

auto enp0s20f0u2
iface enp0s20f0u2 inet static

   address 192.168.7.1
   netmask 255.255.255.252
   network 192.168.7.0
   gateway 192.168.7.2

( where enp0s20f0u2 was the name of the interface coming when BBB is
connected through USB port in Host system )

  I might suspect that there is still a misconfigured parameter on the
BBB -- something defining what the USB-network is supposed to identify as
during USB enumeration. What you have looks suspiciously like the raw
enumeration path (bus, port, unit, maybe some other layers).

  Again, I'm just guessing at this point.

Hi Dennis,

I am also suspicious about the USB gadgets in BBB.

To get a clarification, I again took a kernel image with default configuration.

And I did all the procedures, which I have done for making Ethernet CDC image (as mentioned in the previous mail). But ssh debian@192.168.7.2 was not working with that image.

I included all the modules required g_ether, g_mass_storage and g_multi with modprobe command. And I verified by lsmod command. But still ssh debian@192.168.7.2 was not working.

That means it is only working with Ethernet CDC image (in which kernel configuration is modified to include Ethernet CDC related modules as built in Modules).

So I think, some more clarifications and detailed documentations is required on this matter, which would help the users like me.

Thanks & Regards,
Sajeevan.K