mail-in-a-box / mailinabox

Mail-in-a-Box helps individuals take back control of their email by defining a one-click, easy-to-deploy SMTP+everything else server: a mail server in a box.
https://mailinabox.email/
Creative Commons Zero v1.0 Universal
13.99k stars 1.44k forks source link

Error: Something went wrong, sorry #327

Closed tuck3r closed 9 years ago

tuck3r commented 9 years ago

I ran the installer, and upon loading up the System Status Check I received the error "Error: Something went wrong, sorry". There isn't an error number or anything.

So I looked around at some forums and tried:

tail -f /var/log/syslog

Which output:

Feb 16 20:39:54 box Exception on /system/status [POST]#012Traceback (most recent call last):#012 File "/usr/lib/python3/dist-packages/flask/app.py", line 1817, in wsgi_app#012 response = self.full_dispatch_request()#012 File "/usr/lib/python3/dist-packages/flask/app.py", line 1477, in full_dispatch_request#012 rv = self.handle_user_exception(e)#012 File "/usr/lib/python3/dist-packages/flask/app.py", line 1381, in handle_user_exception#012 reraise(exc_type, exc_value, tb)#012 File "/usr/lib/python3/dist-packages/flask/_compat.py", line 33, in reraise#012 raise value#012 File "/usr/lib/python3/dist-packages/flask/app.py", line 1475, in full_dispatch_request#012 rv = self.dispatch_request()#012 File "/usr/lib/python3/dist-packages/flask/app.py", line 1461, in dispatch_request#012 return self.view_functionsrule.endpoint#012 File "/usr/local/bin/mailinabox-daemon", line 35, in newview#012 return viewfunc(_args, *_kwargs)#012 File "/usr/local/bin/mailinabox-daemon", line 298, in system_status#012 run_checks(env, output)#012 File "/root/mailinabox/management/status_checks.py", line 22, in run_checks#012 shell('check_call', ["/usr/sbin/rndc", "flush"])#012 File "/root/mailinabox/management/utils.py", line 149, in shell#012 ret = getattr(subprocess, method)(cmd_args, **kwargs)#012 File "/usr/lib/python3.4/subprocess.py", line 557, in check_call#012 raise CalledProcessError(retcode, cmd)#012subprocess.CalledProcessError: Command '['/usr/sbin/rndc', 'flush']' returned non-zero exit status 1

edit: I just loaded up the site.com/mail and.. everything seems to be working. I sent a test message, and it came through. The only thing that seems to be failing.. is the status tests.

JoshData commented 9 years ago

Try running management/status_checks.py from the command line and see if there's more helpful output?

tuck3r commented 9 years ago

I went ahead and ran that from ~/mailinabox/ and I received:

rndc: connect failed: 127.0.0.1#953: connection refused Traceback (most recent call last): File "management/status_checks.py", line 633, in run_checks(env, ConsoleOutput()) File "management/status_checks.py", line 22, in run_checks shell('check_call', ["/usr/sbin/rndc", "flush"]) File "/root/mailinabox/management/utils.py", line 149, in shell ret = getattr(subprocess, method)(cmd_args, **kwargs) File "/usr/lib/python3.4/subprocess.py", line 557, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['/usr/sbin/rndc', 'flush']' returned non-zero exit status 1

h8h commented 9 years ago

I think I have a similar error, after updating miab i get the Sorry, Something went wrong - Error under the following circumstances:

Start `mailinabox` service
Login
Logout
Login
`Something went wrong` for the status checks view, all the other views work fine. 
Restart `mailinabox` service
Status Checks works again.

Also for the management/status_checks.py: Run the script 1000x times - just kidding - but a few times Login / Logout (on the admin web interface) Run the console script again

