System.UnauthorizedAccessException: Access to the path 'C:\ProgramData\NzbDrone\bin\NzbDrone.exe' is denied.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.File.InternalDelete(String path, Boolean checkHost)
at System.IO.File.Delete(String path)
at NzbDrone.Common.Disk.DiskProviderBase.DeleteFile(String path) in m:\BuildAgent\work\6c3239faf2b92630\src\NzbDrone.Common\Disk\DiskProviderBase.cs:line 234
at NzbDrone.Common.Disk.DiskProviderBase.EmptyFolder(String path) in m:\BuildAgent\work\6c3239faf2b92630\src\NzbDrone.Common\Disk\DiskProviderBase.cs:line 417
at NzbDrone.Update.UpdateEngine.InstallUpdateService.Start(String installationFolder, Int32 processId) in m:\BuildAgent\work\6c3239faf2b92630\src\NzbDrone.Update\UpdateEngine\InstallUpdateService.cs:line 90
This is the error I’m getting when I click the install button on the upgrade. I have tried running nzbdrone.exe as administrator, and as the regular local user. I checked the permissions on the file and all users have full access to the parent directories (…\nzbdrone) and all files within.
This is what happens at the tail end of the install steps:
15-3-20 17:53:53.7|Fatal|InstallUpdateService|Failed to copy upgrade package to target folder.
System.UnauthorizedAccessException: Access to the path ‘C:\ProgramData\NzbDrone\bin\NzbDrone.exe’ is denied.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.File.InternalDelete(String path, Boolean checkHost)
at System.IO.File.Delete(String path)
at NzbDrone.Common.Disk.DiskProviderBase.DeleteFile(String path) in m:\BuildAgent\work\6c3239faf2b92630\src\NzbDrone.Common\Disk\DiskProviderBase.cs:line 234
at NzbDrone.Common.Disk.DiskProviderBase.EmptyFolder(String path) in m:\BuildAgent\work\6c3239faf2b92630\src\NzbDrone.Common\Disk\DiskProviderBase.cs:line 417
at NzbDrone.Update.UpdateEngine.InstallUpdateService.Start(String installationFolder, Int32 processId) in m:\BuildAgent\work\6c3239faf2b92630\src\NzbDrone.Update\UpdateEngine\InstallUpdateService.cs:line 90
15-3-20 17:53:53.7|Info|BackupAndRestore|Attempting to rollback upgrade
This is what happens at the tail end of the rollback steps:
15-3-20 17:53:54.5|Debug|ProcessProvider|Starting C:\ProgramData\NzbDrone\bin\NzbDrone.exe /nobrowser
15-3-20 17:53:54.5|Fatal|UpdateApp|An error has occurred while applying update package.
System.UnauthorizedAccessException: Access to the path ‘C:\ProgramData\NzbDrone\bin\NzbDrone.exe’ is denied.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.File.InternalDelete(String path, Boolean checkHost)
at System.IO.File.Delete(String path)
at NzbDrone.Common.Disk.DiskProviderBase.DeleteFile(String path) in m:\BuildAgent\work\6c3239faf2b92630\src\NzbDrone.Common\Disk\DiskProviderBase.cs:line 234
at NzbDrone.Common.Disk.DiskProviderBase.TransferFile(String source, String destination, TransferMode mode, Boolean overwrite) in m:\BuildAgent\work\6c3239faf2b92630\src\NzbDrone.Common\Disk\DiskProviderBase.cs:line 260
at NzbDrone.Common.Disk.DiskProviderBase.TransferFolder(String source, String destination, TransferMode mode) in m:\BuildAgent\work\6c3239faf2b92630\src\NzbDrone.Common\Disk\DiskProviderBase.cs:line 223
at NzbDrone.Common.Disk.DiskProviderBase.CopyFolder(String source, String destination) in m:\BuildAgent\work\6c3239faf2b92630\src\NzbDrone.Common\Disk\DiskProviderBase.cs:line 176
at NzbDrone.Update.UpdateEngine.BackupAndRestore.Restore(String target) in m:\BuildAgent\work\6c3239faf2b92630\src\NzbDrone.Update\UpdateEngine\BackupAndRestore.cs:line 36
at NzbDrone.Update.UpdateEngine.InstallUpdateService.Start(String installationFolder, Int32 processId) in m:\BuildAgent\work\6c3239faf2b92630\src\NzbDrone.Update\UpdateEngine\InstallUpdateService.cs:line 98
at NzbDrone.Update.UpdateApp.Start(String args) in m:\BuildAgent\work\6c3239faf2b92630\src\NzbDrone.Update\UpdateApp.cs:line 59
at NzbDrone.Update.UpdateApp.Main(String args) in m:\BuildAgent\work\6c3239faf2b92630\src\NzbDrone.Update\UpdateApp.cs:line 43
The rest seems to be install/rollback steps. If you need more let me know and I’ll have to sanitize the whole log file and post it.
How are your running Sonarr? Via the startup folder? A few things could prevent it from deleting, one is permissions, which shouldn’t be an issue, given that all users have Full Access, anti-virus or it could be a lock due to it being in use.
I could see it being in use if it was unable to stop the process (though I’d expect an error that would have caused it to fail before), or if it was running again (being respawned after it was shutdown).
Are you able to delete NzbDrone.exe as the same user thats running Sonarr?
Which anti-virus are you running? Could you disable it temporarily to see if its the cause?
Sonarr is running via startup folder.
Permissions appear to be OK
I am able to move NzbDrone.exe out of the folder, and move it back without any UAC prompts, or errors.
I am only running Windows Defender (Windows 8.1). I disabled it and attempted update and it still doesn’t work.
It’s possible to be a lock due to it being in use but the only way to run the update is having NzbDrone.exe running and activating through the web interface. Ensuring NzbDrone.exe isn’t running while updating seems to be the job of the update script.
Yes and it does stop it, thats why I wanted to know how it was being started, we saw similar issues on Ubuntu when Upstart would restart Sonarr after it was stopped for the update, wanted to make sure there wasn’t a watchdog system in play here as well.
Seems to even fail when trying to install! I’ve run the installer straight, and “as administrator” and both fails giving a permission denied.
So I can move the entire folder out, but I cannot overwrite the file using nzbdrone web app or even the installer. Definitely a windows 8.1 permissions issue, but it seems more like a bug than anything since I clearly got the files in there in the first place!
Can I wipe the programdata/nzbdrone folder and re-install without losing my databases?
No, thats where the data is stored, but you can delete C:\ProgramData\NzbDrone\bin (as thats the application files only, not the databases and config file).