Update
I just verified this problem ONLY happens with opensuse tumberweed on virtual box.
I installed NEON KDE on same Virtual box and did the same exact steps as shown below and the x-bit is not lost while running the script. Only on opensuse tumberweed this happens. Using Latest versions as of today 12/30/2024. All fresh installations from ISO images. So the problem seems to be with opensuse tumberweed guest edition software. I have switched to NEON KDE now to try it.
CASE closed.
I have been using Linux and virtual box for more than 20 years and this is the first time I see this problem. I tried everything and nothing works.
I installed new Linux opensuse tumbleweed, XFCE desktop, on Virtualbox (host is windows 10)
>hostnamectl
Static hostname: (unset)
Transient hostname: localhost
Icon name: computer-vm
Chassis: vm 🖴
Virtualization: oracle
Operating System: openSUSE Tumbleweed
CPE OS Name: cpe:2.3:o:opensuse:tumbleweed:20241129:*:*:*:*:*:*:*
Kernel: Linux 6.11.8-1-default
Architecture: x86-64
Everything is working well. I followed the same instructions I always use for each Linux I install on virtual box to share my G:/public_html/ folder. I have done this 100's of times before.
I create mount point at /mnt/g/public_html and my shared folder (which I set during installation of virtual box for Linux) as G:/public_html
Here is the problem. On my shared folder I have many Linux scripts. They all have x bit set.
I noticed when I run a script, it immediately losses the x bit. While the script is running. I check the file from a second terminal using ls -l and see x is gone.
As soon as the script is finished, the x bit comes back !
This only happens on scripts that are on my windows shared folder. Not on scripts that are on my Linux installation, such as $HOME.
So this tells me it has something to do with setting for the shared folder.
What this means, is that if I try to run the same script from another terminal, while it is still running in the first terminal, I get permission denied. I have to wait until the first process is done running the script in order to run it in order for the x bit to be set back automatically.
I have another Linux as guest (Linux endeavour) in different virtual box and this problem does not happen there.
This is what I noticed and I think this could be the cause: On openSUSE when I mount the shared folder, all files have 'me' 'me' as user id and group id. Where 'me' is my user name.
ls -l /mnt/g
total 12
drwxrwxrwx 1 me me 12288 Dec 1 06:45 public_html
On endeavour OS, using same mount command, I get this
ls -l /mnt/g
total 12
drwxrwxrwx 1 me autologin 12288 Dec 1 06:45 public_html
Notice that the group ID is autologin here. The command I use to mount my shared folder is the same on both systems. So I have no idea why one linux using autologin for the group id for the shared folder and another does not. I do not know if this is why the x bit is lost. But this is the only difference I could see.
>cat mount_win.sh
mount -t vboxsf -o uid=1000,gid=1000 public_html /mnt/g/public_html
>id
uid=1000(me) gid=1000(me) groups=1000(me)
>
I also tried adding exec to the above mount command, but it did not help.
The above mount command is the same I always use for each new Linux I install on Virtual box. It always worked.
I made small movie below to show this (click on it to enlarge).
The script does sleep for 20 seconds. While it is running, you see that the x bit is lost until the script is finished. Watch the left terminal how ls -l now showing no x while script is running.
>cd /mnt/g/public_html/LINUX_HOME_FILES/
>ls -l T.sh
-rwxrwxrwx 1 me me 70 Dec 1 16:09 T.sh
>
>cat T.sh
#!/bin/bash
echo "starting script"
sleep 20s
echo "finishing script"
>
Anything else I can try or any other information needed, please let me know.
could you cat out your group file
On opensuse (where the problem is):
>cat /etc/group
root:x:0:
etc..
vboxguest:x:467:
vboxsf:x:466:
vnc:x:465:
me:!:1000:
>
On EOS (where there is no problem):
>cat /etc/group
root:x:0:root
etc...
autologin:x:1000:me
me:x:1001:
vboxsf:x:109:
>
So on opensuse the file is missing autologin entry, and 'me' says 1000. But on EOS where there is no problem, the autologin entry is there (1000) but 'me' now says 1001. That is why when I used same command to mount shared folder
mount -t vboxsf -o uid=1000,gid=1000 public_html /mnt/g/public_html
On EOS, the group was autologin but on opensuse it was 'me'.
I do not know what all this means and why opensuse is missing autologin in the group file.
It is a nightmere getting shared folder to work OK with virtual box. So I am now moving back to WSL 2.0 on windows, where none of these issues come up. Nothing to mount. All my windows drive can be accessed directly using /mnt/g and /mnt/e and so on from WSL Linux. Much easier.

