After the
Operating System reload sequence has finished the
System Information & Operating System / Firmware Load page should be reloaded. This page in itself checks the following three points :-
- The Apache2 server is up and running.
- The PHP interpreter is working.
- The CGI binaries are operating as expected.
Take a look :-

The
Apache2 webserver is up & running and the
PHP interpreter is working fine but it would appear
Apache2 is serving up the
peekstring binary instead of executing it and serving up the result!
Scroll down on the
System webpage and click on
Refresh in the
System table.

Expected result! Looks like
Apache2 is not executing anything
CGI related.
Also, the MAC address has dissapeared from the
Network table.
Use the
Debug terminal to login to PetaLinux and investigate what's gone wrong.
Check for the executable attribute on the
peekstring CGI.
petalinux:~$ ls -la /srv/www/cgi-bin/peekstring
-rwxr-xr-x 1 root root 5512 Mar 9 2018 /srv/www/cgi-bin/peekstring
Looks good!
Examine the
Apache2 error log.
petalinux:~$ cat /tmp/apache2_error_log
[Fri Mar 09 12:35:13.734461 2018] [unixd:alert] [pid 611:tid 611] AH02155: getpwuid: couldn't determine user name from uid -1, you probably need to modify the User directive
[Fri Mar 09 12:35:13.738481 2018] [unixd:alert] [pid 612:tid 612] AH02155: getpwuid: couldn't determine user name from uid -1, you probably need to modify the User directive
[Fri Mar 09 12:35:13.741911 2018] [mpm_prefork:notice] [pid 604:tid 604] AH00163: Apache/2.4.62 (Unix) PHP/8.2.20 configured -- resuming normal operations
[Fri Mar 09 12:35:13.742316 2018] [core:notice] [pid 604:tid 604] AH00094: Command line: '/usr/sbin/httpd'
[Fri Mar 09 12:35:13.747078 2018] [unixd:alert] [pid 613:tid 613] AH02155: getpwuid: couldn't determine user name from uid -1, you probably need to modify the User directive
[Fri Mar 09 12:35:13.748607 2018] [unixd:alert] [pid 614:tid 614] AH02155: getpwuid: couldn't determine user name from uid -1, you probably need to modify the User directive
[Fri Mar 09 12:35:13.754288 2018] [unixd:alert] [pid 615:tid 615] AH02155: getpwuid: couldn't determine user name from uid -1, you probably need to modify the User directive
cat: can't open '/sys/class/net/eth0/address': No such file or directory
[Fri Mar 09 12:35:14.755520 2018] [unixd:alert] [pid 649:tid 649] AH02155: getpwuid: couldn't determine user name from uid -1, you probably need to modify the User directive
[Fri Mar 09 12:35:15.758246 2018] [unixd:alert] [pid 681:tid 681] AH02155: getpwuid: couldn't determine user name from uid -1, you probably need to modify the User directive
[Fri Mar 09 12:35:15.761482 2018] [unixd:alert] [pid 682:tid 682] AH02155: getpwuid: couldn't determine user name from uid -1, you probably need to modify the User directive
[Fri Mar 09 12:35:16.764407 2018] [unixd:alert] [pid 683:tid 683] AH02155: getpwuid: couldn't determine user name from uid -1, you probably need to modify the User directive
[Fri Mar 09 12:35:16.770937 2018] [unixd:alert] [pid 684:tid 684] AH02155: getpwuid: couldn't determine user name from uid -1, you probably need to modify the User directive
[Fri Mar 09 12:35:16.775268 2018] [unixd:alert] [pid 685:tid 685] AH02155: getpwuid: couldn't determine user name from uid -1, you probably need to modify the User directive
[Fri Mar 09 12:35:16.778756 2018] [unixd:alert] [pid 686:tid 686] AH02155: getpwuid: couldn't determine user name from uid -1, you probably need to modify the User directive
Looks OK! Nothing related to the
CGI issues.
Examining the
Apache2 configuration file.
petalinux:~$ grep -i cgi /etc/apache2/httpd.conf
#LoadModule proxy_fcgi_module /usr/libexec/apache2/modules/mod_proxy_fcgi.so
#LoadModule proxy_scgi_module /usr/libexec/apache2/modules/mod_proxy_scgi.so
#LoadModule cgi_module /usr/libexec/apache2/modules/mod_cgi.so
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
ScriptAlias /cgi-bin/ "/srv/www/cgi-bin/"
# socket used to communicate with the CGI daemon of mod_cgid.
Scriptsock /var/run/cgid.sock
# "/usr/libexec/apache2/modules/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
# Avoid passing HTTP_PROXY environment to CGI's on this or any proxied
# To use CGI scripts outside of ScriptAliased directories:
# (You will also need to add "ExecCGI" to the "Options" directive.)
#AddHandler cgi-script .cgi
#ErrorDocument 404 "/cgi-bin/missing_handler.pl"
The
cgi_module entry is commented out! Uncomment the
cgi_module entry and reload
Apache2. The previous entry for this in
httpd.conf used the
mod_cgid.so module, hence the
sed command in
apache2_%.bbappend didn't perform the uncomment correctly.
petalinux:~$ sudo sed -i 's/#LoadModule cgi_module/LoadModule cgi_module/' /etc/apache2/httpd.conf
petalinux:~$ sudo /etc/init.d/apache2 force-reload
Reloading apache2 modules.
Refresh the
System tab to see if the
Firmware Information has put in an appearance.
All good! The
Firmware Information table updated successfully.
Check the interface for the MAC address issue.
petalinux:~$ ls -la /sys/class/net
drwxr-xr-x 2 root root 0 Jan 1 1970 .
drwxr-xr-x 49 root root 0 Jan 1 1970 ..
lrwxrwxrwx 1 root root 0 Mar 20 18:28 enx000a35001e53 -> ../../devices/soc0/axi/e000b000.ethernet/net/enx000a35001e53
lrwxrwxrwx 1 root root 0 Jan 1 1970 lo -> ../../devices/virtual/net/lo
lrwxrwxrwx 1 root root 0 Jan 1 1970 sit0 -> ../../devices/virtual/net/sit0
Looks like the name has changed from eth0 to enx000a35001e53, lets extract the MAC address a little more cleanly.
petalinux:~$ cat /sys/class/net/$(ip route show default | awk '/default/ {print $5}')/address
00:0a:35:00:1e:53