Raspberry Zero to USB at Linux
s
p
ri
n
SD card formating and flashing
Preparing SD with Etcher
Preparing SD with Etcher
https://desertbot.io/blog/ssh-into-pi-zero-over-usb
Changes in boot folder files of SD card
Step 4. Edit config.txt
In the root folder of the SD card, open config.txt(/Volumes/boot/config.txt) in a text editor
Append this line to the bottom of it:dtoverlay=dwc2
Save the file
Step 5. Edit cmdline.txt
In the root folder of the SD card, open cmdline.txt(/Volumes/boot/cmdline.txt) in a text editor
After rootwait, append this text leaving only one space between rootwait and the new text (otherwise
it might not be parsed correctly):modules-load=dwc2,g_ether
If there was any text after the new text make sure that there is only one space between that
text and the new text
Save the file
On a fresh image that has never been booted, you may see extra text after rootwait. But if you boot
the pi from the disk at least once, that extra text may go away. That is why you must put the new
text directly after rootwait - so it doesn't get accidentally deleted.
Setting for USB _Ethernet
Settings for ssh file in Boot folder of SD
Card
#In your SD card Boot folder
sudo chmod 755 ssh
Connecting to Raspberry Zero
sudo ssh pi@raspberrypi.local
Using vcnserver at
raspberry terminal
Setting in Pi for changing it’s IP
#Reffrence: https://cdn-learn.adafruit.com/downloads/pdf/turning-your-raspberry-pi-zero-into-a-usb-gadget.pdf
sudo nano /etc/network/interfaces
#AND in Opend file add this texts at the end of file:
allow-hotplug wlan1
iface wlan1 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
allow-hotplug usb0
iface usb0 inet static
address 192.168.7.2
netmask 255.255.255.0
network 192.168.7.0
broadcast 192.168.7.255
gateway 192.168.7.1
USB Ethernet setting in Linux PC
New Connecting to PI
sudo ssh pi@192.168.7.2
Enablig internet to PI With USB Ethernet
Restart Raspberry Pi and In Raspberry consol do this:
sudo ifconfig usb0 192.168.7.2
sudo route add default gw 192.168.7.1
Enablig internet to PI With USB Ethernet
In Your Linux PC console do this:
#wlp2s0 is my internet facing interface, enp0s20f0u2 is the Raspberry USB
connection
sudo ifconfig enp0s20f0u2 192.168.7.1
sudo iptables --table nat --append POSTROUTING --out-interface wlp2s0 -j
MASQUERADE
sudo iptables --append FORWARD --in-interface enp0s20f0u2 -j ACCEPT
sudo echo 1 > /proc/sys/net/ipv4/ip_forward
Troubleshuting internet to PI With USB
Ethernet
If you can’t conect to Pi with this comand:
sudo ssh pi@192.168.7.2
So do this cammand ant again try:
sudo ip link set br0 down
Installing LCD 5 Inch but not working!!!
pi@raspberrypi:~ $ sudo apt-get install xserver-xorg-input-evdev
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be upgraded:
xserver-xorg-input-evdev
1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
Need to get 117 kB of archives.
After this operation, 1,024 B of additional disk space will be used.
Err:1 http://raspbian.mirror.net.in/raspbian/raspbian stretch/main armhf xserver-xorg-input-evdev armhf 1:2.10.5-1
503 Service Unavailable
E: Failed to fetch http://raspbian.mirror.net.in/raspbian/raspbian/pool/main/x/xserver-xorg-input-evdev/xserver-xorg-input-evdev_2.10.5-1_armhf.deb 503 Service Unavailable
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
pi@raspberrypi:~ $ sudo apt-get update
Get:1 http://raspbian.raspberrypi.org/raspbian stretch InRelease [15.0 kB]
Get:2 http://archive.raspberrypi.org/debian stretch InRelease [25.4 kB]
Get:3 http://raspbian.raspberrypi.org/raspbian stretch/main armhf Packages [11.7 MB]
Get:4 http://archive.raspberrypi.org/debian stretch/main armhf Packages [221 kB]
Get:5 http://archive.raspberrypi.org/debian stretch/ui armhf Packages [45.0 kB]
Get:6 http://raspbian.raspberrypi.org/raspbian stretch/non-free armhf Packages [95.5 kB]
Fetched 12.1 MB in 1min 17s (157 kB/s)
Reading package lists... Done
pi@raspberrypi:~ $ sudo apt-get install xserver-xorg-input-evdev
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be upgraded:
xserver-xorg-input-evdev
1 upgraded, 0 newly installed, 0 to remove and 52 not upgraded.
1 not fully installed or removed.
Need to get 117 kB of archives.
After this operation, 1,024 B of additional disk space will be used.
Get:1 http://raspbian.mirror.net.in/raspbian/raspbian stretch/main armhf xserver-xorg-input-evdev armhf 1:2.10.5-1 [117 kB]
Fetched 117 kB in 4s (25.2 kB/s)
Reading changelogs... Done
(Reading database ... 80898 files and directories currently installed.)
Preparing to unpack .../xserver-xorg-input-evdev_1%3a2.10.5-1_armhf.deb ...
Unpacking xserver-xorg-input-evdev (1:2.10.5-1) over (1:2.10.3-1) ...
Setting up xserver-xorg-input-evdev (1:2.10.5-1) ...
Processing triggers for man-db (2.7.6.1-2) ...
pi@raspberrypi:~ $ sudo apt-get install xserver-xorg-input-evdev
Reading package lists... Done
Building dependency tree
Reading state information... Done
xserver-xorg-input-evdev is already the newest version (1:2.10.5-1).
0 upgraded, 0 newly installed, 0 to remove and 52 not upgraded.