root@srv:~/mailinabox# management/status_checks.py
System
======
✓  All system services are running.
Traceback (most recent call last):
  File "management/status_checks.py", line 785, in <module>
    run_checks(env, ConsoleOutput())
  File "management/status_checks.py", line 34, in run_checks
    shell('check_call', ["/usr/sbin/rndc", "flush"], trap=True)
  File "/root/mailinabox/management/utils.py", line 152, in shell
    ret = getattr(subprocess, method)(cmd_args, **kwargs)
  File "/usr/lib/python3.4/subprocess.py", line 552, in check_call
    retcode = call(*popenargs, **kwargs)
  File "/usr/lib/python3.4/subprocess.py", line 533, in call
    with Popen(*popenargs, **kwargs) as p:
  File "/usr/lib/python3.4/subprocess.py", line 848, in __init__
    restore_signals, start_new_session)
  File "/usr/lib/python3.4/subprocess.py", line 1384, in _execute_child
    restore_signals, start_new_session, preexec_fn)
OSError: [Errno 12] Cannot allocate memory

Kidding? My memory is free, but maybe the server has too many open sockets (see numtcpsock @ cat /proc/user_beancounter)

root@srv:~/mailinabox# free -m
             total       used       free     shared    buffers     cached
Mem:          4096       1458       2637        172          0        714
-/+ buffers/cache:        743       3352
Swap:         3072          1       3070
root@srv:~/mailinabox# lsof | egrep '(TCP|UDP)' | grep 10222 | wc -l
49

49 Sockets only for miab is too much?! Maybe your last commit 7e05d7 opens too many connections for my box and never closes them.

JoshData commented 9 years ago

I believe these are separate errors. Committing what I hope is a fix for the second (Cannot allocate memory) error in 7ec662c83f8a63fdb784d0388964be024d2a1b58.

JoshData commented 9 years ago

@tuck3r: Try service bind9 restart. I think this is a quasi-bug that I've already fixed for the next update --- the local DNS server bind9 many not be running.

tuck3r commented 9 years ago

I ran

service bind9 restart

Still having the same error. After that I decided to get a list of statuses that are running. It shows [?] for bind9, even after reboot?

service --status-all [ ? ] bind9 [ + ] fail2ban [ - ] haveged [ ? ] killprocs [ ? ] kmod [ ? ] mailinabox [ + ] memcached [ ? ] modules_dep.sh [ ? ] networking [ + ] nginx [ - ] nsd [ + ] ntp [ ? ] ondemand [ + ] opendkim [ - ] php5-fpm [ + ] postfix [ + ] postgrey [ - ] procps [ - ] quota [ - ] quotarpc [ ? ] rc.local [ + ] resolvconf [ - ] rsync [ + ] rsyslog [ ? ] sendsigs [ - ] spamassassin [ + ] spampd [ - ] ssh [ - ] sudo [ - ] udev [ ? ] umountfs [ ? ] umountnfs.sh [ ? ] umountroot [ - ] unattended-upgrades [ - ] urandom [ ? ] vzreboot [ ? ] wide-dhcpv6-client

JoshData commented 9 years ago

Some VM providers install a crippled bind9 package.

tuck3r commented 9 years ago

I have the VPS through vpsdime. They did not have bind9 installed by default. They didn't even have sudo or man installed. Is there a way to test for a certain aspect of bind9 that miab needs?

JoshData commented 9 years ago

Well after being installed it should run. :) That's what we need.

tuck3r commented 9 years ago

Well, I checked and...

apt-get install bind9 Reading package lists... Done Building dependency tree
Reading state information... Done bind9 is already the newest version. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

It is installed already... So I decided to check the version of it as well. Everything seems fine?

dpkg -p bind9 Package: bind9 Priority: optional Section: net Installed-Size: 950 Maintainer: Ubuntu Developers ubuntu-devel-discuss@lists.ubuntu.com Architecture: amd64 Version: 1:9.9.5.dfsg-3ubuntu0.1 Replaces: apparmor-profiles (<< 2.1+1075-0ubuntu4), bind, bind9utils (<< 1:9.9.3.dfsg.P2-3), dnsutils (<< 1:9.1.0-3) Depends: libbind9-90 (= 1:9.9.5.dfsg-3ubuntu0.1), libc6 (>= 2.14), libcap2 (>= 2.10), libdns100 (= 1:9.9.5.dfsg-3ubuntu0.1), libisc95 (= 1:9.9.5.dfsg-3ubuntu0.1), libisccc90 (= 1:9.9.5.dfsg-3ubuntu0.1), libisccfg90 (= 1:9.9.5.dfsg-3ubuntu0.1), liblwres90 (= 1:9.9.5.dfsg-3ubuntu0.1), libxml2 (>= 2.7.4), debconf (>= 0.5) | debconf-2.0, init-system-helpers (>= 1.13~), netbase, adduser, lsb-base (>= 3.2-14), bind9utils (= 1:9.9.5.dfsg-3ubuntu0.1), net-tools Suggests: dnsutils, bind9-doc, resolvconf, ufw Conflicts: apparmor-profiles (<< 2.1+1075-0ubuntu4), bind Size: 287082

