Sudo dpkg-reconfigure sonarr non-interactive

Sonarr version (exact version): 3.0.6
Mono version (if Sonarr is not running on Windows): 4.0
OS: Ubuntu 20.04

Description of issue:
When I run; dpkg-reconfigure sonarr the systemd file at /lib/systemd/system/sonarr.service is changed accordingly for user and group

However, when trying to run it non-interactively with;
sudo DEBIAN_FRONTEND=noninteractive apt install sonarr mediainfo -y
Then;

cat << EOF | sudo debconf-set-selections
sonarr  sonarr/owning_group     string chris
sonarr  sonarr/owning_user      string chris
EOF

and restarting the service with;
sudo systemctl daemon-reload the file at;
/lib/systemd/system/sonarr.service is does not change the user and group

As I am trying to script this, I really need to able to set it non-interactively and change the systmd file accordingly

Anything I can do without manually changing the file at;
/lib/systemd/system/sonarr.service or running;
sudo dpkg-reconfigure sonarr as I don’t want the whiptail menu and interactive input

try doing debconf-set-selection before installing

changing a file doesn’t magically run install scripts to update unit files :wink:

That doesn’t work either, I still end up with;

cat << EOF | sudo debconf-set-selections                                                                                                                                                                  
sonarr  sonarr/owning_group     string me
sonarr  sonarr/owning_user      string me
EOF

sudo DEBIAN_FRONTEND=noninteractive apt install sonarr -y

sudo debconf-get-selections | grep sonarr                                                                                                                                                                 
sonarr	sonarr/owning_umask	string	0002
sonarr	sonarr/owning_user	string	sonarr
sonarr	sonarr/config_directory	string	/var/lib/sonarr
sonarr	sonarr/owning_group	string	sonarr

Just returned from holiday.

Ubuntu 20.04 VM. sonarr not installed.

> sudo apt install debconf-utils
> cat << EOF | sudo debconf-set-selections                                                                                                                                                                  
  sonarr  sonarr/owning_group     string me
  sonarr  sonarr/owning_user      string me
  EOF

> sudo debconf-get-selections | grep sonarr yields correct values.

> sudo DEBIAN_FRONTEND=noninteractive apt install sonarr -y
Unpacking sonarr (3.0.6) ...
Setting up sonarr (3.0.6) ...
Adding system user `me' (UID 130) ...
Adding new user `me' (UID 130) with group `me' ...
Not creating home directory `/home/me'.

> sudo debconf-get-selections | grep sonarr yields correct values.

> ps aux | grep sonarr also yields correct values.

I suspect you executed one of the commands incorrectly.