Solving the bootup issue

Posted by Matthias 
This forum is currently read only. You can not log in or make any changes. This is a temporary situation.
Now, this forum is in read-only mode. You find details Details hereContinue on /r/PirateBox
Solving the bootup issue
June 25, 2014 07:02PM
Hi,
I'm trying to summarize the problem solution for the startup-issue here. I'm sorry for those problems.

First option, that works in some cases: [piratebox.cc] (Enabling Device PROBE)
Sometimes it can help to increase the PROBE_TIME in piratebox.conf (If you increased, please report your value back).


If the fix above doesn't help you, please edit
/etc/systemd/system/piratebox.service
, that it looks like that

[Unit]
Description=PirateBox Service

[Service]
Type=idle
RemainAfterExit=yes
ExecStart=/opt/piratebox/init.d/piratebox_alt start
ExecStop=/opt/piratebox/init.d/piratebox_alt stop
#Restart=/opt/piratebox/init.d/piratebox_alt restart
#PIDFile=/var/run/piratebox.pid

[Install]
WantedBy=multi-user.target

Matthias

edit by stylesuxx:
unstickied this, since the problem should be solved with the new image


This is only my signature.



Edited 2 time(s). Last edit at 02/06/2016 08:36PM by stylesuxx.
Re: Solving the bootup issue
June 30, 2014 05:39PM
Dec 31 17:00:13 alarmpi piratebox_alt[117]: Starting hostap...
Dec 31 17:00:13 alarmpi piratebox_alt[117]: 0
Dec 31 17:00:13 alarmpi piratebox_alt[117]: Setting up wlan
Dec 31 17:00:13 alarmpi piratebox_alt[117]: Bringing up wifi interface wlan0
Dec 31 17:00:13 alarmpi piratebox_alt[117]: wlan0: ERROR while getting interface flags: No such device
Dec 31 17:00:14 alarmpi piratebox_alt[117]: ..failed
Dec 31 17:00:13 alarmpi systemd[1]: piratebox.service: control process exited, code=exited status=255
Dec 31 17:00:14 alarmpi piratebox_alt[117]: failed setting up Interface
Dec 31 17:00:14 alarmpi systemd[1]: Failed to start PirateBox Service.
Dec 31 17:00:14 alarmpi systemd[1]: Unit piratebox.service entered failed state.
Re: Solving the bootup issue
July 04, 2014 07:11PM
Thanks for your time.

I get this response below after pi start up.

* piratebox.service - PirateBox Service
   Loaded: loaded (/etc/systemd/system/piratebox.service; enabled)
   Active: failed (Result: exit-code) since Wed 1969-12-31 17:00:10 MST; 44 years 6 months ago
  Process: 109 ExecStart=/opt/piratebox/init.d/piratebox_alt start (code=exited, status=255)

Dec 31 17:00:10 alarmpi piratebox_alt[109]: Starting hostap...
Dec 31 17:00:10 alarmpi piratebox_alt[109]: 0
Dec 31 17:00:10 alarmpi piratebox_alt[109]: Setting up wlan
Dec 31 17:00:10 alarmpi piratebox_alt[109]: Bringing up wifi interface wlan0
Dec 31 17:00:10 alarmpi piratebox_alt[109]: wlan0: ERROR while getting interface flags: No such device
Dec 31 17:00:10 alarmpi systemd[1]: piratebox.service: control process exited, code=exited status=255
Dec 31 17:00:10 alarmpi piratebox_alt[109]: ..failed
Dec 31 17:00:10 alarmpi piratebox_alt[109]: failed setting up Interface
Dec 31 17:00:10 alarmpi systemd[1]: Failed to start PirateBox Service.
Dec 31 17:00:10 alarmpi systemd[1]: Unit piratebox.service entered failed state.

Running
systemctl start piratebox
and
systemctl enable piratebox
works only until next start.

Tried increasing probe time to no avail.

Using approved TP-Link TL-WN722N wireless adapter and followed setup instructions exactly, numerous times.

Any help or advise much appreciated. Keep up the awesome work BTW.
Re: Solving the bootup issue
July 05, 2014 08:06PM
Hi,
thanks for your feedback.

Can you please edit the file /opt/piratebox/conf/hostapd.conf

and add the following lines at the end:

logger_syslog=-1
logger_syslog_level=2


