Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OSError: [Errno 30] Read-only file system #209

Closed
rlayte opened this issue Dec 26, 2011 · 27 comments
Closed

OSError: [Errno 30] Read-only file system #209

rlayte opened this issue Dec 26, 2011 · 27 comments

Comments

@rlayte
Copy link

rlayte commented Dec 26, 2011

I've started getting a strange error when trying to create new environments:

Traceback (most recent call last):
     File "/usr/local/bin/virtualenv", line 9, in <module>
       load_entry_point('virtualenv==1.7', 'console_scripts', 'virtualenv')()
     File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 928, in main
       never_download=options.never_download)
     File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 1029, in create_environment
       site_packages=site_packages, clear=clear))
     File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 1145, in install_python
       fix_local_scheme(home_dir)
     File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 1430, in fix_local_scheme
       os.symlink(os.path.abspath(home_dir), local_path)
OSError: [Errno 30] Read-only file system

I don't seem to have trouble creating symlinks under any other circumstances.

I'm running Ubuntu 11.04 through Virtualbox - I've tried destroying and rebuilding the box from scratch (using an unchanged puppet manifest), but the same error persists.

@carljm
Copy link

carljm commented Jan 3, 2012

I'm afraid there's not much I can do here, as I'm not able to reproduce the failure. I don't know why you'd get a read-only filesystem error unless the filesystem you're trying to create the virtualenv on is in fact read-only.

This code has changed in the development version of virtualenv, so you could try with virtualenv==dev and see if that helps.

@rlayte rlayte closed this as completed Jan 16, 2012
@lylepratt
Copy link

I'm also having this problem on Ubuntu 11.04 on Virtualbox. @rlayte if you figured out how to solve this, I'd love to know how.

@rlayte
Copy link
Author

rlayte commented Jan 19, 2012

I'm pretty sure this is a virtualbox issue now so should probably be raised with them if you want a real solution to it.

I 'solved' it by moving the .virtualenvs directory into a non-shared folder as the problem only exists on folders shared with os x.

I ultimately decided to move away from virtualbox due to this kind of instability.

@lylepratt
Copy link

I ended up giving the shared folder group write permissions in OSX, then remounted it in Ubuntu, and it seemed to solve the problem.

@oakwhiz
Copy link

oakwhiz commented Jun 16, 2012

Yikes, ran into this issue just now, but I think it's a VirtualBox bug: https://www.virtualbox.org/ticket/10085#comment:12

Basically symlinks don't work in shared folders anymore for security reasons.

@tedtieken
Copy link

This can be solved on virtualbox when the issues are created by shared folders by running:

virtualenv ~/[my-env-name]
source ~/[my-env-name]/bin/activate

This won't store your environment in your folder, but best practice is to use requirements.txt and tell your VCS to ignore your environment tree

@lehrblogger
Copy link

Update: Of course, a good night's sleep makes everything clearer. Installing python-dev as sudo changed permissions in some Python files that caused the virtualenv command to fail, but I can just run that as sudo and it works.

I'm seeing this same error. If I create a fresh VM from the base lucid32 box and then execute the following commands:

  • sudo apt-get install python-pip
  • sudo pip install virtualenv
  • cd /vagrant/
  • virtualenv test0
  • sudo apt-get install python-dev
  • virtualenv test1

Then the first virtualenv will be created successfully, but the second will fail with the above [Errno 30] Read-only file system. I've posted the full output of this process here: https://gist.github.com/3346994. (I need python-dev for mysql-python.)

Does anyone know how I might fix/work around this? I'd strongly prefer to keep using shared folders, and this seems different than the issue with VirtualBox. Thanks, and let me know if I can provide any more information!

@jokull
Copy link

jokull commented Sep 18, 2012

sudo pip install virtualenv==dev did the trick for me. I’m on OS X Lion host and Ubuntu 12.04.1 LTS (GNU/Linux 3.2.0-23-generic x86_64) as guest.

@lehrblogger
Copy link

I noticed this again when I tried to set up a fresh VM, and it seems that a change between virtualenv 1.8.2 and 1.8.3 caused that error to come back:

