1
Upgrading the Linux BETA to 8895
Problem reported by Ciaran Morgan - 5/13/2024 at 9:56 AM
Resolved
Hi all,

I have just tried upgrading build 8886 to 8895 by uninstalling 8886 and then installing 8895.
Unfortunately the Smartermail service has failed and the systemctl status is as follows:-

smartermail.service - SmarterMail (100.0.8895.40874)
     Loaded: loaded (/etc/systemd/system/smartermail.service; enabled; preset: enabled)
     Active: failed (Result: signal) since Mon 2024-05-13 17:41:00 BST; 54s ago
   Duration: 1.153s
    Process: 1298 ExecStart=/opt/smartermail/MailService (code=killed, signal=ABRT)
   Main PID: 1298 (code=killed, signal=ABRT)
        CPU: 1.237s

May 13 17:41:00 enterprise MailService[1298]:    at Microsoft.Extensions.Hosting.Internal.Host.<StartAsync>b__15_1(IHostedService service, CancellationToken token)
May 13 17:41:00 enterprise MailService[1298]:    at Microsoft.Extensions.Hosting.Internal.Host.ForeachService[T](IEnumerable`1 services, CancellationToken token, Boolean concurrent, Boolean abortOnFirstException, List`1 exceptions, Func`3 operation)
May 13 17:41:00 enterprise MailService[1298]:    at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken)
May 13 17:41:00 enterprise MailService[1298]:    at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
May 13 17:41:00 enterprise MailService[1298]:    at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
May 13 17:41:00 enterprise MailService[1298]:    at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.Run(IHost host)
May 13 17:41:00 enterprise MailService[1298]:    at SmarterMail.Program.Main(String[] args) in /build/SmarterMail/gitsrc/src/SmarterMail/Program.cs:line 73
May 13 17:41:00 enterprise systemd[1]: smartermail.service: Main process exited, code=killed, status=6/ABRT
May 13 17:41:00 enterprise systemd[1]: smartermail.service: Failed with result 'signal'.
May 13 17:41:00 enterprise systemd[1]: smartermail.service: Consumed 1.237s CPU time.

Trying to restart the service also redults in a failure as above.

I have tried uninstalling 8895, rebooting and reinstalling but with the same result.

My setup is a headless Debian 12 box running standard Debian 12.5 with no graphical desktop installed. The box sits behind a NAT firewall on a 192.168.1.x network.
Smartermail is installed running the Smartermail web interface on port 17017 and I reverse proxy this on Apache2 to port 80 - this setup worked very well for build 8886

Any advice or suggestions on how to get the service to start and get the BETA back up running again welcome?

Regards

Ciaran

12 Replies

Reply to Thread
1
Patrick Jeski Replied
Backup your domains and any users, and follow Derek’s full uninstall instructions?

I personally, windows or Linux, simply install the new version over the old. Never an issue in all the years. 
0
Kyle Kerst Replied
Employee Post
Doing a full uninstall, then installing again might not be a bad idea just to flush everything out. Before you do that though, do you find anything in the /var/lib/SmarterMail/Logs folder that correlates to the time the service failed to start? You might also check /var/log in Debian to see if it logs anything from the service failure. The sudo service smartermail status command might also dump out some details.
Kyle Kerst IT Coordinator SmarterTools Inc. www.smartertools.com
0
Ciaran Morgan Replied
Hi Kyle,
Thanks for the suggestions.  I tried a full uninstall reboot and reinstall and still the same result - the Smartermail service will not start.
There was nothing on the logs except for the sudo service smartermail status report which was as above in my original post.

I tried starting the SmarterMail service in a temainal and noticed a couple of things.  The install is supposed to be using the Smartermail web server on port 17017 but when I started the SmarterMail service in a terminal it reported that it was listening on ports 80 and 443.  It also recorded a "fail" status as it could not bind to http://0.0.0.0:80 as follows:-

m0xtd@enterprise:~$ sudo /opt/smartermail/MailService
Listening on port 80 and 443
info: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[62]
      User profile is available. Using '/root/.aspnet/DataProtection-Keys' as key repository; keys will not be encrypted at rest.
warn: Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware[16]
      The WebRootPath was not found: /home/m0xtd/wwwroot. Static files may be unavailable.
warn: Microsoft.AspNetCore.Server.Kestrel[0]
      Overriding address(es) 'http://localhost:17017'. Binding to endpoints defined via IConfiguration and/or UseKestrel() instead.
fail: Microsoft.Extensions.Hosting.Internal.Host[11]
      Hosting failed to start
      System.IO.IOException: Failed to bind to address http://0.0.0.0:80: address already in use.
       ---> Microsoft.AspNetCore.Connections.AddressInUseException: Address already in use
       ---> System.Net.Sockets.SocketException (98): Address already in use
         at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress)
         at System.Net.Sockets.Socket.Bind(EndPoint localEP)
         at Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.SocketTransportOptions.CreateDefaultBoundListenSocket(EndPoint endpoint)
         at Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.SocketConnectionListener.Bind()

The output from the service suggested that ports 80/443 was already in use - which they are because Apache is already running serving other websites, including the reverse proxy site for smartermail.
Given I am running Apace2 webserver on debian, I tried stopping Apache2 service and retired starting the Smartermail service again and this time it worked and was accessible on port 80 from the Debian machine.
However, Apache2 would not restart, reporting an error that the ports where already in use.

So is the Smartermail service using the built in web server trying to bind to ports 80, 443 and 17017 when in reality it should only be binding to 17017?

Ciaran

2
Patrick Jeski Replied
You didn’t select “no” to use smarter mail’s web server maybe?
0
Ciaran Morgan Replied
Couldn't get the Smartermail service to start irrespective of whether the SmarterMail webserver was installed or not - and that was with full uninstalls between trys.

As it was a development/testing box, I rebuilt it to the original spec including Apache2 and reinstalled smartermail which started first time. Waiting to see the next upgrade to see if the problem arises again.
1
Patrick Jeski Replied
I had no problem upgrading 8887 to 8888 then to 8895 just by wget, chmod + x, sudo ./smartermail_XXXX install. No stopping services, no uninstalling. Two different VMs, one running smartermail's web server, the other nginx. 
1
Matt Petty Replied
Employee Post
@Ciaran Morgan
Since fixing the webserver issue you were having, what is being printed now into "sudo systemctl status smartermail.service"
Matt Petty Senior Software Developer SmarterTools Inc. www.smartertools.com
0
Ciaran Morgan Replied
● smartermail.service - SmarterMail (100.0.8895.40874)
     Loaded: loaded (/etc/systemd/system/smartermail.service; enabled; preset: enabled)
     Active: active (running) since Tue 2024-05-14 15:50:58 BST; 6h ago
   Main PID: 1592 (MailService)
      Tasks: 57 (limit: 19077)
     Memory: 515.1M
        CPU: 12min 20.118s
     CGroup: /system.slice/smartermail.service
             └─1592 /opt/smartermail/MailService

May 14 15:50:58 enterprise systemd[1]: Started smartermail.service - SmarterMail (100.0.8895.40874).
May 14 15:50:59 enterprise MailService[1592]: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] No XML encryptor configured. Key {0b52f5ff-af47-4935-9b5e-8d281c2b1519} may be persisted to storage in unencrypted form.
May 14 15:50:59 enterprise MailService[1592]: Microsoft.Hosting.Lifetime[14] Now listening on: http://localhost:17017
May 14 15:50:59 enterprise MailService[1592]: Microsoft.Hosting.Lifetime[0] Application started. Hosting environment: Production; Content root path: /opt/smartermail
May 14 15:51:00 enterprise MailService[1592]: [Information] SmarterMail Starting


2
Matt Petty Replied
Employee Post
Hmm seems to be fine. You should be able to point your local webserver on that machine to reverse-proxy that URL. Keep in mind we bind localhost:17017 and not 0.0.0.0:17017, so your nginx/apache need to be on the machine to use that URL. I've been thinking about having SM bind go 0.0.0.0:17017 and leaving the port blocked by default might be the better option. That allows you to reverse proxy from another machine.
Matt Petty Senior Software Developer SmarterTools Inc. www.smartertools.com
1
csharp Replied
I'd suggest either a 0.0.0.0 binding at minimum default, or the simple option for a specific IP or 0.0.0.0 binding. Most larger hosting setups will have load balancing and TLS offload upstream. Forcing an additional proxy just to essentially re-bind the listener is a bit silly.
1
Matt Petty Replied
Employee Post
I agree, I made a task to switch the bindings to 0.0.0.0 and we're also gonna likely be binding the ipv6 as well.
Matt Petty Senior Software Developer SmarterTools Inc. www.smartertools.com
1
Matt Petty Replied
Employee Post
Looks like when we're running in "webserver" mode we are now binding already to 0.0.0.0, I have added ipv6 to this as well.
When we're not running in "webserver" mode we were binding to localhost:17017 but now will bind to all ipv4 and ipv6 address.

The (cmd-line) installer opens port 80 and 443 automatically when you choose run the web server. You will still need to open port 17017 yourself if you wish to use the internal port externally.

TL;DR: The next update will bind 17017 to all ips in non-websever and will bind 80 and 443 to all ips in webserver mode.
Matt Petty Senior Software Developer SmarterTools Inc. www.smartertools.com

Reply to Thread