command-line-PATH-bug.txt

2022-07-22

Dear Sirs:

	Thank you so very much for your excellent help. My original Bugzilla report #? dated 2021-09-15-Problem-with-PATH.txt fixed almost all of the problems, but there are a few stragglers that have shown up. I made a little shell program (below) that demonstrate these stragglers: http://162.250.19.7/command-line-PATH-bug.txt.
	It would be nice if distributions included: "/home/local/sbin:/home/local/bin:" in the "PATH" command for use by programs that are compiled form source code for a specific computer. This would let these programs be backed-up by just copying "/home" and the directories under it. Since most of the programs that are installed with "apt" are generic binary files and are stored under "/usr" and "/var". Putting programs that are compiled from source code there makes it very hard to back them up.
	I have upgraded my install of "thttpd" from Acme.com so hopefully even a third or fourth grader will be more able to install "thttpd" and have their own bullet proof World Wide Web server which is directly connected to the internet. My web site is: http://162.250.19.7/ and theoretically just the IP Address: 162.250.19.7 should get one to it. The file "freedom.zip" contains all of the material. A Raspberry Pi 400 ($70 USD, Kit $100 USD) pulls 7 - 10 watts and has a built-in heat sink so is totally silent. Running a 32 bit OS limits the maximum size file served by thttpd to less than 2 GB. Using a 64 bit OS gives an unlimited file size. In a few days, My site now running on a Raspberry Pi 4 B with 4 GB RAM, will have been up on the World Wide Web for over three years, without any problems of being hacked.
	My log files are under "ac0xl/logs." and show the beating a computer connected to the internet takes and the tactics that are being used to hack web sites. "thttpd" is an industrial grade web server. Just a couple of months ago, the total number of web-server computers directly connected to the internet, in the whole world, finally went over 12 million, https://news.netcraft.com.
	Having a web server that is safe only on a local area network does not build much interest for one, when they can be building robots or video games and interacting with others, see: RaspberryPi.com and RaspberryPi.org.
	Thanks again for all of your FANTASTIC HELP! Feel free to share this information with everyone.

Sincerely,


Frank Anderson, AC0XL

PO Box 615
Green River, UT 84525-0615

e-mail: ac0xl.ham@gmail.com
MagicJack Phones: 435-210-0710 or 970-424-1451



**********************************************************************************************************************8





command-line-PATH-bug.txt
2022-03-23

pi@raspberrypi:~ $ #		********** Original PATH **********

pi@raspberrypi:~ $ $PATH
bash: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games: No such file or directory



# My pathtest file.

pi@raspberrypi:~ $ ls -al pathtest
-rwxr-xr-x 1 pi pi 98 Mar 23 12:02 pathtest
pi@raspberrypi:~ $ 
pi@raspberrypi:~ $ cat pathtest
#!/bin/sh
# pathtest

echo "pathtest shell program.\n pathtest pid = " `ps -C pathtest`
date
w

#
pi@raspberrypi:~ $ 




# OS Build version (Raspberry Pi 64-bit OS)



pi@raspberrypi:~ $ cat /proc/version
Linux version 5.10.103-v8+ (dom@buildbot) (aarch64-linux-gnu-gcc-8 (Ubuntu/Linaro 8.4.0-3ubuntu1) 8.4.0, GNU ld (GNU Binutils for Ubuntu) 2.34) #1530 SMP PREEMPT Tue Mar 8 13:06:35 GMT 2022



# Running on a Raspberry Pi 400 and 128 GB microSD card.


pi@raspberrypi:~ $ cat /proc/cpuinfo
processor	: 0
BogoMIPS	: 108.00
Features	: fp asimd evtstrm crc32 cpuid
CPU implementer	: 0x41
CPU architecture: 8
CPU variant	: 0x0
CPU part	: 0xd08
CPU revision	: 3

processor	: 1
BogoMIPS	: 108.00
Features	: fp asimd evtstrm crc32 cpuid
CPU implementer	: 0x41
CPU architecture: 8
CPU variant	: 0x0
CPU part	: 0xd08
CPU revision	: 3

