Error on installing MiaB

I created a fresh Ubuntu 22.04 install on a Zboxnano-ad12 with 2GB memory and a 128GB SSD.

Got Ubuntu how I wanted it and went on to the MiaB install. I am running as root.

BTW, I am accessing the server over SSH and I am doing the install in screen. I have been burned in the past with SSH hanging and loosing everything on a partial setup. With screen, I can always SSH again and “screen -r”. It has saved my butt a number of times over the years.

I am going to move a test sub zone here:

test.htt-consult.com

So my email here is rgm@test.htt-consult.com

The MiaB host name MUST be:

klovia.htt-consult.com

Install took some time but I finally got to:

Installing Mail-in-a-Box system management daemon…
Installing Munin (system monitoring)…
Command ‘[‘ssh-keyscan’, ‘-4’, ‘-t’, ‘rsa,dsa,ecdsa,ed25519’, ‘-p’, ‘22’, ‘localhost’]’ returned non-zero exit status 1.web updated

Okay. I’m about to set up rgm@test.htt-consult.com for you. This account will also
have access to the box’s control panel.
password:
(again):
<!doctype html>

500 Internal Server Error

Internal Server 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.

How do I figure out what failed and how to fix?

I just noticed that ssh-keyscan line.

I have moved SSHD to a different port than 22.

Part of my server defense posture.

More observations:

Since I did the install logged in as root (su) from /root, it looks like all the files are off of /root

That does not seem to be good.

There is also a new directory /home/rgm/Mail that is empty.

I can log into the admin web page. and it is asking me to

cd mailinabox

then run a script. Seems rather odd that everything got dropped into the directory I was at on running the setup script.

Check if the mailinabox daemon is running or has errors: sudo journalctl -u mailinabox

The code surrounding ssh-keyscan should detect the port sshd is running on. Can you check that the server is not also listening on port 22? (e.g. sudo sshd -T | grep port and sudo sshd -T | grep listenaddress)

There are explicit instructions one can find for moving the Ubuntu SSHD server. A key one is:

vi /etc/systemd/system/ssh.socket.d/listen.conf
[Socket}
ListenStream=
ListenStream=1234

If you leave out that empty ListenStream line, then SSHD still listens on 22. Otherwise not.

journalctl -u mailinabox
May 15 17:09:55 klovia.htt-consult.com systemd[1]: Started Mail-in-a-Box System>

with 75 lines showing it is running.

I have rethought how I am going to build this.

I am going ahead on using htt-consult.com as my primary domain, but in DNS, I will set the MX records to point to my current server.

So all admin emails go over there…

And as I use the IMAP migrate, I “just” change the MX records accordingly.

I think this will give me better end results.

Now SHOULD I reinstall from my regular user account so all files are under it? I guess because of issues going back some decades I just did not trust myself and would work as SU rather than need to constantly SUDO.

I can change SSHD to listen also on 22 for the install then change back to only my new port #.

Ok, another way to do this, never seen this before :wink:
Mailinabox probably does not detect this way of configuration. Can you still provide the output of sudo sshd -T | grep port and sudo sshd -T | grep listenaddress? Perhaps it is easy to add support for this configuration.
(for reference, mailinabox looks at the output of sshd -T for the port variable.)

I won´t comment as I’m not sure what you want to achieve.

You can either use it from /root as root, or as a normal user from the home directory. You’ll need sudo to provide needed access rights, but you might get away with using su as well. (I have to little experience with su to advice you)

Tried to set up quoting but a bit of a pain on this forum…

For changing SSHD port I got this from

https://askubuntu.com/questions/1439461/ssh-default-port-not-changing-ubuntu-22-10-and-later

Scroll down a bit to get to the “OR” for listening socket stream.

sshd -T | grep port

port 22
gatewayports no

sshd -T | grep listenaddress

listenaddress 23.123.122.149:1234

netstat -tulpn|grep :1234

tcp 0 0 23.123.122.149:1234 0.0.0.0:* LISTEN

netstat -tulpn|grep :22

nothing…

It is “easy” to take out that empty listener= line in the config and restart sshd for during the install.

Doing the install from root rather than me impacts file owner and some access rules. Depends on how processes need to access config info.

I am more use to packages like this installing into /usr/bin and such. Makes it more portable if one changes user that is doing the maint.

I have been running my own email since '95 and every migration was hard. I was first thinking to just test with one of my subzones and then struggle with my principle zone and its users. But then I remembered my last migration and dug up notes going back some 10 years. Get everything set up in parallel and then move the mail and MX records.

Migrations are always a place where something will not work as wanted.

So install again below me. Hey, that has been my userid lo these 30 years and unlikely for me to use something else as I look toward retirement.

What retire? Whatever for?

Yeah, it might be worth it to configure the port number in /etc/ssh/sshd_config or /etc/ssh/ssh_config.d/ just to prevent issues with how Mailinabox handles the SSH configuration.

Setting this up in parallel, to try it out, then moving over the old mail using e.g. imap-sync or something like it, is an oft followed route.

Continuing saga,

Changing SSHD back to port 22 was a challenge. systemd does that in user changes source files and systemd has its own, and changes are promulgated all over the place. Fortunately I have a history with systemd (but from CentOS and Fedora, but), so I am back on port 22.

Did the install over.

It did NOT create the mailinabox directory under my userid, nor the snap one. They are still sitting under /root

connected to https://…/admin

Can’t cd mailinabox
Can’t cd /root/mailinabox
no permissions. So SU and

management/cli.py user make-admin rgm@klovia.htt-consult.com
That’s not a user (rgm@klovia.htt-consult.com).

A user where?

management/cli.py user make-admin rgm@htt-consult.com
That’s not a user (rgm@htt-consult.com).