edit: I also did some google-fu for vpsdime issues with bind9 and didn't run across anything too obvious..

JoshData commented 9 years ago

The version is right. But is it running? e.g.

dig @localhost google.com
tuck3r commented 9 years ago

So, I went to run dig, it wasn't installed. Ran an update and that failed with a bunch of errors. I ran across this article and I was able to get dig installed, but that leads me to believe that there is some internal DNS issues going on. I went ahead and rebooted bind9 and ran dig:

dig @localhost google.com ; <<>> DiG 9.9.5-3ubuntu0.1-Ubuntu <<>> @localhost google.com ; (2 servers found) ;; global options: +cmd ;; connection timed out; no servers could be reached

I take it that is what you were expecting to see at this point?

JoshData commented 9 years ago

Right right. Something isn't quite right on the machine. I'd love Mail-in-a-Box to be smart about these problems (at least proactively explain the situation), but for now all I can offer is choosing a different VM provider.

tuck3r commented 9 years ago

Oh that is fine. Thank you for helping out as much as you did. I will contact their support perchance they have run across this before. Right now, Roundcube, postfix and such seem to still be working? So I am not too concerned with moving it. I just might have to get creative managing the packages and update as you do. Thanks again!!

tuck3r commented 9 years ago

Just another quick note. I ran this changing out 'localhost' for my servers hostname and it actually gave some results. Just thought I'd add that.

dig @myhostname google.com ; <<>> DiG 9.9.5-3ubuntu0.1-Ubuntu <<>> @myhostname google.com ; (1 server found) ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 27363 ;; flags: qr rd; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1 ;; WARNING: recursion requested but not available ;; OPT PSEUDOSECTION: ; EDNS: version: 0, flags:; udp: 4096 ;; QUESTION SECTION: ;google.com. IN A ;; Query time: 0 msec ;; SERVER: myip#53(myip) ;; WHEN: Wed Feb 18 13:51:10 EST 2015 ;; MSG SIZE rcvd: 39

JoshData commented 9 years ago

Yep. bind9 is used for local resolving queries only and nsd is used for public (remote) non-resolving/non-recursive queries only.

h8h commented 9 years ago

@JoshData Thanks your commit works for me. :+1:

randy2134 commented 8 years ago

hello,

I'm having the same problem, my status checks aren't working - here is a result of status_checks.py below: Looks like a firewall issue, any ideas?

randy@box:~/mailinabox$ sudo management/status_checks.py

System

✓ All system services are running. ✓ SSH disallows password-based login. ✓ System software is up to date. ✓ Mail-in-a-Box is up to date. You are running version v0.20. ✓ System administrator address exists as a mail alias. [administrator@box.ruppmail.net ↦ randy@randallrupp.com] ✓ The disk has 22.38 GB space remaining. ✓ System memory is 57% free.

Network

ERROR: problem running iptables: modprobe: ERROR: ../libkmod/libkmod.c:556 kmod_search_moddep() could not open moddep file '/lib/modules/3.19.0-39-generic/modules.dep.bin' iptables v1.4.21: can't initialize iptables table `filter': Table does not exist (do you need to insmod?) Perhaps iptables or your kernel needs to be upgraded.

Traceback (most recent call last): File "management/status_checks.py", line 956, in run_checks(False, env, ConsoleOutput(), pool) File "management/status_checks.py", line 64, in run_checks run_network_checks(env, output) File "management/status_checks.py", line 262, in run_network_checks check_ufw(env, output) File "management/status_checks.py", line 172, in check_ufw ufw = shell('check_output', ['ufw', 'status']).splitlines() File "/home/randy/mailinabox/management/utils.py", line 193, in shell ret = getattr(subprocess, method)(cmd_args, **kwargs) File "/usr/lib/python3.4/subprocess.py", line 620, in check_output raise CalledProcessError(retcode, process.args, output=output) subprocess.CalledProcessError: Command '['ufw', 'status']' returned non-zero exit status 1

