Raspbian For Robots Oct 17, 2020 Release Test Log For My GoPiGo3

Any idea what causes this in general? What must be done to (generally) avoid this error in the future?

IOW: Given a user who has never used this before, what must be changed in either the code or it’s documentation to prevent this from occurring?

I suspect that RPI-Monitor is trying to launch a web server on 127.0.0.1 which the R4R apache2 server has claimed:

pi@Carl:~/Carl $ ps -ef | grep apache
root       753     1  0 Nov25 ?        00:00:06 /usr/sbin/apache2 -k start
www-data 17069   753  0 00:00 ?        00:00:00 /usr/sbin/apache2 -k start
www-data 17070   753  0 00:00 ?        00:00:00 /usr/sbin/apache2 -k start
www-data 17072   753  0 00:00 ?        00:00:00 /usr/sbin/apache2 -k start
www-data 17073   753  0 00:00 ?        00:00:00 /usr/sbin/apache2 -k start
www-data 17074   753  0 00:00 ?        00:00:00 /usr/sbin/apache2 -k start
pi       21655  1483  0 10:27 pts/0    00:00:00 grep --color=auto apache
pi@Carl:~/Carl $ sudo systemctl status rpimonitor
● rpimonitor.service - RPi-Monitor daemon
   Loaded: loaded (/etc/systemd/system/rpimonitor.service; enabled; vendor preset: enabled)
   Active: active (running) since Wed 2020-11-25 15:46:13 EST; 18h ago
 Main PID: 20282 (rpimonitord)
    Tasks: 5 (limit: 1939)
   CGroup: /system.slice/rpimonitor.service
           β”œβ”€20282 /usr/bin/perl /usr/bin/rpimonitord -a 10.0.0.186
           β”œβ”€20291 /usr/bin/perl /usr/bin/rpimonitord -a 10.0.0.186
           β”œβ”€20292 /usr/bin/perl /usr/bin/rpimonitord -a 10.0.0.186
           β”œβ”€21683 sh -c /home/pi/Carl/plib/getChargingStateStr.py 2>/dev/null
           └─21684 python3 /home/pi/Carl/plib/getChargingStateStr.py

Nov 25 15:46:13 Carl systemd[1]: Started RPi-Monitor daemon.





pi@Carl:~/Carl $ sudo systemctl status apache2
● apache2.service - The Apache HTTP Server
   Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
   Active: active (running) since Wed 2020-11-25 10:18:27 EST; 1 day 4h ago
     Docs: https://httpd.apache.org/docs/2.4/
  Process: 17057 ExecReload=/usr/sbin/apachectl graceful (code=exited, status=0/SUCCESS)
 Main PID: 753 (apache2)
    Tasks: 11 (limit: 1939)
   CGroup: /system.slice/apache2.service
           β”œβ”€  753 /usr/sbin/apache2 -k start
           β”œβ”€ 1884 /usr/sbin/apache2 -k start
           β”œβ”€ 1892 /usr/sbin/apache2 -k start
           β”œβ”€ 1893 /usr/sbin/apache2 -k start
           β”œβ”€ 1894 /usr/sbin/apache2 -k start
           β”œβ”€ 1898 /usr/sbin/apache2 -k start
           β”œβ”€17069 /usr/sbin/apache2 -k start
           β”œβ”€17070 /usr/sbin/apache2 -k start
           β”œβ”€17072 /usr/sbin/apache2 -k start
           β”œβ”€17073 /usr/sbin/apache2 -k start
           └─17074 /usr/sbin/apache2 -k start

Nov 25 10:18:22 Carl systemd[1]: Starting The Apache HTTP Server...
Nov 25 10:18:26 Carl apachectl[515]: AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' dir
Nov 25 10:18:27 Carl systemd[1]: Started The Apache HTTP Server.
Nov 26 00:00:55 Carl systemd[1]: Reloading The Apache HTTP Server.
Nov 26 00:00:55 Carl apachectl[17057]: AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' d
Nov 26 00:00:55 Carl systemd[1]: Reloaded The Apache HTTP Server.

thus the success of instructing the RPI-Monitor to use the reserved DHCP address I assigned to Carl’s on-board WiFi instead of the 127.0.0.1 localhost commonly used as a default server address.

This is the pertinent installation change that I made to make it work:

RPi-Monitor for GoPiGo3 Carl

