raspberry Pi and Calibre-server

Drobo NAS and Linux
I am attempting to use a Raspberry Pi to run Calibre-server and access calibre libraries stored on a Drobo on the local network.
I mounted the drobo on the Pi


MAKE MOUNT DIRECTORY ON Pi
mkdir drobomnt
sudo mount //192.168.0.9/public /drobomnt


I can then see all the files on the Drobo.

When I run
calibre-server --with-library /drobomnt/CalLibtest --port 8081 &

it comes up with this error


pi@raspberrypi ~ $ Traceback (most recent call last):
File “/usr/bin/calibre-server”, line 19, in
sys.exit(main())
File “/usr/lib/calibre/calibre/library/server/main.py”, line 118, in main
db = LibraryDatabase2(opts.with_library)
File “/usr/lib/calibre/calibre/library/database2.py”, line 221, in init
self.initialize_dynamic()
File “/usr/lib/calibre/calibre/library/database2.py”, line 334, in initialize_dynamic
‘UPDATE authors SET sort=author_to_author_sort(name) WHERE sort IS NULL’)
File “/usr/lib/calibre/calibre/library/sqlite.py”, line 314, in run
raise DatabaseException(*res)
calibre.library.sqlite.DatabaseException: attempt to write a readonly database
RemoteTraceback (most recent call last):
File “/usr/lib/calibre/calibre/library/sqlite.py”, line 271, in run
ok, res = True, bfunc(*args, **kwargs)
OperationalError: attempt to write a readonly database

[1]+ Exit 1 calibre-server --with-library /drobomnt/CalLibtest --port 8081


However, I can run the server when the files are directly attached to the Pi.
(apart from a library which has 17000 entries)

It is , I think, a problem with the Drobo.

Anyone got any ideas?

Basil

Are you sure you can write to the mount on the Drobo? I’m pretty sure that the command line you used to mount will try to use a guest account, which by default is not allowed to write to the share.

Try to mount the share using the admin account. That one should have write access.

I tried this
sudo mount //192.168.0.9/calibre /drobocal -o username=XXXXXX,password=XXXXXX

It still failed

(The only password and use I can thing of is my DROBO admin one

using the mount command returned

//192.168.0.9/calibre on /drobocal type cifs (rw,relatime,vers=1.0,sec=ntlmssp,cache=strict,username=XXXXX,domain=DROBO5N,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.0.9,file_mode=0755,dir_mode=0755,nounix,serverino,rsize=61440,wsize=65536,actimeo=1)

I think the Pi can write to the drobo as it makes empty directories with the MKDIR command.

BTW I am v. old and new to Linux. I decided in the 1980’s to give up on CLI operating systems but my son encouraged me to start again.
Maybe a mistake.

I think I might have found the problem. You said you are calling mount with sudo. This means that the owner of the mount will be “root.”

Now, if you look at the mount options, you’ll see “file_mode=0755,dir_mode=0755,” which means that users that are not root will only have read access to files and folders.

What happens if you mount the share using “file_mode=0777,dir_mode=0777” with the options?

It still fails


pi@raspberrypi ~ $ sudo mount //192.168.0.9/calibre /drobocal -o file_mode=0777,dir_mode=0777,username=basil,password=bloom6502
pi@raspberrypi ~ $ calibre-server --with-library /drobocal/CalLibtest --port 8081 &
[1] 7909
pi@raspberrypi ~ $ mount
/dev/root on / type ext4 (rw,noatime,data=ordered)
devtmpfs on /dev type devtmpfs (rw,relatime,size=85876k,nr_inodes=21469,mode=755)
tmpfs on /run type tmpfs (rw,nosuid,noexec,relatime,size=18832k,mode=755)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /run/shm type tmpfs (rw,nosuid,nodev,noexec,relatime,size=37640k)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620)
/dev/mmcblk0p5 on /boot type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,errors=remount-ro)
fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime)
/dev/sda5 on /media/usbhdd type fuseblk (rw,nosuid,nodev,relatime,user_id=0,group_id=0,default_permissions,allow_other,blksize=4096)
//192.168.0.9/calibre on /drobocal type cifs (rw,relatime,vers=1.0,sec=ntlmssp,cache=strict,username=basil,domain=DROBO5N,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.0.9,file_mode=0777,dir_mode=0777,nounix,serverino,rsize=61440,wsize=65536,actimeo=1)
pi@raspberrypi ~ $ Traceback (most recent call last):
File “/usr/bin/calibre-server”, line 19, in
sys.exit(main())
File “/usr/lib/calibre/calibre/library/server/main.py”, line 118, in main
db = LibraryDatabase2(opts.with_library)
File “/usr/lib/calibre/calibre/library/database2.py”, line 221, in init
self.initialize_dynamic()
File “/usr/lib/calibre/calibre/library/database2.py”, line 346, in initialize_dynamic
‘’’.format(_(‘News’)))
File “/usr/lib/calibre/calibre/library/sqlite.py”, line 314, in run
raise DatabaseException(*res)
calibre.library.sqlite.DatabaseException: database is locked
RemoteTraceback (most recent call last):
File “/usr/lib/calibre/calibre/library/sqlite.py”, line 271, in run
ok, res = True, bfunc(*args, **kwargs)
OperationalError: database is locked


