jacobalberty / unifi-docker

Unifi Docker files
MIT License
2.14k stars 454 forks source link

Unable to open sed temporary files using virtiofs mount #743

Closed townsen closed 2 months ago

townsen commented 4 months ago

After starting the unifi container with the /unifi directory mounted to the host using a virtiofs filesystem mount the docker logs unifi command produces the following:

[2024-05-14 11:28:48,646] <docker-entrypoint> Starting unifi controller service.
sed: couldn't open temporary file /unifi/data/sed7Yw31v: Permission denied
sed: couldn't open temporary file /unifi/data/sedJfmZk8: Permission denied
sed: couldn't open temporary file /unifi/data/sedZwMFRJ: Permission denied
sed: couldn't open temporary file /unifi/data/sedjUL2kl: Permission denied
sed: couldn't open temporary file /unifi/data/sedbrCRXX: Permission denied
[2024-05-14 11:28:48,674] <docker-entrypoint> WARNING: Running UniFi in insecure (root) mode

The reason for this is that the files were created with empty permissions and are not visible. Running ls -l inside the container produces this:

root@unifi:/unifi/data# ls -l
ls: sedJfmZk8: No such file or directory
ls: sedbrCRXX: No such file or directory
ls: sedZwMFRJ: No such file or directory
ls: sed7Yw31v: No such file or directory
ls: sedjUL2kl: No such file or directory
total 44
drwxr-xr-x   5 root root   160 May  4 08:16 backup
drwxr-xr-x 338 root root 10816 May 14 12:07 db
-rw-r--r--   1 root root 25699 May 14 11:30 firmware.json
-rw-r--r--   1 root root  2742 May  2 11:27 keystore
-rw-r--r--   1 root root  1424 May 14 11:29 model_lifecycles.json
----------   1 root root     0 May 14 11:28 sed7Yw31v
----------   1 root root     0 May 14 11:28 sedJfmZk8
----------   1 root root     0 May 14 11:28 sedZwMFRJ
----------   1 root root     0 May 14 11:28 sedbrCRXX
----------   1 root root     0 May 14 11:28 sedjUL2kl
-rw-r--r--   1 root root  1470 May 14 11:29 system.properties
-rw-r--r--   1 root root  1470 May 14 11:29 system.properties.bk
drwxr-xr-x   3 root root    96 May  2 11:27 webrtc
root@unifi:/unifi/data# 

After googling similar problems it seems that sed and virtiofs filesystems don't play nice. See this bug report for some details. They claim the problem is fixed in sed version 4.8. Would you be able to upgrade to that version? Or perhaps there is another fix that avoids the sed issue?

github-actions[bot] commented 3 months ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.