yodax commented 8 years ago

Are you running on a system with the firewall disabled? (This is a different problem related to the new firewall status checks)

What does the command ufw status say?

randy2134 commented 8 years ago

No, it should be a stock system.

Sent from my iPhone

On Oct 2, 2016, at 00:28, Michael Kroes notifications@github.com wrote:

Are you running on a system with the firewall disabled? (This is a different problem related to the new firewall status checks)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

yodax commented 8 years ago

Can you run ufw status?

randy2134 commented 8 years ago

randy@box:~$ sudo ufw status [sudo] password for randy: ERROR: problem running iptables: modprobe: ERROR: ../libkmod/libkmod.c:556 kmod_search_moddep() could not open moddep file '/lib/modules/3.19.0-39-generic/modules.dep.bin' iptables v1.4.21: can't initialize iptables table `filter': Table does not exist (do you need to insmod?) Perhaps iptables or your kernel needs to be upgraded.

randy2134 commented 8 years ago

I appreciate any help anyone has to offer, I'm not sure what to do here... I've been playing around with it but I cant seem to figure it out.. While I'm certainly not a programmer at the level of @joshdata or most of the people on the board i'm not illiterate either, I run a few wordpress sites, my own dns server, and my own vpn on digital ocean as well as my mailinabox. This mailinabox is pretty much a stock install on Digital ocean Ubuntu 14.04 per josh's instructions on his website. nothing else is on this droplet....

JoshData commented 8 years ago

There's something wrong with the droplet, I think. Those sorts of messages are not normal.

randy2134 commented 8 years ago

I guess I'll have to try a fresh install, other than these errors this mailinabox has been working flawlessly for almost two years... This started with the last version upgrade. Its possible I tinkered with something a long time ago and forgot about it, and when the new version came out my "tinkering" blew back on me..

randy2134 commented 8 years ago

here is my service status page if anyone has any ideas

randy@box:/lib/modules/3.13.0-96-generic$ service --status-all [ + ] acpid [ - ] apparmor [ ? ] apport [ + ] atd [ + ] bind9 [ ? ] console-setup [ + ] cron [ - ] dbus [ ? ] dns-clean [ - ] fail2ban [ + ] friendly-recovery [ - ] grub-common [ + ] haveged [ ? ] irqbalance [ ? ] killprocs [ ? ] kmod [ ? ] mailinabox [ + ] memcached [ ? ] munin [ + ] munin-node [ ? ] networking [ + ] nginx [ + ] nsd [ + ] ntp [ ? ] ondemand [ + ] opendkim [ + ] opendmarc [ + ] php5-fpm [ - ] postfix [ + ] postgrey [ ? ] pppd-dns [ - ] procps [ ? ] rc.digitalocean [ ? ] rc.local [ + ] resolvconf [ - ] rsync [ + ] rsyslog [ ? ] screen-cleanup [ ? ] sendsigs [ - ] spamassassin [ - ] spampd [ + ] ssh [ - ] sudo [ + ] udev [ ? ] umountfs [ ? ] umountnfs.sh [ ? ] umountroot [ - ] unattended-upgrades [ - ] urandom randy@box:/lib/modules/3.13.0-96-generic$

yodax commented 8 years ago

This problem wasn't introduced by mail-in-a-box, only exposed. I added a status check that checks the status of the firewall. If that isn't active you aren't protected against brute force login attacks. There was a bug in that code, in this specific case where the kernel doesn't support ip_tables it crashed. (There is a fix incoming for that, it will not solve your issue, it will report that ufw isn't working and continue with running the rest of the checks)

Best guess is that something went wrong during an update of ubuntu, a kernel was upgraded but without the modules. With out the kernel module ip_tables ufw can't function. Normally that module is loaded by ufw. You can load it manually by mod_probe ip_tables. This will not work in you case because it isn't there.

If you aren't on 4.4.4-std-3, you might try upgrading to that. (check with uname -r) Otherwise it might be easier to get a new box.