vagrant@lucid32:/vagrant$ virtualenv test
New python executable in test/bin/python
Traceback (most recent call last):
  File "/usr/local/bin/virtualenv", line 9, in <module>
    load_entry_point('virtualenv==1.8.3', 'console_scripts', 'virtualenv')()
  File "/usr/local/lib/python2.6/dist-packages/virtualenv.py", line 961, in main
    never_download=options.never_download)
  File "/usr/local/lib/python2.6/dist-packages/virtualenv.py", line 1062, in create_environment
    site_packages=site_packages, clear=clear))
  File "/usr/local/lib/python2.6/dist-packages/virtualenv.py", line 1482, in install_python
    os.symlink(py_executable_base, full_pth)
OSError: [Errno 30] Read-only file system

I can use 1.8.2 for now, but thought I'd mention here. Thanks!

@g2p
Copy link

g2p commented Nov 27, 2012

@lehrblogger Could you run strace -f virtualenv test, to pinpoint which paths are causing the error?

@g2p
Copy link

g2p commented Dec 4, 2012

@brentsmyth The relevant bit isn't there. Use a pastebin or a gist.

@howardroark
Copy link

much better idea...

http://pastebin.com/imzmMYFj

@howardroark
Copy link

The problem lies in virtualbox though. You can find some work around options in these links...

hashicorp/vagrant#713
http://ahtik.com/blog/2012/08/16/fixing-your-virtualbox-shared-folder-symlink-error/

@lehrblogger
Copy link

@g2p !! Sorry it took me so long to get to this, I was travelling and must have missed the email.

https://gist.github.com/4211296

I'm running Mac OS X 10.8.2 and just upgraded to the latest versions of VirtualBox (4.2.4) and Vagrant (1.0.5). I'm happy to provide more info if it'd be helpful, and I promise I'll respond more quickly :)

@lehrblogger
Copy link

