I cant seem to install any packages on Ubuntu 16.04 LTS

I originally installed the LAMP package on installation of the server. Took me ages to get the web server to work and then I found that PHP hadnt been installed as part of the package, which is odd as it should have been. I also tried to install SSH server so I could log in using Putty. Any time I try to install anything I get the following:-

jim@Unseen:~\$ sudo apt-get -f install php libapache2-mod-php php-mcrypt php-mysq
l
Building dependency tree
The following additional packages will be installed:
libmcrypt4 php7.0 php7.0-mcrypt
Suggested packages:
libmcrypt-dev mcrypt
The following NEW packages will be installed
libmcrypt4 php php-mcrypt php7.0 php7.0-mcrypt
0 to upgrade, 5 to newly install, 0 to remove and 0 not to upgrade.
Need to get 0 B/83.5 kB of archives.
After this operation, 326 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
E: Waited for /usr/sbin/dpkg-preconfigure --apt || true but it wasn't there
E: Failure running script /usr/sbin/dpkg-preconfigure --apt || true


I've tried apt-get clean. I've tried the standard apt-get. I've run apt-get update. Nothing I try seems to work. Can anyone suggest anything to help me please. I am new to ubuntu and getting very frustrated with it. Thanks in advance

Edit:

I tried the fix suggested on a similar post that refers to 14.0* although my server is 16.04.4:-

sudo sh -c "echo 'DPkg::Pre-Install-Pkgs {"/usr/sbin/dpkg-preconfigure --apt || true";};' >> /etc/apt/apt.conf.d/70debconf"


This did not work and reported that 70debconf did not exist.

Edit 2

I corrected the command string as suggested to:-

sudo sh -c "echo 'DPkg::Pre-Install-Pkgs {\"/usr/sbin/dpkg-preconf
igure --apt || true\";};' >> /etc/apt/apt.conf.d/70debconf"


It returned a prompt with no messages so I presume it worked

I then ran the following:-

sudo apt-get install openssh-server


And returned exactly the same as before:-

Reading package lists... Done
Building dependency tree
The following additional packages will be installed:
ncurses-term openssh-sftp-server python3-requests python3-urllib3
ssh-import-id
Suggested packages:
python3-openssl python3-pyasn1
The following NEW packages will be installed
ncurses-term openssh-server openssh-sftp-server python3-requests
python3-urllib3 ssh-import-id
0 to upgrade, 6 to newly install, 0 to remove and 0 not to upgrade.
Need to get 0 B/746 kB of archives.
After this operation, 5,652 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Preconfiguring packages ...
E: Waited for /usr/sbin/dpkg-preconfigure --apt || true but it wasn't there
E: Failure running script /usr/sbin/dpkg-preconfigure --apt || true


Edit 3

A thought occurred to me after some terrific help. Before these problem started I installed Webmin as a quick way to remotely access the server from my desktop. I tried to to install Openssh-server through webmin and to my surprise it worked. So the conclusion looks like webmin has somehow interfered with the native functions on the server. I'm sure this shouldn't happen and wonder if I should report it.

• Possible duplicate of "Waited for * || true but it wasn't there " each time I run apt – Jos Mar 6 '18 at 21:03
• Hang on, that question was not properly answered, I think, although it has an accepted answer. – Jos Mar 6 '18 at 21:05
• I read that and it didnt help me at all. – Figgis1965 Mar 6 '18 at 21:42
• I'll retract my vote. Meanwhile, please add the contents of /etc/apt/apt.conf.d/70debconf to your question. – Jos Mar 6 '18 at 21:46
• Sorry I'm confused.. why would I need to add /etc/apt/apt.conf.d/70debconf to my question if that refers to something in 14.0* and not 16.04.4. I've added it but cant understand why – Figgis1965 Mar 6 '18 at 22:04

There's a problem with initial answer, the inner set of double quotes need to be escaped

sudo sh -c "echo 'DPkg::Pre-Install-Pkgs {\"/usr/sbin/dpkg-preconfigure --apt || true\";};' >> /etc/apt/apt.conf.d/70debconf"


I can confirm that /etc/apt/apt.conf.d/70debconf exists on both my Ubuntu 16.04 and Ubuntu 17.10 boxes. The contents of this file on my Ubuntu 16.04 box are

// Pre-configure all packages with debconf before they are installed.
// If you don't like it, comment it out.
DPkg::Pre-Install-Pkgs {"/usr/sbin/dpkg-preconfigure --apt || true";};

• I tried the string as you corrected and the system accepted it. However I still have the same problem. – Figgis1965 Mar 7 '18 at 0:07
• Ok, 2 things to try; 1. see if /usr/sbin/dpkg-preconfigure is executable, try /usr/sbin/dpkg-preconfigure --help. 2. Open /etc/apt/apt.conf.d/70debconf and comment out the Dpkg::Pre-Install-Pkgs line by prepending it with // – Kevin Mooney Mar 7 '18 at 0:20
• I've just had a look at the file /etc/apt/apt.conf.d/70debconf and this is what it contains:- "code" // Pre-configure all packages with debconf before they are installed. // If you don't like it, comment it out. DPkg::Pre-Install-Pkgs {"/usr/sbin/dpkg-preconfigure --apt || true";}; Dpg::Pre-Install-Pkgs {"/usr/sbin/dpkg-preconfigure --apt || true";}; DPkg::Pre-Install-Pkgs {"/usr/sbin/dpkg-preconfigure --apt || true";}; 'code' – Figgis1965 Mar 7 '18 at 0:20
• Hmm, so you've the same line repeated 3 times but there appears to be a typo in the second, this is possibly the issue. Remove the 2nd and 3rd Dpkg::Pre-Install-Pkgs lines and try my suggestions in the 2nd comment – Kevin Mooney Mar 7 '18 at 0:23
• I tried commenting out the line like you said and this is the error I got:- dpkg: unrecoverable fatal error, aborting: waiting for subprocess dpkg-split failed: No child processes W: Waited for dpkg --assert-multi-arch but it wasn't there - dpkgGo (10: No chil d processes) E: Sub-process /usr/bin/dpkg couldn't be waited for. E: Couldn't wait for subprocess - waitpid (10: No child processes) – Figgis1965 Mar 7 '18 at 0:35