Provisioning fails because /tmp is not empty? #80

mikebayliss opened this Issue Jun 23, 2014 · 10 comments


None yet

Right at the end of building a windows 7 VM packer failed with an error from what looks like an internally generated script.

This is Windows 7 building virtualbox. I'm on the latest versions of virtualbox, vagrant and packer. Everything has gone fine building the image (including all updates) and provisioning seems to have completed with the following scripts (all from the packer-windows project):


The console ouput ends with:
==> virtualbox-iso: Provisioning with shell script: ./scripts/puppet.bat
virtualbox-iso: C:\Users\vagrant>if not exist "C:\Windows\Temp\puppet.msi" (powershell -Command "(New-Object System.Net.WebClient).DownloadFile('', 'C:\Windows\Temp\puppet.msi')" 0<NUL )
virtualbox-iso: C:\Users\vagrant>msiexec /qn /i C:\Windows\Temp\puppet.msi /log C:\Windows\Temp\puppet.log
virtualbox-iso: C:\Users\vagrant>set /p ".=;C:\Program Files (x86)\Puppet Labs\Puppet\bin" 0<nul 1>>C:\Windows\Temp\PATH
virtualbox-iso: C:\Users\vagrant>set /p PATH= 0<C:\Windows\Temp\PATH
virtualbox-iso: C:\Users\vagrant>setx PATH "C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files (x86)\Puppet Labs\Puppet\bin" /m
virtualbox-iso: SUCCESS: Specified value was saved.
==> virtualbox-iso: Provisioning with shell script: C:\Users\mbayliss\AppData\Local\Temp\packer-shell448994023
virtualbox-iso: rm: cannot remove `/tmp/TMP000000060D8C519E2AA75846': Device or resource busy
==> virtualbox-iso: Unregistering and deleting virtual machine...
==> virtualbox-iso: Deleting output directory...
Build 'virtualbox-iso' errored: Script exited with non-zero exit status: 1

Anybody seen this before? Any suggestions for a workaround?




i have the exact same issue ... currently no workaround yet.
please let me know if you stumble across something.

kind regards


I've never seen that myself. Assuming I'm reading your output correctly, then the workaround is to remove the following provision step from your packer file, as it's not strictly necessary

    "type": "shell",
    "inline": [
      "rm -rf /tmp/*"
rgl commented Jun 26, 2014

Here it fails at that rm step too:

    virtualbox-iso: rm: cannot remove `/tmp/winstore.log': Device or resource busy

That winstore.log is from the windows store; I think its there because at the first run, the metro ui tries to download the default apps (at least the download icon appears on all titles).

So maybe we can shortcircuit that command? e.g. rm ... || true

@kensykora kensykora added this to the 1.22 milestone Aug 16, 2014

I'm having the same issue. There's no solution to this anywhere.


The same thing is happening to me with Packer 0.7.1


I can report success by rewriting rgl's solution to "rm -rf /tmp/* || ! false"


The solution of gerardkok works, but still I receive following error:

==> virtualbox-iso: Provisioning with shell script: /var/folders/mp/8rxvhtsd3jn9rdj1z3780wxm0000gn/T/packer-shell735432321
    virtualbox-iso: rm: cannot remove `/tmp/TMP000003B59E3A8A8F295F0693': Device or resource busy
    virtualbox-iso: rm: cannot remove `/tmp/TMP000003B68745D3E4F2719CAA': Device or resource busy

Has someone a idea? I use Packer v0.7.1 and Vagrant 1.6.5

Greetings, Tommy




Fixed in cf59ea8 per @dylanmei's suggestion

@kensykora kensykora closed this Nov 5, 2014
avtar commented Dec 17, 2014

I'm using the following on Arch to create a Windows 8.1 Vagrant box:

  • Packer 0.7.5
  • VirtualBox 4.3.20
  • Vagrant 1.7.0

I was getting the rm: cannot remove/tmp/winstore.log'error when using the [windows_81.json template]( with justrm -rf /tmp/set. Changing that to"rm -rf /tmp/ || ! false"` resulted in a successful build.

@jbarber jbarber added a commit to jbarber/packer-windows that referenced this issue Sep 30, 2015
@jbarber jbarber Update windows_81.json
Addresses joefitzgerald#80 for Windows 8.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment