Unable to save document on mounted samba shares

Hi,

I cannot modify a document on a mounted samba share. It is only opened read-only and the only option is to use “save as”. Modifying local documents is not a problem.

The samba server is based on Ubuntu 20.04.03 LTS with Samba 4.11.6. My working station uses Ubuntu 21.04 with LibreOffice:

Version: 7.1.6.2 / LibreOffice Community
Build ID: 10(Build:2)
CPU threads: 8; OS: Linux 5.11; UI render: default; VCL: gtk3
Locale: de-DE (en_US.UTF-8); UI: en-US
Ubuntu package version: 1:7.1.6-0ubuntu0.21.04.1
Calc: threaded

The samba share is mounted in fstab with this line:
//myserver/samba /home/kermit/samba cifs x-systemd.after=network-online.target,iocharset=utf8,uid=kermit,gid=kermit,workgroup=WORKGROUP,rw,file_mode=0664 0 0

I think I have a similar problem on version 1:7.3.7-0ubuntu0.22.04.4 for two users in the office. User has access to the file and the directory. Full read/write rights and another office application has no problem reading and writing but libreoffice gives an error on locking and it can save only a copy.

Is there a way of figuring out what is going wrong here?

It seems like I’ve found the solution: I have added the “directory mask 0770” to the smb.conf for the corresponding share. After a restart it works fine for all tests. Anyhow, I don’t understand, why the directory mask solves the problem, because only a file is opened.

1 Like

If you open a file LO will create also a lock-file. To create this (temporary) file you need permission to modify=write the directory.

Also to “find” a file in a subdirectory you need to “execute” the higher directories.

Well, I have also seen the temporary file and it seems that it causes the problems, because I get these error messages:

"The lock file is corrupted and probably empty. Opening the document
read-only and closing it again removes the corrupted lock file."

"Error saving the document …:
Object not accessible.
The object cannot be accessed
due to insufficient user rights."

Anyhow, I think the access rights are correctly set:

Document stat:
Access: (0664/-rw-rw-r–) Uid: ( 1000/ kermit) Gid: ( 1000/ kermit)
Access: 2021-10-05 10:28:16.541569200 +0200
Modify: 2021-10-05 10:28:16.541569200 +0200
Change: 2021-10-05 10:28:16.541569200 +0200
Birth: 2021-10-05 10:28:16.536080300 +0200

Directory stat:
Access: (0755/drwxr-xr-x) Uid: ( 1000/ kermit) Gid: ( 1000/ kermit)
Access: 2021-10-05 10:38:11.785177200 +0200
Modify: 2021-10-05 10:38:11.785177200 +0200
Change: 2021-10-05 10:38:11.785177200 +0200
Birth: 2021-04-01 15:59:36.766533000 +0200

The option “directory mask = 0770” causes quite less errors, but today I have had again a read error in order of insufficient user rights. The temporary lock file is always created when I open the document. In most cases has a size of 62 byte. One time it was bigger (102kb?). When I try to store the modified document and the error above happen, then the temporary lock file becomes 0 bytes big. I think, that this is the real issue. The question is, why the file becomes 0 bytes big and how can I track the cause.

Finally, I think, I have found the cause. The mount point of the samba share was rebind to documents folder “~/documents” for a seamless integration. In my installation of LO, the “temporary file directory” (Options → LibreOffce → Path) is also set to “~/documents”, that means, temporary files are created on the samba share. After I have switched the temporary file directory to “~/.cache” it works proper even without the directory mask.

2 Likes

Unfortunately, my solution above doesn’t solve the problem always. Sometimes the problem occurs, again. Today, I have got a new error message: “libreoffice could not create backup copy”. I found in this post the following solution: Add nobrl to the /etc/fstab cifs mount and then remount cifs shares again. I hope, that’s the final solution :-).

1 Like