Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sqlite3 db is locked

I am on Ubuntu10. Create new db file with

touch development.db

Want my migrations

rake db:migrate

but get locked error

SQLite3::BusyException: database is locked

How it can be locked?!


update it can be locked by samba. it's shared folder

like image 833
Igor Alekseev Avatar asked Nov 21 '25 03:11

Igor Alekseev


2 Answers

I have run into this problem myself. I have found that the only way to avoid the lock being placed on a file like this is to add the nobrl option to your mount. The entry in your /etc/fstab might look something like this:

//<SERVERNAME>/<REMOTEPATH> /<LOCALMOUNTPOINT>/<LOCALPATH> cifs credentials=/home/<LOCALUSERNAME>/.smbcredentials,iocharset=utf8,uid=1000,gid=1000,file_mode=0775,dir_mode=0775,nobrl 0 0

This is loosely following the ubuntu wiki page found at: https://wiki.ubuntu.com/MountWindowsSharesPermanently

like image 194
tinifni Avatar answered Nov 23 '25 16:11

tinifni


You should try rake db:create instead of touch. This always works for me. Maybe there's a problem with the migrations itself?

like image 37
hurikhan77 Avatar answered Nov 23 '25 18:11

hurikhan77



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!