After that, please power you raspberry off (using the command "halt"),
and then boot it and post again the output of
systemctl status piratebox

Those two lines should enable the debug output of hostapd and hopefully systemd catches that (and shows it later on)

Thanks,
Matthias
Re: Solving the bootup issue
July 06, 2014 12:09PM
[root@alarmpi ~]# systemctl status piratebox
* piratebox.service - PirateBox Service
Loaded: loaded (/etc/systemd/system/piratebox.service; enabled)
Active: failed (Result: exit-code) since Wed 1969-12-31 17:00:10 MST; 44 years 6 months ago
Process: 114 ExecStart=/opt/piratebox/init.d/piratebox_alt start (code=exited, status=255)

Dec 31 17:00:09 alarmpi piratebox_alt[114]: Starting hostap...
Dec 31 17:00:09 alarmpi piratebox_alt[114]: 0
Dec 31 17:00:09 alarmpi piratebox_alt[114]: Setting up wlan
Dec 31 17:00:10 alarmpi piratebox_alt[114]: Bringing up wifi interface wlan0
Dec 31 17:00:10 alarmpi piratebox_alt[114]: wlan0: ERROR while getting interface flags: No such device
Dec 31 17:00:10 alarmpi piratebox_alt[114]: ..failed
Dec 31 17:00:10 alarmpi systemd[1]: piratebox.service: control process exited, code=exited status=255
Dec 31 17:00:10 alarmpi piratebox_alt[114]: failed setting up Interface
Dec 31 17:00:10 alarmpi systemd[1]: Failed to start PirateBox Service.
Dec 31 17:00:10 alarmpi systemd[1]: Unit piratebox.service entered failed state.
Re: Solving the bootup issue
July 06, 2014 12:26PM
Hi Peter,
thank you... too bad, I hoped that would give more information on the first try.

Can you modfiy/add the lines & test again please. Now the snipped would be:

logger_syslog=-1
logger_syslog_level=1
logger_stdout=-1
logger_stdout_level=1

Thanks Matthias


This is only my signature.
Re: Solving the bootup issue
July 06, 2014 01:04PM
[root@alarmpi ~]# systemctl status piratebox
* piratebox.service - PirateBox Service
Loaded: loaded (/etc/systemd/system/piratebox.service; enabled)
Active: failed (Result: exit-code) since Wed 1969-12-31 17:00:10 MST; 44 years 6 months ago
Process: 114 ExecStart=/opt/piratebox/init.d/piratebox_alt start (code=exited, status=255)

Dec 31 17:00:09 alarmpi piratebox_alt[114]: Starting hostap...
Dec 31 17:00:09 alarmpi piratebox_alt[114]: 0
Dec 31 17:00:09 alarmpi piratebox_alt[114]: Setting up wlan
Dec 31 17:00:09 alarmpi piratebox_alt[114]: Bringing up wifi interface wlan0
Dec 31 17:00:10 alarmpi piratebox_alt[114]: wlan0: ERROR while getting interface flags: No such device
Dec 31 17:00:10 alarmpi piratebox_alt[114]: ..failed
Dec 31 17:00:10 alarmpi systemd[1]: piratebox.service: control process exited, code=exited status=255
Dec 31 17:00:10 alarmpi piratebox_alt[114]: failed setting up Interface
Dec 31 17:00:10 alarmpi systemd[1]: Failed to start PirateBox Service.
Dec 31 17:00:10 alarmpi systemd[1]: Unit piratebox.service entered failed state.
Re: Solving the bootup issue
July 06, 2014 05:55PM
Thanks.

I applied the same changes and get the same feedback as Peter (above).

[root@alarmpi ~]# systemctl status piratebox
* piratebox.service - PirateBox Service
   Loaded: loaded (/etc/systemd/system/piratebox.service; enabled)
   Active: failed (Result: exit-code) since Wed 1969-12-31 17:00:10 MST; 44 years 6 months ago
  Process: 107 ExecStart=/opt/piratebox/init.d/piratebox_alt start (code=exited, status=255)

