Sommanker
Posts: 7
Joined: Thu Mar 01, 2018 9:29 pm

Getting Wi-Fi to work (Pi Zero)

Thu Mar 01, 2018 9:45 pm

Hi, I've been trying for weeks at this point to get Wi-Fi to work on my Pi Zero, with no success.
I'm using a usb wireless dongle, chipset 148f:7601, (it's the old Zero, not the Zero W with inbuilt wireless card), and a fresh install of whatever the heck I can get to work. I've tried DietPi, the latest version of Raspbian, and the lite version, as well as an older version of Stretch and what I think was the last version of Jessie.
From what I've read online, I think it's a problem with the wireless dongle's drivers - I've tried several drivers from online, I've tried installing the firmware-ralink package and firmware-misc-nonfree, each to no effect.

I've tried reinstalling several times, changing things in dchcp.conf, wpa_supplicant.conf and /etc/network/interfaces.
It does show up in when I do lsusb.
On Stretch, it recognises it, ifup returns, and wlan0 exists but it can't connect to the internet, and I get wpa_supplicant errors.
On Jessie, it tells me wlan0 doesn't even exist. I do ifconfig, and the loopback interface is the only one recognised.
/etc/wpa_supplicant/wpa_supplicant.conf looks like
network={
ssid="myssid"
psk="mypassword"
}

obviously where those two are my real ssid and password.
/etc/network/interfaces looks like

auto lo
iface lo inet loopback
allow-hotplug wlan0
auto wlan0
iface wlan0 inet dhcp


And I've tried various other suggestions like including wpa-supplicant, setting wpa-ssid and wpa-psk in this file too, setting wlan1 and eth0, and various other combinations.

Hopefully somebody knows how to help me, I'm getting pretty desperate - and I'm not very experienced in linux at all, so try not to make it too complicated.
I also, obviously, don't have any way to connect this to the internet, which makes installing packages or updates all the more awkward, as I can't do apt-get or git clone or anything of that sort.

Thanks in advance! :)

jbudd
Posts: 686
Joined: Mon Dec 16, 2013 10:23 am

Re: Getting Wi-Fi to work (Pi Zero)

Fri Mar 02, 2018 12:50 am

There used to be a list of compatible USB wifi dongles somewhere but I don't know if it has been kept up to date.

With Raspbian Stretch, /etc/network/interfaces should contain

Code: Select all

# 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
/etc/wpa_supplicant/wpa_supplicant.conf should contain (the 3 lines at the top are important. You can change GB to your country code if you like - it affects which wifi channels are available)

Code: Select all

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=GB


network={
        ssid="your ssid"
        psk="your wpa2 key"
}

User avatar
HawaiianPi
Posts: 2670
Joined: Mon Apr 08, 2013 4:53 am
Location: Aloha, Oregon USA

Re: Getting Wi-Fi to work (Pi Zero)

Fri Mar 02, 2018 1:19 am

I use a PcDuino USB WiFi dongle which works with Raspbian by default (no additional drivers needed). They are available on ebay for less than 4 bucks from China with slow shipping, or from various online dealers for $6-$10.

I combined mine with a tiny OTG adapter that slips inside the USB plug.
Image
It's based on the RT5370 wireless chipset.
Image

I like the open circuit board look, as it matches the Pi Zero nicely. However, there are other Raspbian compatible nano-dongle style WiFi adapters available for similar pricing (or sometimes even less) from various Raspberry Pi dealers.
My mind is like a browser. 27 tabs are open, 9 aren't responding,
lots of pop-ups...and where is that annoying music coming from?

User avatar
Lob0426
Posts: 2197
Joined: Fri Aug 05, 2011 4:30 pm
Location: Susanville CA.
Contact: Website

Re: Getting Wi-Fi to work (Pi Zero)

Fri Mar 02, 2018 2:45 am

I have had nothing but good operation from WiPi dongles. They are $4.50 + $3.99 shipping at amazon. They do not need any additional drivers from any of the Raspbian versions so far! I have used them on B 1.0, B1.2, B+, A+, and 2B's

https://www.amazon.com/Wi-Pi-Raspberry- ... words=wipi
512MB version 2.0 as WordPress Server
Motorola Lapdock with Pi2B
Modded Rev 1.0 with pin headers at USB

