VirtualBox

Opened 5 years ago

Last modified 4 years ago

#19086 assigned defect

rm / rmdir not working correctly in shared folders

Reported by: Reiner Brodbeck Owned by:
Component: shared folders Version: VirtualBox 6.0.14
Keywords: rm rmdir shared folder vboxsf Cc:
Guest type: Linux Host type: Windows

Description

As it seems that comments to existing tickets are not enough, I make a ticket out of my comment to #18569.

Since the beginning of VirtualBox v6.x the "rm -r" command is not working correctly in shared folder within a Linux guest.

I attach a screen shot of an example what happens.

Host: Windows 10 1903 Guest: CentOS 6.6, kernel 2.6.32-504.el6.x86_64

Attachments (3)

sharedFolderProblem.txt (1.9 KB ) - added by Reiner Brodbeck 5 years ago.
dirtest.sh (330 bytes ) - added by Frank Batschulat (Oracle) 5 years ago.
dirtest3.sh (959 bytes ) - added by Frank Batschulat (Oracle) 5 years ago.

Download all attachments as: .zip

Change History (15)

by Reiner Brodbeck, 5 years ago

Attachment: sharedFolderProblem.txt added

comment:1 by Frank Batschulat (Oracle), 5 years ago

Owner: set to Frank Batschulat (Oracle)
Status: newaccepted

that's presumably an issue which relates to the older kernel, I have not observed such misbehavior with newer kernels of the 5.X series.

Will try reproduce with a CentOS 6.10 guest now.

comment:2 by Frank Batschulat (Oracle), 5 years ago

I can reproduce this issue very easy using the attached scripts dirtest.sh / dirtest3.sh iff I run a Linux guest on a Windows host, I cannot reproduce the behavior on a Linux host. I do not have a MacOS host right now.

Host:

Windows 10
    Build 1809

Guest:

CentOS release 6.10
    Linux 2.6.32-754.24.2.el6.x86_64 #1 SMP Wed Nov 13 15:39:52 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux 

