uuidd doesn't start, /var/lib/libuuid is missing
Description:
The uuidd service is not started due to the missing /var/lib/libuuid directory. The service is important as libuuid functions like uuid_generate_time_safe() will always create a UUID, however without the central uuidd collissions are possible under high load with many parallel processes requesting UUIDs.
By default the directory is empty, at runtime uuidd will create the clock.txt in this directory. Ownership by user and group uuidd is important.
Additional info:
- package version(s): 2.39.3-1
Steps to reproduce:
- Check uuidd.service is not running, and uuidd.socket is active.
root@hostname ~ # systemctl status uuidd.service
Loaded: loaded (/usr/lib/systemd/system/uuidd.service; indirect; preset: disabled)
Active: inactive (dead)
TriggeredBy: ● uuidd.socket
Docs: man:uuidd(8)
root@hostname ~ # systemctl status uuidd.socket
Loaded: loaded (/usr/lib/systemd/system/uuidd.socket; enabled; preset: disabled)
Active: active (listening) since Wed 2024-02-21 19:28:07 CET; 1min 46s ago
Triggers: ● uuidd.service
Listen: /run/uuidd/request (Stream)
CGroup: /system.slice/uuidd.socket
Feb 21 19:28:07 hostname systemd[1]: Listening on UUID daemon activation socket.
- As user generate a time based UUID via uuidgen
user@hostname ~ % uuidgen -t
root@hostname ~ # systemctl status --no-pager -l uuidd.service
× uuidd.service - Daemon for generating UUIDs
Loaded: loaded (/usr/lib/systemd/system/uuidd.service; indirect; preset: disabled)
Active: failed (Result: exit-code) since Wed 2024-02-21 19:30:31 CET; 23s ago
TriggeredBy: × uuidd.socket
...
Feb 21 19:30:31 hostname (uuidd)[1831]: uuidd.service: Failed to set up mount namespacing: /var/lib/libuuid: No such file or directory
- Create the directory and make uuidd the owner. Restart the socket listener.
root@hostname ~ # mkdir -m 700 /var/lib/libuuid && chown uuidd:uuidd /var/lib/libuuid
root@hostname ~ # systemctl restart uuidd.socket
- Again as user request a UUID. If executed as root the filesystem permissions of clock.txt will be wrong, user uuidd won't be able to write into the file.
user@hostname ~ % uuidgen -t
root@hostname ~ # systemctl status --no-pager -l uuidd.service
Loaded: loaded (/usr/lib/systemd/system/uuidd.service; indirect; preset: disabled)
Active: active (running) since Wed 2024-02-21 19:39:01 CET; 5s ago
TriggeredBy: ● uuidd.socket
...
CGroup: /system.slice/uuidd.service
└─1960 /usr/bin/uuidd --socket-activation
Feb 21 19:39:01 hostname systemd[1]: Started Daemon for generating UUIDs.
root@hostname ~ # ls -l /var/lib/libuuid
-rw-rw---- 1 uuidd uuidd 75 21. Feb 19:39 clock.txt