Dec 31 17:00:10 alarmpi piratebox_alt[107]: Starting hostap...
Dec 31 17:00:10 alarmpi piratebox_alt[107]: 0
Dec 31 17:00:10 alarmpi piratebox_alt[107]: Setting up wlan
Dec 31 17:00:10 alarmpi piratebox_alt[107]: Bringing up wifi interface wlan0
Dec 31 17:00:10 alarmpi piratebox_alt[107]: wlan0: ERROR while getting interface flags: No such device
Dec 31 17:00:10 alarmpi piratebox_alt[107]: ..failed
Dec 31 17:00:10 alarmpi systemd[1]: piratebox.service: control process exited, code=exited status=255
Dec 31 17:00:10 alarmpi piratebox_alt[107]: failed setting up Interface
Dec 31 17:00:10 alarmpi systemd[1]: Failed to start PirateBox Service.
Dec 31 17:00:10 alarmpi systemd[1]: Unit piratebox.service entered failed state.

For the record I get the same response with not only the TP-Link TL-WN722N but also the WIPI (FCC ID: OYR-COMFAST88). Both are listed as known to be working. I just wondered what might be different in our cases here where the setup is working.
Re: Solving the bootup issue
July 09, 2014 07:43PM
Hi,
ok, while working on another thread, I had an idea today.
The output you posted doesn't contain the line "Probing interface wlan0". This can have to reasons:

1. PROBE_INTERFACE is not set correctly to "yes" (should be done by
sed -i 's|PROBE_INTERFACE="no"|PROBE_INTERFACE="yes"|g' /opt/piratebox/conf/piratebox.conf
without problem)

2. The issues below

That HAVE-TO appear if you enabled the function correctly.

So, I introduce you some changes, and then retest it.

1. Adjust piratebox_alt
edit with "vi" or "nano"
  /opt/piratebox/init.d/piratebox_alt
find the following line:
    fi

    if [ "$PROBE_INTERFACE" = yes ] ; then
      echo "  Probe wlan"
That should be around line 87 -

Please change it to
   if [ "$PROBE_INTERFACE" = "yes" ] ; then

That should create the message "Probe wlan" BEFORE "Starting hostap." when you run

2. But I think in the wifi-setup script is the next bug.
So edit
/opt/piratebox/bin/piratebox_setup_wlan.sh
.

Look around at line 79 , there you should find
  ifconfig $INTERFACE down
elif [ $ = "probe" ] ; then 
   # simply check if the interface is available
   probe
fi

please change it to:
elif [ "$2" = "probe" ] ; then

Test restarting the piratebox

systemctl piratebox restart
systemctl piratebox status
journalctl -xn

See if the messages about probing the interface appear.

Hope that helps.

regards Matthias


