VirtualBox

Opened 15 years ago

Last modified 8 years ago

#4890 reopened defect

Linux guest, "mv -f file1 file2" fails on shared folder without write permissions on file2 (Windows hosts)

Reported by: David Owned by:
Component: shared folders Version: VirtualBox 3.2.10
Keywords: Cc:
Guest type: Linux Host type: Windows

Description (last modified by aeichner)

Test case:

touch file1 file2 chmod a-w file2 mv -f file1 file2

On the guest disk, there is no message whatsoever and file2 is replaced by file1. This is the behavior I expect.

On a shared folder pointing to a directory on the host's local hard disk drive, I get this error from the mv command and file1 remains:

mv: cannot move file1' to file2': Operation not permitted

When the shared folder is pointing to a network drive, I get this error from the mv command and file1 remains:

mv: cannot move file1' to file2': File exists

Change History (17)

comment:1 by David, 15 years ago

Sorry for the formatting above. Here is the test case with correct newlines:

touch file1 file2
chmod a-w file2
mv -f file1 file2

comment:2 by Frank Mehnert, 15 years ago

Summary: WinXP host, Ubuntu 9.04 guest, "mv -f file1 file2" fails on shared folder without write permissions on file2Linux guest, "mv -f file1 file2" fails on shared folder without write permissions on file2 => Fixed in SVN

Fixed in the next release.

comment:3 by Frank Mehnert, 15 years ago

Resolution: fixed
Status: newclosed

Fixed in 3.1.8

comment:4 by petr, 14 years ago

Resolution: fixed
Status: closedreopened

I don't believe this has actually been fixed.

  • Host: Win 7 (32b)
  • Guest: Ubuntu 10.04 (tried both 64b and 32b)
  • Guest/Vbox version: tried 3.2.8 and 3.2.10