http://rich1.dyndns.tv/
(RS)Allied ships old stock to reward its Customers for long wait!

Sommanker
Posts: 7
Joined: Thu Mar 01, 2018 9:29 pm

Re: Getting Wi-Fi to work (Pi Zero)

Fri Mar 02, 2018 10:33 am

Alright, so if it comes to it I'll buy another, but I'd much rather not have to buy another one.
Is there any way I can make this one work?

User avatar
HawaiianPi
Posts: 2670
Joined: Mon Apr 08, 2013 4:53 am
Location: Aloha, Oregon USA

Re: Getting Wi-Fi to work (Pi Zero)

Fri Mar 02, 2018 11:26 am

Sommanker wrote:
Thu Mar 01, 2018 9:45 pm
...
I also, obviously, don't have any way to connect this to the internet, which makes installing packages or updates all the more awkward, as I can't do apt-get or git clone or anything of that sort.

Thanks in advance! :)
I can't help you with the drivers, but I can help you with the problem I of no Internet access. Setup your Pi Zero as a USB Gadget.

USB Gadget mode turns the Pi Zero into a USB Ethernet/RNDIS Gadget network adapter. You can then use Zeroconf to SSH into raspberrypi.local, then you can share your Internet connection with the USB Ethernet gadget (ICS) and use VNC remote desktop (after turning on that service).
  1. Grab the latest Raspbian image from https://www.raspberrypi.org/downloads/raspbian/
  2. Grab the Etcher software from https://etcher.io/
  3. Install Etcher and use it to write the Raspbian image to your SD card.
    • You don't need to extract the image or format the card prior to writing.
    • Just choose the Raspbian .zip you downloaded, pick your SD card and write.
    • If you have trouble, verify the SHA256 checksum of the download.
  4. Remove and reinsert the SD card so that your Windows or Mac PC can see the small FAT32 partition on the SD card (labelled "boot").
    • If you get a message telling you the card must be formatted, cancel it.
  5. On the small FAT32 "boot" partition, create a file with the name ssh (or ssh.txt). It can be empty, the contents don't matter.
Now you'll need to edit 2 existing files.
Add this to the end of config.txt as a new line: dtoverlay=dwc2
Add this to the end of cmdline.txt after rootwait (with a single space between) without creating a new line: modules-load=dwc2,g_ether
Make sure you use a pure text editor like Notepad++ on those files, and that cmdline.txt is one long single line (no breaks).

All of these files are on the small FAT32 partition that is accessible to Windows/Mac computers (not in any folder).

That configures the Pi Zero to use USB Gadget mode, now to simplify your SSH/VNC connection you'll want the Zeroconf network service to resolve hostnames. For Windows you can install Apple's iTunes, Bonjour or Quicktime, but if you don't want to install unnecessary stuff, use WinRAR or 7-Zip to extract the Bonjour installer into a folder, and just install Bonjour.msi (32 bit) or Bonjour64.msi for the Zeroconf network service.

Now safely eject the SD card from your computer and install it into the slot on the Pi Zero. Next get a standard micro-USB cable and connect that to the USB data port of the Pi Zero (the one closer to the HDMI port), and don't connect anything to the other USB port. Finally, plug the other end of the micro-USB cable into your main (Windows/Mac) computer and the Pi Zero should start booting (green activity LED will flash intermittently).

Give the little Pi a minute or so to boot and you should be able to SSH into [email protected] from your main PC.

If you have trouble, check device manager and make sure your Pi Zero shows up as a USB Ethernet/RNDIS Gadget network adapter.
Image
If that's not what you see, then something is wrong with your Windows system, as that's what should get installed automatically.

If all has gone well you can share your Internet connection from your main PC with the USB Gadget to give 'net access to your little Pi. If you want remote desktop control, use the raspi-config utility to turn on the VNC server (sudo raspi-config) and then install RealVNC Viewer on your main PC.
My mind is like a browser. 27 tabs are open, 9 aren't responding,
lots of pop-ups...and where is that annoying music coming from?

jbudd
Posts: 686
Joined: Mon Dec 16, 2013 10:23 am

Re: Getting Wi-Fi to work (Pi Zero)

