Can't update due to DNSMasq

nc15

#1

@nachoparker, All

I’m currently running NC15.0.4 under NCPi 1.3.6, but am being told that 1.5.1 is available for update. However if I try it (either via the panel or the command line) it’s choking on the current dnsmasq install:

sudo apt-get upgrade
Reading package lists… Done
Building dependency tree
Reading state information… Done
Calculating upgrade… Done
The following packages have been kept back:
certbot php7.2-bz2 php7.2-cli php7.2-common php7.2-curl php7.2-fpm php7.2-gd php7.2-intl php7.2-json
php7.2-ldap php7.2-mbstring php7.2-mysql php7.2-opcache php7.2-readline php7.2-xml php7.2-zip python-acme
0 upgraded, 0 newly installed, 0 to remove and 17 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up dnsmasq (2.76-5+deb9u2) …
dpkg: error processing package dnsmasq (–configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
dnsmasq
E: Sub-process /usr/bin/dpkg returned an error code (1)

If I try to configure it via dpkg --configure I get the same error code 1 as well and the update bombs out.

Can anyone advise what I should try to unstick things and let the update happen properly?


#2

maybe try purging dnsmasq and installing it again. If you had it activated, run it from ncp-config to re-apply your settings.


#3

@nachoparker - Thanks for the reply. Tried that, and it fails with both apt-get and dpkg:

root@2b900b399526:/# sudo apt-get purge dnsmasq
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following packages were automatically installed and are no longer required:
dnsmasq-base libnetfilter-conntrack3 libnfnetlink0
Use ‘sudo apt autoremove’ to remove them.
The following packages will be REMOVED:
dnsmasq*
0 upgraded, 0 newly installed, 1 to remove and 17 not upgraded.
1 not fully installed or removed.
After this operation, 72.7 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database … 20024 files and directories currently installed.)
Removing dnsmasq (2.76-5+deb9u2) …
invoke-rc.d: could not determine current runlevel
invoke-rc.d: policy-rc.d denied execution of stop.
(Reading database … 20015 files and directories currently installed.)
Purging configuration files for dnsmasq (2.76-5+deb9u2) …
dpkg: error processing package dnsmasq (–purge):
subprocess installed post-removal script returned error exit status 1
Errors were encountered while processing:
dnsmasq
E: Sub-process /usr/bin/dpkg returned an error code (1)

root@2b900b399526:/# sudo dpkg --purge dnsmasq
(Reading database … 20010 files and directories currently installed.)
Purging configuration files for dnsmasq (2.76-5+deb9u2) …
dpkg: error processing package dnsmasq (–purge):
subprocess installed post-removal script returned error exit status 1
Errors were encountered while processing:
dnsmasq

Same error code as before, and looks like some problem with systemd?


#4

@nachoparker Do you have any further thoughts, or am I looking at nuking the container and setting up a new one (again) to sort this out?

Is there any easier way to force a container reinstall from the image?


#5

if you are in docker you can try to stop and remove the container and starting it again (you could also pull the latest one).

Just in case, always make backups or a copy of your volume


#6

@nachoparker - unfortunately that seems to have completely broken it.

Stopped and removed the container, built a new one and now i’m getting this in the log:

Making /usr/local/bin persistent …

Starting PHP-fpm

Starting Apache

AH00526: Syntax error on line 5 of /etc/apache2/sites-enabled/ncp.conf:

SSLCertificateFile: file ‘/etc/letsencrypt/live/URLRemoved/fullchain.pem’ does not exist or is empty

Action ‘start’ failed.

The Apache error log may have more information.

Starting Redis

Starting Cron

Starting Postfix

ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2 “No such file or directory”)

e

Even removed the image and started afresh (but with same data stored on my USB drive as the original one) so looks like something has got very corrupted somewhere in there?

Am I forced to salvage what I can off the USB drive and then start totally afresh? Any other ideas to save my previous set-up?

I’ve removed my url from the log, but aside from that it’s as seen.


#7

well, normally the easiest is to restore a backup. You can also try to fix what’s broken if you have some linux knowledge.

You can change the following lines in /etc/apache2/sites-available/ files nextcloud.conf and ncp.conf

   SSLCertificateFile      /etc/ssl/certs/ssl-cert-snakeoil.pem
    SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key

(SOLVED) Cannot access NextcloudPi - Connection refused - httpd service down
#8

Thanks :slight_smile:

In the end I blew the container away again, renamed the whole data folder tree and then started a fresh container. Then moved the user data folder from the old tree into the new one and had it rescan and now I’ve got a working system again, fully up to date.

DNSMasq and LetsEncrypt are back up and working too, so at least for now things are good. Next will be to stop the whole server and back up the SD card just in case, and we’re good to go again.