Cannot Update - Update process failed: Your Sonarr configuration is being stored in application folder which will cause data loss during the upgrade

Hey Sonarr Team,

I stumbled across system logs as follows.

Update process failed: Your Sonarr configuration ‘/opt/NzbDrone/.config/NzbDrone’ is being stored in application folder ‘/opt/NzbDrone’ which will cause data lost during the upgrade. Please remove any symlinks or redirects before trying again.

When I created a specific user acccount to run the nzbdrone service, It was done with an option that prevents login and removes its bash shell. It doesn’t have a home directory.

I could symlink it to another directory, then move the data there, but I’d have to do this every time and remove the symlink if I wanted to upgrade once again.

Is there a better solution?

I read through the following sources.



Thanks!

Version
2.0.0.4472
Mono Version
4.6.2 (Stable 4.6.2.16/ac9e222
AppData directory
/opt/NzbDrone/.config/NzbDrone
Startup directory
/opt/NzbDrone

Sonarr puts the config information under the home directory, so either /opt/NzbDrone/ is the home directoryor you’re using the /data=/opt/NzbDrone/.config/NzbDrone argument, in either case you want the config information going to another folder. You’ll either need to fix the home directory or change the /data= argument.

Markus,

Good note there. I believe I told it not to create a home directory initially but did set this specifically, then I manually set it afterwards. Its been so long I almost forgot where this was set. See below.

root@123# cat /etc/passwd | grep -i "usernamehere"
username:x:1001:1001:Sonarr NzbDrone TV Show Grabber:/opt/NzbDrone:/bin/false

Also, on the ‘/data=’ where is this defined? I can’t recall

----- EDIT

If I simply change the home directory for that users, will Sonarr/Nzbdrone just start writing the data there after a reboot?

Make a proper home directory from .skel w/ correct permissions. Make a backup of your Sonarr data before you do anything. Start / Stop Sonarr and, if needed, import your backup.

Perfect. I had planned to do exactly this, except I can just manually define the home directory in etc fstab and it will work like that too. Will backup before hand and import to the new directory.

Thanks!

1 Like

Would be interested to hear how it ends up working out. If you had to solve any additional issues along the way, etc. Could help future people searching for same issue.

I will absolutely post my solution and will update my Autostart Debian Security Notes found in the following link which suggested setting that home directory of said user account that runs the service to the same directory of where the installation is held. I had added these ‘Security Notes’ after successfully confirming my first install of Sonarr on a Debian system.

1 Like

Fixed that wiki entry since that was never recommended to set you home directory to /opt/NzbDrone.

Hey Markus,

I personally think it would be useful to add what You told me to the excerpt in the following link under “Updating will not be possible to prevent deleting AppData on Update”

If I would have known that the database for Sonarr’s files was automatically chosen/placed into the home directory of the user running the service, I would have been able to solve the issue without opening a ticket. Could be helpful for other people who run into this issue.

Thanks!

Yeah it does need to be updated under the scenario when we create a system user to run the service. Simply put, the assigned home directory specified in /etc/passwd needs to be different than the directory where the installation resides.

I stand by the security notes otherwise.


I see your edit. Nicely done. I will confirm any other details, like directory permissions for manually creating that /home directory for a system user once I completely have this done. Creating a system level user to run a service will not have a default home directory created when we initially create that user with --system flags.

Thanks again for the awesome support!

Alright, it works now!

I stopped the service.
‘service nzbdrone stop’

Made a new directory for that user and a another backup folder
mkdir /opt/nzbdrone.config.backup
mkdir /home/nzbdrone

Edited the user’s home directory and specified the direcory location above.
nano /etc/passwd

Took a backup of where the database was being held.
cp -R /opt/nzbdrone/.config /opt/nzbdrone.config.backup

Copied contents from the backup directory to the new user’s home directory
cp -R /opt/nzbdrone/.config /home/nzbdrone

Set the proper ownership and permissions on the new directory recursively
chown -R nzbdrone:nzbdrone /home/nzbdrone
chmod -R 770 /home/nzbdrone

Restarted the service
service nzbdrone start

Logged into web portal and verified that all of the TV shows I had in place are still there.

I then proceeded to update and voila!

I did notice that Sonarr appears to have ‘cleaned’ up after itself. After I got this working, I noticed the original /opt/Nzbdrone/.config directory entirely vanished and I definitely did not remove it myself.

Thanks again everyone!

We can close this issue out.


Edited the Autostart on Debian - Security Notes section to reflect having a home directory where the .config is stored separate from the /opt/Nzbdrone installation folder.

1 Like

Just an FYI next time you have to make a home directory do

cp -R /etc/skel/ /home/newuser/

instead of making an empty folder. You still may want to look to make sure that you have a .bashrc and .bash_logout in /home/nzbdrone

Unless those do something else that I’m not aware of, I don’t see the need in this case.

I dont login to that user account and i have /bin/false set. The service works as intended.

For a general user account, sure that makes sense.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.