(It's fine if I have to use one of the VirtualBox workarounds, but the weird thing is that it works with virtualenv 1.8.2 and not 1.8.4 – see the end of my gist.)

@ngrilly
Copy link

ngrilly commented Dec 28, 2012

I ran into the same issue. Using VBoxManage setextradata as proposed in https://www.virtualbox.org/ticket/10085 worked for me. But this is another little thing that makes the process of running a virtual local dev server unnecessary cumbersome :)

@lehrblogger
Copy link

I've been able to get VBoxManage setextradata to work for me too (with virtualenv 1.8.4) by using "v-root" as my "SHARE_NAME" in my Vagranfile, as suggested in this comment. Thanks everyone for the info/suggestions!

@sorokins
Copy link

My steps to fix it:

  1. Use virtualenv==1.8.2 (not working with 1.8.4!)
  2. setextradata in host OS:
VBoxManage setextradata CENTOS VBoxInternal2/SharedFoldersEnableSymlinksCreate/home/oe 1

, where CENTOS - Virtualbox OS name, /home/oe - name of mounted folder
3. Mount device in guest OS with read-write permissions:

sudo mount -t vboxsf -o rw,uid=1000 shared_folder /mnt/shared_folder

, where uid=1000 - uid of current user in guest OS (see /etc/passwd).

@socrateslee
Copy link

upgrade virtualenv to the latest version(1.11.6), and use it as

virtualenv --always-copy testenv

the options will not use hard link but copy the files

@liaohuqiu
Copy link

@dmcnulla
Copy link

I got this error on a shared directory from the vm host. When I switched to a directory that isn't shared, it was fine.

@n-92
Copy link

n-92 commented Apr 15, 2017

@socrateslee Thanks mate. You saved me a lot of hassle!

@machengyan
Copy link

the reason is you tried to start the virtualenv in a shared folder

@svrajput
Copy link

OSError: [Errno 30] Read-only file system
if you have using shared drive inside vm and trying to execute tox inside that directory it will throw this error. Simple solution is copy that source code inside some directory in vm, lets say inside your home directory /home/sunil/projectName/ . and execute tox command inside this directory.

@dahluwalia-ag
Copy link

Tox now has a way to set not using symlinks in the virtualenv.

`[testenv]

alwayscopy = True`

@andreshg112
Copy link

I'm not using Virtual Box and I'm facing this issue. I don't know why in a specific folder it doesn't work. I did chmod and chown but It just don't work.

ERROR: Could not install packages due to an EnvironmentError.
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/virtualenv_support/pip-19.1.1-py2.py3-none-any.whl/pip/_internal/commands/install.py", line 414, in run
    use_user_site=options.use_user_site,
  File "/usr/local/lib/python3.7/site-packages/virtualenv_support/pip-19.1.1-py2.py3-none-any.whl/pip/_internal/req/__init__.py", line 58, in install_given_reqs
    **kwargs
  File "/usr/local/lib/python3.7/site-packages/virtualenv_support/pip-19.1.1-py2.py3-none-any.whl/pip/_internal/req/req_install.py", line 920, in install
    use_user_site=use_user_site, pycompile=pycompile,
  File "/usr/local/lib/python3.7/site-packages/virtualenv_support/pip-19.1.1-py2.py3-none-any.whl/pip/_internal/req/req_install.py", line 448, in move_wheel_files
    warn_script_location=warn_script_location,
  File "/usr/local/lib/python3.7/site-packages/virtualenv_support/pip-19.1.1-py2.py3-none-any.whl/pip/_internal/wheel.py", line 426, in move_wheel_files
    clobber(source, lib_dir, True)
  File "/usr/local/lib/python3.7/site-packages/virtualenv_support/pip-19.1.1-py2.py3-none-any.whl/pip/_internal/wheel.py", line 357, in clobber
    ensure_dir(dest)  # common for the 'include' path
  File "/usr/local/lib/python3.7/site-packages/virtualenv_support/pip-19.1.1-py2.py3-none-any.whl/pip/_internal/utils/misc.py", line 99, in ensure_dir
    os.makedirs(path)
  File "/Users/aw3/Projects/python/platzi-python/appengine_contact_server/venv/bin/../lib/python3.7/os.py", line 211, in makedirs
    makedirs(head, exist_ok=exist_ok)
  File "/Users/aw3/Projects/python/platzi-python/appengine_contact_server/venv/bin/../lib/python3.7/os.py", line 211, in makedirs
    makedirs(head, exist_ok=exist_ok)
  File "/Users/aw3/Projects/python/platzi-python/appengine_contact_server/venv/bin/../lib/python3.7/os.py", line 221, in makedirs
    mkdir(name, mode)
OSError: [Errno 30] Read-only file system: '/lib'
Cleaning up...
Removed build tracker '/private/var/folders/31/j0bhpp4s3qx1kcpz6fnq__b40000gn/T/pip-req-tracker-ry41njg8'
----------------------------------------
...Installing setuptools, pip, wheel...done.
Traceback (most recent call last):
  File "/usr/local/bin/virtualenv", line 10, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.7/site-packages/virtualenv.py", line 870, in main
    symlink=options.symlink,
  File "/usr/local/lib/python3.7/site-packages/virtualenv.py", line 1173, in create_environment
    install_wheel(to_install, py_executable, search_dirs, download=download)
  File "/usr/local/lib/python3.7/site-packages/virtualenv.py", line 1019, in install_wheel
    _install_wheel_with_search_dir(download, project_names, py_executable, search_dirs)
  File "/usr/local/lib/python3.7/site-packages/virtualenv.py", line 1110, in _install_wheel_with_search_dir
    call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=script)
  File "/usr/local/lib/python3.7/site-packages/virtualenv.py", line 963, in call_subprocess
    raise OSError("Command {} failed with error code {}".format(cmd_desc, proc.returncode))
OSError: Command /Users/aw3/Projects/...r/venv/bin/python3.7 - setuptools pip wheel failed with error code 1

@andreif
Copy link

andreif commented Dec 20, 2019

In my case it was setup.cfg with empty prefix= that was causing this mess.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests