Ticket #9069 (new defect)

Opened 4 years ago

Last modified 2 months ago

shared folder doesn't seem to update

Reported by: tillk Owned by:
Priority: critical Component: shared folders
Version: VirtualBox 4.0.8 Keywords:
Cc: Guest type: Linux
Host type: Linux


I ran into an issue where when I change a file on/in a shared folder, the change is not seen when I serve up the file through a webserver (e.g. nginx).

I originally reported this with  vagrant, but they directed me here. I tried 4.0.8 of course already. This issue is present on at least two operating systems (Linux und MacOSX).

The guest in both cases was Linux (Ubuntu Karmic 9.10). I can provide my image if necessary --- it's a vagrant box.

Per ticket I previously opened (on github, vagrant), it seems to be an issue related to the syscalls of sendfile.

Let me know if I can provide more information or test.

Change History

comment:1 Changed 4 years ago by Denis Obydennykh

I'm using Virtual Box for development purposes. There I have installed LAMP + nginx. The communication between host Windows and virtual machine is made using virtualbox shared directories.

Some time ago nginx started working wrong - static files were not updated after changes (i've changed them from windows). If the browser tried to retrieve file throw nginx - it recieved old version (also with some special chars at the end of file). At the same time apache was working normal, vim and other programs inside virtualbox were showing right version of file.

The problem was solved by changing virtual machine disk controller from sata to ide.

comment:2 Changed 4 years ago by Denis Obydennykh

IDE solved the problem only for some time.

Seems that stat return wrong timestamp of last modification. And nginx thinks that file didn't changed.

comment:3 Changed 4 years ago by steolo

happens to me all the time...

actually, since my newly built machine, I also get incoherent states where folders or applications inside my ubuntu virtualmachine are listed in red, plenty of question marks, and are actually not-accessible.

comment:4 Changed 4 years ago by billwiens

I had the same issue, with the Apache webserver, and I found a solution on  this StackOverflow post. I'm able to fix the problem by adding "EnableSendfile off" to my Apache configuration.

I'm assuming that the same problem can be fixed in nginx by editing the  sendfile directive.

comment:5 Changed 20 months ago by mpeters

Same issue for several years now. This really needs to be fixed since shared folders between hosts and guests are essential for many work flows. And sendfile is a very useful performance improvement for lots of software. And it's just such an obscure bug that can suck tons of time trying to track down and fix.

Please put some effort into at least investigating this and hopefully it'll be a quick fix.

comment:6 Changed 19 months ago by peppy

This NEEDS to be fixed. I spent a good deal of today trying to figure why my changes just weren't showing in nginx. Very hard to track down, as cat, ls show the changes, and restarting nginx does not help.

comment:7 Changed 19 months ago by Bear L

This has been driving me nuts for months. I've been thinking it was a caching issue with Apache, and trying unsuccessfully to implement expiry. If not resolved this could drive me away from VirtualBox.

I am using a Win7 Pro computer, with the latest version of VirtualBox, and the correct Guest Additions. Most of my development editing is done on the windows side, using gVIM and Notepad++. The symptom only shows up on html and css files. Any PHP changes show correctly on refresh.

This problem also exists using IDEs like PhP Storm or others.

If I edit an html file using gVim on Win7, and refresh the browser, the changes are not shown, and view source shows the unchanged file. If I open the file in a terminal using vim, and simply save it using ":w!" then changes show in the browser. I thought is might have something to do with access or modification times, so tried stat index.html between each action.

# before saving on Win7 gVim
$ stat index.html
  File: `index.html'
  Size: 14827           Blocks: 29         IO Block: 4096   regular file
Device: 15h/21d Inode: 1176        Links: 1
Access: (0777/-rwxrwxrwx)  Uid: (    0/    root)   Gid: (  500/  vboxsf)
Access: 2014-05-15 10:44:40.413631400 -0600
Modify: 2014-05-15 10:44:40.415631700 -0600
Change: 2014-05-15 10:44:40.415631700 -0600

# after saving on Win7 gVim -- changes not in browser
$ stat index.html
  File: `index.html'
  Size: 14830           Blocks: 29         IO Block: 4096   regular file
Device: 15h/21d Inode: 1176        Links: 1
Access: (0777/-rwxrwxrwx)  Uid: (    0/    root)   Gid: (  500/  vboxsf)
Access: 2014-05-15 10:46:49.001460000 -0600
Modify: 2014-05-15 10:46:49.001960100 -0600
Change: 2014-05-15 10:46:49.001960100 -0600

# attempting just a `touch` -- no success
$ touch index.html
$ stat index.html
  File: `index.html'
  Size: 14830           Blocks: 29         IO Block: 4096   regular file
Device: 15h/21d Inode: 1176        Links: 1
Access: (0777/-rwxrwxrwx)  Uid: (    0/    root)   Gid: (  500/  vboxsf)
Access: 2014-05-15 10:47:19.000000000 -0600
Modify: 2014-05-15 10:47:19.000000000 -0600
Change: 2014-05-15 10:47:19.000000000 -0600

# after vi on linux just ":w!" -- shows changes in browser
$ stat index.html
  File: `index.html'
  Size: 14830           Blocks: 29         IO Block: 4096   regular file
Device: 15h/21d Inode: 1181        Links: 1
Access: (0777/-rwxrwxrwx)  Uid: (    0/    root)   Gid: (  500/  vboxsf)
Access: 2014-05-15 10:48:07.564936300 -0600
Modify: 2014-05-15 10:48:07.568436700 -0600
Change: 2014-05-15 10:48:07.568436700 -0600

Oddly, if I rename the file on the windows side, or unmount and remount the filesystem, the changes show up immediately.

System info:

  • Host: Windows 7 Professional 64 bit
  • VirtualBox: 4.3.10
  • Guest OS: CentOS-5.7 (RedHat 32 bit)
  • Apache: 2.2
Last edited 19 months ago by Bear L (previous) (diff)

comment:8 Changed 18 months ago by Computime

I've same problem:


apache 2.2.15 
php 5.5
myslq 5.6

mounted volume (share folder), so I work on host files and the websever is on virtualbox.

I setted "EnableSendfile off" and all work fine, but it's not a solution, is a brutal patch. When do you resolve it? thanks

comment:9 Changed 16 months ago by cgill27

I can confirm seeing the same issue. Windows host, centos linux guest running Apache, sharing web files between vm and windows using a virtualbox share.

Phpstorm would save a javascript file, and in the vm you can cat or vi the file and see the change, however reloading the javascript file via browser you could not see the change.

The workaround to disable Apache's sendfile does work.

comment:10 Changed 16 months ago by traiii

I have the exact same issue with static files from my shared folder not updating after being served once from my virtualbox vm. I am using the gunicorn python server to run a python app. Since I am not using apache or nginx to serve my static files, the disabling sendfile fix does not work for me.

comment:11 Changed 16 months ago by paul-sh

Are there any updates on this issue? There's a related ticket #12597.

comment:12 Changed 12 months ago by CleanCut

I am affected by this issue as well. This is a showstopper for our organization.

comment:13 Changed 12 months ago by CleanCut

I added some specific feedback on my experience to ticket #12597, which seems to be a more specific description of the sendfile bug.

comment:14 Changed 10 months ago by rmc33

I can confirm I am seeing the same issue. The file is updated in the file system but apache is showing an older or corrupted file when viewing from the browser. The workaround to disable sendfile in apache does work. I think updating apache would fix this. I do not need to disable sendfile in apache 2.4.6 but I do need to with an older version 2.2.15.

Last edited 10 months ago by rmc33 (previous) (diff)

comment:15 Changed 3 months ago by tristan0x

Bug still applies on 5.0.3

comment:16 Changed 3 months ago by MartinP

I am having this issue with stale files using VirtualBox 4.3.22 to run Mint 17.0 guest (with guest additions on top of Windows 8.1 host.

However, I'm having this when I simply use nemo to copy and paste a sub-folder from the shared folder to a native folder inside the vm's file structure.

If I right-click to edit the files in the shared folder, gedit sees the new content. But if I then copy the folder containing that file (copy from source, paste to destination), then edit the copy, the copy ends up with the stale contents.

Sometimes gedit claims the contents of the copy files are corrupt and the file cannot be edited. Perhaps explained if this link is correct that the file length is being overridden to not match the contents:-

Noting that comment 7 mentions PHPStorm - I am editing the files using RybyMine 7.1.3, which comes from the same stable of products based on IntelliJ.

comment:17 Changed 2 months ago by arimus

Note, I also had this same problem on 5.0.3 in a CentOS 7 guest & OSX Host. I was getting the following trying to manually mount:

/sbin/mount.vboxsf: mounting failed with the error: No such device

Two things helped: rebuild the vbox additions, in case you've done yum update and have a different kernel running. Also, the vboxsf module isn't auto-loaded by default. Add "modprobe vboxsf" to /etc/rc.modules and ensure that file has execute bit set (chmod +x /etc/rc.modules). Reboot the VM.

Note: See TracTickets for help on using tickets.
ContactPrivacy policyTerms of Use