Adi R's picture


I did Distribution Upgrade via Webmin after about a year of Turnkey LAMP appliance working fine. Just wanted to keep up with latest security patches.

That upgrade got hung after a while without any error. Eventually I rebooted and noticed that Webmin doesn't work any more (just getting Connection Reset). So I SSH'd into the server and did apt-get dist-upgrade from the command line. It also failed:

Total 1751 (delta 210), reused 1751 (delta 210)
E: Sub-process /usr/bin/dpkg returned an error code (1)

Internet says "just reboot", I tried 3 reboots by now but still getting error above. Also Webmin still doesn't work, don't know which log to check for root cause on that but when I go to Webmin port I simply get "connection reset". Interestingly most other things seem to work fine on the server, including apache, mysql, etc.

Any ideas?

Jeremy Davis's picture

Firstly, because TurnKey auto installs all Debian security updates every day, an occasional reboot (to load any kernel updates) is all that should be required to keep your server humming along nicely. Having said that, many servers include software installed from elsewhere. E.g. many web apps are installed direct from upstream (i.e. the application developers). You'll need to manually update those yourself.

Having said that, running upgrade and/or dist-upgrade should not cause any major issues. Also you didn't specify whether you just ran dist-upgrade, or whether you also adjusted the repos to upgrade the Debian version. If you were trying to upgrade to a new Debian version (e.g. Stretch) before we have (which we haven't yet - it's currently in progress), then problems are to be expected. We don't yet have any packages in our stretch archive, so if you tried to dist-upgrade to that, it's probably uninstalled Webmin (we package that ourselves and haven't yet built it for Stretch). If you want to use Stretch, then let me know as I have a personal repo with TurnKey Stretch packages which you can use for now if you wish. Let me know.

Anyway, it sounds like something didn't complete during the upgrade process. To be able to even have a stab at guessing what the issue is, I'd need to see more of the output. Before it gets to the bit you've posted, it should note the package that it's having issues with. Assuming it's a package that hasn't properly installed, you may not even need to know what it is. The following my just fix it:

apt-get install -f

That should try to reinstall any packages that are broken and hopefully fix your issue in the meantime.

Hopefully that's enough to give you some ideas. If you want some more suggestions, please give me some more info about what version of TurnKey you are running and exactly what you did, plus some more of the problematic output.

Adi R's picture

I ran the command you suggested and it failed fairly quickly. Also worth noting that I didn't change any repo prior to attempting dist-upgrade. My Turnkey version is probably a year or so old - how can I confirm what it is?

It kept going with errors, eventually listing errored packages which all start with webmin-

 ~# apt-get install -f
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
23 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up webmin-apache (1.831-turnkey+0) ...
/var/lib/dpkg/info/webmin-apache.postinst: 5: /var/lib/dpkg/info/webmin-apache.postinst: ./ not found
dpkg: error processing package webmin-apache (--configure):
 subprocess installed post-installation script returned error exit status 127
Setting up webmin-custom (1.831-turnkey+0) ...
/var/lib/dpkg/info/webmin-custom.postinst: 5: /var/lib/dpkg/info/webmin-custom.postinst: ./ not found
Jeremy Davis's picture

Thanks for the clarification that you haven't updated your sources.list. That at least rules out what I thought may have happened (and why).

But this is still quite weird. Unless that file has been deleted by you (or someone with access to your server) it doesn't make any sense to me.

My next thought, was perhaps it's somehow related to a bug that we have discovered during our development of v15.0 (the upcoming next release). I was pretty sure that it was related to a change in Debian (i.e. a change between Jessie/v14.x and Stretch/v15.x). Looking closer at that issue, I'm almost certain that they are unrelated. That issue is an error in, rather than the file missing altogether!

The only thing that I can think to suggest at this point, is to try to reinstall the base webmin package (that's where the missing file comes from). TBH, I don't know if it will work, but probably worth a shot:

apt-get clean
apt-get update
apt-get install --reinstall webmin

Unfortunately, I have a funny feeling that that will also fail because of the other broken packages. There are another couple of commands you could try, but I'm not sure on likelihood of success with these either...:

apt-get upgrade -f
# &/or
dpkg --configure -a

Failing that, the only way forward that I can think of would be to take note of the names of the 23 packages (obviously webmin-apache is one and webmin-custom is another). Then manually uninstall them all, something like this:

apt-get remove webmin-apache webmin-custom webmin-...
If Webmin itself is one of those, you could probably skip that (and just reinstall as per above), although that's your call. Then once all of that is removed, you can try reinstalling. If you removed all the Webmin packages (not just the modules and theme) I suggest that you start by installing the base Webmin package on it's own:
apt-get install webmin
Then check that's working. If it's not, you may need to start webmin:
service webmin start

Hopefully it should be working ok now (although it may look really ugly as it's likely no theme is installed yet). So the last step would be to reinstall all the modules (and the theme). Essentially that's the same as removing them (above) except, instead of 'remove' put 'install', i.e.:

apt-get install webmin-apache webmin-custom webmin-...

I hope that works. I'd still really like to understand how it happened though. It's a very weird issue and something that shouldn't happen, nor one that I can reproduce.

Adi R's picture

Thanks so much - this resolved the issue! In fact I just executed these 3 commands you posted:

apt-get clean
apt-get update
apt-get install --reinstall webmin

After that ran without errors I decided to reboot the server and see how it goes - and it came up with the server this time and looks to work just fine!

Thanks again!


Jeremy Davis's picture

So glad to hear that you are up and running again! :)

Thanks for posting back to confirm what worked for you.

Add new comment