Raspberry zero usb in linux

  • 1.
    Raspberry Zero toUSB at Linux s p ri n
  • 2.
    SD card formatingand flashing
  • 3.
  • 4.
  • 5.
  • 6.
    Changes in bootfolder files of SD card Step 4. Edit config.txt In the root folder of the SD card, open config.txt(/Volumes/boot/config.txt) in a text editor Append this line to the bottom of it:dtoverlay=dwc2 Save the file Step 5. Edit cmdline.txt In the root folder of the SD card, open cmdline.txt(/Volumes/boot/cmdline.txt) in a text editor After rootwait, append this text leaving only one space between rootwait and the new text (otherwise it might not be parsed correctly):modules-load=dwc2,g_ether If there was any text after the new text make sure that there is only one space between that text and the new text Save the file On a fresh image that has never been booted, you may see extra text after rootwait. But if you boot the pi from the disk at least once, that extra text may go away. That is why you must put the new text directly after rootwait - so it doesn't get accidentally deleted.
  • 7.
    Setting for USB_Ethernet
  • 8.
    Settings for sshfile in Boot folder of SD Card #In your SD card Boot folder sudo chmod 755 ssh
  • 9.
  • 10.
  • 11.
    Setting in Pifor changing it’s IP #Reffrence: https://cdn-learn.adafruit.com/downloads/pdf/turning-your-raspberry-pi-zero-into-a-usb-gadget.pdf sudo nano /etc/network/interfaces #AND in Opend file add this texts at the end of file: allow-hotplug wlan1 iface wlan1 inet manual wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf allow-hotplug usb0 iface usb0 inet static address 192.168.7.2 netmask 255.255.255.0 network 192.168.7.0 broadcast 192.168.7.255 gateway 192.168.7.1
  • 12.
  • 13.
  • 14.
    Enablig internet toPI With USB Ethernet Restart Raspberry Pi and In Raspberry consol do this: sudo ifconfig usb0 192.168.7.2 sudo route add default gw 192.168.7.1
  • 15.
    Enablig internet toPI With USB Ethernet In Your Linux PC console do this: #wlp2s0 is my internet facing interface, enp0s20f0u2 is the Raspberry USB connection sudo ifconfig enp0s20f0u2 192.168.7.1 sudo iptables --table nat --append POSTROUTING --out-interface wlp2s0 -j MASQUERADE sudo iptables --append FORWARD --in-interface enp0s20f0u2 -j ACCEPT sudo echo 1 > /proc/sys/net/ipv4/ip_forward
  • 16.
    Troubleshuting internet toPI With USB Ethernet If you can’t conect to Pi with this comand: sudo ssh [email protected] So do this cammand ant again try: sudo ip link set br0 down
  • 17.
    Installing LCD 5Inch but not working!!! pi@raspberrypi:~ $ sudo apt-get install xserver-xorg-input-evdev Reading package lists... Done Building dependency tree Reading state information... Done The following packages will be upgraded: xserver-xorg-input-evdev 1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 1 not fully installed or removed. Need to get 117 kB of archives. After this operation, 1,024 B of additional disk space will be used. Err:1 http://raspbian.mirror.net.in/raspbian/raspbian stretch/main armhf xserver-xorg-input-evdev armhf 1:2.10.5-1 503 Service Unavailable E: Failed to fetch http://raspbian.mirror.net.in/raspbian/raspbian/pool/main/x/xserver-xorg-input-evdev/xserver-xorg-input-evdev_2.10.5-1_armhf.deb 503 Service Unavailable E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing? pi@raspberrypi:~ $ sudo apt-get update Get:1 http://raspbian.raspberrypi.org/raspbian stretch InRelease [15.0 kB] Get:2 http://archive.raspberrypi.org/debian stretch InRelease [25.4 kB] Get:3 http://raspbian.raspberrypi.org/raspbian stretch/main armhf Packages [11.7 MB] Get:4 http://archive.raspberrypi.org/debian stretch/main armhf Packages [221 kB] Get:5 http://archive.raspberrypi.org/debian stretch/ui armhf Packages [45.0 kB] Get:6 http://raspbian.raspberrypi.org/raspbian stretch/non-free armhf Packages [95.5 kB] Fetched 12.1 MB in 1min 17s (157 kB/s) Reading package lists... Done pi@raspberrypi:~ $ sudo apt-get install xserver-xorg-input-evdev Reading package lists... Done Building dependency tree Reading state information... Done The following packages will be upgraded: xserver-xorg-input-evdev 1 upgraded, 0 newly installed, 0 to remove and 52 not upgraded. 1 not fully installed or removed. Need to get 117 kB of archives. After this operation, 1,024 B of additional disk space will be used. Get:1 http://raspbian.mirror.net.in/raspbian/raspbian stretch/main armhf xserver-xorg-input-evdev armhf 1:2.10.5-1 [117 kB] Fetched 117 kB in 4s (25.2 kB/s) Reading changelogs... Done (Reading database ... 80898 files and directories currently installed.) Preparing to unpack .../xserver-xorg-input-evdev_1%3a2.10.5-1_armhf.deb ... Unpacking xserver-xorg-input-evdev (1:2.10.5-1) over (1:2.10.3-1) ... Setting up xserver-xorg-input-evdev (1:2.10.5-1) ... Processing triggers for man-db (2.7.6.1-2) ... pi@raspberrypi:~ $ sudo apt-get install xserver-xorg-input-evdev Reading package lists... Done Building dependency tree Reading state information... Done xserver-xorg-input-evdev is already the newest version (1:2.10.5-1). 0 upgraded, 0 newly installed, 0 to remove and 52 not upgraded.