Script not executing... command not found
-
Hello and thanks in advance for any help. I can't seem to get a script to execute during boot, or even executing manually.
This all started when I switched to AT&T and found the PFATT.SH script and EAPOL workaround. I've followed all the directions, to a T, but the script won't execute.
BACKGROUND:
Custom-built machine.
Gigabyte J1900N-D3V motherboard
Intel Celeron J1900
RealTek Gb NICs
pfSense 2.4.5 (amd64)
UEFI boot into GPT partitionThe file is located at /root/bin/pfatt.sh
The permissions are 0755. When I navigate to /root/bin and enter the command "pfatt.sh" it returnspfatt.sh: Command not found.
Even after explicitly applying
chmod +x /root/bin/pfatt.sh
it still returns
pfatt.sh: Command not found.
During bootup, I notice these messages:
Initializing.................. done. Starting device manager (devd)...kldload: can't load ums: No such file or directory done. Loading configuration......done. sh: /root/bin/pfatt.sh: not found Updating configuration...done.
Attached is a copy of
dmesg -a
pfsense dmesg.txtAny help is appreciated. Thanks again!!
-
Is it actually there? What does
ls -ls /root/bin
show?To run it from the directory you're in you would need to run
./pfatt.sh
Steve
-
It's there, as far as I can tell. Output from
ls -ls /root/bin
is:[2.4.5-RELEASE][root@pfSense.localdomain]/root: ls -ls /root/bin total 4 4 -rwxr-xr-x 1 root wheel 3157 May 31 11:01 pfatt.sh [2.4.5-RELEASE][root@pfSense.localdomain]/root:
And output from
./pfatt.sh
is the same as before:[2.4.5-RELEASE][root@pfSense.localdomain]/root: cd bin [2.4.5-RELEASE][root@pfSense.localdomain]/root/bin: ./pfatt.sh ./pfatt.sh: Command not found. [2.4.5-RELEASE][root@pfSense.localdomain]/root/bin: chmod +x pfatt.sh [2.4.5-RELEASE][root@pfSense.localdomain]/root/bin: ./pfatt.sh ./pfatt.sh: Command not found. [2.4.5-RELEASE][root@pfSense.localdomain]/root/bin: ls -la total 12 drwxr-xr-x 2 root wheel 512 May 31 11:01 . drwxr-xr-x 3 root wheel 512 May 31 11:01 .. -rwxr-xr-x 1 root wheel 3157 May 31 11:01 pfatt.sh [2.4.5-RELEASE][root@pfSense.localdomain]/root/bin:
When I
cat /root/bin/pfatt.sh
it outputs the script with my edits, so the file exists. For the life of me, I can't figure out why I can't make it executable (or run with ShellCMD package).
Sorry if I'm missing something basic. I'm familiar with Windows and a bit of Linux. BSD is a whole different ball-game. -
@zsing82 said in Script not executing... command not found:
pfatt.sh
Can you show the first line of this file ?
What does
file /root/bin/pfatt.sh
say ?
When you open / edit the file using Notepad++ (at least) you can confirm it's a
login-to-view
file ? -
Here's output from
file /root/bin/pfatt.sh
[2.4.5-RELEASE][root@pfSense.localdomain]/root: file /root/bin/pfatt.sh /root/bin/pfatt.sh: POSIX shell script, ASCII text executable, with CRLF line terminators [2.4.5-RELEASE][root@pfSense.localdomain]/root:
When I open in Notepad++ (from my Windows workstation) bottom-right of the status bar says "Windows (CR LF) UTF-8"
login-to-view -
The first line of scripts start with #! /bin/sh. Does yours? Also, I hope you're not using a Windows editor for this. Windows likes to use CR LF for end of line, whereas the *nix apps use just LF.
-
@zsing82 said in Script not executing... command not found:
When I open in Notepad++ (from my Windows workstation) bottom-right of the status bar says "Windows (CR LF) UTF-8"
There you have it : that's a no go.
Short explanation : FreeBSD is not Windows.
Little bit longer : file formats ...... as the world is not a happy ASCI place. Ask Google what file encoding is (ASCI, UTF, etc etc) - it's enough to go nuts.Convert your file and you'll be fine.
-
Hmm, curious. I think I would removed the file entirely and then create/edit it in pfSense.
Will it run if you call it with sh?
sh pfatt.sh
If so it's probably not seeing it as something executable. What's in that file?
Steve
-
Does your script have that first line I mentioned? It needs it. Also, the file either has to be in the path, or the location specified. If you're in the same directory, then you could use ./<script name>. This is basic Unix stuff.
-
Thanks to everyone for responding.
It ended up being at encoding issue. When I pulled a fresh copy of the script and used EE to edit the file, it executed as expected.
Yet another simple issue that I overlooked. Believe it or not, I have quite a few years as a system admin and network admin. But like I said, it was all Windows and couple Debian boxes. BSD is a whole different animal.
Thanks again for everyone's help. Hopefully, now I can get that awful AT&T Residential Gateway off to the side.
-
@zsing82 said in Script not executing... command not found:
it was all Windows and couple Debian boxes. BSD is a whole different animal.
Debain, and FreeBSD for that matter, are equal in this scenario.
(file) Text encoding can be really head scratching if you don't know what it is.
Debian has tools to convert, like dos2unix etc. -
@zsing82 said in Script not executing... command not found:
Debian boxes. BSD is a whole different animal
Actually, for the most part Linux and BSD are similar, in that they're both Unix variations. However, there are some differences, but nowhere near the difference between either and the Windows shell commands.