Using the ODROID C2 as a WLAN Testing Tool – Part 4: Installing FruityWifi

Using the ODROID C2 as a WLAN Testing Tool – Part 4: Installing FruityWifi

My System Specifications

I am running Dietpi on an ODroid C2.  Here are the Details of my OS, most recently updated at the time of this posting.:

root@dietpi:~# cat /etc/*-release
PRETTY_NAME="Debian GNU/Linux 8 (jessie)"
NAME="Debian GNU/Linux"
VERSION_ID="8"
VERSION="8 (jessie)"
ID=debian
HOME_URL="http://www.debian.org/"
SUPPORT_URL="http://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/

The OS is currently in a default state, I have done nothing except edit some locale/language information and the keyboard layout.  I have basically got a bare bones DietPi installation at this point.

Installing FruityWiFi

I have installed FruityWifi version 2.4.  If you are using Kali Linux you can simply use the apt-get service as FruityWifi is included in those repositories.  I am running a variant of Debian and so need to actually run the installation script itself.   Here is a repeat of the commands on the Wiki that I followed:

root@dietpi:~# wget https://github.com/xtr4nge/FruityWifi/archive/master.zip
root@dietpi:~# sudo unzip master.zip
root@dietpi:~# cd FruityWifi-master
root@dietpi:~/FruityWifi-master# sudo chmod 755 ./install-FruityWifi.sh
root@dietpi:~/FruityWifi-master# sudo ./install-FruityWifi.sh

After reading through some of the issues, it is apparent that the best way to install any of the modules is via the web interface one by one and not all in one go!  You can also install FruityWifi on Android with NetHunter, which is a tempting idea for my Nexus 6…  If you want a quick installation tutorial on that platform, check this or this out.

I will keep an updated list of issues I encounter with each new version of FruityWifi on DietPi here on this page for my own reference and perhaps yours.  But if you want more details on working with FruityWiFi, I think the best idea is to head over to the Wiki.

Reboot / Start-up

I have found that the FruityWiFi web UI is not automatically available when the ODROID boots up.  I had a look at the running processes in my ODROID using top and htop and found that the the web server for FruityWiFi (Nginx) was not running.  I have also found that starting NGINX manually is also failing.

First, let’s try starting Nginx:

root@DietPi:~# /etc/init.d/nginx start
[....] Starting nginx (via systemctl): nginx.serviceJob for nginx.service failed. See 'systemctl status nginx.service' and 'journalctl -xn' for details.
failed!
root@DietPi:~#

Err. ok that didn’t work… let’s follow the hint shall we?

root@DietPi:~# systemctl status nginx.service
 nginx.service - A high performance web server and a reverse proxy server
   Loaded: loaded (/lib/systemd/system/nginx.service; enabled)
   Active: failed (Result: exit-code) since Mon 2017-08-07 14:19:40 SAST; 1min 51s ago
  Process: 2951 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)

Aug 07 14:19:40 DietPi nginx[2951]: nginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (2: No such file or directory)
Aug 07 14:19:40 DietPi nginx[2951]: 2017/08/07 14:19:40 [emerg] 2951#0: open() "/var/log/nginx/access.log" failed (2: No such file or directory)
Aug 07 14:19:40 DietPi nginx[2951]: nginx: configuration file /etc/nginx/nginx.conf test failed
Aug 07 14:19:40 DietPi systemd[1]: nginx.service: control process exited, code=exited status=1
Aug 07 14:19:40 DietPi systemd[1]: Failed to start A high performance web server and a reverse proxy server.
Aug 07 14:19:40 DietPi systemd[1]: Unit nginx.service entered failed state.
root@DietPi:~# 

Let’s go and look at exactly what is wrong here, first let’s look for the directory /var/log/nginx which was mentioned explicitly in the errors.

root@DietPi:~# cd /var/log/nginx
-bash: cd: /var/log/nginx: No such file or directory
root@DietPi:~# mkdir /var/log/nginx
root@DietPi:~# 

Right, so we have created the directory /var/log/nginx let’s see if that helps?

root@DietPi:~# /etc/init.d/nginx start
[ ok ] Starting nginx (via systemctl): nginx.service.
root@DietPi:~# systemctl status nginx.service
 nginx.service - A high performance web server and a reverse proxy server
   Loaded: loaded (/lib/systemd/system/nginx.service; enabled)
   Active: active (running) since Mon 2017-08-07 14:30:14 SAST; 7s ago
  Process: 3212 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
  Process: 3209 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
 Main PID: 3213 (nginx)
   CGroup: /system.slice/nginx.service
           ├─3213 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
           ├─3214 nginx: worker process
           ├─3215 nginx: worker process
           ├─3216 nginx: worker process
           └─3217 nginx: worker process

Aug 07 14:30:14 DietPi systemd[1]: Started A high performance web server and a reverse proxy server.
root@DietPi:~# 

If you had this problem and followed the steps above, you should be able to browse to the FruityWiFi WEB UI now.

Permanently Add /var/log/nginx

The /var/log directory is a temporary set of files that is recreated on each boot.  So even though we have added the /var/log/nginx directory above, if you reboot your SBC, it may disappear and you may have to re-do the steps above to get FruityWiFi working again.

I have tested this and in some reboots, the /var/log/nginx directory disappeared after a reboot.  In other tests, it remained.  I am not entirely sure WHY there was variability in those results, but if the directory does keep disappearing on you, here is a way to fix that.

This forum post on linksprite helped me a lot!  I am going to use nano to edit the rc.local script to add the /var/log/nginx for me at each boot  by adding the line:

mkdir -p /var/log/nginx

immediately before  ‘exit 0’.

This will get the directory in place, but it is not going to get the service up and running on its own. You will have to run the command to start the nginx service once you have booted up.

Right now, I have removed this command from my /etc/rc.local file and everything seems to be working fine without starting the service manually.  I am somewhat bemused by the whole situation, but if I ever run into this problem again I will track back here and update with more details.

Thats all for now!

Leave a Reply

Your email address will not be published. Required fields are marked *