hassio-addons/addon-nginx-proxy-manager

Unable to clean uninstall. Keeps coming back with previous settings and issues

AlexHimself opened this issue · 2 comments

Problem/Motivation

Receiving error Cannot read properties of null (reading 'avatar') after deleting admin@example.com account. Uninstalling/reinstalling nginx is not removing previous settings. I'm using the Raspberry Pi Home Assistant image (not sure technical name of that install).

I believe this is after the auto-upgrade breaking change and deleting the admin@example.com user. #507 .

The following error appears on nearly every configuration page, not just SSL Certificates.

image

Expected behavior

Uninstalling nginx and reinstalling would be a vanilla install again.

Actual behavior

Same settings, user accounts, and errors persist after each uninstall/install and even mixing in restarts.

[08:41:29] INFO: Starting NGinx...
s6-rc: info: service legacy-services successfully started
2024/02/02 08:41:29 [error] 208#208: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.86.7, server: nginxproxymanager, request: "GET /api/ HTTP/1.1", upstream: "http://127.0.0.1:3000/", host: "hapi4.local:81", referrer: "http://hapi4.local:81/nginx/certificates"
[2/2/2024] [8:41:29 AM] [Global ] › ℹ info Using Sqlite: /config/database.sqlite
[2/2/2024] [8:41:32 AM] [Migrate ] › ℹ info Current database version: none

Steps to reproduce

The steps that lead to this error were essentially:

  1. Noticed was unable to login to nginx with my account and I used admin@example.com/changeme and it allowed me to login. This was likely due to #507
  2. Was not prompted to change password and previous settings were gone. Appeared vanilla.
  3. I configured the proxy hosts and SSL certificate using admin@example.com account.
  4. Added MyAdmin@MyDomain.com as admin.
  5. Deleted admin@example.com.
  6. Signed out of admin@example.com and in as MyAdmin@MyDomain.com.
  7. Received error that I suspect is related and could be solved by this github post. I'm guessing the certificate owner was the admin@example.com account.
  8. Uninstalled/reinstalled multiple times as well as restarted device and previous settings (user account, forwarding) persist.

This is in the log, if relevant:

[08:41:29] INFO: Starting NGinx...
s6-rc: info: service legacy-services successfully started
2024/02/02 08:41:29 [error] 208#208: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.86.7, server: nginxproxymanager, request: "GET /api/ HTTP/1.1", upstream: "http://127.0.0.1:3000/", host: "hapi4.local:81", referrer: "http://hapi4.local:81/nginx/certificates"
[2/2/2024] [8:41:29 AM] [Global ] › ℹ info Using Sqlite: /config/database.sqlite
[2/2/2024] [8:41:32 AM] [Migrate ] › ℹ info Current database version: none

I managed to fix the database, but I think the underlying issue may still exist. My resolution was the following:

From web SSH Terminal, I ran the following:

  1. apk add sqlite
  2. I opened my nginx database with sqlite3 /addon_configs/a0d7b954_nginxproxymanager/database.sqlite
  3. Ran the following two commands:

update certificate set owner_user_id = 2;
update proxy_host set owner_user_id = 2;
.exit

  1. Refreshed nginx and it was corrected.

Observation - I noticed when running SELECT * FROM 'auth' that there are 3 users and is_deleted = 0 for all of them. I only have 1 user account (MyAdmin@MyDomain.com).

When running SELECT * FROM 'user' however, I see is_deleted=1 for the two other accounts that shouldn't be there. One is admin@example.com and the other is admin@example2.com, which was my attempt to recreate the default admin account.

There hasn't been any activity on this issue recently, so we clean up some of the older and inactive issues.
Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by leaving a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thanks!