1

I had reinstalled apache2 because my websites were all cache and now when I try to install it I get:

root@vps139242:~# sudo apt-get install apache2
Reading package lists... Done
Building dependency tree
Reading state information... Done
apache2 is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 48 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 apache2 (2.4.7-1ubuntu4.18) ...
ERROR: Config file dir.conf not properly enabled: /etc/apache2/mods-enabled/dir.conf is a real file, not touching it
dpkg: error processing package apache2 (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 apache2
E: Sub-process /usr/bin/dpkg returned an error code (1)

I've tried purging it and autoremove but still nothing I don't know what to do any help is appreciated.

2
  • Check you check disk space? Do you have any error on line before this error?
    – ob2
    Nov 23, 2017 at 21:55
  • What do you mean by "because my websites were all cache"?. Also if you properly reinstall, you will most probably lose all your custom configs. Anyway, this is the command sudo apt-get install apache2 --reinstall.
    – bistoco
    Nov 23, 2017 at 22:58

1 Answer 1

3

If you really want to reset your apache2 configuration, do the following steps.

# Rename your Apache2 configuration folder (just in case of).
sudo mv /etc/apache2 /etc/apache2.old

# Look up for all Apache2 package installed
dpkg -l | grep apache2

# Remove all Apache packages, usualy the following
apt remove --purge apache2 apache2-data apache2-bin

# Finally reinstall your Apache2 server
apt install apache2
8
  • root@vps139242:~# sudo apt install --reinstall apache2 Reading package lists... Done Building dependency tree Reading state information... Done 0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 48 not upgraded. 1 not fully installed or removed. After this operation, 0 B of additional disk space will be used. E: Internal Error, No file name for apache2:amd64
    – Rhys19
    Nov 23, 2017 at 22:07
  • Hum, seems to be a different error now, try sudo dpkg --configure -a.
    – ob2
    Nov 23, 2017 at 22:13
  • root@vps139242:~# sudo dpkg --configure -a Setting up apache2 (2.4.7-1ubuntu4.18) ... ERROR: Module mpm_event does not exist! dpkg: error processing package apache2 (--configure): subprocess installed post-installation script returned error exit status 1 Errors were encountered while processing: apache2 root@vps139242:~#
    – Rhys19
    Nov 23, 2017 at 22:15
  • I updated my answer :D
    – ob2
    Nov 23, 2017 at 22:22
  • @olivierb2 Suggestions: 1)Proposing a more elegant line for mvsudo mv /etc/apache2{,.old} 2)Reading and 48 not upgraded does explain for me why things may have gone wrong during reinstallation attempts.
    – Videonauth
    Nov 23, 2017 at 22:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .