Run .BIN command using BigFix Action Script

I am trying to run a .bin file using a bigfix action script. I have tried many different approaches, but I keep getting either error code 1 or 127.

This is what works directly in linux:

chmod +x /var/opt/BESClient/__BESData/actionsite/cd __Download/invcol_LN64_K4KWG_25_12_00_37_A00.BIN
sudo /var/opt/BESClient/__BESData/actionsite/__Download/invcol_LN64_K4KWG_25_12_00_37_A00.BIN -outc="/var/opt/BESClient/Inventory.xml" -comptype=BIOS,APAC,FRMW

This is what I am trying or have tried in Action Script. I got the chmod to work using the 755. It's the actual running of the .bin that isn't working.

wait chmod 755 /var/opt/BESClient/__BESData/actionsite/__Download/invcol_LN64_K4KWG_25_12_00_37_A00.BIN
wait sudo /var/opt/BESClient/__BESData/actionsite/__Download/invcol_LN64_K4KWG_25_12_00_37_A00.BIN -outc="/var/opt/BESClient/Inventory.xml" -comptype=BIOS,APAC,FRMW
wait ./var/opt/BESClient/__BESData/actionsite/__Download/invcol_LN64_K4KWG_25_12_00_37_A00.BIN -outc="/var/opt/BESClient/Inventory.xml" -comptype=BIOS,APAC,FRMW
wait sh -c "/var/opt/BESClient/__BESData/actionsite/__Download/invcol_LN64_K4KWG_25_12_00_37_A00.BIN -outc="/var/opt/BESClient/Inventory.xml" -comptype=BIOS,APAC,FRMW"
wait /bash/sh -c "/var/opt/BESClient/__BESData/actionsite/__Download/invcol_LN64_K4KWG_25_12_00_37_A00.BIN -outc="/var/opt/BESClient/Inventory.xml" -comptype=BIOS,APAC,FRMW"

What am I missing?

Are you able to run it on the system without using BigFix?

Yes, the first section of code is the one that works directly on the server.

Sorry, I missed that.

I am not verse in linux, especially when it comes to BigFix but here are some guesses.

Do you need the sudo? BigFix runs as system.
Does the sudo need to be on the same line as the command?

That is all I have, and they are just guesses.

Hi @mikinvestigator When passing a quoted command string to sh -c, it's often easiest to wrap the entire command in double quotes, and use single quotes for internal strings that need literal interpretation (e.g., filenames with spaces). Therefore you can have the Inventory.xml in the outc within single quotes as an option.

wait /bash/sh -c "/var/opt/BESClient/__BESData/actionsite/__Download/invcol_LN64_K4KWG_25_12_00_37_A00.BIN -outc='/var/opt/BESClient/Inventory.xml' -comptype=BIOS,APAC,FRMW"
2 Likes

When I do that, I get this error even though ls -l shows it in there and I can run the command directly on the server
Command failed (child exec() failed (errno is 2: No such file or directory

Hi @mikinvestigator this error usually means that the executable file itself, a library it depends on, or the shell used to run it is missing or the path to it is incorrect. Can you validate your wait command of /bash/sh -c is correct? I believe it should be /bin/sh -c or /bin/bash -c.

You were right it should be /bin/bash -c but now I am getting that the command succeed with an Exit Code of 126 and the XML file isn't generated

Hi @mikinvestigator , Modify your action script to explicitly add execute permissions using chmod +x before attempting to run the BIN file.

I do have the chmod +x command first. I realized I forgot the ending " so I ran it again and I am getting the command succeeded with Exit Code 127 but XML file still isn't generated.


wait /bin/bash -c "chmod +x /var/opt/BESClient/__BESData/actionsite/__Download/invcol_LN64_K4KWG_25_12_00_37_A00.BIN"

wait /bin/bash -c "/var/opt/BESClient/__BESData/actionsite/__Download/invcol_LN64_K4KWG_25_12_00_37_A00.BIN -outc='/var/opt/BESClient/Inventory.xml' -comptype=BIOS,APAC,FRMW"

There's probably still something wrong in the quoting. Instead of sorting out what's going on with the shell quoting it's probably easier to generate a script and run the script, so you don't need to worry about spaces and quoting parameters.

Also, on what operating system are you running this?

Try

delete __createfile
createfile until BIGFIX_END_OF_FILE_MARKER_TAG_EOF
#!/bin/bash

chmod +x ./__Download/invcol_LN64_K4KWG_25_12_00_37_A00.BIN

./__Download/invcol_LN64_K4KWG_25_12_00_37_A00.BIN -outc='/var/opt/BESClient/Inventory.xml' -comptype=BIOS,APAC,FRMW


BIGFIX_END_OF_FILE_MARKER_TAG_EOF

delete GeneratedScript.sh
move __createfile GeneratedScript.sh

wait chmod +x GeneratedScript.sh
wait /bin/sh --login -c "./GeneratedScript.sh > '/tmp/scriptoutput.txt' 2>&1"

This will create a shell script to run the commands, run them, and save both stdout and stderr output to the file in tmp so that if there is still an error, you might be able to retrieve the error message.
It also spawns /bin/sh as a 'login' shell, which processes dot-files that might provide some PATH or environment variable upon which that BIN relies.

edit: I edited my copy-paste to use relative paths for the downloaded file, be sure to use that update. And also you need to actually have whatever download command is downloading that .BIN file for you first.

1 Like

This is for OS RHEL 9. I tried running what you have above and there that is generated is this. Why would it work when I run it manually but not through BigFix?
./_Download/invcol_LN64_K4KWG_25_12_00_37_A00.BIN: line 42: exec: xterm: not found

Not sure. Maybe xterm is coming from a graphical desktop environment? It's not clear to me what this utility is, or why it should open an xterm, that seems like it would be difficult to automate.

@mikinvestigator can you please provide which tool you are trying to install, on which Operating system

It isn't anything that gets installed, it's a BIN file that scans to get the Dell Drivers and save the information into an XML file. The Operating System is RHEL9

I guess this been was provided by Dell right?
What is the exact name of this product and version please

This was provided by Dell. I am trying to run it on a Dell Linux Server RHEL9.6

I’m guessing its the unpacked files from https://ftp.gwdg.de/pub/linux/dell/repo/hardware/dsu/os_independent/x86_64/invcol_LN64_K4KWG_25_12_00_37_A00-25.12.00-K4KWG.x86_64.rpm

I tried a route that doesn't assume the site will be actionsite and uses relevance substitution to create the command. I get exit 127 but my RHEL lab is a HyperV but you may want to try it.

prefetch invcol_LN64_K4KWG_25_12_00_37_A00.BIN sha1:2c8b7698ae6b42ecc11f04132799ca0e9b3d2db1 size:356534159 http://<fqdn>:52311/Uploads/Files/invcol_LN64_K4KWG_25_12_00_37_A00.BIN sha256:4b5ee8ca85393187513226aafd2769a1bccf2b42a857717288acbd960464c182

wait /bin/bash -c "chmod +x {(pathname of client folder of current site) & "/__Download/invcol_LN64_K4KWG_25_12_00_37_A00.BIN"}"
wait /bin/bash -c "{(pathname of client folder of current site) & "/__Download/invcol_LN64_K4KWG_25_12_00_37_A00.BIN -outc=/var/opt/BESClient/Inventory.xml -comptype=BIOS,APAC,FRMW"}"

I get the exit code of 127 still using that command

What does line 42 of the BIN file say? My guess is xterm is not in your path, and that is why it is failing at this point. This also brings up the question, have you run this from the command line successfully? If so, when you run this, does it pop open a new window?