mysql-server-5.0 upgrade problem. Unable to install anything.

Yesterday a bunch of updates were available for Mysql and php related stuff, so I upgraded but some problems with mysql started occurring. Aptitude said that it was unable to update due to some errors, but the rest installed fine and it even seems that Mysql upgraded ('mysql --version' gives the up-to-date version). I still keep getting the errors though, and I am unable to update the mysql-server-5.0 package, and due to the problems with that I am unable to install any other packages.

Here's what I get when I try to update mysql:

n$ sudo aptitude dist-upgrade
Reading package lists... Done
Building dependency tree... Done
Reading extended state information
Initializing package states... Done
Reading task descriptions... Done
Building tag database... Done
The following packages will be upgraded:
  mysql-server-5.0
1 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0B/25.6MB of archives. After unpacking 16.4kB will be used.
Do you want to continue? [Y/n/?] y
Writing extended state information... Done
Preconfiguring packages ...
Selecting previously deselected package mysql-server-5.0.
(Reading database ... 63770 files and directories currently installed.)
Preparing to replace mysql-server-5.0 5.0.26-3 (using .../mysql-server-5.0_5.0.2 7-1_amd64.deb) ...
Stopping MySQL database server: mysqld.
/etc/lsb-base-logging.sh: line 42: RUNLEVEL: unbound variable
invoke-rc.d: initscript mysql, action "stop" failed.
dpkg: warning - old pre-removal script returned error exit status 1
dpkg - trying script from the new package instead ...
Stopping MySQL database server: mysqld.
/etc/lsb-base-logging.sh: line 42: RUNLEVEL: unbound variable
invoke-rc.d: initscript mysql, action "stop" failed.
dpkg: error processing /var/cache/apt/archives/mysql-server-5.0_5.0.27-1_amd64.deb (--unpack):
 subprocess new pre-removal script returned error exit status 1
Stopping MySQL database server: mysqld.
/etc/lsb-base-logging.sh: line 42: RUNLEVEL: unbound variable
invoke-rc.d: initscript mysql, action "stop" failed.
Starting MySQL database server: mysqld.
/etc/lsb-base-logging.sh: line 42: RUNLEVEL: unbound variable
invoke-rc.d: initscript mysql, action "start" failed.

At that point it just seems to hang, so I ctrl+c and get this:

dpkg: error while cleaning up:
 subprocess post-installation script killed by signal (Interrupt)
Errors were encountered while processing:
 /var/cache/apt/archives/mysql-server-5.0_5.0.27-1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
A package failed to install.  Trying to recover:
dpkg: error processing mysql-server-5.0 (--configure):
 Package is in a very bad inconsistent state - you should
 reinstall it before attempting configuration.
Errors were encountered while processing:
 mysql-server-5.0

(Note: I have tried to just leave aptitude doing it's thing for an hour or so, but it didn't do anything)

When I try to install something I get this:

$ sudo aptitude install automake
Reading package lists... Done
Building dependency tree... Done
Reading extended state information
Initializing package states... Done
Reading task descriptions... Done
Building tag database... Done
The following NEW packages will be automatically installed:
  autoconf
The following packages have been kept back:
  mysql-server-5.0
The following NEW packages will be installed:
  autoconf automake
0 packages upgraded, 2 newly installed, 0 to remove and 1 not upgraded.
Need to get 0B of archives. After unpacking 3195kB will be used.
Do you want to continue? [Y/n/?] y
Writing extended state information... Error!
E: I wasn't able to locate file for the mysql-server-5.0 package. This might mean you need to manually fix this package.
E: Couldn't lock list directory..are you root?

I tried removing and reinstalling MySQL but it doesn't allow me to do that either.

Is there anyway to override this error and remove MySQL to reinstall it? Does anyone know why this error even occurs? I seriously need help :(

Edit: I managed to at least get Apt to a working state by removing the package entries in the status files under /var/lib/dpkg/. I am still unable to install or remove MySQL though, the major problem appears to be with lsb-base.
I cannot start the MySQL server which still appears to be installed (though it isn't in apt's database) due to an error:

$ sudo /etc/init.d/mysql start
Starting MySQL database server: mysqld . . . . . . . . . . . . . . failed!
/etc/lsb-base-logging.sh: line 42: RUNLEVEL: unbound variable

Could someone please help? I need MySQL for web development :(

No votes yet

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Quick and dirty fix

I had this problem today, I don't believe it's mysql related, and there was no need to do anything with mysql to work around it.

I encountered this today on dist-upgrade of debian sid, in sidux [ http://sidux.com ] run sid. apt-get install -f did not resolve it, dist-upgrade halted on errors no matter what I did.

The same exact error, so after poking around a little, and realizing that maybe the error message actually meant what it said, that the RUNLEVEL variable on line 42 was in fact not set.

Because I needed the upgrade to finish, I just did a simple hack, like this:

<br />
#<br />
# The first piece is just what it is /lib/lsb/init-functions<br />
# for debian. We probably should supply something else for<br />
# ubuntu.<br />
#<br />
# TODO we need to know whats the next step in the progress<br />
# file and send exit to Splashy before X starts (after setting<br />
# the percentage to the right amount)<br />
#### NOTE: I ADDED THIS RUNLEVEL VARIABLE INITIALIZATION HERE:<br />
RUNLEVEL=''<br />
# int log_end_message (int exitstatus)<br />
log_end_msg () {<br />
    # If no arguments were passed, return<br />
    [ -z "${1:-}" ] && return 1<br />

Adding that RUNLEVEL initiatialization fixed the halt, allowed mysql to finish installing. I want to stress though, this looks like an error in this config file by the, I assume, ubuntu, developer.

I'm not sure what the consequences to this hack are, but since I don't use splashy it's probably not going to be that bad.

Sorry about the extra
junk that's a bug with this blog software, not my fault.

Quick and dirty fix

sorry about the break tags, somebody should fix this software to make it post correctly, anyway, ignore all < br / > tags in that above posting.

Syndicate content