15:59:23.221701 main     VBoxService 6.0.14 r133895 (verbosity: 0) linux.amd64 (Oct 10 2019 20:44:32) release log
15:59:23.221705 main     Log opened 2019-11-14T15:59:23.221647000Z
15:59:23.221785 main     OS Product: Linux
15:59:23.221863 main     OS Release: 2.6.32-754.24.2.el6.x86_64
15:59:23.221892 main     OS Version: #1 SMP Wed Nov 13 15:39:52 UTC 2019
15:59:23.221920 main     Executable: /opt/VBoxGuestAdditions-6.0.14/sbin/VBoxService
15:59:23.221921 main     Process ID: 1930
15:59:23.221922 main     Package type: LINUX_64BITS_GENERIC
15:59:23.223549 main     6.0.14 r133895 started. Verbose level = 0
15:59:23.224272 main     vbglR3GuestCtrlDetectPeekGetCancelSupport: Supported (#1)
vboxsf: g_fHostFeatures=0x8000000f g_fSfFeatures=0x1 g_uSfLastFunction=29
vboxsf: Successfully loaded version 6.0.14
vboxsf: Successfully loaded version 6.0.14 on 2.6.32-754.24.2.el6.x86_64 SMP mod_unload modversions  (LINUX_VERSION_CODE=0x20620)
SELinux: initialized (dev vboxsf, type vboxsf), uses genfs_contexts
15:59:23.276130 automount vbsvcAutomounterMountIt: Successfully mounted 'Pictures' on '/media/sf_Pictures'
fuse init (API version 7.14)

Ubuntu 18.04.3 LTS
    Linux 5.0.0-36-generic #39~18.04.1-Ubuntu SMP Tue Nov 12 11:09:50 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

[   11.236865] 16:39:38.429570 main     VBoxService 6.0.14 r133895 (verbosity: 0) linux.amd64 (Oct 10 2019 20:44:32) release log
               16:39:38.429576 main     Log opened 2019-11-14T16:39:38.429527000Z
[   11.236915] 16:39:38.429663 main     OS Product: Linux
[   11.236999] 16:39:38.429749 main     OS Release: 5.0.0-36-generic
[   11.237061] 16:39:38.429812 main     OS Version: #39~18.04.1-Ubuntu SMP Tue Nov 12 11:09:50 UTC 2019
[   11.237103] 16:39:38.429844 main     Executable: /opt/VBoxGuestAdditions-6.0.14/sbin/VBoxService
               16:39:38.429845 main     Process ID: 1270
               16:39:38.429845 main     Package type: LINUX_64BITS_GENERIC
[   11.238745] 16:39:38.431462 main     6.0.14 r133895 started. Verbose level = 0
[   11.240695] 16:39:38.433421 main vbglR3GuestCtrlDetectPeekGetCancelSupport: Supported (#1)
[   11.255000] vboxsf: g_fHostFeatures=0x8000000f g_fSfFeatures=0x1 g_uSfLastFunction=29
[   11.255046] vboxsf: Successfully loaded version 6.0.14
[   11.255079] vboxsf: Successfully loaded version 6.0.14 on 5.0.0-36-generic SMP mod_unload  (LINUX_VERSION_CODE=0x50015)
[   11.256702] 16:39:38.449408 automount vbsvcAutomounterMountIt: Successfully mounted 'Downloads' on '/media/sf_Downloads'
[   11.261137] 16:39:38.453291 automount vbsvcAutomounterMountIt: Successfully mounted 'Pictures' on '/media/sf_Pictures'

In the CentOS release 6.10 guest VM I can almost immediately observe the problem and failure running the dirtest.sh script:

[fbatschu@localhost sf_Pictures]$ pwd
/media/sf_Pictures
[fbatschu@localhost sf_Pictures]$ ./dirtest.sh
Looping ... number 1
Looping ... number 2
Looping ... number 3
Looping ... number 4
Looping ... number 5
Looping ... number 6
Looping ... number 7
Looping ... number 8
Looping ... number 9
dir1  dir2  dir3  dir4	dir5  dir6  dir7  dir8	dir9  f1.txt  f2.txt f3.txt  f4.txt  f5.txt  f6.txt  f7.txt  f8.txt  f9.txt
rm: cannot remove `dirtest': Text file busy
TEST FAILED
[fbatschu@localhost sf_Pictures]$ ls dirtest
[fbatschu@localhost sf_Pictures]$
[fbatschu@localhost sf_Pictures]$ rm -rf dirtest
rm: cannot remove `dirtest': Text file busy
[fbatschu@localhost sf_Pictures]$
[fbatschu@localhost sf_Pictures]$ rmdir dirtest
[fbatschu@localhost sf_Pictures]$ echo $?
0
[fbatschu@localhost sf_Pictures]$

or like this, where the error is really sticking:

[fbatschu@localhost sf_Pictures]$ ./dirtest.sh
Looping ... number 1
Looping ... number 2
Looping ... number 3
Looping ... number 4
Looping ... number 5
Looping ... number 6
Looping ... number 7
Looping ... number 8
Looping ... number 9
dir1  dir2  dir3  dir4	dir5  dir6  dir7  dir8	dir9  f1.txt  f2.txt f3.txt  f4.txt  f5.txt  f6.txt  f7.txt  f8.txt  f9.txt
rm: cannot remove `dirtest': Text file busy
TEST FAILED
[fbatschu@localhost sf_Pictures]$ ls -la dirtest
total 8
drwxrwx---. 1 root vboxsf 4096 Nov 15 09:18 .
drwxrwx---. 1 root vboxsf 4096 Nov 15 09:18 ..
[fbatschu@localhost sf_Pictures]$ rm -rf dirtest
rm: cannot remove `dirtest': Text file busy
[fbatschu@localhost sf_Pictures]$ rm -rf dirtest
rm: cannot remove `dirtest': Text file busy
[fbatschu@localhost sf_Pictures]$ rm -rf dirtest
rm: cannot remove `dirtest': Text file busy
[fbatschu@localhost sf_Pictures]$ rm -rf dirtest
rm: cannot remove `dirtest': Text file busy
[fbatschu@localhost sf_Pictures]$ fuser dirtest
[fbatschu@localhost sf_Pictures]$ rm -rf dirtest
rm: cannot remove `dirtest': Text file busy
[fbatschu@localhost sf_Pictures]$ rm -rf dirtest
rm: cannot remove `dirtest': Text file busy
[fbatschu@localhost sf_Pictures]$ pwd
/media/sf_Pictures
[fbatschu@localhost sf_Pictures]$ rm -rf dirtest
rm: cannot remove `dirtest': Text file busy
[fbatschu@localhost sf_Pictures]$
 
[fbatschu@localhost sf_Pictures]$ stat dirtest
  File: `dirtest'
  Size: 4096      	Blocks: 8          IO Block: 16384  directory
Device: 15h/21d	Inode: 26          Links: 1
Access: (0770/drwxrwx---)  Uid: (    0/    root)   Gid: (  490/  vboxsf)
Access: 2019-11-15 09:18:55.164145200 +0100
Modify: 2019-11-15 09:18:55.164145200 +0100
Change: 2019-11-15 09:18:55.164145200 +0100
 
[fbatschu@localhost sf_Pictures]$ rm -rf dirtest
rm: cannot remove `dirtest': Text file busy
[fbatschu@localhost sf_Pictures]$ rm -rf dirtest
rm: cannot remove `dirtest': Text file busy
[fbatschu@localhost sf_Pictures]$ rmdir dirtest
[fbatschu@localhost sf_Pictures]$ ls -la dirtest
ls: cannot access dirtest: No such file or directory

In the Ubuntu 18.04.03 guest VM the dirtest.sh script runs a lot longer and eventually fails with different failure modes:

fbatschu@fbatschu-VirtualBox:/media/sf_Pictures$ ./dirtest.sh
[...]
Looping ... number 4
Looping ... number 5
Looping ... number 6
Looping ... number 7
Looping ... number 8
Looping ... number 9
dir1  dir3  dir5  dir7	dir9	f2.txt	f4.txt	f6.txt	f8.txt
dir2  dir4  dir6  dir8	f1.txt	f3.txt	f5.txt	f7.txt	f9.txt
Looping ... number 1
Looping ... number 2
Looping ... number 3
Looping ... number 4
Looping ... number 5
Looping ... number 6
Looping ... number 7
Looping ... number 8
Looping ... number 9
dir1  dir3  dir5  dir7	dir9	f2.txt	f4.txt	f6.txt	f8.txt
dir2  dir4  dir6  dir8	f1.txt	f3.txt	f5.txt	f7.txt	f9.txt
rm: cannot remove 'dirtest': Directory not empty
TEST FAILED
dir7
 
fbatschu@fbatschu-VirtualBox:/media/sf_Pictures$ ls dirtest
fbatschu@fbatschu-VirtualBox:/media/sf_Pictures$
fbatschu@fbatschu-VirtualBox:/media/sf_Pictures$ rm -rf dirtest
fbatschu@fbatschu-VirtualBox:/media/sf_Pictures$
[...] 
dir1  dir3  dir5  dir7	dir9	f2.txt	f4.txt	f6.txt	f8.txt
dir2  dir4  dir6  dir8	f1.txt	f3.txt	f5.txt	f7.txt	f9.txt
Looping ... number 1
Looping ... number 2
Looping ... number 3
Looping ... number 4
Looping ... number 5
Looping ... number 6
Looping ... number 7
Looping ... number 8
Looping ... number 9
dir1  dir3  dir5  dir7	dir9	f2.txt	f4.txt	f6.txt	f8.txt
dir2  dir4  dir6  dir8	f1.txt	f3.txt	f5.txt	f7.txt	f9.txt
rm: cannot remove 'dirtest': Text file busy
TEST FAILED
fbatschu@fbatschu-VirtualBox:/media/sf_Pictures$ ls dirtest
fbatschu@fbatschu-VirtualBox:/media/sf_Pictures$
fbatschu@fbatschu-VirtualBox:/media/sf_Pictures$ rm -rf dirtest
fbatschu@fbatschu-VirtualBox:/media/sf_Pictures$ ls
'Camera Roll'   desktop.ini   dirtest.sh  'Saved Pictures'
fbatschu@fbatschu-VirtualBox:/media/sf_Pictures$

To get the rm -rf * out of the picture, I converted the test script to only use rm and rmdir as appropriate, and we can observe the following failure scenarions now running script dirtest3.sh in the CentOS 6.10 guest VM:

1st Looping ... number 9
dir1  dir2  dir3  dir4	dir5  dir6  dir7  dir8	dir9  f1.txt  f2.txt f3.txt  f4.txt  f5.txt  f6.txt  f7.txt  f8.txt  f9.txt
2nd Looping ... number 1
2nd Looping ... number 2
2nd Looping ... number 3
2nd Looping ... number 4
2nd Looping ... number 5
2nd Looping ... number 6
2nd Looping ... number 7
2nd Looping ... number 8
2nd Looping ... number 9
1st Looping ... number 1
1st Looping ... number 2
1st Looping ... number 3
1st Looping ... number 4
1st Looping ... number 5
1st Looping ... number 6
1st Looping ... number 7
1st Looping ... number 8
1st Looping ... number 9
dir1  dir2  dir3  dir4	dir5  dir6  dir7  dir8	dir9  f1.txt  f2.txt f3.txt  f4.txt  f5.txt  f6.txt  f7.txt  f8.txt  f9.txt
2nd Looping ... number 1
2nd Looping ... number 2
2nd Looping ... number 3
2nd Looping ... number 4
2nd Looping ... number 5
2nd Looping ... number 6
2nd Looping ... number 7
2nd Looping ... number 8
2nd Looping ... number 9
mkdir: cannot create directory `dirtest': Protocol error
1st Looping ... number 1

or this one:

1st Looping ... number 1
1st Looping ... number 2
1st Looping ... number 3
1st Looping ... number 4
1st Looping ... number 5
1st Looping ... number 6
1st Looping ... number 7
1st Looping ... number 8
1st Looping ... number 9
dir1  dir2  dir3  dir4	dir5  dir6  dir7  dir8	dir9  f1.txt  f2.txt f3.txt  f4.txt  f5.txt  f6.txt  f7.txt  f8.txt  f9.txt
2nd Looping ... number 1
2nd Looping ... number 2
2nd Looping ... number 3
2nd Looping ... number 4
2nd Looping ... number 5
2nd Looping ... number 6
2nd Looping ... number 7
2nd Looping ... number 8
2nd Looping ... number 9
dir2
rmdir: failed to remove `dirtest': Directory not empty
TEST FAILED rm dirtest
dir2
[fbatschu@localhost sf_Pictures]$
[fbatschu@localhost sf_Pictures]$ ls -la dirtest
total 8
drwxrwx---. 1 root vboxsf 4096 Nov 15 13:39 .
drwxrwx---. 1 root vboxsf 4096 Nov 15 13:39 ..
 
[fbatschu@localhost sf_Pictures]$ rm -rf dirtest
rm: cannot remove `dirtest': Text file busy
[fbatschu@localhost sf_Pictures]$ rm -rf dirtest
rm: cannot remove `dirtest': Text file busy
[fbatschu@localhost sf_Pictures]$ rm -rf dirtest
rm: cannot remove `dirtest': Text file busy
[fbatschu@localhost sf_Pictures]$ rmdir dirtest
[fbatschu@localhost sf_Pictures]$ echo $?
0
[fbatschu@localhost sf_Pictures]$ ll dirtest
ls: cannot access dirtest: No such file or directory

And on the Ubuntu 18.04.03 guest VM we also get slightely different failure symptoms running script dirtest3.sh:

1st mkdir/truncate Looping ... number 1
1st mkdir/truncate Looping ... number 2
1st mkdir/truncate Looping ... number 3
1st mkdir/truncate Looping ... number 4
1st mkdir/truncate Looping ... number 5
1st mkdir/truncate Looping ... number 6
1st mkdir/truncate Looping ... number 7
1st mkdir/truncate Looping ... number 8
1st mkdir/truncate Looping ... number 9
dir1  dir3  dir5  dir7	dir9	f2.txt	f4.txt	f6.txt	f8.txt
dir2  dir4  dir6  dir8	f1.txt	f3.txt	f5.txt	f7.txt	f9.txt
2nd rm/rmdir Looping ... number 1
2nd rm/rmdir Looping ... number 2
2nd rm/rmdir Looping ... number 3
2nd rm/rmdir Looping ... number 4
2nd rm/rmdir Looping ... number 5
2nd rm/rmdir Looping ... number 6
2nd rm/rmdir Looping ... number 7
2nd rm/rmdir Looping ... number 8
2nd rm/rmdir Looping ... number 9
mkdir: cannot create directory ‘dirtest’: Protocol error
TEST FAILED mkdir dirtest
'Camera Roll'   desktop.ini   dirtest   dirtest2.sh   dirtest3.sh dirtest.sh	'Saved Pictures'
fbatschu@fbatschu-VirtualBox:/media/sf_Pictures$
fbatschu@fbatschu-VirtualBox:/media/sf_Pictures$ ls -la
total 14
drwxrwx--- 1 root vboxsf 4096 Nov 15 14:17  .
drwxr-xr-x 5 root root   4096 Nov 14 17:26  ..
drwxrwx--- 1 root vboxsf    0 Feb 17  2019 'Camera Roll'
-rwxrwx--- 1 root vboxsf  504 Nov  1 14:37  desktop.ini
-rwxrwx--- 1 root vboxsf  716 Nov 15 13:00  dirtest2.sh
-rwxrwx--- 1 root vboxsf  959 Nov 15 14:17  dirtest3.sh
-rwxrwx--- 1 root vboxsf  389 Nov 15 09:40  dirtest.sh
drwxrwx--- 1 root vboxsf    0 Feb 17  2019 'Saved Pictures'
fbatschu@fbatschu-VirtualBox:/media/sf_Pictures$ 

by Frank Batschulat (Oracle), 5 years ago

Attachment: dirtest.sh added

by Frank Batschulat (Oracle), 5 years ago

Attachment: dirtest3.sh added

comment:3 by Frank Batschulat (Oracle), 5 years ago

Keywords: rm rmdir shared folder vboxsf added
Summary: rm -r not working correctly in shared folderrm / rmdir not working correctly in shared folders

comment:4 by Frank Batschulat (Oracle), 5 years ago

see also #19004

comment:5 by Frank Batschulat (Oracle), 5 years ago

actually we find the first occurence of this bug in an older ticket from 9 years ago! see also #8761

comment:6 by Reiner Brodbeck, 5 years ago

I don't think it is related to #8761. That old ticket was for VirtualBox v4.x. For me the problem started with v6.x. In v5.x this was okay

comment:7 by desolat, 5 years ago

The same error pattern was indeed described for VirtualBox 4.x, e.g. here: https://github.com/hashicorp/vagrant/issues/2282. Maybe some regression now in 6.x? Seeing the error pattern as described in #19004 in all current 6.x versions.

The source of the problem seems to be the Guest Additions as the problem is reproducible with VirtualBox 6.1.6 and Guest Additions 6.x, but not with Guest Additions 5.2.8 on any VirtualBox 6.x.

Any chance to get that sorted out soon?

Last edited 5 years ago by desolat (previous) (diff)

comment:8 by Frank Batschulat (Oracle), 4 years ago

see also:

#18776 Vagrant shared folders unable to install Package Management Plugins (Composer, PHP)
#8761 Silent failure to delete files on Shared Folders

comment:9 by Frank Batschulat (Oracle), 4 years ago

Owner: Frank Batschulat (Oracle) removed
Status: acceptedassigned

comment:10 by miff2000, 4 years ago

I can confirm, downgrade to latest 5.x guest additions release does work around the issue. Windows 10 Version 2004 (OS Build 19041.508) and Linux Mint VirtualBox VM.

In my case I am passing the vboxsf volume into a docker container and running composer install from in there. Works on v5.x but not v6.x guest additions.

5.x GA release downloaded from https://download.virtualbox.org/virtualbox

Last edited 4 years ago by miff2000 (previous) (diff)

comment:11 by csm10495, 4 years ago

Any chance that this issue could also affect trying to do unlinks and renames in certain cases? I'm using Nginx as a lancache (for steam, etc) and seem to be getting this if the space Nginx uses for the cache is a shared folder.

Is the workaround to change the guest additions on the host or the vm itself? Thanks

comment:12 by binary1230, 4 years ago

lots more tech info / kernel debugging info dropped into this ticket, which is potentially related to, or perhaps the same, as this ticket (unsure) https://www.virtualbox.org/ticket/8761

Note: See TracTickets for help on using tickets.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette