fileutils.rb:519:in `rename': Permission denied

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

fileutils.rb:519:in `rename': Permission denied

wenlock
Hi,

I've been trying to get a package command to work on my vagrant installation.   I keep getting this error:
D:/vagrant/vagrant/embedded/lib/ruby/1.9.1/fileutils.rb:519:in `rename': Permission denied -

It's trying to rename a folder under my users home directory (Temp)
/AppData/Local/Temp/vagrant-20130315-11960-dvhvzx  to /.vagrant.d/boxes/...

I've tried this as administrator and local user, I've also tried to open up permissions on Temp as well, no luck.  I'm wondering if there is a way to tell Vagrant to use a folder that might not be as protected....

Thanks,
Edward

--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: fileutils.rb:519:in `rename': Permission denied

Mitchell Hashimoto
Hi,

This appears to be an issue on Windows, and I'm unsure yet why it happens: https://github.com/mitchellh/vagrant/issues/1424

I'm still looking into it, but at this point, I'm not sure.

Best,
Mitchell


On Fri, Mar 15, 2013 at 9:17 AM, mocchi <[hidden email]> wrote:
Hi,

I've been trying to get a package command to work on my vagrant installation.   I keep getting this error:
D:/vagrant/vagrant/embedded/lib/ruby/1.9.1/fileutils.rb:519:in `rename': Permission denied -

It's trying to rename a folder under my users home directory (Temp)
/AppData/Local/Temp/vagrant-20130315-11960-dvhvzx  to /.vagrant.d/boxes/...

I've tried this as administrator and local user, I've also tried to open up permissions on Temp as well, no luck.  I'm wondering if there is a way to tell Vagrant to use a folder that might not be as protected....

Thanks,
Edward

--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: fileutils.rb:519:in `rename': Permission denied

wenlock
In reply to this post by wenlock
This actually is happening during the box add command (I had a script that was running a package, then add ):


c:\boxfiles>
    vagrant box add WIN_BUILD w2k8-build.box

Thanks,
Edward


On Friday, March 15, 2013 9:17:22 AM UTC-7, mocchi wrote:
Hi,

I've been trying to get a package command to work on my vagrant installation.   I keep getting this error:
D:/vagrant/vagrant/embedded/lib/ruby/1.9.1/fileutils.rb:519:in `rename': Permission denied -

It's trying to rename a folder under my users home directory (Temp)
/AppData/Local/Temp/vagrant-20130315-11960-dvhvzx  to /.vagrant.d/boxes/...

I've tried this as administrator and local user, I've also tried to open up permissions on Temp as well, no luck.  I'm wondering if there is a way to tell Vagrant to use a folder that might not be as protected....

Thanks,
Edward

--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: fileutils.rb:519:in `rename': Permission denied

wenlock
In reply to this post by Mitchell Hashimoto
OK, good, thanks for the quick response.   I really need 1.1 working for me so I might spend a little more time on this today before throwing in the towel and going back to 1.09.   The provider capabilities are just to nice to ignore.  Will post if I find a reasonable workaround.

Thanks,
Edward

On Friday, March 15, 2013 9:19:24 AM UTC-7, Mitchell Hashimoto wrote:
Hi,

This appears to be an issue on Windows, and I'm unsure yet why it happens: https://github.com/mitchellh/vagrant/issues/1424

I'm still looking into it, but at this point, I'm not sure.

Best,
Mitchell


On Fri, Mar 15, 2013 at 9:17 AM, mocchi <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="aTLAYTvPZbMJ">edward....@...> wrote:
Hi,

I've been trying to get a package command to work on my vagrant installation.   I keep getting this error:
D:/vagrant/vagrant/embedded/lib/ruby/1.9.1/fileutils.rb:519:in `rename': Permission denied -

It's trying to rename a folder under my users home directory (Temp)
/AppData/Local/Temp/vagrant-20130315-11960-dvhvzx  to /.vagrant.d/boxes/...

I've tried this as administrator and local user, I've also tried to open up permissions on Temp as well, no luck.  I'm wondering if there is a way to tell Vagrant to use a folder that might not be as protected....

Thanks,
Edward

--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="aTLAYTvPZbMJ">vagrant-up+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: fileutils.rb:519:in `rename': Permission denied

wenlock
Hey Mitchell,

I made some really good progress on finding some workarounds that might be useful for you on trying to figure this issue out on vagrant 1.1.2 running under git bash.   

The first issue I ran into was that bsdtar.exe was not in my path, so I was getting a file not found error during a vagrant package or vagrant add command.   I saw that you relocated the bsdtar.exe out of the embedded/bin folder, since now there are two under mingw/bin and gnuwin32/bin.   I've been using git bash (which is msys32) so I wanted to get mingw/bin into the path.   For this I modified the /vagrant/bin/vagrant file (bash file) to include the following lines (this is with vagrant 1.1.2):

