Search code examples
rubysqliteubuntusamba

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


Solution

  • 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