processor	: 2
BogoMIPS	: 108.00
Features	: fp asimd evtstrm crc32 cpuid
CPU implementer	: 0x41
CPU architecture: 8
CPU variant	: 0x0
CPU part	: 0xd08
CPU revision	: 3

processor	: 3
BogoMIPS	: 108.00
Features	: fp asimd evtstrm crc32 cpuid
CPU implementer	: 0x41
CPU architecture: 8
CPU variant	: 0x0
CPU part	: 0xd08
CPU revision	: 3

Hardware	: BCM2835
Revision	: c03130
Serial		: 1000000019c3b021
Model		: Raspberry Pi 400 Rev 1.0



# The original PATH is stored in /etc/profile in two places, on Ubuntu it is stored in /etc/environment, on the RaspberryPi OS it is in /etc/profile.


pi@raspberrypi:~ $ cd /etc
pi@raspberrypi:/etc $ 


pi@raspberrypi:/etc $ cat profile
# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).

if [ "$(id -u)" -eq 0 ]; then
  PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
else
  PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games"
fi
export PATH

if [ "${PS1-}" ]; then
  if [ "${BASH-}" ] && [ "$BASH" != "/bin/sh" ]; then
    # The file bash.bashrc already sets the default PS1.
    # PS1='\h:\w\$ '
    if [ -f /etc/bash.bashrc ]; then
      . /etc/bash.bashrc
    fi
  else
    if [ "$(id -u)" -eq 0 ]; then
      PS1='# '
    else
      PS1='$ '
    fi
  fi
fi

