1

I have:

  1. Raspberry pi zero with one micro HDMI port and 2 microUSB (1 for power and the other for general purposes)
  2. One Power Supply 2.1A (which I thought should be connected to the power microUSB
  3. One microUSB to USB adapter that would be connected to the other microUSB
  4. One USB to ethernet adapter, which would be connected with the other adapter
  5. One ethernet cable which is connected to 4 and to the router

My final connection is like this image below: Raspberry connected to router with microUSB to USB, USB to ethernet and ethernet cable image from here

I wanted to ssh the raspberry first and then I could install pi hole, but I don't know what I need to do. If you have any tutorial to follow I would do it happily.

I have done some tests at the adapters, details below:

  • When I connect my laptop with USB to ethernet adaptor connected with the ethernet cable connected to router, I have internet connection.
  • When I connect the raspberry with the MicroUSB to USB adaptor with a usb mouse, I can use the GUI of Raspbian. (this test was done with the configurations of usb connection below)

Now since I couldn't ssh my raspberry over lan (like image above), I mistakenly thought that if I configure it to work connected with my laptop (like image below) it would be the same with the other connection

raspberry connected to laptop over USB

What I have done to connect the raspberry to laptop over USB is:

  1. Flashed a microSD with the latest Raspbian
  2. Changed at microSD
    1. Added at config.txt the: dtoverlay=dwc2
    2. Added at microSD cmdline.txt after rootwait the: modules-load=dwc2,g_ether
    3. Created ssh file
  3. Then I connected my laptop over USB (with a microUSB to USD cable)
  4. I connected to raspberry by ssh [email protected] and changed the /etc/network/interfaces file to the following:
# interfaces(5) file used by ifup(8) and ifdown(8)

# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'

# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

auto lo usb0
iface lo inet loopback

iface eth0 inet manual

allow-hotplug wlan0
iface wlan0 inet manual
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

allow-hotplug wlan1
iface wlan1 inet manual
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

allow-hotplug usb0
iface usb0 inet manual
  1. I configured my laptop to share internet to RNDIS/Ethernet
  2. Reboot raspberry and when I reconnected again I had internet at my raspberry

Since the raspberry connection with my laptop was the only successful ssh attempt I executed lsusb and sudo lsusb -v at that connection (response of these execution below). This is the reason that @Andrew and @Jaromanda X were telling that there isn't any ethernet adapter. I didn't manage to ssh the raspberry with the desired (first image) connection

The response of lsusb is below:

pi@raspberrypi:~ $ lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

also

pi@raspberrypi:~ $ sudo lsusb -v

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            9 Hub
  bDeviceSubClass         0
  bDeviceProtocol         1 Single TT
  bMaxPacketSize0        64
  idVendor           0x1d6b Linux Foundation
  idProduct          0x0002 2.0 root hub
  bcdDevice            5.10
  iManufacturer           3 Linux 5.10.17+ dwc2_hsotg
  iProduct                2 DWC OTG Controller
  iSerial                 1 20980000.usb
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength       0x0019
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0xe0
      Self Powered
      Remote Wakeup
    MaxPower                0mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         9 Hub
      bInterfaceSubClass      0
      bInterfaceProtocol      0 Full speed (or root) hub
      iInterface              0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0004  1x 4 bytes
        bInterval              12
Hub Descriptor:
  bLength               9
  bDescriptorType      41
  nNbrPorts             1
  wHubCharacteristic 0x0008
    Ganged power switching
    Per-port overcurrent protection
    TT think time 8 FS bits
  bPwrOn2PwrGood        1 * 2 milli seconds
  bHubContrCurrent      0 milli Ampere
  DeviceRemovable    0x00
  PortPwrCtrlMask    0xff
 Hub Port Status:
   Port 1: 0000.0000
can't get device qualifier: Resource temporarily unavailable
can't get debug descriptor: Resource temporarily unavailable
Device Status:     0x0001
  Self Powered

I understood the the following configuration was wrong for the connection of the first image and I tried to configure the /etc/dhcpcd.conf that is proposed here and here. So from the above configuration I did the following:

  1. ssh my raspberry connected to my laptop
  2. Addded the following lines at /etc/dhcpcd.conf
interface eth0
static ip_address=192.168.1.21/24    
static routers=192.168.1.1
static domain_name_servers=192.168.1.1 8.8.8.8
  1. Reverted /etc/network/interfaceschanges
  2. Extracted microSD and reverted the changes at config.txt and cmdline.txt
  3. Connected my raspberry with router using the 2 adapters (see first image) and I couldn't see my raspberry from my router

So even with that my raspberry zero could obtain ip to access the local network and the internet over all. What am I missing?

5
  • I think you have a couple of issues - the modules-load=dwc2,g_ether is to turn the USB port into an Ethernet over USB for connecting to USB ports on other computers. It may not be needed if you are using an USB to Ethernet adapter. Second, network/interfaces is not really used in Buster as that's configured via dhcpcd.conf . You need to find out if the USB / Ethernet adapter is recognised by Linux - start with posting the output of lsusb into your question so we can see if drivers are available.
    – user130616
    Apr 14, 2021 at 17:05
  • @Andrew thank you for trying to help me. I have tried without modules-load=dwc2,g_ether as proposed here. I have also tried without any change at /etc/network/interfaces. Finally, I have updated the question with the response of lsusb Apr 14, 2021 at 18:47
  • The output of lsusb shows that the USB to Ethernet device is not recognised by the Pi at all - possible cabling or port issue. The Zero / Zero W boards only have one USB port (the one closest to the CPU / HDMI port) - the other (nearest the corner) is power only. Without an entry for the device you are stuck.
    – user130616
    Apr 14, 2021 at 20:25
  • I am not an expert of that, but when I connect my raspberry with my laptop I can access it with this command ssh [email protected], so probably the port is working except if I don't understand something. Also, ethernet cable with usb to ethernet works when I connect them to my laptop. Finally, when I use Micro USB to usb adaptor with a usb mouse, I can use the GUI of Raspbian. I don't think it is a hardware issue, maybe a driver or a missing configuration. Thanks again for your time Apr 14, 2021 at 20:46
  • the fact that nothing comes up on lsusb other than the root hub means that the device isn't even there as far as the pi is concerned - check the functionality of the microUSB to USB adapter by plugging in a known good device (a USB thumb drive should be fine) - if that is recognised by the pi, then perhaps the USB ethernet dongle is dead - I mean, even if the pi couldn't use it, it should still "see" it is attached ... does the output of dmesg perhaps show anything? Apr 14, 2021 at 22:54

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.