When the installation runs from `unattended-upgrade`, `$SUDO_USER` and `$USER` will probably not be set. Fixes #6983 (cherry picked from commit d99265b9)