Fri Mar 02, 2018 11:38 am

Is there any way I can make this one work?
Use the latest Raspbian, not Jessie. More and more USB dongle drivers have been included in each release.

Don't change /etc/network/interfaces.
On Stretch, it recognises it, ifup returns, and wlan0 exists but it can't connect to the internet, and I get wpa_supplicant errors.
What errors?

Sommanker
Posts: 7
Joined: Thu Mar 01, 2018 9:29 pm

Re: Getting Wi-Fi to work (Pi Zero)

Fri Mar 02, 2018 10:54 pm

What errors?
On a fresh install of the latest version of Raspbian Stretch, everything unchanged with the exception of /etc/wpa_supplicant/wpa_supplicant.conf which i edited to contain:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
ap_scan=1
update_config=1
network={
ssid="myssid"
psk="mypassword"
}
where "myssid" and "mypassword" are my actual ssid and password.



After editing that, I rebooted and plugged in the usb wifi dongle.
lsusb lists it as:
Bus 001 Device 026: ID 148f:7601 Ralink Technology, Corp. MT7601U Wireless Adapter
ifup wlan0 returns:
ifup: unknown interface wlan0
ifconfig returns:
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1 (Local Loopback)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
systemctl status wpa_supplicant.service returns
wpa_supplicant.service - WPA supplicant
Loaded: loaded (/lib/systemd/system/wpa_supplicant.service; disabled; vendor preset: enabled)
Active: inactive (dead)
Hope that helps as a starting point? :)

USB Gadget mode turns the Pi Zero into a USB Ethernet/RNDIS Gadget network adapter. You can then use Zeroconf to SSH into raspberrypi.local, then you can share your Internet connection with the USB Ethernet gadget (ICS) and use VNC remote desktop (after turning on that service).
That looks like a very good idea, thanks for the suggestion and instructions :) - I'm going to try to get it to work normally first anyway, mainly since I don't want to have to sacrifice a USB port, and I'd really like to know what I've been doing wrong.
If I can't, though, and give up, this is definitely what I'll do.

User avatar
davidcoton
Posts: 3125
Joined: Mon Sep 01, 2014 2:37 pm
Location: Cambridge, UK

Re: Getting Wi-Fi to work (Pi Zero)

Fri Mar 02, 2018 11:43 pm

I'm not an expert, but I think this line may be wrong:

Code: Select all

ap_scan=1
The usual incantation is:

Code: Select all

scan_ssid=1
"Thanks for saving my life." See https://www.raspberrypi.org/forums/viewtopic.php?p=1327656#p1327656
“Raspberry Pi is a trademark of the Raspberry Pi Foundation”

jbudd
Posts: 686
Joined: Mon Dec 16, 2013 10:23 am

Re: Getting Wi-Fi to work (Pi Zero)

Sat Mar 03, 2018 12:51 am

This is your wpa_supplicant.conf

Code: Select all

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
ap_scan=1
update_config=1
network={
ssid="myssid"
psk="mypassword"
}

And this is the wpa_supplicant.conf that always works for me. Did you try it?

Code: Select all

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=GB


network={
        ssid="your ssid"
        psk="your wpa2 key"
}


I think this is misleading. ap_scan and scan_ssid are related but different
I'm not an expert, but I think this line may be wrong:

Code: Select all

ap_scan=1

The usual incantation is:

Code: Select all

scan_ssid=1

Here is some documentation about ap_scan. It's all dutch to me. Luckily I have never had to use it

Code: Select all