root@keira-u64:/www/tmp# touch file1
root@keira-u64:/www/tmp# ll
total 16
drwxrwxrwx 1 poisson poisson     0 2010-10-16 09:05 ./
dr-xr-xr-x 1 poisson poisson 16384 2010-10-11 20:13 ../
-rwxrwxrwx 1 poisson poisson     0 2010-10-16 09:04 file1*
root@keira-u64:/www/tmp# chmod a-w file1
root@keira-u64:/www/tmp# ll
total 16
drwxrwxrwx 1 poisson poisson     0 2010-10-16 09:05 ./
dr-xr-xr-x 1 poisson poisson 16384 2010-10-11 20:13 ../
-r-xr-xr-x 1 poisson poisson     0 2010-10-16 09:04 file1*
root@keira-u64:/www/tmp# rm -f file1
rm: cannot remove `file1': Operation not permitted
root@keira-u64:/www/tmp# chmod a+w file1
root@keira-u64:/www/tmp# rm -f file1
root@keira-u64:/www/tmp# ll
total 16
drwxrwxrwx 1 poisson poisson     0 2010-10-16 09:06 ./
dr-xr-xr-x 1 poisson poisson 16384 2010-10-11 20:13 ../
root@keira-u64:/www/tmp#

Mounted as: /www on /www type vboxsf (uid=1000,gid=1000,rw)

comment:5 by Frank Mehnert, 14 years ago

Summary: Linux guest, "mv -f file1 file2" fails on shared folder without write permissions on file2 => Fixed in SVNLinux guest, "mv -f file1 file2" fails on shared folder without write permissions on file2 (Windows hosts)
Version: VirtualBox 3.0.4VirtualBox 3.2.10

Right, this was actually fixed for Linux hosts but not for Windows hosts. In contrast to Linux where a file can be removed if the directory is writable but the file itself is read-only, a read-only file cannot be removed on Windows.

comment:6 by petr, 14 years ago

Thanks. Could it perhaps be fixed so that the driver would automatically add the write permission prior to the deletion?

comment:7 by vbuser, 14 years ago

Can the priority of fixing this problem be increased? The solution suggested by "poisson" should resolve this and many other issues related to the difference between how Windows and Linux handle a "move" to an existing file that is set to read-only. A Linux guest cannot successfully access a Subversion shared folder on a Windows host due to this problem. See http://forums.virtualbox.org/viewtopic.php?f=6&t=3201&start=15 and http://forums.virtualbox.org/viewtopic.php?f=3&t=22048 and http://forums.virtualbox.org/viewtopic.php?f=1&t=29406 ...

comment:8 by Frank Mehnert, 14 years ago

priority: minormajor

comment:10 by mszulc, 14 years ago

Bug still exist in 4.0.6 (Host: Windows SP3 (x86) with all updates; Guest: Ubuntu 10.10 x86 with all updates and Guest Additions 4.0.6):

mateusz@arizona-virtual ~ $ sudo mount -t vboxsf D_DRIVE dyskd
[sudo] password for mateusz: 
mateusz@arizona-virtual ~ $ cd dyskd 
mateusz@arizona-virtual ~/dyskd $ touch file1 file2 
mateusz@arizona-virtual ~/dyskd $ chmod a-w file2 
mateusz@arizona-virtual ~/dyskd $ mv -f file1 file2 
mv: cannot move file1' to file2': Operation not permitted

This is particulary annoying when working with SVN (subversion) client:

mateusz@arizona-virtual ~/dyskd/project_svn $ svn update 
svn: Can't move '.svn/tmp/entries' to '.svn/entries': Operation not permitted

comment:11 by Jack, 14 years ago

Still exists in 4.0.8 (Host: Windows Vista) (Guest Ubuntu 10.10) I also ran into this with svn - is there any workaround, or am I just unable to use svn? (I'm getting "file exists" rather than "operation not permitted" but it appears to be the same issue.

comment:12 by George Stagas, 13 years ago

The bug still exists in v4.1.4 tested with 64bit Windows 7 host and 64bit Ubuntu 11.10 guest.

comment:13 by astronaute, 12 years ago

Still exist in 4.2.4 on windows 7 64bit...

Will this ever be fixed?

comment:14 by henriqueutsch, 12 years ago

I have the same problem, and no fixed this bug. My VB version is 4.2.10. I am disappointed. Im 4 years ago no fixed this problem.

Last edited 12 years ago by henriqueutsch (previous) (diff)

comment:15 by rewen, 11 years ago

Same problem still exists in 4.2.16 on Win7 x64.

Extremely frustrating. I have no valid workarounds at the moment.

comment:16 by aeichner, 8 years ago

Description: modified (diff)
Resolution: obsolete
Status: reopenedclosed

Please reopen if still relevant with a recent VirtualBox release.

comment:17 by joelerr, 8 years ago

Resolution: obsolete
Status: closedreopened

problem still exists with most recent VirtualBox release (Version 5.1.12 r112440 (Qt5.6.2)).

Host: Win 10 (64b) Guest: 3.16.0-4-amd64 (debian_version 8.6) Guest/Vbox version: 5.1.12 r112440 (Qt5.6.2)

  • using OP's test, mv: cannot move 'file1' to 'file2': Operation not permitted
  • this also impacts sed -i operations , e.g: sed -i 's/hello/goodbye/' hello.txt where hello.txt is read only.
  • sed failures mean Docker WordPress containers refuse to start when the entrypoint.sh script attempts a sed for wp-config.php/wp-config-sample.php and fails due to this bug.
  • Workaround 1: add write/remove write permissions of source file before and after the operation.
  • WorkAround 2: mount using smb/CIFS , e.g: in /etc/fstab:
//mylaptop/www  /media/www  cifs username=MY_WINDOWS_USER,password=MY_PASSWORD,file_mode=0777,dir_mode=0777,iocharset=utf8,noperm,sec=ntlm  0  0
Last edited 8 years ago by joelerr (previous) (diff)

comment:18 by bompus, 8 years ago

I'm still able to reproduce this on Windows Host 5.0.26 , Linux Guest. My use case is slightly different, as I'm just trying to "rm -f /shared/file.txt" and getting the error. Fairly confident it's the same cause.

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