starting on line 46

 

OS=$(uname -o 2> /dev/null)

if [ -z "${OS}" ]; then

   # maybe uname has different options

   OS=$(uname -s 2> /dev/null |cut -d _ -f 1)

fi

 

# Prepend our embedded dir to the PATH so that we call that preferably

export PATH="${EMBEDDED_DIR}/bin:${PATH}"

 

# use mingw32 embedded commands

[ "${OS}" = "MINGW32" ] && export PATH="${EMBEDDED_DIR}/mingw/bin:${PATH}"



There probably has to be some additional logic for getting this to work in Cygwin so that when OS is Cygwin you use the correct bsdtar.exe (I wasn't sure if this would have been gnuwin32/bin or the mingw/bin).  Maybe someone can test it on cygwin....

The second issue I ran into was a windows api issue with win32 api rename not returning a valid error when rename fails due to the destination being on a different file system.   After doing some digging into fileutils.rb, I was seeing that it was raising an access denied error on call to File.rename (line 515).  After digging around and seeing this article related to emacs explaining the rename issue on windows http://lists.gnu.org/archive/html/emacs-devel/2011-12/msg00579.html,  it occurred to me that my .vagrant.d folder that is in the %USERPROFILE% is actually on a different file system than where my %USERPROFILE%/AppData/Local/Temp or %TEMP% folder lives on my system (I use an SSD drive, so I had done some relocation of fatter folders in %USERPROFILE%).  rename must be throwing Access Denied error instead of EXDEV so that mv can catch it and do a copy_entry.

After relocating the folders to be on the same filesystem, this solved my vagrant add issue.  I suspect using FileUtils.mv without checking for access denied exceptions might not exactly work with Ruby 1.9.2 on windows.  I didn't dig around to see if they dealt with the windows issue in newer releases of ruby, but I would suggest that for windows you should probably add a check and use a cp followed by rm instead of mv in box_collection.rb line 155  (there might be others if FileUtils.mv is used alot).   For now, if I see the issue again I'll know to look and see if the source and destination folders are on the same file system for windows.

Hope the workaround help you solve some bugs.

Thanks,
Edward


On Friday, March 15, 2013 9:33:53 AM UTC-7, mocchi wrote:
OK, good, thanks for the quick response.   I really need 1.1 working for me so I might spend a little more time on this today before throwing in the towel and going back to 1.09.   The provider capabilities are just to nice to ignore.  Will post if I find a reasonable workaround.

Thanks,
Edward

On Friday, March 15, 2013 9:19:24 AM UTC-7, Mitchell Hashimoto wrote:
Hi,

This appears to be an issue on Windows, and I'm unsure yet why it happens: https://github.com/mitchellh/vagrant/issues/1424

I'm still looking into it, but at this point, I'm not sure.

Best,
Mitchell


On Fri, Mar 15, 2013 at 9:17 AM, mocchi <[hidden email]> wrote:
Hi,

I've been trying to get a package command to work on my vagrant installation.   I keep getting this error:
D:/vagrant/vagrant/embedded/lib/ruby/1.9.1/fileutils.rb:519:in `rename': Permission denied -

It's trying to rename a folder under my users home directory (Temp)
/AppData/Local/Temp/vagrant-20130315-11960-dvhvzx  to /.vagrant.d/boxes/...

I've tried this as administrator and local user, I've also tried to open up permissions on Temp as well, no luck.  I'm wondering if there is a way to tell Vagrant to use a folder that might not be as protected....

Thanks,
Edward

--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: fileutils.rb:519:in `rename': Permission denied

Mitchell Hashimoto
Edward,

Thanks so much for this. I've modified the installers to fix the Bash files to work properly. I just use the "gnuwin32" path. Is that alright for msys as well?

Also, the FileUtils.mv issue is indeed a Ruby bug. I've gone ahead and pushed in a workaround for this now.

Best,
Mitchell


On Wed, Mar 20, 2013 at 10:34 PM, mocchi <[hidden email]> wrote:
Hey Mitchell,

I made some really good progress on finding some workarounds that might be useful for you on trying to figure this issue out on vagrant 1.1.2 running under git bash.   

The first issue I ran into was that bsdtar.exe was not in my path, so I was getting a file not found error during a vagrant package or vagrant add command.   I saw that you relocated the bsdtar.exe out of the embedded/bin folder, since now there are two under mingw/bin and gnuwin32/bin.   I've been using git bash (which is msys32) so I wanted to get mingw/bin into the path.   For this I modified the /vagrant/bin/vagrant file (bash file) to include the following lines (this is with vagrant 1.1.2):

starting on line 46

 

OS=$(uname -o 2> /dev/null)

if [ -z "${OS}" ]; then

   # maybe uname has different options

   OS=$(uname -s 2> /dev/null |cut -d _ -f 1)

fi

 

# Prepend our embedded dir to the PATH so that we call that preferably

export PATH="${EMBEDDED_DIR}/bin:${PATH}"

 

# use mingw32 embedded commands

[ "${OS}" = "MINGW32" ] && export PATH="${EMBEDDED_DIR}/mingw/bin:${PATH}"



There probably has to be some additional logic for getting this to work in Cygwin so that when OS is Cygwin you use the correct bsdtar.exe (I wasn't sure if this would have been gnuwin32/bin or the mingw/bin).  Maybe someone can test it on cygwin....

The second issue I ran into was a windows api issue with win32 api rename not returning a valid error when rename fails due to the destination being on a different file system.   After doing some digging into fileutils.rb, I was seeing that it was raising an access denied error on call to File.rename (line 515).  After digging around and seeing this article related to emacs explaining the rename issue on windows http://lists.gnu.org/archive/html/emacs-devel/2011-12/msg00579.html,  it occurred to me that my .vagrant.d folder that is in the %USERPROFILE% is actually on a different file system than where my %USERPROFILE%/AppData/Local/Temp or %TEMP% folder lives on my system (I use an SSD drive, so I had done some relocation of fatter folders in %USERPROFILE%).  rename must be throwing Access Denied error instead of EXDEV so that mv can catch it and do a copy_entry.

After relocating the folders to be on the same filesystem, this solved my vagrant add issue.  I suspect using FileUtils.mv without checking for access denied exceptions might not exactly work with Ruby 1.9.2 on windows.  I didn't dig around to see if they dealt with the windows issue in newer releases of ruby, but I would suggest that for windows you should probably add a check and use a cp followed by rm instead of mv in box_collection.rb line 155  (there might be others if FileUtils.mv is used alot).   For now, if I see the issue again I'll know to look and see if the source and destination folders are on the same file system for windows.

Hope the workaround help you solve some bugs.

Thanks,
Edward


On Friday, March 15, 2013 9:33:53 AM UTC-7, mocchi wrote:
OK, good, thanks for the quick response.   I really need 1.1 working for me so I might spend a little more time on this today before throwing in the towel and going back to 1.09.   The provider capabilities are just to nice to ignore.  Will post if I find a reasonable workaround.

Thanks,
Edward

On Friday, March 15, 2013 9:19:24 AM UTC-7, Mitchell Hashimoto wrote:
Hi,

This appears to be an issue on Windows, and I'm unsure yet why it happens: https://github.com/mitchellh/vagrant/issues/1424

I'm still looking into it, but at this point, I'm not sure.

Best,
Mitchell


On Fri, Mar 15, 2013 at 9:17 AM, mocchi <[hidden email]> wrote:
Hi,

I've been trying to get a package command to work on my vagrant installation.   I keep getting this error:
D:/vagrant/vagrant/embedded/lib/ruby/1.9.1/fileutils.rb:519:in `rename': Permission denied -

It's trying to rename a folder under my users home directory (Temp)
/AppData/Local/Temp/vagrant-20130315-11960-dvhvzx  to /.vagrant.d/boxes/...

I've tried this as administrator and local user, I've also tried to open up permissions on Temp as well, no luck.  I'm wondering if there is a way to tell Vagrant to use a folder that might not be as protected....

Thanks,
Edward

--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: fileutils.rb:519:in `rename': Permission denied

wenlock
Well, I think git bash or msys are not going to have a uname that behaves correctly with returning Cygwin.   Would be good to add this after first uname call:

OS=$(uname -o 2> /dev/null)

if [ -z "${OS}" ]; then

   # maybe uname has different options

   OS=$(uname -s 2> /dev/null |cut -d _ -f 1)

fi


Then after your Cygwin check, add the MINGW32 check.


# use mingw32 embedded commands

[ "${OS}" = "MINGW32" ] && export PATH="${EMBEDDED_DIR}/mingw/bin:${PATH}"


This should help cover the git bash and msys use case.  


Thanks! :D


Edward


Just saw the code post h
On Wednesday, March 20, 2013 10:36:05 PM UTC-7, Mitchell Hashimoto wrote:
Edward,

Thanks so much for this. I've modified the installers to fix the Bash files to work properly. I just use the "gnuwin32" path. Is that alright for msys as well?

Also, the FileUtils.mv issue is indeed a Ruby bug. I've gone ahead and pushed in a workaround for this now.

Best,
Mitchell


On Wed, Mar 20, 2013 at 10:34 PM, mocchi <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="z2Kc3ixstBYJ">edward....@...> wrote:
Hey Mitchell,

I made some really good progress on finding some workarounds that might be useful for you on trying to figure this issue out on vagrant 1.1.2 running under git bash.   

The first issue I ran into was that bsdtar.exe was not in my path, so I was getting a file not found error during a vagrant package or vagrant add command.   I saw that you relocated the bsdtar.exe out of the embedded/bin folder, since now there are two under mingw/bin and gnuwin32/bin.   I've been using git bash (which is msys32) so I wanted to get mingw/bin into the path.   For this I modified the /vagrant/bin/vagrant file (bash file) to include the following lines (this is with vagrant 1.1.2):

starting on line 46

 

OS=$(uname -o 2> /dev/null)

if [ -z "${OS}" ]; then

   # maybe uname has different options

   OS=$(uname -s 2> /dev/null |cut -d _ -f 1)

fi

 

# Prepend our embedded dir to the PATH so that we call that preferably

export PATH="${EMBEDDED_DIR}/bin:${PATH}"

 

# use mingw32 embedded commands

[ "${OS}" = "MINGW32" ] && export PATH="${EMBEDDED_DIR}/mingw/bin:${PATH}"



There probably has to be some additional logic for getting this to work in Cygwin so that when OS is Cygwin you use the correct bsdtar.exe (I wasn't sure if this would have been gnuwin32/bin or the mingw/bin).  Maybe someone can test it on cygwin....

The second issue I ran into was a windows api issue with win32 api rename not returning a valid error when rename fails due to the destination being on a different file system.   After doing some digging into fileutils.rb, I was seeing that it was raising an access denied error on call to File.rename (line 515).  After digging around and seeing this article related to emacs explaining the rename issue on windows http://lists.gnu.org/archive/html/emacs-devel/2011-12/msg00579.html,  it occurred to me that my .vagrant.d folder that is in the %USERPROFILE% is actually on a different file system than where my %USERPROFILE%/AppData/Local/Temp or %TEMP% folder lives on my system (I use an SSD drive, so I had done some relocation of fatter folders in %USERPROFILE%).  rename must be throwing Access Denied error instead of EXDEV so that mv can catch it and do a copy_entry.

After relocating the folders to be on the same filesystem, this solved my vagrant add issue.  I suspect using FileUtils.mv without checking for access denied exceptions might not exactly work with Ruby 1.9.2 on windows.  I didn't dig around to see if they dealt with the windows issue in newer releases of ruby, but I would suggest that for windows you should probably add a check and use a cp followed by rm instead of mv in box_collection.rb line 155  (there might be others if FileUtils.mv is used alot).   For now, if I see the issue again I'll know to look and see if the source and destination folders are on the same file system for windows.

Hope the workaround help you solve some bugs.

Thanks,
Edward


On Friday, March 15, 2013 9:33:53 AM UTC-7, mocchi wrote:
OK, good, thanks for the quick response.   I really need 1.1 working for me so I might spend a little more time on this today before throwing in the towel and going back to 1.09.   The provider capabilities are just to nice to ignore.  Will post if I find a reasonable workaround.

Thanks,
Edward

On Friday, March 15, 2013 9:19:24 AM UTC-7, Mitchell Hashimoto wrote:
Hi,

This appears to be an issue on Windows, and I'm unsure yet why it happens: https://github.com/mitchellh/vagrant/issues/1424

I'm still looking into it, but at this point, I'm not sure.

Best,
Mitchell


On Fri, Mar 15, 2013 at 9:17 AM, mocchi <[hidden email]> wrote:
Hi,

I've been trying to get a package command to work on my vagrant installation.   I keep getting this error:
D:/vagrant/vagrant/embedded/lib/ruby/1.9.1/fileutils.rb:519:in `rename': Permission denied -

It's trying to rename a folder under my users home directory (Temp)
/AppData/Local/Temp/vagrant-20130315-11960-dvhvzx  to /.vagrant.d/boxes/...

I've tried this as administrator and local user, I've also tried to open up permissions on Temp as well, no luck.  I'm wondering if there is a way to tell Vagrant to use a folder that might not be as protected....

Thanks,
Edward

--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="z2Kc3ixstBYJ">vagrant-up+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: fileutils.rb:519:in `rename': Permission denied

wenlock
Hmm, you might want to hold off on this change.  I just tested bsdtar from mingw on a large windows image and it seems to be chocking on the file size....
I'm going to try the gnuwin32 version to see if it does much better.
Will report back tomorrow hopefully.

Thanks,
Edward

On Wednesday, March 20, 2013 10:42:45 PM UTC-7, mocchi wrote:
Well, I think git bash or msys are not going to have a uname that behaves correctly with returning Cygwin.   Would be good to add this after first uname call:

OS=$(uname -o 2> /dev/null)

if [ -z "${OS}" ]; then

   # maybe uname has different options

   OS=$(uname -s 2> /dev/null |cut -d _ -f 1)

fi


Then after your Cygwin check, add the MINGW32 check.


# use mingw32 embedded commands

[ "${OS}" = "MINGW32" ] && export PATH="${EMBEDDED_DIR}/mingw/bin:${PATH}"


This should help cover the git bash and msys use case.  


Thanks! :D


Edward


Just saw the code post h
On Wednesday, March 20, 2013 10:36:05 PM UTC-7, Mitchell Hashimoto wrote:
Edward,

Thanks so much for this. I've modified the installers to fix the Bash files to work properly. I just use the "gnuwin32" path. Is that alright for msys as well?

Also, the FileUtils.mv issue is indeed a Ruby bug. I've gone ahead and pushed in a workaround for this now.

Best,
Mitchell


On Wed, Mar 20, 2013 at 10:34 PM, mocchi <[hidden email]> wrote:
Hey Mitchell,

I made some really good progress on finding some workarounds that might be useful for you on trying to figure this issue out on vagrant 1.1.2 running under git bash.   

The first issue I ran into was that bsdtar.exe was not in my path, so I was getting a file not found error during a vagrant package or vagrant add command.   I saw that you relocated the bsdtar.exe out of the embedded/bin folder, since now there are two under mingw/bin and gnuwin32/bin.   I've been using git bash (which is msys32) so I wanted to get mingw/bin into the path.   For this I modified the /vagrant/bin/vagrant file (bash file) to include the following lines (this is with vagrant 1.1.2):

starting on line 46

 

OS=$(uname -o 2> /dev/null)

if [ -z "${OS}" ]; then

   # maybe uname has different options

   OS=$(uname -s 2> /dev/null |cut -d _ -f 1)

fi

 

# Prepend our embedded dir to the PATH so that we call that preferably

export PATH="${EMBEDDED_DIR}/bin:${PATH}"

 

# use mingw32 embedded commands

[ "${OS}" = "MINGW32" ] && export PATH="${EMBEDDED_DIR}/mingw/bin:${PATH}"



There probably has to be some additional logic for getting this to work in Cygwin so that when OS is Cygwin you use the correct bsdtar.exe (I wasn't sure if this would have been gnuwin32/bin or the mingw/bin).  Maybe someone can test it on cygwin....

The second issue I ran into was a windows api issue with win32 api rename not returning a valid error when rename fails due to the destination being on a different file system.   After doing some digging into fileutils.rb, I was seeing that it was raising an access denied error on call to File.rename (line 515).  After digging around and seeing this article related to emacs explaining the rename issue on windows http://lists.gnu.org/archive/html/emacs-devel/2011-12/msg00579.html,  it occurred to me that my .vagrant.d folder that is in the %USERPROFILE% is actually on a different file system than where my %USERPROFILE%/AppData/Local/Temp or %TEMP% folder lives on my system (I use an SSD drive, so I had done some relocation of fatter folders in %USERPROFILE%).  rename must be throwing Access Denied error instead of EXDEV so that mv can catch it and do a copy_entry.

After relocating the folders to be on the same filesystem, this solved my vagrant add issue.  I suspect using FileUtils.mv without checking for access denied exceptions might not exactly work with Ruby 1.9.2 on windows.  I didn't dig around to see if they dealt with the windows issue in newer releases of ruby, but I would suggest that for windows you should probably add a check and use a cp followed by rm instead of mv in box_collection.rb line 155  (there might be others if FileUtils.mv is used alot).   For now, if I see the issue again I'll know to look and see if the source and destination folders are on the same file system for windows.

Hope the workaround help you solve some bugs.

Thanks,
Edward


On Friday, March 15, 2013 9:33:53 AM UTC-7, mocchi wrote:
OK, good, thanks for the quick response.   I really need 1.1 working for me so I might spend a little more time on this today before throwing in the towel and going back to 1.09.   The provider capabilities are just to nice to ignore.  Will post if I find a reasonable workaround.

Thanks,
Edward

On Friday, March 15, 2013 9:19:24 AM UTC-7, Mitchell Hashimoto wrote:
Hi,

This appears to be an issue on Windows, and I'm unsure yet why it happens: https://github.com/mitchellh/vagrant/issues/1424

I'm still looking into it, but at this point, I'm not sure.

Best,
Mitchell


On Fri, Mar 15, 2013 at 9:17 AM, mocchi <[hidden email]> wrote:
Hi,

I've been trying to get a package command to work on my vagrant installation.   I keep getting this error:
D:/vagrant/vagrant/embedded/lib/ruby/1.9.1/fileutils.rb:519:in `rename': Permission denied -

It's trying to rename a folder under my users home directory (Temp)
/AppData/Local/Temp/vagrant-20130315-11960-dvhvzx  to /.vagrant.d/boxes/...

I've tried this as administrator and local user, I've also tried to open up permissions on Temp as well, no luck.  I'm wondering if there is a way to tell Vagrant to use a folder that might not be as protected....

Thanks,
Edward

--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: fileutils.rb:519:in `rename': Permission denied

wenlock
OK, I think I can say for sure that gnuwin32/bin works allot better for git bash.   I changed my vagrant file to :

# Determine the OS that we're on, which is used in some later checks.
# It is very important we do this _before_ setting the PATH below
# because uname dependencies can conflict on some platforms.
OS=$(uname -o 2> /dev/null)
if [ -z "${OS}" ]; then
   # maybe uname has different options
   OS=$(uname -s 2> /dev/null |cut -d _ -f 1)
fi

# Prepend our embedded dir to the PATH so that we call that preferably
export PATH="${EMBEDDED_DIR}/bin:${PATH}"

# use mingw32 embedded commands
[  "${OS}" = "MINGW32" -o  "${OS}" = "Cygwin"  ] && export PATH="${EMBEDDED_DIR}/gnuwin32/bin:${PATH}"

This is working good with a windows image I have that's about 12G.

Thanks,
Edward

On Wednesday, March 20, 2013 11:38:01 PM UTC-7, mocchi wrote:
Hmm, you might want to hold off on this change.  I just tested bsdtar from mingw on a large windows image and it seems to be chocking on the file size....
I'm going to try the gnuwin32 version to see if it does much better.
Will report back tomorrow hopefully.

Thanks,
Edward

On Wednesday, March 20, 2013 10:42:45 PM UTC-7, mocchi wrote:
Well, I think git bash or msys are not going to have a uname that behaves correctly with returning Cygwin.   Would be good to add this after first uname call:

OS=$(uname -o 2> /dev/null)

if [ -z "${OS}" ]; then

   # maybe uname has different options

   OS=$(uname -s 2> /dev/null |cut -d _ -f 1)

fi


Then after your Cygwin check, add the MINGW32 check.


# use mingw32 embedded commands

[ "${OS}" = "MINGW32" ] && export PATH="${EMBEDDED_DIR}/mingw/bin:${PATH}"


This should help cover the git bash and msys use case.  


Thanks! :D


Edward


Just saw the code post h
On Wednesday, March 20, 2013 10:36:05 PM UTC-7, Mitchell Hashimoto wrote:
Edward,

Thanks so much for this. I've modified the installers to fix the Bash files to work properly. I just use the "gnuwin32" path. Is that alright for msys as well?

Also, the FileUtils.mv issue is indeed a Ruby bug. I've gone ahead and pushed in a workaround for this now.

Best,
Mitchell


On Wed, Mar 20, 2013 at 10:34 PM, mocchi <[hidden email]> wrote:
Hey Mitchell,

I made some really good progress on finding some workarounds that might be useful for you on trying to figure this issue out on vagrant 1.1.2 running under git bash.   

The first issue I ran into was that bsdtar.exe was not in my path, so I was getting a file not found error during a vagrant package or vagrant add command.   I saw that you relocated the bsdtar.exe out of the embedded/bin folder, since now there are two under mingw/bin and gnuwin32/bin.   I've been using git bash (which is msys32) so I wanted to get mingw/bin into the path.   For this I modified the /vagrant/bin/vagrant file (bash file) to include the following lines (this is with vagrant 1.1.2):

starting on line 46

 

OS=$(uname -o 2> /dev/null)

if [ -z "${OS}" ]; then

   # maybe uname has different options

   OS=$(uname -s 2> /dev/null |cut -d _ -f 1)

fi

 

# Prepend our embedded dir to the PATH so that we call that preferably

export PATH="${EMBEDDED_DIR}/bin:${PATH}"

 

# use mingw32 embedded commands

[ "${OS}" = "MINGW32" ] && export PATH="${EMBEDDED_DIR}/mingw/bin:${PATH}"



There probably has to be some additional logic for getting this to work in Cygwin so that when OS is Cygwin you use the correct bsdtar.exe (I wasn't sure if this would have been gnuwin32/bin or the mingw/bin).  Maybe someone can test it on cygwin....

The second issue I ran into was a windows api issue with win32 api rename not returning a valid error when rename fails due to the destination being on a different file system.   After doing some digging into fileutils.rb, I was seeing that it was raising an access denied error on call to File.rename (line 515).  After digging around and seeing this article related to emacs explaining the rename issue on windows http://lists.gnu.org/archive/html/emacs-devel/2011-12/msg00579.html,  it occurred to me that my .vagrant.d folder that is in the %USERPROFILE% is actually on a different file system than where my %USERPROFILE%/AppData/Local/Temp or %TEMP% folder lives on my system (I use an SSD drive, so I had done some relocation of fatter folders in %USERPROFILE%).  rename must be throwing Access Denied error instead of EXDEV so that mv can catch it and do a copy_entry.

After relocating the folders to be on the same filesystem, this solved my vagrant add issue.  I suspect using FileUtils.mv without checking for access denied exceptions might not exactly work with Ruby 1.9.2 on windows.  I didn't dig around to see if they dealt with the windows issue in newer releases of ruby, but I would suggest that for windows you should probably add a check and use a cp followed by rm instead of mv in box_collection.rb line 155  (there might be others if FileUtils.mv is used alot).   For now, if I see the issue again I'll know to look and see if the source and destination folders are on the same file system for windows.

Hope the workaround help you solve some bugs.

Thanks,
Edward


On Friday, March 15, 2013 9:33:53 AM UTC-7, mocchi wrote:
OK, good, thanks for the quick response.   I really need 1.1 working for me so I might spend a little more time on this today before throwing in the towel and going back to 1.09.   The provider capabilities are just to nice to ignore.  Will post if I find a reasonable workaround.

Thanks,
Edward

On Friday, March 15, 2013 9:19:24 AM UTC-7, Mitchell Hashimoto wrote:
Hi,

This appears to be an issue on Windows, and I'm unsure yet why it happens: https://github.com/mitchellh/vagrant/issues/1424

I'm still looking into it, but at this point, I'm not sure.

Best,
Mitchell


On Fri, Mar 15, 2013 at 9:17 AM, mocchi <[hidden email]> wrote:
Hi,

I've been trying to get a package command to work on my vagrant installation.   I keep getting this error:
D:/vagrant/vagrant/embedded/lib/ruby/1.9.1/fileutils.rb:519:in `rename': Permission denied -

It's trying to rename a folder under my users home directory (Temp)
/AppData/Local/Temp/vagrant-20130315-11960-dvhvzx  to /.vagrant.d/boxes/...

I've tried this as administrator and local user, I've also tried to open up permissions on Temp as well, no luck.  I'm wondering if there is a way to tell Vagrant to use a folder that might not be as protected....

Thanks,
Edward

--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: fileutils.rb:519:in `rename': Permission denied

Mitchell Hashimoto
Edward,

Awesome! The 1.1.3 installers will do this. :)

Best,
Mitchell


On Thu, Mar 21, 2013 at 6:49 AM, mocchi <[hidden email]> wrote:
OK, I think I can say for sure that gnuwin32/bin works allot better for git bash.   I changed my vagrant file to :

# Determine the OS that we're on, which is used in some later checks.
# It is very important we do this _before_ setting the PATH below
# because uname dependencies can conflict on some platforms.
OS=$(uname -o 2> /dev/null)
if [ -z "${OS}" ]; then
   # maybe uname has different options
   OS=$(uname -s 2> /dev/null |cut -d _ -f 1)
fi

# Prepend our embedded dir to the PATH so that we call that preferably
export PATH="${EMBEDDED_DIR}/bin:${PATH}"

# use mingw32 embedded commands
[  "${OS}" = "MINGW32" -o  "${OS}" = "Cygwin"  ] && export PATH="${EMBEDDED_DIR}/gnuwin32/bin:${PATH}"

This is working good with a windows image I have that's about 12G.

Thanks,
Edward

On Wednesday, March 20, 2013 11:38:01 PM UTC-7, mocchi wrote:
Hmm, you might want to hold off on this change.  I just tested bsdtar from mingw on a large windows image and it seems to be chocking on the file size....
I'm going to try the gnuwin32 version to see if it does much better.
Will report back tomorrow hopefully.

Thanks,
Edward

On Wednesday, March 20, 2013 10:42:45 PM UTC-7, mocchi wrote:
Well, I think git bash or msys are not going to have a uname that behaves correctly with returning Cygwin.   Would be good to add this after first uname call:

OS=$(uname -o 2> /dev/null)

if [ -z "${OS}" ]; then

   # maybe uname has different options

   OS=$(uname -s 2> /dev/null |cut -d _ -f 1)

fi


Then after your Cygwin check, add the MINGW32 check.


# use mingw32 embedded commands

[ "${OS}" = "MINGW32" ] && export PATH="${EMBEDDED_DIR}/mingw/bin:${PATH}"


This should help cover the git bash and msys use case.  


Thanks! :D


Edward


Just saw the code post h
On Wednesday, March 20, 2013 10:36:05 PM UTC-7, Mitchell Hashimoto wrote:
Edward,

Thanks so much for this. I've modified the installers to fix the Bash files to work properly. I just use the "gnuwin32" path. Is that alright for msys as well?

Also, the FileUtils.mv issue is indeed a Ruby bug. I've gone ahead and pushed in a workaround for this now.

Best,
Mitchell


On Wed, Mar 20, 2013 at 10:34 PM, mocchi <[hidden email]> wrote:
Hey Mitchell,

I made some really good progress on finding some workarounds that might be useful for you on trying to figure this issue out on vagrant 1.1.2 running under git bash.   

The first issue I ran into was that bsdtar.exe was not in my path, so I was getting a file not found error during a vagrant package or vagrant add command.   I saw that you relocated the bsdtar.exe out of the embedded/bin folder, since now there are two under mingw/bin and gnuwin32/bin.   I've been using git bash (which is msys32) so I wanted to get mingw/bin into the path.   For this I modified the /vagrant/bin/vagrant file (bash file) to include the following lines (this is with vagrant 1.1.2):

starting on line 46

 

OS=$(uname -o 2> /dev/null)

if [ -z "${OS}" ]; then

   # maybe uname has different options

   OS=$(uname -s 2> /dev/null |cut -d _ -f 1)

fi

 

# Prepend our embedded dir to the PATH so that we call that preferably

export PATH="${EMBEDDED_DIR}/bin:${PATH}"

 

# use mingw32 embedded commands

[ "${OS}" = "MINGW32" ] && export PATH="${EMBEDDED_DIR}/mingw/bin:${PATH}"



There probably has to be some additional logic for getting this to work in Cygwin so that when OS is Cygwin you use the correct bsdtar.exe (I wasn't sure if this would have been gnuwin32/bin or the mingw/bin).  Maybe someone can test it on cygwin....

The second issue I ran into was a windows api issue with win32 api rename not returning a valid error when rename fails due to the destination being on a different file system.   After doing some digging into fileutils.rb, I was seeing that it was raising an access denied error on call to File.rename (line 515).  After digging around and seeing this article related to emacs explaining the rename issue on windows http://lists.gnu.org/archive/html/emacs-devel/2011-12/msg00579.html,  it occurred to me that my .vagrant.d folder that is in the %USERPROFILE% is actually on a different file system than where my %USERPROFILE%/AppData/Local/Temp or %TEMP% folder lives on my system (I use an SSD drive, so I had done some relocation of fatter folders in %USERPROFILE%).  rename must be throwing Access Denied error instead of EXDEV so that mv can catch it and do a copy_entry.

After relocating the folders to be on the same filesystem, this solved my vagrant add issue.  I suspect using FileUtils.mv without checking for access denied exceptions might not exactly work with Ruby 1.9.2 on windows.  I didn't dig around to see if they dealt with the windows issue in newer releases of ruby, but I would suggest that for windows you should probably add a check and use a cp followed by rm instead of mv in box_collection.rb line 155  (there might be others if FileUtils.mv is used alot).   For now, if I see the issue again I'll know to look and see if the source and destination folders are on the same file system for windows.

Hope the workaround help you solve some bugs.

Thanks,
Edward


On Friday, March 15, 2013 9:33:53 AM UTC-7, mocchi wrote:
OK, good, thanks for the quick response.   I really need 1.1 working for me so I might spend a little more time on this today before throwing in the towel and going back to 1.09.   The provider capabilities are just to nice to ignore.  Will post if I find a reasonable workaround.

Thanks,
Edward

On Friday, March 15, 2013 9:19:24 AM UTC-7, Mitchell Hashimoto wrote:
Hi,

This appears to be an issue on Windows, and I'm unsure yet why it happens: https://github.com/mitchellh/vagrant/issues/1424

I'm still looking into it, but at this point, I'm not sure.

Best,
Mitchell


On Fri, Mar 15, 2013 at 9:17 AM, mocchi <[hidden email]> wrote:
Hi,

I've been trying to get a package command to work on my vagrant installation.   I keep getting this error:
D:/vagrant/vagrant/embedded/lib/ruby/1.9.1/fileutils.rb:519:in `rename': Permission denied -

It's trying to rename a folder under my users home directory (Temp)
/AppData/Local/Temp/vagrant-20130315-11960-dvhvzx  to /.vagrant.d/boxes/...

I've tried this as administrator and local user, I've also tried to open up permissions on Temp as well, no luck.  I'm wondering if there is a way to tell Vagrant to use a folder that might not be as protected....

Thanks,
Edward

--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.