# AP scanning/selection
# By default, wpa_supplicant requests driver to perform AP scanning and then
# uses the scan results to select a suitable AP. Another alternative is to
# allow the driver to take care of AP scanning and selection and use
# wpa_supplicant just to process EAPOL frames based on IEEE 802.11 association
# information from the driver.
# 1: wpa_supplicant initiates scanning and AP selection; if no APs matching to
#    the currently enabled networks are found, a new network (IBSS or AP mode
#    operation) may be initialized (if configured) (default)
# 0: driver takes care of scanning, AP selection, and IEEE 802.11 association
#    parameters (e.g., WPA IE generation); this mode can also be used with
#    non-WPA drivers when using IEEE 802.1X mode; do not try to associate with
#    APs (i.e., external program needs to control association). This mode must
#    also be used when using wired Ethernet drivers (including MACsec).
# 2: like 0, but associate with APs using security policy and SSID (but not
#    BSSID); this can be used, e.g., with ndiswrapper and NDIS drivers to
#    enable operation with hidden SSIDs and optimized roaming; in this mode,
#    the network blocks in the configuration file are tried one by one until
#    the driver reports successful association; each network block should have
#    explicit security policy (i.e., only one option in the lists) for
#    key_mgmt, pairwise, group, proto variables
# Note: ap_scan=2 should not be used with the nl80211 driver interface (the
# current Linux interface). ap_scan=1 is optimized work working with nl80211.
# For finding networks using hidden SSID, scan_ssid=1 in the network block can
# be used with nl80211.
# When using IBSS or AP mode, ap_scan=2 mode can force the new network to be
# created immediately regardless of scan results. ap_scan=1 mode will first try
# to scan for existing networks and only if no matches with the enabled
# networks are found, a new IBSS or AP mode network is created.
If your router ssid is hidden then you will need scan_ssid=1 in the network block.
If you use any other than WPA/WPA2 encryption then you may need other lines in the network block too.

Sommanker
Posts: 7
Joined: Thu Mar 01, 2018 9:29 pm

Re: Getting Wi-Fi to work (Pi Zero)

Sat Mar 03, 2018 8:37 am

I have just tried
And this is the wpa_supplicant.conf that always works for me. Did you try it?

Code: Select all

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=GB


