• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login
Netgate Discussion Forum
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login

Script not executing... command not found

Scheduled Pinned Locked Moved General pfSense Questions
12 Posts 4 Posters 2.3k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Z
    zsing82
    last edited by zsing82 May 31, 2020, 3:54 PM May 31, 2020, 3:51 PM

    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 partition

    The 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 returns pfatt.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.txt

    Any help is appreciated. Thanks again!!

    1 Reply Last reply Reply Quote 0
    • S
      stephenw10 Netgate Administrator
      last edited by May 31, 2020, 11:01 PM

      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

      1 Reply Last reply Reply Quote 0
      • Z
        zsing82
        last edited by Jun 1, 2020, 2:24 AM

        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.

        1 Reply Last reply Reply Quote 0
        • G
          Gertjan
          last edited by Gertjan Jun 1, 2020, 6:30 AM Jun 1, 2020, 6:28 AM

          @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
          f61480d5-1b2f-4c4b-8e6a-647a57eb0560-image.png
          file ?

          No "help me" PM's please. Use the forum, the community will thank you.
          Edit : and where are the logs ??

          1 Reply Last reply Reply Quote 0
          • Z
            zsing82
            last edited by Jun 1, 2020, 10:51 AM

            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"
            script-status-bar.jpg

            J G 2 Replies Last reply Jun 1, 2020, 12:51 PM Reply Quote 0
            • J
              JKnott @zsing82
              last edited by Jun 1, 2020, 12:51 PM

              @zsing82

              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.

              PfSense running on Qotom mini PC
              i5 CPU, 4 GB memory, 32 GB SSD & 4 Intel Gb Ethernet ports.
              UniFi AC-Lite access point

              I haven't lost my mind. It's around here...somewhere...

              1 Reply Last reply Reply Quote 0
              • G
                Gertjan @zsing82
                last edited by Jun 1, 2020, 1:09 PM

                @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.

                No "help me" PM's please. Use the forum, the community will thank you.
                Edit : and where are the logs ??

                1 Reply Last reply Reply Quote 2
                • S
                  stephenw10 Netgate Administrator
                  last edited by Jun 1, 2020, 4:06 PM

                  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

                  J 1 Reply Last reply Jun 1, 2020, 4:08 PM Reply Quote 0
                  • J
                    JKnott @stephenw10
                    last edited by Jun 1, 2020, 4:08 PM

                    @stephenw10

                    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.

                    PfSense running on Qotom mini PC
                    i5 CPU, 4 GB memory, 32 GB SSD & 4 Intel Gb Ethernet ports.
                    UniFi AC-Lite access point

                    I haven't lost my mind. It's around here...somewhere...

                    1 Reply Last reply Reply Quote 0
                    • Z
                      zsing82
                      last edited by Jun 1, 2020, 6:18 PM

                      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.

                      G J 2 Replies Last reply Jun 2, 2020, 5:26 AM Reply Quote 0
                      • G
                        Gertjan @zsing82
                        last edited by Jun 2, 2020, 5:26 AM

                        @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.

                        No "help me" PM's please. Use the forum, the community will thank you.
                        Edit : and where are the logs ??

                        1 Reply Last reply Reply Quote 0
                        • J
                          JKnott @zsing82
                          last edited by Jun 2, 2020, 10:50 AM

                          @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.

                          PfSense running on Qotom mini PC
                          i5 CPU, 4 GB memory, 32 GB SSD & 4 Intel Gb Ethernet ports.
                          UniFi AC-Lite access point

                          I haven't lost my mind. It's around here...somewhere...

                          1 Reply Last reply Reply Quote 0
                          12 out of 12
                          • First post
                            12/12
                            Last post
                          Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.
                            This community forum collects and processes your personal information.
                            consent.not_received