lamw / ghettoVCB

ghettoVCB
MIT License
1.27k stars 363 forks source link

ghettoVCB and esxi 8.0 "Operation not permitted" #271

Closed ArchParks closed 1 year ago

ArchParks commented 1 year ago

ghettoVCB worked fine with esxi 7.03 (after changing the line that said 7.0.0|7.0.1|7.0.2|7.0.3) VER=7; break;;)

After loading esxi 8.0 this morning, it now says "-sh: ghettoVCB.sh: Operation not permitted"

Any ideas?

lamw commented 1 year ago

I just took a look at this in my env as it looked a bit strange. Because the script doesn't have interpreter specified at the top of the script by default (e.g. #!/bin/bash), it fails to run.

ESXi doesn't have fully bash, but it does have ash and if you add:

!#/bin/ash

as the very first line of the script, it'll run without issues.

ArchParks commented 1 year ago

I tried that and I get the same error. I even tried a small file that says nothing but:

!#/bin/ash ls

and it gives the same error.

lamw commented 1 year ago

If it has executable flag, you should be able to run it using ./ghettoVCB.sh or whatever full path. I confirmed it with a vanilla installation of ESXi 8.0

Because of the missing #! entry, it thinks the script is a binary and by default in ESXi 8.0, the execOnlyInstall parameter is enabled by default and hence preventing it from running.

ArchParks commented 1 year ago

Weird: ls -lh /vmfs/volumes/53ace301-ce670a12/batch/ghettoVCB.sh -rwxr--r-x 1 root root 70.5K Oct 13 13:21 /vmfs/volumes/53ace301-ce670a12/batch/ghettoVCB.sh

/vmfs/volumes/53ace301-ce670a12/batch/ghettoVCB.sh /bin/ash: /vmfs/volumes/53ace301-ce670a12/batch/ghettoVCB.sh: Operation not permitted

If I copy it to /tmp, it does this:

ls -lh /tmp/ghettoVCB.sh -rwxr--r-x 1 root root 70.5K Oct 13 13:48 /tmp/ghettoVCB.sh

/tmp/ghettoVCB.sh

/bin/ash: /tmp/ghettoVCB.sh: Operation not permitted

Note this was an upgrade from version 7.03.

lamw commented 1 year ago

Does /bin/ash show when you do ls? You could also try /bin/sh and I ended up using that to fix it in main script, which you can download directly from repo

ArchParks commented 1 year ago

Bear in mind that you know more about this stuff in your little finger then I do in my entire person so some of my comments are problem dumb!

I'm not positive what your first question meant but I tried changing the first line to "!#/bin/sh" but it gave this message: "/bin/sh: /tmp/ghettoVCB.sh: Operation not permitted"

for the heck of it, I ran this:

/bin/sh /vmfs/volumes/53ace301-ce670a12/batch/ghettoVCB.sh

and your script fired off (it gave the normal error saying " ERROR: Incorrect number of arguments!" because I didn't have anything else on the command line.

I then tried running it like normal with this command /bin/sh /vmfs/volumes/53ace301-ce670a12/batch/ghettoVCB.sh -f /vmfs/volumes/NFS/scripts/vms_to_backup -g /vmfs/volumes/NFS/scripts/ghettoVCB.conf -l /tmp/ghettoVCB.log

And its plugging away doing backups as I type this!

Thanks!

Last question: In /etc/rc.local.d//local.sh I have a line that populates crontabs by saying"

/bin/echo "55 19 SUN /vmfs/volumes/53ace301-ce670a12/batch/ghettoVCB.sh -f /vmfs/volumes/NFS/scripts/vms_to_backup -g /vmfs/volumes/NFS/scripts/ghettoVCB.conf -l /tmp/ghettoVCB.log > /dev/null" >> /var/spool/cron/crontabs/root

Do I need to change it by adding the "/bin/sh" portion at the beginning of the command that gets stored in crontabs or does crontab execute it like it did in version 7.0x?