if [ -d /etc/profile.d ]; then
  for i in /etc/profile.d/*.sh; do
    if [ -r $i ]; then
      . $i
    fi
  done
  unset i
fi



pi@raspberrypi:/etc $ sudo nano profile
pi@raspberrypi:/etc $ 


# Added "/home/local/sbin:/home/local/bin:" to both lines in /etc/profile.


pi@raspberrypi:/etc $ cat profile
# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).

if [ "$(id -u)" -eq 0 ]; then
  PATH="/home/local/sbin:/home/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
else
  PATH="/home/local/sbin:/home/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games"
fi
export PATH

if [ "${PS1-}" ]; then
  if [ "${BASH-}" ] && [ "$BASH" != "/bin/sh" ]; then
    # The file bash.bashrc already sets the default PS1.
    # PS1='\h:\w\$ '
    if [ -f /etc/bash.bashrc ]; then
      . /etc/bash.bashrc
    fi
  else
    if [ "$(id -u)" -eq 0 ]; then
      PS1='# '
    else
      PS1='$ '
    fi
  fi
fi

if [ -d /etc/profile.d ]; then
  for i in /etc/profile.d/*.sh; do
    if [ -r $i ]; then
      . $i
    fi
  done
  unset i
fi



pi@raspberrypi:/etc $ 
pi@raspberrypi:/etc $ reboot





pi@raspberrypi:~ $ $PATH
bash: /home/local/sbin:/home/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games: No such file or directory





pi@raspberrypi:~ $ ./pathtest
pathtest shell program.
 pathtest pid =  PID TTY TIME CMD 3642 pts/1 00:00:00 pathtest
Wed 23 Mar 2022 12:12:31 PM MDT
 12:12:31 up  2:47,  2 users,  load average: 0.00, 0.05, 0.08
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
pi       tty7     :0               Tue20   15:35m  5:50   0.65s /usr/bin/lxsession -s LXDE
pi       tty1     -                Tue20   15:35m  0.06s  0.05s -bash
pi@raspberrypi:~ $ 



# /home/local does not exist at this point.


pi@raspberrypi:~ $ ls -alR /home/local/
ls: cannot access '/home/local/': No such file or directory
pi@raspberrypi:~ $ 



# /usr/local exists, but sbin and bin are both empty.



pi@raspberrypi:~ $ ls -alR /usr/local/
/usr/local/:
total 40
drwxr-xr-x 10 root root 4096 Jan 27 19:58 .
drwxr-xr-x 11 root root 4096 Jan 27 19:58 ..
drwxr-xr-x  2 root root 4096 Jan 27 19:58 bin
drwxr-xr-x  2 root root 4096 Jan 27 19:58 etc
drwxr-xr-x  2 root root 4096 Jan 27 19:58 games
drwxr-xr-x  2 root root 4096 Jan 27 19:58 include
drwxr-xr-x  4 root root 4096 Jan 27 20:08 lib
lrwxrwxrwx  1 root root    9 Jan 27 19:58 man -> share/man
drwxr-xr-x  2 root root 4096 Jan 27 19:58 sbin
drwxr-xr-x  7 root root 4096 Jan 27 20:09 share
drwxr-xr-x  2 root root 4096 Jan 27 19:58 src


/usr/local/bin:
total 8
drwxr-xr-x  2 root root 4096 Jan 27 19:58 .
drwxr-xr-x 10 root root 4096 Jan 27 19:58 ..


/usr/local/etc:
total 8
drwxr-xr-x  2 root root 4096 Jan 27 19:58 .
drwxr-xr-x 10 root root 4096 Jan 27 19:58 ..


/usr/local/games:
total 8
drwxr-xr-x  2 root root 4096 Jan 27 19:58 .
drwxr-xr-x 10 root root 4096 Jan 27 19:58 ..


/usr/local/include:
total 8
drwxr-xr-x  2 root root 4096 Jan 27 19:58 .
drwxr-xr-x 10 root root 4096 Jan 27 19:58 ..


/usr/local/lib:
total 16
drwxr-xr-x  4 root root 4096 Jan 27 20:08 .
drwxr-xr-x 10 root root 4096 Jan 27 19:58 ..
drwxr-xr-x  3 root root 4096 Jan 27 20:08 pypy2.7
drwxr-xr-x  3 root root 4096 Jan 27 20:00 python3.9


/usr/local/lib/pypy2.7:
total 12
drwxr-xr-x 3 root root 4096 Jan 27 20:08 .
drwxr-xr-x 4 root root 4096 Jan 27 20:08 ..
drwxr-xr-x 2 root root 4096 Jan 27 20:08 dist-packages


/usr/local/lib/pypy2.7/dist-packages:
total 8
drwxr-xr-x 2 root root 4096 Jan 27 20:08 .
drwxr-xr-x 3 root root 4096 Jan 27 20:08 ..


/usr/local/lib/python3.9:
total 12
drwxr-xr-x 3 root root 4096 Jan 27 20:00 .
drwxr-xr-x 4 root root 4096 Jan 27 20:08 ..
drwxr-xr-x 2 root root 4096 Jan 27 20:00 dist-packages


/usr/local/lib/python3.9/dist-packages:
total 8
drwxr-xr-x 2 root root 4096 Jan 27 20:00 .
drwxr-xr-x 3 root root 4096 Jan 27 20:00 ..


/usr/local/sbin:
total 8
drwxr-xr-x  2 root root 4096 Jan 27 19:58 .
drwxr-xr-x 10 root root 4096 Jan 27 19:58 ..


/usr/local/share:
total 28
drwxr-xr-x  7 root root  4096 Jan 27 20:09 .
drwxr-xr-x 10 root root  4096 Jan 27 19:58 ..
drwxr-xr-x  2 root root  4096 Jan 27 19:59 ca-certificates
drwxrwsr-x  2 root staff 4096 Jan 27 20:02 fonts
drwxr-xr-x  2 root root  4096 Jan 27 19:58 man
drwxr-xr-x  7 root root  4096 Jan 27 20:08 sgml
drwxr-xr-x  6 root root  4096 Jan 27 20:09 xml


/usr/local/share/ca-certificates:
total 8
drwxr-xr-x 2 root root 4096 Jan 27 19:59 .
drwxr-xr-x 7 root root 4096 Jan 27 20:09 ..


/usr/local/share/fonts:
total 12
drwxrwsr-x 2 root staff 4096 Jan 27 20:02 .
drwxr-xr-x 7 root root  4096 Jan 27 20:09 ..
-rw-r--r-- 1 root staff   36 Jan 27 20:04 .uuid


/usr/local/share/man:
total 8
drwxr-xr-x 2 root root 4096 Jan 27 19:58 .
drwxr-xr-x 7 root root 4096 Jan 27 20:09 ..


/usr/local/share/sgml:
total 28
drwxr-xr-x 7 root root 4096 Jan 27 20:08 .
drwxr-xr-x 7 root root 4096 Jan 27 20:09 ..
drwxr-xr-x 2 root root 4096 Jan 27 20:08 declaration
drwxr-xr-x 2 root root 4096 Jan 27 20:08 dtd
drwxr-xr-x 2 root root 4096 Jan 27 20:08 entities
drwxr-xr-x 2 root root 4096 Jan 27 20:08 misc
drwxr-xr-x 2 root root 4096 Jan 27 20:08 stylesheet


/usr/local/share/sgml/declaration:
total 8
drwxr-xr-x 2 root root 4096 Jan 27 20:08 .
drwxr-xr-x 7 root root 4096 Jan 27 20:08 ..


/usr/local/share/sgml/dtd:
total 8
drwxr-xr-x 2 root root 4096 Jan 27 20:08 .
drwxr-xr-x 7 root root 4096 Jan 27 20:08 ..


/usr/local/share/sgml/entities:
total 8
drwxr-xr-x 2 root root 4096 Jan 27 20:08 .
drwxr-xr-x 7 root root 4096 Jan 27 20:08 ..


/usr/local/share/sgml/misc:
total 8
drwxr-xr-x 2 root root 4096 Jan 27 20:08 .
drwxr-xr-x 7 root root 4096 Jan 27 20:08 ..


/usr/local/share/sgml/stylesheet:
total 8
drwxr-xr-x 2 root root 4096 Jan 27 20:08 .
drwxr-xr-x 7 root root 4096 Jan 27 20:08 ..


/usr/local/share/xml:
total 24
drwxr-xr-x 6 root root 4096 Jan 27 20:09 .
drwxr-xr-x 7 root root 4096 Jan 27 20:09 ..
drwxr-xr-x 2 root root 4096 Jan 27 20:09 declaration
drwxr-xr-x 2 root root 4096 Jan 27 20:09 entities
drwxr-xr-x 2 root root 4096 Jan 27 20:09 misc
drwxr-xr-x 2 root root 4096 Jan 27 20:09 schema


/usr/local/share/xml/declaration:
total 8
drwxr-xr-x 2 root root 4096 Jan 27 20:09 .
drwxr-xr-x 6 root root 4096 Jan 27 20:09 ..


/usr/local/share/xml/entities:
total 8
drwxr-xr-x 2 root root 4096 Jan 27 20:09 .
drwxr-xr-x 6 root root 4096 Jan 27 20:09 ..


/usr/local/share/xml/misc:
total 8
drwxr-xr-x 2 root root 4096 Jan 27 20:09 .
drwxr-xr-x 6 root root 4096 Jan 27 20:09 ..


/usr/local/share/xml/schema:
total 8
drwxr-xr-x 2 root root 4096 Jan 27 20:09 .
drwxr-xr-x 6 root root 4096 Jan 27 20:09 ..


/usr/local/src:
total 8
drwxr-xr-x  2 root root 4096 Jan 27 19:58 .
drwxr-xr-x 10 root root 4096 Jan 27 19:58 ..
pi@raspberrypi:~ $ 




$ Created both /home/local/sbin/ and /home/local/bin/.


pi@raspberrypi:~ $ sudo mkdir -p /home/local/sbin/ /home/local/bin/



pi@raspberrypi:~ $ ls -alR /home/local/
/home/local/:
total 16
drwxr-xr-x 4 root root 4096 Mar 23 12:20 .
drwxr-xr-x 4 root root 4096 Mar 23 12:20 ..
drwxr-xr-x 2 root root 4096 Mar 23 12:20 bin
drwxr-xr-x 2 root root 4096 Mar 23 12:20 sbin


/home/local/bin:
total 8
drwxr-xr-x 2 root root 4096 Mar 23 12:20 .
drwxr-xr-x 4 root root 4096 Mar 23 12:20 ..


/home/local/sbin:
total 8
drwxr-xr-x 2 root root 4096 Mar 23 12:20 .
drwxr-xr-x 4 root root 4096 Mar 23 12:20 ..
pi@raspberrypi:~ $ 



# moved pathtest from pi to /home/local/sbin/.


pi@raspberrypi:~ $ sudo mv -v pathtest /home/local/sbin/
renamed 'pathtest' -> '/home/local/sbin/pathtest'



pi@raspberrypi:~ $ ls -al /home/local/sbin
total 12
drwxr-xr-x 2 root root 4096 Mar 23 12:22 .
drwxr-xr-x 4 root root 4096 Mar 23 12:20 ..
-rwxr-xr-x 1 pi   pi     98 Mar 23 12:02 pathtest
pi@raspberrypi:~ $ 



# changed owner and group from pi to root.


pi@raspberrypi:~ $ sudo chown -v root:root /home/local/sbin/pathtest
changed ownership of '/home/local/sbin/pathtest' from pi:pi to root:root
pi@raspberrypi:~ $ 



pi@raspberrypi:~ $ ls -al /home/local/sbin
total 12
drwxr-xr-x 2 root root 4096 Mar 23 12:22 .
drwxr-xr-x 4 root root 4096 Mar 23 12:20 ..
-rwxr-xr-x 1 root root   98 Mar 23 12:02 pathtest
pi@raspberrypi:~ $ 



pi@raspberrypi:~ $ ls -alR /home/local/
/home/local/:
total 16
drwxr-xr-x 4 root root 4096 Mar 23 12:20 .
drwxr-xr-x 4 root root 4096 Mar 23 12:20 ..
drwxr-xr-x 2 root root 4096 Mar 23 12:20 bin
drwxr-xr-x 2 root root 4096 Mar 23 12:22 sbin


/home/local/bin:
total 8
drwxr-xr-x 2 root root 4096 Mar 23 12:20 .
drwxr-xr-x 4 root root 4096 Mar 23 12:20 ..


/home/local/sbin:
total 12
drwxr-xr-x 2 root root 4096 Mar 23 12:22 .
drwxr-xr-x 4 root root 4096 Mar 23 12:20 ..
-rwxr-xr-x 1 root root   98 Mar 23 12:02 pathtest
pi@raspberrypi:~ $ 



pi@raspberrypi:~ $ reboot

*************************************************************************************************

pi@raspberrypi:~ $ 

# Both /home/local/sbin/ and /home/local/bin/ are now in the $PATH.


pi@raspberrypi:~ $ $PATH
bash: /home/local/sbin:/home/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games: No such file or directory



pi@raspberrypi:~ $ ls -al /etc/rc.local
-rwxr-xr-x 1 root root 420 Jan 27 20:03 /etc/rc.local
pi@raspberrypi:~ $ 



# Original /etc/rc.local file.


pi@raspberrypi:~ $ cat /etc/rc.local
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
  printf "My IP address is %s\n" "$_IP"
fi

exit 0



pi@raspberrypi:~ $ sudo nano /etc/rc.local
pi@raspberrypi:~ $ 


# Added: # Start pathtest
		 echo "Starting pathtest. \n" 
		 #    /home/local/sbin/pathtest
		 pathtest

		 #
 # to the end before the exit 0.



pi@raspberrypi:~ $ ls -al /etc/rc.local
-rwxr-xr-x 1 root root 513 Mar 23 13:22 /etc/rc.local
pi@raspberrypi:~ $ 



pi@raspberrypi:~ $ cat /etc/rc.local
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
  printf "My IP address is %s\n" "$_IP"
fi


# Start pathtest
echo "Starting pathtest. \n" 
#    /home/local/sbin/pathtest
	pathtest

#

exit 0
pi@raspberrypi:~ $ 



# Running: /etc/rc.local using just pathtest and it works OK.


pi@raspberrypi:~ $ /etc/rc.local
My IP address is 192.168.19.15 
Starting pathtest. 

pathtest shell program.
 pathtest pid =  PID TTY TIME CMD 1850 pts/0 00:00:00 pathtest
Wed 23 Mar 2022 01:41:16 PM MDT
 13:41:16 up 58 min,  2 users,  load average: 0.02, 0.09, 0.08
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
pi       tty7     :0               12:42   58:38   1:08   0.20s /usr/bin/lxsession -s LXDE-pi
pi       tty1     -                12:42   58:38   0.07s  0.05s -bash
pi@raspberrypi:~ $ 



# Running: sudo /etc/rc.local and pathtest can not be found!


pi@raspberrypi:~ $ sudo /etc/rc.local
My IP address is 192.168.19.15 
Starting pathtest. 

/etc/rc.local: 24: pathtest: not found
pi@raspberrypi:~ $ 



# Running: pathtest and it works OK.


pi@raspberrypi:~ $ pathtest
pathtest shell program.
 pathtest pid =  PID TTY TIME CMD 1858 pts/0 00:00:00 pathtest
Wed 23 Mar 2022 01:41:54 PM MDT
 13:41:54 up 59 min,  2 users,  load average: 0.08, 0.09, 0.08
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
pi       tty7     :0               12:42   59:16   1:09   0.20s /usr/bin/lxsession -s LXDE-pi
pi       tty1     -                12:42   59:16   0.07s  0.05s -bash
pi@raspberrypi:~ $ 



# Running: sudo pathtest and it can not find pathtest.


pi@raspberrypi:~ $ sudo pathtest
sudo: pathtest: command not found
pi@raspberrypi:~ $ 
pi@raspberrypi:~ $ 
pi@raspberrypi:~ $ sudo nano /etc/rc.local
pi@raspberrypi:~ $ 



# Changed /etc/rc.local to /home/local/sbin/pathtest from just pathhtest.


pi@raspberrypi:~ $ cat /etc/rc.local
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
  printf "My IP address is %s\n" "$_IP"
fi


# Start pathtest
echo "Starting pathtest. \n" 
    /home/local/sbin/pathtest
#	pathtest

#

exit 0
pi@raspberrypi:~ $ 



# Running: /etc/rc.local and it works OK.


pi@raspberrypi:~ $ /etc/rc.local
My IP address is 192.168.19.15 
Starting pathtest. 

pathtest shell program.
 pathtest pid =  PID TTY TIME CMD 1874 pts/0 00:00:00 pathtest
Wed 23 Mar 2022 01:45:07 PM MDT
 13:45:07 up  1:02,  2 users,  load average: 0.04, 0.08, 0.08
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
pi       tty7     :0               12:42    1:02m  1:11   0.20s /usr/bin/lxsession -s LXDE-pi
pi       tty1     -                12:42    1:02m  0.07s  0.05s -bash
pi@raspberrypi:~ $ 



# Running: sudo /etc/rc.local and it works OK.


pi@raspberrypi:~ $ sudo /etc/rc.local
My IP address is 192.168.19.15 
Starting pathtest. 

pathtest shell program.
 pathtest pid =  PID TTY TIME CMD 1881 pts/0 00:00:00 pathtest
Wed 23 Mar 2022 01:45:27 PM MDT
 13:45:27 up  1:02,  2 users,  load average: 0.02, 0.07, 0.08
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
pi       tty7     :0               12:42    1:02m  1:11   0.20s /usr/bin/lxsession -s LXDE-pi
pi       tty1     -                12:42    1:02m  0.07s  0.05s -bash
pi@raspberrypi:~ $ 



# Running: pathtest and it works OK.


pi@raspberrypi:~ $ pathtest
pathtest shell program.
 pathtest pid =  PID TTY TIME CMD 1886 pts/0 00:00:00 pathtest
Wed 23 Mar 2022 01:45:51 PM MDT
 13:45:51 up  1:03,  2 users,  load average: 0.18, 0.10, 0.09
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
pi       tty7     :0               12:42    1:03m  1:11   0.20s /usr/bin/lxsession -s LXDE-pi
pi       tty1     -                12:42    1:03m  0.07s  0.05s -bash
pi@raspberrypi:~ $ 



# Running: sudo pathtest and it can not find pathtest.


pi@raspberrypi:~ $ sudo pathtest
sudo: pathtest: command not found
pi@raspberrypi:~ $ 
pi@raspberrypi:~ $ 



# Copying /home/local/sbin/* into /usr/local/sbin.


pi@raspberrypi:~ $ sudo cp -iav /home/local/sbin/* /usr/local/sbin
'/home/local/sbin/pathtest' -> '/usr/local/sbin/pathtest'
pi@raspberrypi:~ $ 



# /usr/local/sbin now also has a copy of pathtest.


pi@raspberrypi:~ $ ls -al /usr/local/sbin
total 12
drwxr-xr-x  2 root root 4096 Mar 23 13:47 .
drwxr-xr-x 10 root root 4096 Jan 27 19:58 ..
-rwxr-xr-x  1 root root   98 Mar 23 12:02 pathtest
pi@raspberrypi:~ $ 



# Running: pathtest and it works OK.


pi@raspberrypi:~ $ pathtest
pathtest shell program.
 pathtest pid =  PID TTY TIME CMD 1896 pts/0 00:00:00 pathtest
Wed 23 Mar 2022 01:47:46 PM MDT
 13:47:46 up  1:04,  2 users,  load average: 0.03, 0.06, 0.08
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
pi       tty7     :0               12:42    1:05m  1:13   0.20s /usr/bin/lxsession -s LXDE-pi
pi       tty1     -                12:42    1:05m  0.07s  0.05s -bash
pi@raspberrypi:~ $ 



# Running: sudo pathtest and it works OK.


pi@raspberrypi:~ $ sudo pathtest
pathtest shell program.
 pathtest pid =  PID TTY TIME CMD 1901 pts/0 00:00:00 pathtest
Wed 23 Mar 2022 01:47:59 PM MDT
 13:47:59 up  1:05,  2 users,  load average: 0.02, 0.06, 0.08
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
pi       tty7     :0               12:42    1:05m  1:13   0.20s /usr/bin/lxsession -s LXDE-pi
pi       tty1     -                12:42    1:05m  0.07s  0.05s -bash
pi@raspberrypi:~ $ 



# Running: /etc/rc.local and it works OK.


pi@raspberrypi:~ $ /etc/rc.local
My IP address is 192.168.19.15 
Starting pathtest. 

pathtest shell program.
 pathtest pid =  PID TTY TIME CMD 1907 pts/0 00:00:00 pathtest
Wed 23 Mar 2022 01:48:29 PM MDT
 13:48:29 up  1:05,  2 users,  load average: 0.01, 0.05, 0.07
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
pi       tty7     :0               12:42    1:05m  1:13   0.20s /usr/bin/lxsession -s LXDE-pi
pi       tty1     -                12:42    1:05m  0.07s  0.05s -bash
pi@raspberrypi:~ $ 



# Running: sudo /etc/rc.local and it works OK.


pi@raspberrypi:~ $ sudo /etc/rc.local
My IP address is 192.168.19.15 
Starting pathtest. 

pathtest shell program.
 pathtest pid =  PID TTY TIME CMD 1915 pts/0 00:00:00 pathtest
Wed 23 Mar 2022 01:48:43 PM MDT
 13:48:43 up  1:05,  2 users,  load average: 0.01, 0.05, 0.07
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
pi       tty7     :0               12:42    1:06m  1:14   0.20s /usr/bin/lxsession -s LXDE-pi
pi       tty1     -                12:42    1:06m  0.07s  0.05s -bash
pi@raspberrypi:~ $ 



pi@raspberrypi:~ $ sudo nano /etc/rc.local
pi@raspberrypi:~ $ 



# Changed /etc/rc.local back to using just pathtest.


pi@raspberrypi:~ $ cat /etc/rc.local
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
  printf "My IP address is %s\n" "$_IP"
fi


# Start pathtest
echo "Starting pathtest. \n" 
#    /home/local/sbin/pathtest
	pathtest

#

exit 0
pi@raspberrypi:~ $ 



Running: /etc/rc.local and it works OK.



pi@raspberrypi:~ $ /etc/rc.local
My IP address is 192.168.19.15 
Starting pathtest. 

pathtest shell program.
 pathtest pid =  PID TTY TIME CMD 1928 pts/0 00:00:00 pathtest
Wed 23 Mar 2022 01:50:28 PM MDT
 13:50:28 up  1:07,  2 users,  load average: 0.04, 0.05, 0.07
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
pi       tty7     :0               12:42    1:07m  1:15   0.20s /usr/bin/lxsession -s LXDE-pi
pi       tty1     -                12:42    1:07m  0.07s  0.05s -bash
pi@raspberrypi:~ $ 



# Running: sudo /etc/rc.local and it works OK.


pi@raspberrypi:~ $ sudo /etc/rc.local
My IP address is 192.168.19.15 
Starting pathtest. 

pathtest shell program.
 pathtest pid =  PID TTY TIME CMD 1935 pts/0 00:00:00 pathtest
Wed 23 Mar 2022 01:50:40 PM MDT
 13:50:40 up  1:07,  2 users,  load average: 0.03, 0.04, 0.07
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
pi       tty7     :0               12:42    1:08m  1:15   0.20s /usr/bin/lxsession -s LXDE-pi
pi       tty1     -                12:42    1:08m  0.07s  0.05s -bash
pi@raspberrypi:~ $ 



# Running: pathtest and it runs OK.


pi@raspberrypi:~ $ pathtest
pathtest shell program.
 pathtest pid =  PID TTY TIME CMD 1940 pts/0 00:00:00 pathtest
Wed 23 Mar 2022 01:51:03 PM MDT
 13:51:03 up  1:08,  2 users,  load average: 0.02, 0.04, 0.06
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
pi       tty7     :0               12:42    1:08m  1:16   0.20s /usr/bin/lxsession -s LXDE-pi
pi       tty1     -                12:42    1:08m  0.07s  0.05s -bash
pi@raspberrypi:~ $ 



# Running: sudo pathtest and it runs OK.


pi@raspberrypi:~ $ sudo pathtest
pathtest shell program.
 pathtest pid =  PID TTY TIME CMD 1945 pts/0 00:00:00 pathtest
Wed 23 Mar 2022 01:51:12 PM MDT
 13:51:12 up  1:08,  2 users,  load average: 0.02, 0.04, 0.06
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
pi       tty7     :0               12:42    1:08m  1:16   0.20s /usr/bin/lxsession -s LXDE-pi
pi       tty1     -                12:42    1:08m  0.07s  0.05s -bash
pi@raspberrypi:~ $ 



# There is still a problem with the path when I add "/home/local/sbin:/home/local/bin:" to the PATH and then reboot so it takes effect! The man pages now load so that part is fixed at least in the Raspberry Pi 64-bit OS. Ubuntu might not have brought the change in. It is like the $PATH is not being followed, at least at times now. Thanks for all of your help!


# Frank Anderson, ac0xl.ham@gmail.com 1-434-210-0710.



#

