How to connect to wifi raspberry pi headless? - ssh

I know there are a bunch of blogs explaining how to set up the wifi headless on the raspberry pi. I have followed them and they worked, once. But I had to format the sd card, and re-do it and it doesn't connect to the WiFi anymore.
I use the RPI Imager to write the OS. (Note I've also tried with the advanced option pressing Ctrl + Shift + 10, and set up the wifi, ssh over like this. After writing it, the verification returned an error that couldn't create a FAT32 partition).
Then I created a blank ssh file inside the sd card (boot) to allow the ssh connection.
Then I created the wpa_supplicant.conf file containing this:
country=CZ
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="NETWORK-NAME"
psk="NETWORK-PASSWORD"
}
Then I eject the sd card, insert it in the raspberry pi and it doesn't connect to the wifi.
I know that the Raspberry pi, and the wifi connector work well. So it must be something that I'm misssing.
I'm honestly desperate at this point since I have spent more than 10 hours just trying to connect to the WiFi. I have formated and re-installed the Raspberri-OS a bunch of times already, and tried as many tutorials as I could find.

There's not really a single universal answer to your question, so at the risk of telling you a bunch of things you already tried, here's my exhaustive list of stuff to try/consider:
If you're using Ubuntu you probably have to use netplan - see here for some instructions https://askubuntu.com/questions/1143287/how-to-setup-of-raspberry-pi-3-onboard-wifi-for-ubuntu-server-with-netplan
Don't forget your key_mgmt field (use the value relevant to your wifi):
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=CA
network={
ssid="NETWORK_SSID"
psk="PSWD"
key_mgmt=WPA-PSK
}
If you can ssh into with a wired connection, and are using Raspian, you may find using raspi-config easier (sudo raspi-config, then System Options > S1 Wireless LAN).
Now we get into the "I already checked that five times" part of the list:
a)if you're using Ubuntu/netplan, ensure you're using the correct interface id by doing ifconfig - should be wlan0, but you never know
b)ensure you have your SSID correct - you can do sudo iw wlan0 scan to find all the networks in reach and double check the SSID. Watch out for weird quotation marks (e.g. 'smart' quotes), elongated dashes and stray spaces - in particular if you have pasted the SSID and password from elsewhere
c) ensure your SSID, password and key setting is correct by checking a different device
d) ensure you are looking for the right IP address on your LAN - you can do a sudo nmap -sn 192.168.1.0/24 and your Pi devices should show up looking like:
Nmap scan report for 192.168.1.68
Host is up (0.00044s latency).
MAC Address: B8:27:EB:8B:73:AD (Raspberry Pi Foundation)
Remember that if using DHCP, your Wifi and Wired connections will get different IP addresses - if using static for Wired, you'll also likely get a DHCP address for your wireless interface.
If you keep failing using the same Raspian image, try something different, just to isolate the problem - e.g. try Ubuntu if you keep failing with Buster (or vice versa)
Finally, some more general advice about what to do when you're just so frustrated with a problem that you've spent way too much time on - write out a 'proof' of why what you're trying to do is impossible, explaining line by line how you've done exactly the steps that are supposed to work. This is my method of last resort, and currently has a 100% success rate - when I try to explain why the thing is impossible, I realize what I didn't do, overlooked, or did wrong.

Actually, I solved this by following this blog https://weworkweplay.com/play/automatically-connect-a-raspberry-pi-to-a-wifi-network/?fbclid=IwAR2QckXB5XMPLCttnyBDUWv-MgxFsk0utfih4FHpF1za4OzH-9h-SKgR0GM and adding some stuff to the /etc/network/interfaces/

Related

PuTTY telnet option 63 (0x32), what should it be?

For an application I had to develop a simple telnet module. (Which I could do quickly with the help of minimalistic telnet)
I did create a telnet server and a client and I used PuTTY to test the behavior of the server.
PuTYY was configured for 'Telnet negotiation mode: active'.
In the server I did see the expected telnet negotiation sequence (and it was giving correct replies).
The last action in the PuTTY negotiation was a strange one.
0xff 0xfe 0x32 or IAC DONT 0x32
The third byte, 0x32, is the option and that is where the problem is (for me).
I did look up all Telnet options at IANA and according to them the options range 50-137 is unassigned (0x32 is 62).
What is behind PuTTY option 0x32?
I have looked on the internet but can't find anything.
I have looked up the PuTTY documentation, same thing.
Putting up a request to the PuTTY development is severely discouraged due to capacity problems (not enough hands to type a sensible reply).
It is perfectly sensible not to use this unknown option but it still is nagging me.
What is option 0x3e supposed to do?
Problem solved.
There was an error in my server code causing PuTTY to generate a reply for a non existing option.
I hereby thank Simon Tatham for the suggestion he gave leading me to find the real problem.

