Open manav7 opened 4 years ago
Hi, thanks for using the script and reporting an issue! Just to inform you that, recently, I have fixed few bugs related Buster OS upgrade issues. But, these fixes are yet to be merged into "master" branch as the original script works well in Stretch Release. After fully verifying the Buster OS fixes into the "rpihotspot-bugfixes" branch, I will merge the fixes into "master" branch.
Meanwhile, can you please use the script from "rpihotspot-bugfixes" branch to check, if its resolving your issues? Please update me if the fixes are working for you.
Here is the script link for "rpihotspot-bugfixes" branch:
https://github.com/idev1/rpihotspot/blob/rpihotspot-bugfixes/setup-network.sh
Thanks Pankaj
Hey Pankaj,
used git clone --single-branch --branch
sudo git clone --single-branch --branch
But I keep getting an unexpected error near unexpected token '<'
Can you tell me what I should do to execute and test this branch it, it's not working on my end..?
Hi @manav7
I appreciate you tried the bug fixes script!
To clone a branch rpihotspot-bugfixes
, please follow the below given steps.
Make any directory. For e.g.:
sudo mkdir rpihotspot-bugfixes
CD into the above directory:
cd rpihotspot-bugfixes
Run the following command to clone the suggested branch (in my previous post):
sudo git clone -b rpihotspot-bugfixes https://github.com/idev1/rpihotspot.git
Step 3 will create a local repo: "rpihotspot". CD into this local repo directory.
cd rpihotspot
Run the below command to verify you cloned the correct repo. The return output of this command must return * rpihotspot-bugfixes which will indicate that, you correctly cloned the suggested branch.
sudo git branch
After that, you can assign the execute permission to script "./setup-network.sh".
sudo chmod ug+x ./setup-network.sh
Finally, you can setup the network using the install examples present in "./readme.md". I used the following command to successfully setup an Access Point network.
sudo ./setup-network.sh --install --ap-ssid="*****" --ap-password="*****" --ap-country-code="IN"
Please let me know if the above steps are solving your problem or not.
Thanks Pankaj
Hey Pankaj,
Thanks for your reply. So this how I did it. Still not solving the issue, unfortunately. Here is what I did.
sudo apt-get update
sudo apt-get dist-upgrade
sudo apt install git-all
git --version
sudo git clone -b rpihotspot-bugfixes https://github.com/idev1/rpihotspot.git
cd rpihotspot/
sudo git show-branch output: [rpihotspot-bugfixes] FIXED issue #12 to trim extra spaces
sudo chmod ug+x setup-network.sh
sudo cat setup-network.sh
sudo ./setup-network.sh --install-upgrade --ap-ssid="test" --ap-password="test123" --ap-password-encrypt
Still get the same output.
[INFO]: Processing network setup for OS Version: 10 [WLAN]: wlan0 IP address: 192.168.8.167 [WLAN]: wlan0 IP Mask address: 255.255.255.0 [WLAN]: wlan0 IP Broadcast address: 192.168.8.255 [WLAN]: wlan0 Country Code: AT [WLAN]: wlan0 Channel: 100 Cleanup: cleaning ... Reading package lists... Done Building dependency tree Reading state information... Done Reading package lists... Done Building dependency tree Reading state information... Done The following packages will be REMOVED: libpolkit-agent-1-0 libpolkit-backend-1-0 libpolkit-gobject-1-0 0 upgraded, 0 newly installed, 3 to remove and 0 not upgraded. After this operation, 307 kB disk space will be freed. (Reading database ... 62734 files and directories currently installed.) Removing libpolkit-agent-1-0:armhf (0.105-25) ... Removing libpolkit-backend-1-0:armhf (0.105-25) ... Removing libpolkit-gobject-1-0:armhf (0.105-25) ... Processing triggers for libc-bin (2.28-10+rpi1) ... Cleanup: apt-get clean/autoremove done. Cleanup: Cleaned all NAT IP Table entries. Reading package lists... Done Building dependency tree Reading state information... Done Reading package lists... Done Building dependency tree Reading state information... Done 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. Cleanup: apt-get clean/autoremove done. [Restart]: System Daemon restarted! Synchronizing state of dhcpcd.service with SysV service script with /lib/systemd/systemd-sysv-install. Executing: /lib/systemd/systemd-sysv-install enable dhcpcd Cleanup: Forcibly enabled dhcpcd.
Install: installing: hostapd dnsmasq iptables-persistent from net ... Hit:1 http://raspbian.raspberrypi.org/raspbian buster InRelease Hit:2 http://archive.raspberrypi.org/debian buster InRelease Reading package lists... Done Reading package lists... Done Building dependency tree Reading state information... Done Calculating upgrade... Done 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. Reading package lists... Done Building dependency tree Reading state information... Done Calculating upgrade... Done 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: dns-root-data dnsmasq-base netfilter-persistent The following NEW packages will be installed: dns-root-data dnsmasq dnsmasq-base hostapd iptables-persistent netfilter-persistent 0 upgraded, 6 newly installed, 0 to remove and 0 not upgraded. Need to get 1,074 kB of archives. After this operation, 2,747 kB of additional disk space will be used. Get:2 http://archive.raspberrypi.org/debian buster/main armhf dnsmasq-base armhf 2.80-1+rpt1 [400 kB] Get:1 http://ftp.tugraz.at/mirror/raspbian/raspbian buster/main armhf hostapd armhf 2:2.7+git20190128+0c1e29f-6+deb10u1 [630 kB] Get:5 http://archive.raspberrypi.org/debian buster/main armhf dnsmasq all 2.80-1+rpt1 [16.5 kB] Get:3 http://ftp.tugraz.at/mirror/raspbian/raspbian buster/main armhf netfilter-persistent all 1.0.11 [10.1 kB] Get:4 http://ftp.tugraz.at/mirror/raspbian/raspbian buster/main armhf iptables-persistent all 1.0.11 [11.7 kB] Get:6 http://ftp.tugraz.at/mirror/raspbian/raspbian buster/main armhf dns-root-data all 2019031302 [5,396 B] Fetched 1,074 kB in 17s (61.6 kB/s) Preconfiguring packages ... Selecting previously unselected package hostapd. (Reading database ... 62719 files and directories currently installed.) Preparing to unpack .../0-hostapd_2%3a2.7+git20190128+0c1e29f-6+deb10u1_armhf.deb ... Unpacking hostapd (2:2.7+git20190128+0c1e29f-6+deb10u1) ... Selecting previously unselected package netfilter-persistent. Preparing to unpack .../1-netfilter-persistent_1.0.11_all.deb ... Unpacking netfilter-persistent (1.0.11) ... Selecting previously unselected package iptables-persistent. Preparing to unpack .../2-iptables-persistent_1.0.11_all.deb ... Unpacking iptables-persistent (1.0.11) ... Selecting previously unselected package dns-root-data. Preparing to unpack .../3-dns-root-data_2019031302_all.deb ... Unpacking dns-root-data (2019031302) ... Selecting previously unselected package dnsmasq-base. Preparing to unpack .../4-dnsmasq-base_2.80-1+rpt1_armhf.deb ... Unpacking dnsmasq-base (2.80-1+rpt1) ... Selecting previously unselected package dnsmasq. Preparing to unpack .../5-dnsmasq_2.80-1+rpt1_all.deb ... Unpacking dnsmasq (2.80-1+rpt1) ... Setting up dnsmasq-base (2.80-1+rpt1) ... Setting up dns-root-data (2019031302) ... Setting up dnsmasq (2.80-1+rpt1) ... Created symlink /etc/systemd/system/multi-user.target.wants/dnsmasq.service → /lib/systemd/system/dnsmasq.service. Setting up hostapd (2:2.7+git20190128+0c1e29f-6+deb10u1) ... Created symlink /etc/systemd/system/multi-user.target.wants/hostapd.service → /lib/systemd/system/hostapd.service. Job for hostapd.service failed because the control process exited with error code. See "systemctl status hostapd.service" and "journalctl -xe" for details. Created symlink /etc/systemd/system/hostapd.service → /dev/null. Setting up netfilter-persistent (1.0.11) ... Created symlink /etc/systemd/system/multi-user.target.wants/netfilter-persistent.service → /lib/systemd/system/netfilter-persistent.service. Setting up iptables-persistent (1.0.11) ... Processing triggers for systemd (241-7~deb10u3+rpi1) ... Processing triggers for man-db (2.8.5-2) ... Processing triggers for dbus (1.12.16-1) ... [Move]: /etc/dnsmasq.conf to /etc/dnsmasq.conf.orig Removed /etc/systemd/system/hostapd.service. Install: enabling netStop.service ... Created symlink /etc/systemd/system/multi-user.target.wants/netStop.service → /etc/systemd/system/netStop.service.
[Reboot]: In 10 seconds ...
Broadcast message from root@raspberrypi (pts/0) (Sun Mar 29 13:27:45 2020): The system is going down for reboot NOW!
Once it prompts this message "the system is going down for reboot" I am not able to ssh into the terminal or see the network in my list. :(
Hi @manav7
Thanks for quickly verifying the suggested steps! Just to inform you that, if you are using the external software such as Putty (or something else to setup the network using the script) using SSH, then after system reboot the SSH connection will be obviously lost and then, you have to reconnect again into the SSH.
But, that is just an additional information..
To debug more into this strange problem (which presently I am unable to replicate in my Raspberry Pi 3B+), it will be good to send me the output of the command ifconfig
to check if the network with virtual AP device called uap0
is present, UP and RUNNING. Please also verify the content of /etc/hostapd/hostapd.conf
file is correctly setup by the script or not and also verify if the dependencies: hostapd, dnsmasq are correctly running using the below command.
sudo systemctl status hostapd
sudo systemctl status dnsmasq
Please re-verify these things and if nothing works then, there is a probability that your current OS (version 10) is internally messed up by upgrades or something else and here in this case, it will be good to re-start with a original Raspbian OS and re-running the script to check if the AP setup works.
Thanks Pankaj
Thats the issue I am facing Pankaj, when I try to ssh back into the Pi using the IP that I am already using, I am not able to connect to it. Thats why I cannot debug further as to why this is happening.
When I start I ssh into my Pi using IP 192.168.X.X
When the script is executed and goes into a reboot, I am not able to ssh into it again using the same IP. Its just gives a Network error, connection time out
weird that it is not happening on your side even though I have a raspberry pi 3B+ as well
I also notice from here -> https://github.com/idev1/rpihotspot/issues/12#issuecomment-601083664
In your output you only get, these last lines to see the reboot is happening
[Reboot]: In 10 seconds ...
Whereas I am getting this output,
[Reboot]: In 10 seconds ...
Broadcast message from root@raspberrypi (pts/0) (Sun Mar 29 13:27:45 2020): The system is going down for reboot NOW!
Well, my experience is that first, the Pi is booting after the install, then booting again by command, i don't no why but it seems you have to boot 2 times in total after the install.
do you seem to see if this is an issue?
I hope, you are using an laptop or desktop to SSH into Raspberry Pi. If I face such kind of issues, I also verify using the external monitor connected to my Raspberry Pi to debug more into the issues and solve the problem.
But, can you also check the AP SSID which you have used in your network setup is presently visible in your Laptop or Desktop WiFi client list ?
If you see this WiFi SSID in your Laptop or Desktop client list then you can try connecting to that SSID by giving the password that you have used for network setup.
If it connects then, I believe, by following your previous post and not using the option --ap-ip-address
, you will have an default AP IP address as 10.0.0.1
assigned to your Raspberry Pi.
Now, try connecting you Putty software using this IP and if connects successfully then, you can reuse my previously sent commands to debug more and please give me the output i requested so that, it will also help me to analyse the issue.
Thanks Pankaj
I also notice from here -> #12 (comment)
In your output you only get, these last lines to see the reboot is happening
[Reboot]: In 10 seconds ...
Whereas I am getting this output,
[Reboot]: In 10 seconds ...
Broadcast message from root@raspberrypi (pts/0) (Sun Mar 29 13:27:45 2020): The system is going down for reboot NOW!
Well, my experience is that first, the Pi is booting after the install, then booting again by command, i don't no why but it seems you have to boot 2 times in total after the install.
do you seem to see if this is an issue?
Yes, the system will reboot twice but, that is the case when the improper shutdown/restart/hard plug-off happens to Raspberry Pi.
Below given is the code which does this in the script to ensure network functionality.
# Create shutdown recovery script when last time shutdown did not go well.
cat > $shutdownRecoveryFile <<EOF
# ----------------------------------------------------------------------------------------------
# IMPORTANT:
# ----------------------------------------------------------------------------------------------
# Improper shutdown/reboot by directly switching of the device or taking off the power plug
# may result in malfuctioning of Access Point (AP) Network setup or may harm other
# functionalies of the application. Hence, below script will ensure improper shutdown recovery.
# You can disable this feature by setting: 'rebootFlag=false' or 'rebootFlag=n' in this script
# or in main script: 'setup-network.sh'.
# ----------------------------------------------------------------------------------------------
if [ ! -f "$netShutdownFlagFile" ]; then
#sudo bash -c 'echo "\$(date +"%Y-%m-%d %T") - [WARNING]: Last time shutdown did not happen properly!" >> $netLogFile'
echo "[WARNING]: Last shutdown errors may affect Access Point(AP) Network to become non-functional!"
echo "[SOLUTION]: Reboot system to solve the shutdown errors."
#read -n 1 -p "Reboot System [y/n]: " "rebootFlag"
if [ "$rebootFlag" = "y" -o "$rebootFlag" = true ]; then
sudo $netStopFile
echo "Rebooting in 5 seconds ..."
sleep 5
sudo reboot
fi
elif [ -f "$netShutdownFlagFile" ]; then
sudo rm -f $netShutdownFlagFile
fi
Thanks Pankaj
Hey Pankaj,
So i tried the current script in the stretch OS before you pushed the changes to the master and it works. I am going to try it on the Buster Lite OS and get back to you with my findings. :)
Just wanted to ask you sth else:
So currently the Raspberry Pi configured regardless of the OS uses the wlan0 Country Code: AT which is set when I execute the script. So when I plugged the Pi anywhere now in Austria, it should work in remote conditions where there is no WiFi available since we configured an AP
Now if I am sending the Pi overseas for anyone to use this, does the Location have to be changed?What configuration has to be changed for the same Pi (hardware) which has this configured already to work in a different global location i.e CA/ US?
Let me know.
Manav
Hey Pankaj,
So i tried the current script in the stretch OS before you pushed the changes to the master and it works. I am going to try it on the Buster Lite OS and get back to you with my findings. :)
Just wanted to ask you sth else:
So currently the Raspberry Pi configured regardless of the OS uses the wlan0 Country Code: AT which is set when I execute the script. So when I plugged the Pi anywhere now in Austria, it should work in remote conditions where there is no WiFi available since we configured an AP
Now if I am sending the Pi overseas for anyone to use this, does the Location have to be changed?What configuration has to be changed for the same Pi (hardware) which has this configured already to work in a different global location i.e CA/ US?
Let me know.
Manav
Hi @manav7
Just to inform you that, after getting confirmation from different people saying that, the new Bug Fixes for Buster Lite OS works, I merged the branch script: rpihotspot-bugfixes
into master
branch and therefore, I am requesting you to use the master branch now to setup the network.
For your asked question on Country Code and its strict tagging to WiFi settings (whether you are specifying Country Code at Access Point [AP] level or Station [STA] with wlan0 interface level), the mandate for strictly specifying Country Code has been enforced by the Standard Community (such as IEEE - 802.11 or IETS Standard Organisation) and hence, by default, the OS (doesn't matter the type of OS like: Windows or Linux) have to follow the mandatory process of setting the Country Code for every type of WiFi setting and that's why, you have the Country Code identifier at AP level thru hostapd
3rd Party external library and at Physical Interface (wlan0) level using built-in wpa-supplicant
Linux library.
So when you are operating over a managed mode (i.e., AP + STA mode), both the Country Code of AP and STA interface (thru hostapd
and wpa-supplicant
libraries respectively) must match with the Country where you are setting up the WiFi. Therefore, in this managed mode, the Country Code specified in /etc/hostapd/hostapd.conf file and _/etc/wpa_supplicant/wpasupplicant.conf file must be same with the operating Country (and therefore, the Country Code presently can be manually changed in the said files).
For your another question:
So when I plugged the Pi anywhere now in Austria, it should work in remote conditions where there is no WiFi available since we configured an AP.
I can say that, since we are operating on Managed mode (AP + STA) and if STA goes down (due to external WiFi router is switched off or external WiFi router signals become weak), the WLAN (wlan0) interface connected to STA will be down but, the AP virtual interface (uap0) must be working (UP and RUNNING) only in INTRANET mode and hence, AP interface shouldn't be down in this case and the devices connected to the AP interface still can communicate with AP (but without the INTERNET services as STA interface is down and there will be not INTERNET WiFi NAT-ing using IP Tables routing).
I hope, this gives the detailed info to your asked quires.
Thanks Pankaj
Hey Pankaj,
Thanks for the reply. been busy with what is going on with Covid. Let me try it with the Buster OS and get back to you on this! Thanks.
No problem @manav7 . Take care of your self and your family first in this struggling time !
Thanks Pankaj
Hey so I am newbie to raspberry Pi. I am using the script given to launch a WAP on the Pi.
I finished successfully installing the script, but when it goes in a reboot. the terminal becomes inactive, and after waiting for quite long (even almost an hour) the ssid does not appear and I cannot ssh into my terminal
Steps I followed are
Downloaded latest Raspbian lite Buster OS using link: https://www.raspberrypi.org/downloads/ using the Raspberry Pi image for Windows.
Selected the SD Card option and the Buster Lite OS and executed the write command
Once finished successfully created a ssh and wpa_supplicant.conf with my wifi credentials
country=AT update_config=1 ctrl_interface=/var/run/wpa_supplicant
network={ ssid="xxxxx" psk="xxxxx" }
Inserted the freshly created SD card into my Raspberry Pi 3B+ device and booted my Pi. I can successfully now SSH into my pi using Putty
After boot, updated the OS using below given commands: sudo apt-get update sudo apt-get dist-upgrade
Installing Git and Verifying sudo apt install git-all git --version
cloning the repo sudo git clone https://github.com/idev1/rpihotspot.git
Navigating to the folder cd rpihotspot
Executable permissions to the file sudo chmod 777 setup-network.sh
Executing the file sudo ./setup-network.sh --install-upgrade --ap-ssid="Test" --ap-password="Test123" --ap-password-encrypt
[WLAN]: wlan0 IP address: 192.168.8.167 [WLAN]: wlan0 IP Mask address: 255.255.255.0 [WLAN]: wlan0 IP Broadcast address: 192.168.8.255 [WLAN]: wlan0 Country Code: AT [WLAN]: wlan0 Channel: 7 Cleanup: cleaning ... Cleanup: Cleaned all NAT IP Table entries. Reading package lists... Done Building dependency tree Reading state information... Done The following packages will be REMOVED: libpolkit-agent-1-0 libpolkit-backend-1-0 libpolkit-gobject-1-0 0 upgraded, 0 newly installed, 3 to remove and 0 not upgraded. After this operation, 307 kB disk space will be freed. (Reading database ... 62734 files and directories currently installed.) Removing libpolkit-agent-1-0:armhf (0.105-25) ... Removing libpolkit-backend-1-0:armhf (0.105-25) ... Removing libpolkit-gobject-1-0:armhf (0.105-25) ... Processing triggers for libc-bin (2.28-10+rpi1) ...
Install: installing: hostapd dnsmasq iptables-persistent from net ... Hit:1 http://raspbian.raspberrypi.org/raspbian buster InRelease Hit:2 http://archive.raspberrypi.org/debian buster InRelease Reading package lists... Done Building dependency tree Reading state information... Done All packages are up to date. Reading package lists... Done Building dependency tree Reading state information... Done Calculating upgrade... Done 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. Reading package lists... Done Building dependency tree Reading state information... Done Calculating upgrade... Done 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: dns-root-data dnsmasq-base netfilter-persistent The following NEW packages will be installed: dns-root-data dnsmasq dnsmasq-base hostapd iptables-persistent netfilter-persistent 0 upgraded, 6 newly installed, 0 to remove and 0 not upgraded. Need to get 1,074 kB of archives. After this operation, 2,747 kB of additional disk space will be used. Get:1 http://archive.raspberrypi.org/debian buster/main armhf dnsmasq-base armhf 2.80-1+rpt1 [400 kB] Get:2 http://mirror.inode.at/raspbian/raspbian buster/main armhf hostapd armhf 2:2.7+git20190128+0c1e29f-6+deb10u1 [630 kB] Get:6 http://archive.raspberrypi.org/debian buster/main armhf dnsmasq all 2.80-1+rpt1 [16.5 kB] Get:3 http://mirror.inode.at/raspbian/raspbian buster/main armhf netfilter-persistent all 1.0.11 [10.1 kB] Get:4 http://mirror.inode.at/raspbian/raspbian buster/main armhf iptables-persistent all 1.0.11 [11.7 kB] Get:5 http://mirror.inode.at/raspbian/raspbian buster/main armhf dns-root-data all 2019031302 [5,396 B] Fetched 1,074 kB in 17s (64.2 kB/s) Preconfiguring packages ... Selecting previously unselected package hostapd. (Reading database ... 62719 files and directories currently installed.) Preparing to unpack .../0-hostapd_2%3a2.7+git20190128+0c1e29f-6+deb10u1_armhf.deb ... Unpacking hostapd (2:2.7+git20190128+0c1e29f-6+deb10u1) ... Selecting previously unselected package netfilter-persistent. Preparing to unpack .../1-netfilter-persistent_1.0.11_all.deb ... Unpacking netfilter-persistent (1.0.11) ... Selecting previously unselected package iptables-persistent. Preparing to unpack .../2-iptables-persistent_1.0.11_all.deb ... Unpacking iptables-persistent (1.0.11) ... Selecting previously unselected package dns-root-data. Preparing to unpack .../3-dns-root-data_2019031302_all.deb ... Unpacking dns-root-data (2019031302) ... Selecting previously unselected package dnsmasq-base. Preparing to unpack .../4-dnsmasq-base_2.80-1+rpt1_armhf.deb ... Unpacking dnsmasq-base (2.80-1+rpt1) ... Selecting previously unselected package dnsmasq. Preparing to unpack .../5-dnsmasq_2.80-1+rpt1_all.deb ... Unpacking dnsmasq (2.80-1+rpt1) ... Setting up dnsmasq-base (2.80-1+rpt1) ... Setting up dns-root-data (2019031302) ... Setting up dnsmasq (2.80-1+rpt1) ... Created symlink /etc/systemd/system/multi-user.target.wants/dnsmasq.service → /lib/systemd/system/dnsmasq.service. Setting up hostapd (2:2.7+git20190128+0c1e29f-6+deb10u1) ... Created symlink /etc/systemd/system/multi-user.target.wants/hostapd.service → /lib/systemd/system/hostapd.service. Job for hostapd.service failed because the control process exited with error code. See "systemctl status hostapd.service" and "journalctl -xe" for details. Created symlink /etc/systemd/system/hostapd.service → /dev/null. Setting up netfilter-persistent (1.0.11) ... Created symlink /etc/systemd/system/multi-user.target.wants/netfilter-persistent.service → /lib/systemd/system/netfilter-persistent.service. Setting up iptables-persistent (1.0.11) ... Processing triggers for systemd (241-7~deb10u3+rpi1) ... Processing triggers for man-db (2.8.5-2) ... Processing triggers for dbus (1.12.16-1) ... [Move]: /etc/dnsmasq.conf to /etc/dnsmasq.conf.orig Removed /etc/systemd/system/hostapd.service. Install: enabling netStop.service ... Created symlink /etc/systemd/system/multi-user.target.wants/netStop.service → /etc/systemd/system/netStop.service.
[Reboot]: In 10 seconds ...
Broadcast message from root@raspberrypi (pts/1) (Fri Mar 27 07:57:46 2020): The system is going down for reboot NOW!
is this a known issue?