Am I looking at it the wrong way around?
is the user and password the raspberry pi one?


No, tried that with the same effect.


Basil

We made some progress, though. You have now a different error. Before it was:

Now you have:

Before you couldn’t write to the database. Now you can’t lock the file because some lock file already exists. I suggest you nuke the folder where the Calibre data is, or move it somewhere else. I.e., restart the configuration of Calibre from scratch.

Well spotted.

I deleted the folder, recreated it, accessed it from the PC. added a book, logged out on the PC.
Unmounted it on the Pi, remounted it and ran server.
Same result - database locked.


pi@raspberrypi ~ $ mount
/dev/root on / type ext4 (rw,noatime,data=ordered)
devtmpfs on /dev type devtmpfs (rw,relatime,size=85876k,nr_inodes=21469,mode=755)
tmpfs on /run type tmpfs (rw,nosuid,noexec,relatime,size=18832k,mode=755)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /run/shm type tmpfs (rw,nosuid,nodev,noexec,relatime,size=37640k)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620)
/dev/mmcblk0p5 on /boot type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,errors=remount-ro)
fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime)
/dev/sda5 on /media/usbhdd type fuseblk (rw,nosuid,nodev,relatime,user_id=0,group_id=0,default_permissions,allow_other,blksize=4096)
pi@raspberrypi ~ $ sudo mount //192.168.0.9/calibre /drobocal -o file_mode=0777,dir_mode=0777,username=pi,password=raspberry
pi@raspberrypi ~ $ calibre-server --with-library /drobocal/CalLibtest --port 8081 &
[1] 8021
pi@raspberrypi ~ $ Traceback (most recent call last):
File “/usr/bin/calibre-server”, line 19, in
sys.exit(main())
File “/usr/lib/calibre/calibre/library/server/main.py”, line 118, in main
db = LibraryDatabase2(opts.with_library)
File “/usr/lib/calibre/calibre/library/database2.py”, line 221, in init
self.initialize_dynamic()
File “/usr/lib/calibre/calibre/library/database2.py”, line 346, in initialize_dynamic
‘’’.format(_(‘News’)))
File “/usr/lib/calibre/calibre/library/sqlite.py”, line 314, in run
raise DatabaseException(*res)
calibre.library.sqlite.DatabaseException: database is locked
RemoteTraceback (most recent call last):
File “/usr/lib/calibre/calibre/library/sqlite.py”, line 271, in run
ok, res = True, bfunc(*args, **kwargs)
OperationalError: database is locked


A bit of googling suggests this might solve the problem: http://www.mobileread.com/forums/showthread.php?t=167267

OUTSTANDING!

this worked.
many thanks, I would never have worked this out my self

Basil