* Documentation:

https://xavierberger.github.io/RPi-Monitor-docs/11_installation.html
https://xavierberger.github.io/RPi-Monitor-docs/index.html

* Installation  (first two added for "site refused to connect")
sudo apt-get install libregexp-common-perl
sudo apt-get install liburi-perl
sudo apt-get install dirmngr
sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 2C0D3C0F
sudo wget http://goo.gl/vewCLL -O /etc/apt/sources.list.d/rpimonitor.list
sudo apt-get update
sudo apt-get install rpimonitor


==== Nov 2020 PiOS R4R install ====

something weird at boot
Runs just fine when run:
ps -ef | grep rpi
(kill off all rpimonitor - rpimonitord + three perl jobs)
sudo rpimonitord -a 10.0.0.186 -l /var/log/rpimonitord.log &


pkg install of rpimonitor places /etc/init.d/rpimonitor which is the "old" method of starting services.  The "new" method is to create /etc/systemd/system/rpimonitor.service , and enable it.

(see https://github.com/XavierBerger/RPi-Monitor/issues/302)




For some reason I have to set the address to 10.0.0.186 or it gets  

Web server not started because of error: Address already in use



sudo nano /etc/systemd/system/rpimonitor.service

# #####
[Unit]
Description=RPi-Monitor daemon
Before=multi-user.target
After=remote-fs.target
After=network-online.target
Wants=network-online.target

[Service]
Type=simple
Restart=on-failure
KillMode=mixed
Nice=19
ExecStart=/usr/bin/rpimonitord -a 10.0.0.186
ExecStop=/bin/kill $MAINPID
StandardOutput=append:/var/log/rpimonitor.log
StandardError=append:/var/log/rpimonitor.log

[Install]
WantedBy=multi-user.target
# ######

then 

sudo systemctl daemon-reload
sudo systemctl enable rpimonitor
sudo systemctl start rpimonitor


(reboot to confirm startup at boot)

That gets the RPI-Monitor up showing processor load and temperature, disk and memory statistics.

Getting the RPI-Monitor to track and display Carl’s battery voltage is a complex configuration of somewhat Carl specific configuration that could easily be generalized for any GoPiGo bot.

If you decide to try installing RPI-Monitor, let me know when it is up and running. I’ll create an β€œany GoPiGo3 config” for you.

1 Like

Thanks!

I don’t think that will be necessary any time soon, there are enough web servers running on Charlie right now, just with the VNC server and the Remote Camera Robot stuff.

However, it is interesting to see you analysis of the problem and your suspicion that it wanted to appropriate localhost. (And why do you have an Apache instance running anyway? :grin:)

Raspbian For Robots (PiOS version) uses apache2 to serve up the R4R landing page:

/var/www/html/index_buster.php 

<title>Dexter Industries Raspbian for Robots</title>
...
<section>
  <p>
    Welcome to Raspbian for Robots, our custom software for your Dexter Industries robots! There are two ways to view and program your robot.
  </p>
  <p>
    The easiest and most user friendly way for beginners is to go in through VNC (virtual network connections), which will show you a little desktop in your browser wi
th icons and folders.
  </p>
  <p>
    If you are more advanced and want to work in the command line, choose Terminal and have fun!
  </p>
</section>

And also interesting the apache error log:

pi@Carl:~/Carl $ sudo more /var/log/apache2/error.log
[Thu Nov 26 00:00:56.003163 2020] [mpm_prefork:notice] [pid 753] AH00163: Apache/2.4.38 (Raspbian) configured -- resuming normal operations
[Thu Nov 26 00:00:56.003303 2020] [core:notice] [pid 753] AH00094: Command line: '/usr/sbin/apache2'
[Thu Nov 26 14:03:13.900447 2020] [php7:notice] [pid 17069] [client 10.0.0.129:50219] PHP Notice:  Undefined offset: 0 in /var/www/html/index.php on line 4
[Thu Nov 26 14:03:13.930312 2020] [php7:notice] [pid 17069] [client 10.0.0.129:50219] PHP Notice:  Undefined variable: ips in /var/www/html/index.php on line 76
[Thu Nov 26 14:03:13.930438 2020] [php7:warn] [pid 17069] [client 10.0.0.129:50219] PHP Warning:  Invalid argument supplied for foreach() in /var/www/html/index.php on
 line 76
1 Like