SANE: The home directory "/var/lib/saned/" is missing
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Raspbian |
New
|
Undecided
|
Unassigned |
Bug Description
Hello,
I would like to report a bug, where the home directory "/var/lib/saned/" in the Raspbian package "sane-utils_
While I was investigating the USB bug "-1 EPIPE (Broken Pipe)" on my Raspberry Pi 4 (8 GB), which uses Raspbian (Debian Buster) as operating system, I analysed the "saned" process via "strace":
$ while [[ true ]]; do strace -p $(pgrep sane) 2>&1 | tee strace_saned; sleep 1; done
I figured out, that the process tries to create the directory "/var/lib/
> mkdir("
It then tries to create the binary file "hewlett-
> openat(AT_FDCWD, "/var/lib/
With this knowledge, I created the home directory for "saned" like so:
$ getent passwd saned
saned:
$ cd "/var/lib/"
$ mkhomedir_helper saned
$ ls -ld saned/
drwxr-xr-x 2 saned saned 4096 Sep 21 18:12 saned/
$ tree -augpsh saned/
saned/
├── [-rw-r--r-- saned saned 220] .bash_logout
├── [-rw-r--r-- saned saned 3.4K] .bashrc
├── [-rw-r--r-- saned saned 807] .profile
0 directories, 3 files
Then, I scanned one more time and found the above mentioned directory ".sane/" and the binary file "hewlett-
$ tree -augpsh saned/
saned/
├── [-rw-r--r-- saned saned 220] .bash_logout
├── [-rw-r--r-- saned saned 3.4K] .bashrc
├── [-rw-r--r-- saned saned 807] .profile
└── [drwx------ saned saned 4.0K] .sane
└── [-rw-r--r-- saned saned 32K] hewlett-
After that, I did some more investigation, if creating the home directory has some impact and it does.
If the home directory is missing, it causes the "saned" process to initiate the scanner every time the client initiates a scan process. I always hear the servo motor adjusting for each initiated scan with a timeout of about three to five seconds. This timeout is hardware related. During tests with other hardware to investigate the USB bug, the following rule of thumb should apply: The less CPU power, the higher the timeout after initiating a scan.
If the home directory exists on the other hand, the process will look for a suiting ".cal" file in there first and then loads it. Initiating a scan with a pre-loaded ".cal" file will skip the servo motor adjustments and the scanner just scans.
Digging further and looking into the "postinst" file, I found the section, where the user is created via "adduser":
$ cd $(mktemp -d)
$ apt download sane-utils
$ ar x sane-utils_
$ tar -Jxvpf control.tar.xz
$ less postinst
[...]
# Create saned user/group if they do not exist
if ! getent passwd | grep -q "^saned:"; then
echo "Adding saned group and user..."
adduser --home /var/lib/saned --quiet --system --no-create-home --group saned || true
fi
[...]
The user "saned" is created and will use the home directory "/var/lib/saned/", but it is not created, since the parameter "--no-create-home" is used.
It would be nice, if this parameter could be removed in further updates.
-Ramon
Reported the bug at the correct place:
https:/ /github. com/RPi- Distro/ repo/issues/ 262
This ticket can be closed.