Errno::ETXTBSY: Text file busy @ unlink_internal

2019-02-17 15:05发布

The error:

Errno::ETXTBSY: Text file busy @ unlink_internal - /home/vagrant/shared/sample_app/db/test.sqlite3 /home/vagrant/shared/sample_app/test/test_helper.rb:3:in <top (required)>' /home/vagrant/shared/sample_app/test/helpers/static_pages_helper_test.rb:1:in' Tasks: TOP => test:run => test:units (See full trace by running task with --trace)

2条回答
Explosion°爆炸
2楼-- · 2019-02-17 15:47

Workaround:

The error was related to Vagrant (or VirtualBox) custom shared folders. I couldn't figure out how to solve it, but there is a workaround. Instead of working with a vagrant custom shared folder (~/shared/sample_app), defined in the vagrantfile I moved the app folder to a standard shared folder inside the VM root (/vagrant). Now I still get the file sync in my host machine and the issue is gone.


UPDATE 1

Reached another conclusion today. Everytime bundle exec rake db:migrate or rails generate migration is executed the error will return.

Another Workaround
1 - Delete the test.sqlite3 file.
2 - Copy the development.sqlite3 file
3 - Paste and change the name to test.sqlite3

* - Just migrated for testing and this seems to be a permanent solution.

查看更多
家丑人穷心不美
3楼-- · 2019-02-17 15:58

Move the database files outside vagrant share, for example to /tmp.

edit database.yml:

development:
  <<: *default
  database: /tmp/project/development.sqlite3

test:
  <<: *default
  database: /tmp/project/test.sqlite3
查看更多
登录 后发表回答