network={
        ssid="your ssid"
        psk="your wpa2 key"
}
]
With the
ap_scan=1
line and without, in case.
Nothing changed.
Note that the file I was using before was exactly as it came installed, only with the network={ block added - I didn't change anything else before this.
I'm not 100% sure the problem lies with wpa_supplicant (though it still could, I suppose) - since it says that lo is the only interface that exists, if wpa_supplicant was working, I'd still have no wlan0 interface, wouldn't I?

Edit: My SSID is not hidden and I use WPA2 encryption.

jbudd
Posts: 686
Joined: Mon Dec 16, 2013 10:23 am

Re: Getting Wi-Fi to work (Pi Zero)

Sat Mar 03, 2018 7:04 pm

it says that lo is the only interface that exists
But in your first post you said
On Stretch, it recognises it, ifup returns, and wlan0 exists but it can't connect to the internet


I confess I'm mystified.

At one time there were issues with the Ralink 148f:7601 and @MrEngman posted drivers at http://www.fars-robotics.net/
However, there is nothing for the latest Raspbian (uname -r shows 4.9.59+) so I take it that the drivers are now included with Raspbian.
There is some discussion regarding Jessie here viewtopic.php?f=28&t=160246

Not very relevant, but I dug out an old Pi which has no wifi, burned Raspbian Lite and tested it with Edimax EW-78811UN, TP-Link TL-WN722N, Netgear WNA1000M and TP-Link TL-WL725N dongles. I have no idea what chipset these have, but they all connected to my wifi without a problem. I do recall problems with the TL-WL725N on a older release of Raspbian.

I have seen suggestions that IPv6 can cause wifi problems with the TL-WN725N. viewtopic.php?t=197378 and https://scribles.net/disabling-ipv6-ker ... n-stretch/
Maybe it's worth seeing if disabling IPv6 helps for you.
.
Maybe it's time to get a new Wifi dongle - they only cost the same as a new Pi Zero! Or get a Zero W

Sommanker
Posts: 7
Joined: Thu Mar 01, 2018 9:29 pm

Re: Getting Wi-Fi to work (Pi Zero)

Sat Mar 03, 2018 7:22 pm

it says that lo is the only interface that exists
But in your first post you said
On Stretch, it recognises it, ifup returns, and wlan0 exists but it can't connect to the internet
That was in Raspbian Lite (also latest version), this was in non-Lite.
Maybe it's time to get a new Wifi dongle
That's why this is so painful,. I bought this like two weeks ago specifically for this purpose, and I can't really justify returning it given that there's nothing wrong with it - it works fine on Windows.

If disabling IPv6 doesn't work, I'll probably use it as a gadget and use SSH like the other guy suggested.
Edit: didn't make a difference.
Last edited by Sommanker on Sat Mar 03, 2018 7:28 pm, edited 1 time in total.

jbudd
Posts: 686
Joined: Mon Dec 16, 2013 10:23 am

Re: Getting Wi-Fi to work (Pi Zero)

Sat Mar 03, 2018 7:26 pm

The script I use to set up new Pi's (not the one I tested above) uses a different method to disable ipv6

Code: Select all

echo "net.ipv6.conf.all.disable_ipv6 = 1" | sudo tee -a /etc/sysctl.conf 
echo "net.ipv6.conf.default.disable_ipv6 = 1" | sudo tee -a /etc/sysctl.conf
echo "net.ipv6.conf.lo.disable_ipv6 = 1" | sudo tee -a /etc/sysctl.conf 
sudo sysctl -p

Sommanker
Posts: 7
Joined: Thu Mar 01, 2018 9:29 pm

Re: Getting Wi-Fi to work (Pi Zero)

Sat Mar 03, 2018 7:30 pm

I added it to the blacklist as in one of the links you put above, and it's not in lsmod, so I think it disabled it, but it didn't make any difference :(

User avatar
davidcoton
Posts: 3125
Joined: Mon Sep 01, 2014 2:37 pm
Location: Cambridge, UK

Re: Getting Wi-Fi to work (Pi Zero)

Sat Mar 03, 2018 9:10 pm

Have you tried rebooting the router/AP?
"Thanks for saving my life." See https://www.raspberrypi.org/forums/viewtopic.php?p=1327656#p1327656
“Raspberry Pi is a trademark of the Raspberry Pi Foundation”

User avatar
DougieLawson
Posts: 33631
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: Getting Wi-Fi to work (Pi Zero)

Sat Mar 03, 2018 9:24 pm

jbudd wrote:
Sat Mar 03, 2018 7:26 pm
The script I use to set up new Pi's (not the one I tested above) uses a different method to disable ipv6

Code: Select all

echo "net.ipv6.conf.all.disable_ipv6 = 1" | sudo tee -a /etc/sysctl.conf 
echo "net.ipv6.conf.default.disable_ipv6 = 1" | sudo tee -a /etc/sysctl.conf
echo "net.ipv6.conf.lo.disable_ipv6 = 1" | sudo tee -a /etc/sysctl.conf 
sudo sysctl -p
That's the recommended way to disable IPv6.

But, what purpose does disabling IPv6 have? Even without a route advertiser (radvd daemon) and a globally unique prefix/address (2001:: or 2E00::), IPv6 with fe80:: link local addresses are not on the same network layer as the WiFi hardware layer so can't have any effect on the hardware getting associated with the access point. The network layers are deliberately seperated from one another with a clearly defined interface for data transfer.

Layer 1 is hardware/network (eg. SLIP, PPP, ATM, WiFi or ethernet). Layer 2 is Internet Protocol (eg. IPv4 or IPv6). Layer 3 is transport (eg. ICMP, ICMPv6, UDP, TCP), Layer 4 is application (eg. FTP, HTTP, HTTPS, MQTT, etc.).
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

2012-18: 1B*5, 2B*2, B+, A+, Z, ZW, 3Bs*3, 3B+

Any DMs sent on Twitter will be answered next month.

Sommanker
Posts: 7
Joined: Thu Mar 01, 2018 9:29 pm

Re: Getting Wi-Fi to work (Pi Zero)

Sat Mar 03, 2018 10:25 pm

I've tried restarting my router to no effect.

I've also now given up on using it as a gadget and booting through SSH, since Windows was having problems with drivers just doing that and it would mean I'd have to keep my main PC on all the time (which is why I'm using the pi in the first place) and sacrifice a USB port.
I'll probably go post in some more places in the hopes of finding a solution, failing that I guess I'll buy a Zero W or a new dongle.
I'll still be checking this too, though - but I'm not sure what more information I can provide, other than the fact that we don't actually know whether it's a problem with anything I've tried so far - the root problem right now is that, well, there are no interfaces installed at all.

Return to “Troubleshooting”

Who is online

Users browsing this forum: salvato and 60 guests