Restore control panel

With one of the last updates the access to control panel was broken.
When trying to access it I’ll get 500 error code “Internal Error The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.”

nginx-error.log contains this message: "*2144 “/home/user-data/www/default/admin/index.html” is not found " as well as “2256 open() “/home/user-data/www/default/.env” failed”.

I tried to reinstall Mail in a box twice. Didn’t change anything. Can I restore those files without complete reinstalling and restoring MiaB? I don’t know how long access does not work and so I can not rely on a consistent backup.

Running MiaB v67 on Ubuntu 22.04.3 LTS

Some quick and dirty things to try:

  • Restart nginx: sudo systemctl restart nginx
  • Regenerate the web config:
    • From the mailinabox install directory, run: sudo tools/web_update
    • And restart nginx

The file /home/user-data/www/default/admin/index.html should not be there. In fact, the box should not try to serve it to you if you access the admin page. Are you sure you’re using box.<domain>/admin to access the admin page?

Hi Jan,

I tried that already. Didn’t work :frowning:

In /home/user-data/www/default is an index.html file and nothing more located.

I tried a few approaches for the admin-page:
ip-adress/admin
fqdn/admin
none of them worked

Ok, no clue yet. But taking some hints from this old topic:

  • Can you access roundcube and nextcloud?
  • What does sudo journalctl -u mailinabox --since yesterday show? (scroll to the end)

Sorry for replying so late:

Access to roundcube and nextcloud works like a charm.

I found those messages:
"Dec 23 14:33:20 gunicorn[2522]: Exception on / [GET]
Traceback (most recent call last):
File “/usr/local/lib/mailinabox/env/lib/python3.10/site-packages/flask/app.py”, line 1455, in wsgi_app
response = self.full_dispatch_request()
File “/usr/local/lib/mailinabox/env/lib/python3.10/site-packages/flask/app.py”, line 869, in full_dispatch_request
rv = self.handle_user_exception(e)
File “/usr/local/lib/mailinabox/env/lib/python3.10/site-packages/flask/app.py”, line 867, in full_dispatch_request
rv = self.dispatch_request()
File “/usr/local/lib/mailinabox/env/lib/python3.10/site-packages/flask/app.py”, line 852, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
File “/root/mailinabox/management/daemon.py”, line 128, in index
return render_template(‘index.html’,
File “/usr/local/lib/mailinabox/env/lib/python3.10/site-packages/flask/templating.py”, line 151, in render_template
template = app.jinja_env.get_or_select_template(template_name_or_list)
File “/usr/local/lib/mailinabox/env/lib/python3.10/site-packages/jinja2/environment.py”, line 1081, in get_or_select_template
return self.get_template(template_name_or_list, parent, globals)
File “/usr/local/lib/mailinabox/env/lib/python3.10/site-packages/jinja2/environment.py”, line 1010, in get_template
return self._load_template(name, globals)
File “/usr/local/lib/mailinabox/env/lib/python3.10/site-packages/jinja2/environment.py”, line 969, in _load_template
template = self.loader.load(self, name, self.make_globals(globals))
File “/usr/local/lib/mailinabox/env/lib/python3.10/site-packages/jinja2/loaders.py”, line 126, in load
source, filename, uptodate = self.get_source(environment, name)
File “/usr/local/lib/mailinabox/env/lib/python3.10/site-packages/flask/templating.py”, line 65, in get_source
return self._get_source_fast(environment, template)
File “/usr/local/lib/mailinabox/env/lib/python3.10/site-packages/flask/templating.py”, line 99, in _get_source_fast
raise TemplateNotFound(template)
jinja2.exceptions.TemplateNotFound: index.html
"

All right, so nginx seems to be working. Focusing on the Mailinabox daemon

  • is the issue still there if you restart the mailinabox daemon? sudo systemctl restart mailinabox
  • look at folder management/templates in the mailinabox installation folder. Is it present? What are the contents?

Hi Jan,

by restarting mailinabox nothing changed.

In the folder /mailinabox/management/templates there is only a system-backup.html located.

is there a place where I can download files that are missing in this folder?

I think the best way is to restore the git repository that is your mailinabox installation directory. It is strange that these files are missing, and there might be other files missing as well.

What is the output of git status when run from the installation directory?

Hi Jan,
error messages:
HEAD detached at v67
deleted: management/templates/aliases.html
deleted: management/templates/custom-dns.html
deleted: management/templates/external-dns.html
deleted: management/templates/index.html
deleted: management/templates/login.html
deleted: management/templates/mail-guide.html
deleted: management/templates/mfa.html
deleted: management/templates/munin.html
deleted: management/templates/ssl.html
deleted: management/templates/sync-guide.html
deleted: management/templates/system-status.html
deleted: management/templates/users.html
deleted: management/templates/web.html
deleted: management/templates/welcome.html

Ok, seems only that folder was changed.
Try this:

  • git reset
  • git checkout . (note the “.” at the end)

Then do a git status again. There should be no more deleted files.
Then check the control panel again, (perhaps another sudo systemctl restart mailinabox is needed)

Any idea how these files were deleted?

After resetting and re-checking out everything worked.
Thank you very much for helping me solving this issue.

I checked the logs of my AV. There were no deletions recently.
What I found and I have to investigate is that these files
were identified by git status:

management/testdisk.log
wget-log

This is a VM in a datacenter where I have no access to run testdisk and ftp is not allowed

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