Firstly, I'm running Ubuntu 15.04 (Velvet) on my local machine.

I recently uninstalled the LAMP stack due to several config issues I was experiencing (especially when I tried working with CodeIgniter). Wasn't sure if it were from PHP or Apache. But I know I'd done several edit configs on my PHP & Apache files of which I had forgotten where & when. Unistalling it all was the only option I could think of.

Now, I was re-installing the stack following the official guide on Ubuntu Help. While installing, I came across a few issues.

Screen shots are available here.

First Issue

Selecting previously unselected package mysql-server-5.6.
Preparing to unpack .../mysql-server-5.6_5.6.25-0ubuntu0.15.04.1_amd64.deb ...
grep: /etc/mysql/: No such file or directory
invoke-rc.d: Unit mysql.service is masked

mysql.service is masked. Does it mean inaccessible?

Second Issue

Setting up mysql-server-5.6 (5.6.25-0ubuntu0.15.04.1) ...
invoke-rc.d: Unit mysql.service is masked
update-alternatives: error: alternative path /etc/mysql/mysql.cnf doesn't exist
dpkg: error processing package mysql-server-5.6 (--configure):
   subprocess installed post-installation script returned error exit status 2
Setting up libalgorithm-c3-perl (0.09-1) ...

It repeated same invoke error as the first. But this time there was an additional file path & dpkg error

Thrid Issue

Setting up libtext-template-perl (1.46-1) ...
Setting up libsoftware-license-perl (0.103010-3) ...
Setting up libterm-ui-perl (0.42-1) ...
Setting up libtext-soundex-perl (3.4-1build2) ...
dpkg: dependency problems prevent configuration of mysql-server:
 mysql-server depends on mysql-server-5.6; however:
  Package mysql-server-5.6 is not configured yet.

dpkg: error processing package mysql-server (--configure):
 dependency problems - leaving unconfigured
Setting up rename (0.20-3) ...
No apport report written because the error message indicates its a followup error from a previous failure.
update-alternatives: using /usr/bin/file-rename to provide /usr/bin/rename (rename) in auto mode
Setting up libcgi-fast-perl (1:2.04-1) ...

Same dpkg error. Seems like it couldn't access a folder, it had to create its own and named it 'rename'

Fourth Issue

Module mpm_event disabled.
Enabling module mpm_prefork.
apache2_switch_mpm Switch to prefork
apache2_invoke: Enable module php5
Setting up apache2-mpm-prefork (2.4.10-9ubuntu1.1) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for systemd (219-7ubuntu6) ...
Errors were encountered while processing:
E: Sub-process /usr/bin/dpkg returned an error code (1)

I was hoping this fourth one is only a summary of the previous 3 errors, but I wasn't sure.

Like mentioned, I'm a novice in Linux. I don't want to mess with any file or folder so I don't screw it up like I always end up doing.

Seems like it all has to do with file access & permission.

If so, how then can I solve this thing please? It's really killing me. I have always had file permission issues trying to access folders (especially) within '/var/lib'.

If not so, what could be the possible issue, and how can I solve it?


  • 1
    Similar thread askubuntu.com/questions/614551/… check whether this could hep you with dpkg.
    – vembutech
    Aug 19, 2015 at 6:23
  • @vembutech I already tried that, it doesn't entirely solve the issue. "mysql-common" wasnt purged... It displayed a dpkg error. The "invoke-rc.d: Unit MySQL.service is masked" error still existed. Aug 19, 2015 at 13:27
  • @vembutech after giving it another try using tasksel, I got an error: "aptitude failed (100)" Aug 19, 2015 at 13:44

1 Answer 1


I solved this issue.

After several trial & error, what I did was:

  1. I rolled back an earlier backup (2 months old)
  2. I re-tried installing lamp sever using:

    sudo tasksel install lamp-server

This helped me identify the missing directories.

  1. I manually created the missing folders in the mysql directory

  2. Next, I ran these commands

    sudo dpkg-reconfigure --force mysql-server 
    sudo dpkg-reconfigure --force mysql-server-5.6
  3. I manually installed every other important php5 & mysql packages

Somehow, this worked for me. I'm not sure where I did it right, & if it has no side effect... so I don't advise anyone having similar issue to follow what I just out-laid.

However, you could keep exploring till you a get a fix. Document it, so in future you know exactly how you handled it in the past.

  • About 4 years later and this still cracks me up. Well, good times. :) Jun 7, 2021 at 23:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.