FS#71867 - [smbnetfs] gencache_init: Failed to create directory: //.cache/samba - Permission denied
Attached to Project:
Community Packages
Opened by Joe Hillenbrand (joehillen) - Thursday, 19 August 2021, 04:13 GMT
Last edited by Sergej Pupykin (sergej) - Thursday, 19 August 2021, 19:06 GMT
Opened by Joe Hillenbrand (joehillen) - Thursday, 19 August 2021, 04:13 GMT
Last edited by Sergej Pupykin (sergej) - Thursday, 19 August 2021, 19:06 GMT
|
Details
Description:
While reading journalctl, I noticed strange log message coming up regularly. I couldn't figure out what was causing it. I couldn't find any reference to '/.cache/samba' anywhere on my system. Then I initially looked in the smbnetfs source code, but didn't find any instance of it, but I did find it in the samba source code: https://github.com/samba-team/samba/blob/e742661bd2507d39dfa47e40531dc1dca636cbbe/source3/lib/gencache.c#L37 https://github.com/samba-team/samba/blob/e742661bd2507d39dfa47e40531dc1dca636cbbe/source3/lib/gencache.c#L104 https://github.com/samba-team/samba/blob/e742661bd2507d39dfa47e40531dc1dca636cbbe/lib/util/util_paths.c#L153 It turns out that (for better or worse) samba checks /etc/passwd before reading HOME: https://github.com/samba-team/samba/blob/e742661bd2507d39dfa47e40531dc1dca636cbbe/lib/util/util_paths.c#L67 I've attached a patch to fix this by runnings as a new user smbnetfs instead of nobody. Additional info: * smbnetfs 0.6.3-1 * samba 4.14.6-1 Logs: smbnetfs[538044]: gencache_init: Failed to create directory: //.cache/samba - Permission denied smbnetfs[538044]: gencache_init: Failed to create directory: //.cache/samba - Permission denied smbnetfs[538044]: gencache_init: Failed to create directory: //.cache/samba - Permission denied smbnetfs[538044]: gencache_init: Failed to create directory: //.cache/samba - Permission denied smbnetfs[538044]: smbXcli_negprot_smb1_done: No compatible protocol selected by server. smbnetfs[538044]: gencache_init: Failed to create directory: //.cache/samba - Permission denied smbnetfs[538044]: gencache_init: Failed to create directory: //.cache/samba - Permission denied smbnetfs[538044]: smbXcli_negprot_smb1_done: No compatible protocol selected by server. Steps to reproduce: Run `systemctl start smbnetfs.service` with default configuration. |
This task depends upon
Closed by Sergej Pupykin (sergej)
Thursday, 19 August 2021, 19:06 GMT
Reason for closing: Fixed
Additional comments about closing: thank you
Thursday, 19 August 2021, 19:06 GMT
Reason for closing: Fixed
Additional comments about closing: thank you
This new patch switches to using tmpfiles instead of changing permissions in post_install() and post_upgrade(). Otherwise, you get an error that the smbnetfs user doesn't exist.
Something I noticed while working on this though is that if you reinstall the package while smbnetfs is running you get this error:
chmod: changing permissions of '/mnt/smbnet': Invalid argument
error: command failed to execute correctly
This is true for both the old version and the patched version. I'm not sure how to mitigate that.