Connect raspberry pi 4 with ubuntu server to wifi
Solution 1
It works updating /etc/netplan/50-cloud-init.yaml
Adding those lines to network
wifis:
wlan0:
optional: true
access-points:
"SSID-NAME":
password: "WIFI-PASSORD"
dhcp4: true
Then
$ sudo netplan --debug try
$ sudo netplan --debug generate
$ sudo netplan --debug apply
and finally reboot
$ sudo reboot
Solution 2
I got headless Wi-Fi via Unbuntu 20.04 on RPi4B working without disabling cloud-init. In a 'nutshell' I used this for my network-config:
# This file contains a netplan-compatible configuration which cloud-init
# will apply on first-boot. Please refer to the cloud-init documentation and
# the netplan reference for full details:
#
# https://cloudinit.readthedocs.io/
# https://netplan.io/reference
#
#Replace the entire user-data on the imaged SD Card with this file.
version: 2
renderer: networkd
wifis:
wlan0:
dhcp4: true
dhcp6: true
optional: true
access-points:
"SSID":
password: "PassPhrase"
Then, I appended the following to the end of user-data:
power_state:
mode: reboot
My config files, step-by-step, and notes are here: https://github.com/DavidUnboxed/Ubuntu-20.04-WiFi-RaspberyPi4B.
Ajouve
Updated on September 18, 2022Comments
-
Ajouve almost 2 years
I have a Raspberry Pi 4.
As I do not have a screen and keyboard available, I connect it through an Ethernet cable.
I want the Raspberry Pi to be connected to the Wi-Fi and not via Ethernet.
I tried to update
/etc/network/interfaces
to:auto lo iface lo inet loopback auto wlan0 iface wlan0 inet static address 192.168.1.150 netmask 255.255.255.0 gateway 192.168.1.1 wpa-essid MYESSID12345 wpa-psk MYPASSWORD$1234567
Then I am running:
sudo dhclient wlan0
But it does not seem to work.
ifconfig
returns:eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.1.41 netmask 255.255.255.0 broadcast 192.168.1.255 inet6 fe80::dea6:32ff:fe62:c4fc prefixlen 64 scopeid 0x20<link> ether dc:a6:32:62:c4:fc txqueuelen 1000 (Ethernet) RX packets 118 bytes 13529 (13.5 KB) RX errors 0 dropped 52 overruns 0 frame 0 TX packets 63 bytes 9012 (9.0 KB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 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 1000 (Local Loopback) RX packets 168 bytes 12300 (12.3 KB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 168 bytes 12300 (12.3 KB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 wlan0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500 ether dc:a6:32:62:c4:fd txqueuelen 1000 (Ethernet) 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
I also tried to do it through:
iwconfig wlan0 essid name key password
Or:
iwconfig wlan0 essid name key s:password
But I have an invalid argument error because my password is 8 characters.
Error for wireless request "Set Encode" (8B2A) : SET failed on device wlan0 ; Invalid argument.
I also tried
iwconfig wlan0 essid name
using wps but it does not work.I also tried with
wpasupplicant
.Creating
/etc/wpa_supplicant.conf
withnetwork={ ssid="ssid_name" psk="password" }
and then running
sudo wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant.conf -D wext
But I have errors too.
Successfully initialized wpa_supplicant ioctl[SIOCSIWENCODEEXT]: Invalid argument ioctl[SIOCSIWENCODEEXT]: Invalid argument
-
Archisman Panigrahi about 4 yearsWelcome to Ask Ubuntu. It is recommended that the answers are not link only, and should describe in details the contents of the link.
-
David Taylor about 4 yearsThank you for the feedback. I updated the post.
-
Abdull about 3 yearsIs the
sudo reboot
step required at all? -
BitfullByte almost 3 yearsI just tried this solution. After a reboot, still no connection but after a forced reconnected from my router all was fine. (PS. I have the Unify Dream Machine)