Using 'connmanctl config' to set static IP without wired connection

I am currently using 'connmanctl config' to set static and DHCP settings with a wired connection. I'm curious if anyone has been successful with applying settings with the wire unplugged?
I would typically use 'connmanctl services' for a list of services then perform a string.match(blah, "ethernet_%w+_cable") to use that wired service name. I have been able to find and apply that service name with the ethernet cable unplugged BUT now when using 'connmanctl config':
connmanctl config ethernet_f8dc7a04ea82_cable --ipv4 manual 192.168.91.108 255.255.255.0 192.168.91.1 --nameservers 8.8.8.8
I get this error:
Error ethernet_f8dc7a04ea82_cable: Method "SetProperty" with signature "sv" on interface "net.connman.Service" doesn't exist
As you can see I have the service applied to the command and this is the same service name as when the cable is plugged in. This feature would be nice for equipment that needs to be pre-programmed before reaching the customer. I have also researched this error but can't find it being an issue with others the same as it is with my situation. Have also read many blogs, articles, etc...on trying to achieve this with nothing that jumps out at me.
...Any ideas ?
I had to perform this action via back-end with the code that I am using to configure. Just an example...settings are applied to /var/lib/connman/ethernet_?????cable/settings. I created the adapter name with the MAC address because it does not exist until the network is detected, created the directory /ethernet?????_cable then created an empty settings file on the fly. When programming and saving the settings via the equipment I am using I just insert the settings manually. When a network cable is plugged in and detected the settings you have applied work wonderfully.

SUMO Address Error

I'm running multiple SUMO simulations in parallel using TraCI.
Every so often one will fail with the message
Error: tcpip::Socket::accept() Unable to create listening socket: Address already in use
Quitting (on error).
I haven't found anyway to set the address to use on the configuration list at http://sumo.dlr.de/wiki/SUMO
I figure if I can set each instances address manually I should be able to avoid this.
The answer is right on the page you mention. The option --remote-port specifies the port number, so something like
sumo --remote-port 54323 -c my.sumocfg
should do the trick. Of course you need to give the same port when connecting from your traci client.

How to set USB serial as debug port / console?

I'm working on an iMX23 cpu with linux-2.6.35.3 and wondering if this is even possible to implement.
I can build g_serial and g_multi and use the serial port function, which uses /dev/ttyGS0.
Do I just have to change [console=ttyS0] to [console=ttyGS0] on the kernel command line?
Thanks
Yes, it should be that simple. Just change your kernel command line to "console=ttyGS0,115200" or similar. You'll find it even works with usb ports ie "console=ttyUSB0" for example.
It seems you can easily add another console port just by adding another setting in [/etc/inittab]
::respawn:/sbin/getty -L ttyAM0 115200 vt100
::respawn:/sbin/getty -L ttyGS0 115200 vt100
Adding another line as above will enable you to use USB serial as console too(/dev/ttyGS0).

Telnet with Bad Request 400

Have a look at the following post:
How to telnet google using command prompt?
I've tried the same thing, but keep getting a Bad Request! (400!) I'm working on a Windows 8 PRO machine. I just want to try a few things using Telnet, but as long as I keep getting this 400-error I can't really achieve much!
All I'm doing is the following:
o www.google.com 80 (PRESSING ENTER TWICE!!!)
GET / HTTP/1.1 (ENTER)
Host: www.google.com (PRESSING ENTER TWICE!!!)
Any help appreciated!
This problem can be solved by typing in the Telnet Commands exactly, so capitalize where needed and vice versa! Check this source for more detailed information on how to setup Telnet as a Instant HTTP Client. The source also explains that once you use a BACKSPACE to retype a command that the server receiving the command may interpret it as
<bs>
and if so, declares it as an illegal request! (This is what happened to me!)
Conclusion
It seems that you can communicate the Backspace-character properly if you have the host and client communicating properly! There's an article here that explains more about it on a technical level. To get this to work for the Windows Telnet Client, I do not know how and I'm not sure whether its possible! To get around this I would like to suggest using a program like PuTTY which is a free (MIT-licensed) Win32 Telnet and SSH client. There's an option available in the PuTTY client that allows you to change how the Backspace is generated in PuTTY, that is, which one is acceptable to you're host (if at all!)!
Please read the documentation section 4.4.1 for configuring this option "properly" (if all hosts are using this protocol; otherwise you probably need to read this article and somehow configure PuTTY to be accepted by you're host or vice versa!)!
Also, in the previous example I used Google which may need other parameters to get that working, but this may not have been the best choice to get a 200-status code immediately! Try bing.com instead (working for me at the moment!)!
o www.bing.com 80 (press ENTER twice!!!)
GET / HTTP/1.1 (press ENTER)
Host: www.bing.com (press ENTER twice!!!)