management/cli.py user make-admin rgm@test.htt-consult.com
OK

That is the userid I setup on the first install. It got remembered and not reset on a reinstall.

Fortunately I remember the password I had selected for this user…

And am in.

Now I have to find where to configure DNS…

But the setup is a bit messed up, and I am wondering if I should reinstall UBUNTU and start over before I get lost.

Or is there a way to completely uninstall MiaB and start over?

The mail-in-a-box user data is stored under /home/user-data/ If you did not delete that, the mail-in-a-box setup will install based on that. This is where the user came from. (there’s also /etc/mailinabox.conf with some system specific configuration)
To start over, just rebuild your VPS image. That’s usually pretty fast, and the easiest way to start with a clean install.

You did find Mail-in-a-Box Setup Guide right?

It looks like there is quite a bit to delete to clean this up for a true fresh install. Not worth it. Back to bare metal. Not like I have not done this in past installs over the decades.

I am NOT using a VPS. This is a clean install on a zboxnano; so move the box back up to my desk, plug it into the KVM, plug in the DVD player with UBUNTU ISO and off I go! I have rather good notes of the steps I took to get the server ready, so can redo. I have done this enough to learn stuff since I started with Whitehat (pre-CentOS days).

Yes, I DID read the guide and the github notes. A number of times. I am now seeing that there is nothing there for actual NSD maintance for my main DNS records, as this will become my main DNS for my zone. Should I install webmin or some other tool to get to those DNS records? It has been quite some time for my since last using webmin, and then I maintained BIND and other services with it on CentOS.

hmm, no package called webmin. What is the tool for this on Ubuntu?

DNS records can be added through the admin panel, although this is not a fully fledged dns administration tool (and not meant as one)

Where DOES MiaB keep its NDS DNS info?

The guide gives on details on DNS.

more /etc/nsd/nsd.conf

Do not edit. Overwritten by Mail-in-a-Box setup.

server:

It is clear that there is nothing to see in /etc/nsd/

nor under /var/lib/nsd/

shows in the example ver BIND-like zone record, so I can PROBABLY edit this by hand, but a tool might be nice.

I want to make this my primary DNS server. As I said, I have decades with BIND9. What little I have found so far, I can tweak this up and if you have done your includes in a clean way, I can do this without stepping on MiaB.

Thank you for all your help.

And perhaps you can save me some research by recommending DNS admin tool here?

nsd.conf points you right at /etc/nsd/zones and /etc/nsd/nsd.conf.d

BUT… It is not the intention of Mailinabox to let you edit those files. The whole point is that your Ubuntu box becomes an email appliance. To be managed from the admin panel, and in principle you should not add other services etc. It might well be that the mailinabox maintenance scripts will remove your changes.
I wonder if you need to reconsider, it sounds like you have lots of plans, but I’m not sure if mailinabox is a good match for you.

I strongly suspect that the mail services are exactly what I want and need. My challenge is first I need to “address” my DNS needs.

I can’t even find where your NDS stub is. /etc/nsd/zones and /etc/nsd/nsd.conf.d are empty. I looked in /home/user-data/dns and only dnssec there.

There should be a stub that at least has the MX records? The guide says nothing about MX records and nothing shows in setting up with your domain service company anything like that. So I am scratching my head here.

Maybe I should just try and set up my sub-zone of test.htt-consult.com and see where it gets dropped?

I suspect once I get your basics on DNS setup, I can deal with it, and then get into the meat-and-potatoes of the mail services.

thanks for your time and help

I’m not sure what the state of your system is. At some time during installation, the dns files should be generated.

I finally figured out that I am hosed wrt NDS setup. Something hiccuped.

I am staying here on this message to get this resolved.

Is there an “easy way” to restart? I suspect that is what I have to do.

I would rather practice, practice, practice. Before heading for Carnegie hall…

If I delete /home/user-data and /root/mailinabox the run the installer is that enough? Or is there something else to delete?

/etc/mailinabox.conf should also go. All the stuff that’s changed in /etc should be overwritten by the setup.

That may have not been enough or there is something else problematic.

First I caught these warnings:

Installing Postfix (SMTP server)…
mv: cannot stat ‘/var/lib/postgrey/*’: No such file or directory
Installing Dovecot (IMAP server)…
doveconf: Warning: NOTE: You can get a new clean config file with: doveconf -Pn > dovecot-new.conf
doveconf: Warning: Obsolete setting in /etc/dovecot/conf.d/10-ssl.conf:91: ssl_dh_parameters_length is no longer needed

Upgrading Nextcloud — backing up existing installation, configuration, and database to directory to /home/user-data/owncloud-backup/2025-05-16-14:38:35…

Now I will point out that I am running the install within screen, so there is no scroll back to get messages and such. My bad that I did not turn on logging for screen that I have done often enough in other uses of it. But:


est. Either the server is overloaded or there is an error in the application.


<!doctype html>

500 Internal Server Error

Internal Server 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.

Okay. I’m about to set up rgm@htt-consult.com for you. This account will also
have access to the box’s control panel.
password:
(again):
<!doctype html>

500 Internal Server Error

Internal Server 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.

anything else I should try?

I just checked and the install STILL created /root/mailinabox and /root/snap even though I deleted these directories before the install and I ran the install from my userid.

Only dnssec in /home/user-data/dns

BTW, I was on my first SMTP/POP3 mailing list (ietf.org) in '92. In the '80s I co-sysoped a PCBoard BBS using Qmail. :slight_smile:

These forums are a bit of a pain for me to deal with…

It’s probably easier to start with a fresh install then to spend time chasing all possible errors you’re encountering.

1 Like

And that will wait for Monday for a new build!

Enjoy your weekend and to resume this thread then. Hopefully with success.