This is only my signature.
Re: Solving the bootup issue
July 09, 2014 11:29PM
[root@alarmpi ~]# systemctl status piratebox
* piratebox.service - PirateBox Service
Loaded: loaded (/etc/systemd/system/piratebox.service; enabled)
Active: active (running) since Wed 2014-07-09 17:18:59 MDT; 16s ago
Process: 332 ExecStart=/opt/piratebox/init.d/piratebox_alt start (code=exited, status=0/SUCCESS)
CGroup: /system.slice/piratebox.service
|-349 /usr/sbin/hostapd /opt/piratebox/conf/hostapd.conf
|-359 /usr/sbin/dnsmasq -x /var/run/piratebox_dnsmasq.pid -C /opt/...
|-366 python /opt/piratebox/bin/droopy -H piratebox.lan -d /opt/pi...
`-374 /usr/sbin/lighttpd -f /opt/piratebox/conf/lighttpd/lighttpd....

Jul 09 17:18:57 alarmpi dnsmasq-dhcp[359]: DHCP, IP range 192.168.77.10 -- 1...h
Jul 09 17:18:57 alarmpi dnsmasq[359]: read /opt/piratebox/conf/hosts_mesh -...es
Jul 09 17:18:57 alarmpi dnsmasq[359]: read /opt/piratebox/conf/hosts_genera...es
Jul 09 17:18:57 alarmpi piratebox_alt[332]: 0
Jul 09 17:18:57 alarmpi piratebox_alt[332]: Starting droopy...
Jul 09 17:18:57 alarmpi piratebox_alt[332]: 0
Jul 09 17:18:59 alarmpi piratebox_alt[332]: Generated HTML-Shoutbox File.
Jul 09 17:18:59 alarmpi piratebox_alt[332]: Starting lighttpd...
Jul 09 17:18:59 alarmpi piratebox_alt[332]: 0
Jul 09 17:18:59 alarmpi systemd[1]: Started PirateBox Service.
Hint: Some lines were ellipsized, use -l to show in full.




and for journalctl -xn:

-- Logs begin at Wed 1969-12-31 17:00:04 MST, end at Wed 2014-07-09 17:26:15 MDT. --
Jul 09 17:26:13 alarmpi dnsmasq-dhcp[404]: DHCP, IP range 192.168.77.10 -- 192.168.77.250, lease time 12h
Jul 09 17:26:13 alarmpi dnsmasq[404]: read /opt/piratebox/conf/hosts_mesh - 0 addresses
Jul 09 17:26:13 alarmpi dnsmasq[404]: read /opt/piratebox/conf/hosts_generated - 1 addresses
Jul 09 17:26:13 alarmpi piratebox_alt[374]: 0
Jul 09 17:26:13 alarmpi piratebox_alt[374]: Starting droopy...
Jul 09 17:26:13 alarmpi piratebox_alt[374]: 0
Jul 09 17:26:15 alarmpi piratebox_alt[374]: Generated HTML-Shoutbox File.
Jul 09 17:26:15 alarmpi piratebox_alt[374]: Starting lighttpd...
Jul 09 17:26:15 alarmpi piratebox_alt[374]: 0
Jul 09 17:26:15 alarmpi systemd[1]: Started PirateBox Service.
-- Subject: Unit piratebox.service has finished start-up
-- Defined-By: systemd
-- Support: [lists.freedesktop.org]
--
-- Unit piratebox.service has finished starting up.
--
-- The start-up result is done.





After reboot it does not work,. I get:

* piratebox.service - PirateBox Service
Loaded: loaded (/etc/systemd/system/piratebox.service; enabled)
Active: failed (Result: exit-code) since Wed 1969-12-31 17:00:10 MST; 44 years 6 months ago
Process: 114 ExecStart=/opt/piratebox/init.d/piratebox_alt start (code=exited, status=255)

Dec 31 17:00:09 alarmpi piratebox_alt[114]: Starting hostap...
Dec 31 17:00:09 alarmpi piratebox_alt[114]: 0
Dec 31 17:00:09 alarmpi piratebox_alt[114]: Setting up wlan
Dec 31 17:00:10 alarmpi piratebox_alt[114]: Bringing up wifi interface wlan0
Dec 31 17:00:10 alarmpi piratebox_alt[114]: wlan0: ERROR while getting interface flags: No such device
Dec 31 17:00:10 alarmpi piratebox_alt[114]: ..failed
Dec 31 17:00:10 alarmpi systemd[1]: piratebox.service: control process exited, code=exited status=255
Dec 31 17:00:10 alarmpi piratebox_alt[114]: failed setting up Interface
Dec 31 17:00:10 alarmpi systemd[1]: Failed to start PirateBox Service.
Dec 31 17:00:10 alarmpi systemd[1]: Unit piratebox.service entered failed state.
Re: Solving the bootup issue
July 10, 2014 03:32AM
Hi Peter,
thank you.
Then, the systmctl status command doesn't print enough lines on default....

can you please check
systemctl status --all piratebox
?

Refering to [bugzilla.redhat.com] it should print more lines.

Matthias


This is only my signature.
Re: Solving the bootup issue
July 10, 2014 09:15AM
[root@alarmpi ~]# systemctl status -all piratebox
* piratebox.service - PirateBox Service
Loaded: loaded (/etc/systemd/system/piratebox.service; enabled)
Active: failed (Result: exit-code) since Wed 1969-12-31 17:00:10 MST; 44 years 6 months ago
Process: 118 ExecStart=/opt/piratebox/init.d/piratebox_alt start (code=exited, status=255)

Dec 31 17:00:09 alarmpi piratebox_alt[118]: Starting hostap...
Dec 31 17:00:10 alarmpi piratebox_alt[118]: 0
Dec 31 17:00:10 alarmpi piratebox_alt[118]: Setting up wlan
Dec 31 17:00:10 alarmpi piratebox_alt[118]: Bringing up wifi interface wlan0
Dec 31 17:00:10 alarmpi piratebox_alt[118]: wlan0: ERROR while getting interface flags: No such device
Dec 31 17:00:10 alarmpi piratebox_alt[118]: ..failed
Dec 31 17:00:10 alarmpi systemd[1]: piratebox.service: control process exited, code=exited status=255
Dec 31 17:00:10 alarmpi piratebox_alt[118]: failed setting up Interface
Dec 31 17:00:10 alarmpi systemd[1]: Failed to start PirateBox Service.
Dec 31 17:00:10 alarmpi systemd[1]: Unit piratebox.service entered failed state.
[root@alarmpi ~]#
Re: Solving the bootup issue
July 21, 2014 07:11PM
unsatisfying, I need the f*** output of hostapd to see what happens...


This is only my signature.
Re: Solving the bootup issue
July 21, 2014 09:21PM
I am sorry that my response is unsatisfactory. Please state the exact command that you wish me to enter, and I will post the output by return.

Regards

Petef
Re: Solving the bootup issue
July 22, 2014 05:17PM
Hi,
yes I know. I didn't want to offensive you... I am only very unsatisfied that I can't solve it.

Matthias


This is only my signature.
Re: Solving the bootup issue
July 22, 2014 09:37PM
So how can I help you with this?

Regards

Peter
Re: Solving the bootup issue
July 24, 2014 07:54PM
You need to find a way to bring debug output of hostapd from the bootup time to a logfile.
It seems that for some reason hostpapd stops working, which is the reason that wlan0 is not available.

The current output above seems to be a limited output, that should be more, too.

but how? no real idea now.


This is only my signature.
Re: Solving the bootup issue
August 01, 2014 08:11PM
Do the startup steps manually and call
hostapd -dd /opt/piratebox/conf/hostapd.conf
? It produces some output for me at least...

Or maybe edit
 start-stop-daemon -m -S -b -p $PIDFILE_HOSTAPN  -x /usr/sbin/hostapd --  $CONF_APN
in the piratebox_alt script to something like
 /usr/sbin/hostapd  -dd $CONF_APN >> /opt/piratebox/hostapd.log

which is dirty, but we can maybe presume that hostapd is not running when that script is called and it will eventually terminate with some error, thus not blocking the rest of the script.

Good Luck!^^
Re: Solving the bootup issue
August 21, 2014 07:51PM
Hi,
I was able to reproduce it with one of my wifi cards.
The problem is, that system.d starts our service too early. Out of its perspective it has done its job, because he initialized the wifi card.. but the wifi card is still initializing when hostapd starts... and after the init of the wifi card is done, hostapd crashes.

I think I found the fix.
Please edit /etc/systemd/system/piratebox.service, that it looks like that

[Unit]
Description=PirateBox Service

[Service]
Type=idle
RemainAfterExit=yes
ExecStart=/opt/piratebox/init.d/piratebox_alt start
ExecStop=/opt/piratebox/init.d/piratebox_alt stop
#Restart=/opt/piratebox/init.d/piratebox_alt restart
#PIDFile=/var/run/piratebox.pid

[Install]
WantedBy=multi-user.target

Type=idle - means, that after the system is jumping into an idle mode.
RemainAfterExit=yes - Means, that the process forks itself.

Sorry, that took so long, I hope this helps

Matthias

edit: to find this issue, I added a few wait steps within piratebox_alt , and analyzed the output of "journalctl" in detail. There you are able to see, that some wifi-driver messages come across after hostapd is done.
With an addition wait step I was able to, see that after the wifi init, the network-step (which usually fails) worked... that was one finger-pointing clue more.


This is only my signature.



Edited 1 time(s). Last edit at 08/21/2014 07:57PM by Matthias.
Re: Solving the bootup issue
August 25, 2014 11:00PM
Hello,

It works! Many thanks for your efforts.

Interestingly though, I moved the SD card and wifi dongle, complete with the formatted usb memory stick to my raspberry pi B+ system and it stops working. Initial indications are that the usb ports are not functioning. I cannot make a usb keyboard plugged into the B+ unit respond in order to log in and edit files on the system. I can of course do this on my Model B. My B+ systems is fine with another card containing a debian image. Quite possibly I am overlooking something obvious.

Regards

Peter
Re: Solving the bootup issue
August 26, 2014 04:41AM
Hi Peter,
the RPi+ is currently not supported by our image sad smiley

I'll create a new image after testing for 1.0.1 is finished.

Matthias


This is only my signature.
MR
Re: Solving the bootup issue
December 14, 2015 03:51PM
Hi guys , after doing all this I still dont have a AP to connect ,
I am using TP-Link TL-WN722N .