package mysql-server-5.1 5.1.37-1ubuntu5 failed to install/upgrade: subprocess installed pre-removal script returned error exit status 1

Bug #501655 reported by Kumar
52
This bug affects 10 people
Affects Status Importance Assigned to Milestone
mysql-dfsg-5.1 (Ubuntu)
In Progress
Low
Unassigned

Bug Description

Upgrading or shutting down mysql fails with exit status 1. This is due to a missing system-maintainer user in the mysql user database. To reproduce this bug, ensure that the user "debian-sys-maint" is not in the mysql.user database.

---Problem---
Changes for the versions:
5.1.37-1ubuntu5
5.1.37-1ubuntu5.1

Error alert said:
E: /var/cache/apt/archives/mysql-server-5.1_5.1.37-1ubuntu5.1_amd64.deb: subprocess new pre-removal script returned error exit status 1

bip@apollo:~$ sudo /etc/init.d/mysql stop
 * Stopping MySQL database server mysqld [fail]
bip@apollo:~$ sudo /etc/init.d/mysql status
/usr/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'debian-sys-maint'@'localhost' (using password: YES)'
 *bip@apollo:~$ sudo /etc/init.d/mysql status
/usr/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'debian-sys-maint'@'localhost' (using password: YES)'
-- snip --/usPreparing to replace mysql-server-5.1 5.1.37-1ubuntu5 (using .../mysql-server-5.1_5.1.37-1ubuntu5.1_amd64.deb) ...
 * Stopping MySQL database server mysqld
   ...fail!
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
   ...fail!

Revision history for this message
Kumar (kumarldh) wrote :
Revision history for this message
Chuck Short (zulcss) wrote :

Hi,

I was wondering if you were still having this problem.

Regards
chuck

Changed in mysql-dfsg-5.1 (Ubuntu):
importance: Undecided → Low
status: New → Incomplete
Revision history for this message
gep (gep) wrote :

I solved the problem. My mysql files and tabled where cirrupted so mysqld had no chance to be stopped. That is why reinstallation crashed

Revision history for this message
Chuck Short (zulcss) wrote :

Thanks closing then.

regards
chuck

Changed in mysql-dfsg-5.1 (Ubuntu):
status: Incomplete → Invalid
Revision history for this message
brian (brian-zijn-digital) wrote :

I just got this when running Update Manager.

$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=9.10
DISTRIB_CODENAME=karmic
DISTRIB_DESCRIPTION="Ubuntu 9.10"

$ uname -a
Linux apollo 2.6.31-19-generic #56-Ubuntu SMP Thu Jan 28 02:39:34 UTC 2010 x86_64 GNU/Linux

Changes for the versions:
5.1.37-1ubuntu5
5.1.37-1ubuntu5.1

Error alert said:
E: /var/cache/apt/archives/mysql-server-5.1_5.1.37-1ubuntu5.1_amd64.deb: subprocess new pre-removal script returned error exit status 1

details:
-- snip --
Setting up linux-generic (2.6.31.20.33) ...
Setting up linux-headers-generic (2.6.31.20.33) ...
Setting up mysql-server-core-5.1 (5.1.37-1ubuntu5.1) ...
Setting up mysql-server (5.1.37-1ubuntu5.1) ...
Setting up mysql-client-5.1 (5.1.37-1ubuntu5.1) ...

Setting up mysql-client (5.1.37-1ubuntu5.1) ...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
-- snip --

MySQL was stopped afterward. It started up again fine.

There was nothing in the MySQL log but the following was in /var/log/messages:

Feb 10 14:06:06 apollo kernel: [ 7085.890655] type=1503 audit(1265828766.543:35): operation="open" pid=9008 parent=9007 profile="/usr/sbin/mysqld" requested_mask="r::" denied_mask="r::" fsuid=0 ouid=0 name="/sys/devices/system/cpu/"
Feb 10 14:06:10 apollo kernel: [ 7090.082048] type=1503 audit(1265828770.733:36): operation="open" pid=9029 parent=9028 profile="/usr/sbin/mysqld" requested_mask="r::" denied_mask="r::" fsuid=0 ouid=0 name="/sys/devices/system/cpu/"
Feb 10 14:06:10 apollo kernel: [ 7090.174701] type=1503 audit(1265828770.823:37): operation="open" pid=9050 parent=9049 profile="/usr/sbin/mysqld" requested_mask="r::" denied_mask="r::" fsuid=0 ouid=0 name="/sys/devices/system/cpu/"

Revision history for this message
Ben Thornton (smenjas) wrote :

As far as I can tell, my database files are not corrupted, and yet the installation failed anyway.

I explicitly stopped MySQL with the following command:

sudo /etc/init.d/mysql stop

then tried the upgrade again, and it still failed with the same message (see the bug summary).

Revision history for this message
Kumar (kumarldh) wrote : Re: [Bug 501655] Re: package mysql-server-5.1 5.1.37-1ubuntu5 failed to install/upgrade: subprocess installed pre-removal script returned error exit status 1

I too faced this issue, last time my MySQL somehow got updated and I wasn't
able to login to MySQL server. MySQL db was corrupted, I had to kill MySQL
and then run mysqlupgrade script. Do I reply to your email or comment on
bugs.launchpad? I just noticed your email.

On 11 February 2010 02:12, Ben Thornton <email address hidden> wrote:

> As far as I can tell, my database files are not corrupted, and yet the
> installation failed anyway.
>
> I explicitly stopped MySQL with the following command:
>
> sudo /etc/init.d/mysql stop
>
> then tried the upgrade again, and it still failed with the same message
> (see the bug summary).
>
> --
> package mysql-server-5.1 5.1.37-1ubuntu5 failed to install/upgrade:
> subprocess installed pre-removal script returned error exit status 1
> https://bugs.launchpad.net/bugs/501655
> You received this bug notification because you are a direct subscriber
> of the bug.
>

--
Regards,
Kumar Chetan Sharma
A Proud Indian

http://www.kumarchetan.com/

Hacker Key Follows
v3sw6hw5ln2pr6Pck6ma2u6Lw5T!ml6K/R/Ci2e5t5b7en4g1aIs3/4Mr1p7 hackerkey.com

Revision history for this message
brian (brian-zijn-digital) wrote :

The update appear to be failing because MySQL cannot be shutdown. I just tried again and this time explicitly tried to first stop MySQL:

-- snip --
bip@apollo:~$ sudo /etc/init.d/mysql stop
 * Stopping MySQL database server mysqld [fail]
bip@apollo:~$ sudo /etc/init.d/mysql status
/usr/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'debian-sys-maint'@'localhost' (using password: YES)'
 *
bip@apollo:~$ mysql mysql -uroot -p
Enter password:
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 29
Server version: 5.1.37-1ubuntu5.1 (Ubuntu)

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> \q
Bye
bip@apollo:~$ sudo /etc/init.d/mysql status
/usr/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'debian-sys-maint'@'localhost' (using password: YES)'
-- snip --

So, for some reason, i cannot stop it. And, apparently, neither can dpkg.

-- snip --
Preparing to replace mysql-server-5.1 5.1.37-1ubuntu5 (using .../mysql-server-5.1_5.1.37-1ubuntu5.1_amd64.deb) ...
 * Stopping MySQL database server mysqld
   ...fail!
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
   ...fail!
invoke-rc.d: initscript mysql, action "stop" failed.
dpkg: error processing /var/cache/apt/archives/mysql-server-5.1_5.1.37-1ubuntu5.1_amd64.deb (--unpack):
 subprocess new pre-removal script returned error exit status 1
 * Stopping MySQL database server mysqld
   ...fail!
invoke-rc.d: initscript mysql, action "stop" failed.
 * Starting MySQL database server mysqld
   ...done.
Preparing to replace libdvdnav4 4.1.3-3 (using .../libdvdnav4_4.1.3-3ubuntu1_amd64.deb) ...
Unpacking replacement libdvdnav4 ...
Errors were encountered while processing:
 /var/cache/apt/archives/mysql-server-5.1_5.1.37-1ubuntu5.1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
A package failed to install. Trying to recover:
Setting up libdvdnav4 (4.1.3-3ubuntu1) ...

Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
-- snip --

I'm fairly new to Ubuntu (coming from Fedora) and don't know anything about debian-sys-maint. Is it normal that this user would be used to stop the daemon from the /etc/init.d script?

bip@apollo:~$ sudo grep debian /etc/mysql/debian.cnf
user = debian-sys-maint
user = debian-sys-maint

Is there any chance this user was only just recently added and MySQL doesn't for some reason know about it? It's not listed in the mysql.user table. I'm more of a Postgres guy so i may be off-base here, but it's not in /etc/passwd, either, so I'm assuming it's supposed to be a MySQL user.

Revision history for this message
brian (brian-zijn-digital) wrote :
Download full text (3.5 KiB)

OK, it looks like this user needs to be in MySQL's user table.

bip@apollo:/etc/mysql$ sudo cat debian.cnf
# Automatically generated for Debian scripts. DO NOT TOUCH!
[client]
host = localhost
user = debian-sys-maint
password = XXXXXXXXXX
socket = /var/run/mysqld/mysqld.sock
[mysql_upgrade]
host = localhost
user = debian-sys-maint
password = XXXXXXXXXX
socket = /var/run/mysqld/mysqld.sock
basedir = /usr

I logged in using mysql mysql -uroot -p

mysql> GRANT ALL ON *.* TO 'debian-sys-maint'@'localhost' IDENTIFIED BY 'XXXXXXXXXX';
Query OK, 0 rows affected (0.00 sec)

mysql>FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

mysql> \q
Bye
bally@apollo:/etc/mysql$ sudo /etc/init.d/mysql stop
 * Stopping MySQL database server mysqld [ OK ]

bally@apollo:/etc/mysql$ sudo /etc/init.d/mysql start
 * Starting MySQL database server mysqld [ OK ]
 * Checking for corrupt, not cleanly closed and upgrade needing tables.

I then ran Update Manager. This is from /var/log/dpkg.log (I can't figure out where the terminal output from Udate Manager is logged but it explicitly showed the DB being properly shut down):

-- snip --
2010-02-11 15:49:49 startup archives unpack
2010-02-11 15:49:50 upgrade mysql-server-5.1 5.1.37-1ubuntu5 5.1.37-1ubuntu5.1
2010-02-11 15:49:50 status half-configured mysql-server-5.1 5.1.37-1ubuntu5
2010-02-11 15:49:52 status unpacked mysql-server-5.1 5.1.37-1ubuntu5
2010-02-11 15:49:52 status half-installed mysql-server-5.1 5.1.37-1ubuntu5
2010-02-11 15:49:53 status triggers-pending ureadahead 0.90.3-2
2010-02-11 15:49:53 status half-installed mysql-server-5.1 5.1.37-1ubuntu5
2010-02-11 15:49:54 status triggers-pending man-db 2.5.6-2
2010-02-11 15:49:54 status half-installed mysql-server-5.1 5.1.37-1ubuntu5
2010-02-11 15:49:54 status half-installed mysql-server-5.1 5.1.37-1ubuntu5
2010-02-11 15:49:55 status unpacked mysql-server-5.1 5.1.37-1ubuntu5.1
2010-02-11 15:49:55 status unpacked mysql-server-5.1 5.1.37-1ubuntu5.1
2010-02-11 15:49:55 trigproc ureadahead 0.90.3-2 0.90.3-2
2010-02-11 15:49:55 status half-configured ureadahead 0.90.3-2
2010-02-11 15:49:55 status installed ureadahead 0.90.3-2
2010-02-11 15:49:55 trigproc man-db 2.5.6-2 2.5.6-2
2010-02-11 15:49:55 status half-configured man-db 2.5.6-2
2010-02-11 15:49:56 status installed man-db 2.5.6-2
2010-02-11 15:49:57 startup packages configure
2010-02-11 15:49:57 configure mysql-server-5.1 5.1.37-1ubuntu5.1 5.1.37-1ubuntu5.1
2010-02-11 15:49:57 status unpacked mysql-server-5.1 5.1.37-1ubuntu5.1
2010-02-11 15:49:57 status unpacked mysql-server-5.1 5.1.37-1ubuntu5.1
2010-02-11 15:49:57 status unpacked mysql-server-5.1 5.1.37-1ubuntu5.1
2010-02-11 15:49:57 status unpacked mysql-server-5.1 5.1.37-1ubuntu5.1
2010-02-11 15:49:57 status unpacked mysql-server-5.1 5.1.37-1ubuntu5.1
2010-02-11 15:49:57 status unpacked mysql-server-5.1 5.1.37-1ubuntu5.1
2010-02-11 15:49:57 status unpacked mysql-server-5.1 5.1.37-1ubuntu5.1
2010-02-11 15:49:57 status unpacked mysql-server-5.1 5.1.37-1ubuntu5.1
2010-02-11 15:49:57 status unpacked mysql-server-5.1 5.1.37-1ubuntu5.1
2010-02-11 15:49:57 status half-configured mysql-server-5.1 5....

Read more...

Revision history for this message
Kumar (kumarldh) wrote :

@ Brian, you are right. I am right now able to pull up the web page where I read about "debian-sys-maint" users, it said that Ubuntu uses "debian-sys-maint" to update/upgrade MySQL installations. The bad thing that happened with me was the update went fine and my MySQL installation, MySQL.users table, was corrupted. My root account was no more valid. I wasn't able to stop MySQL. I had to kill it either using kill command or system monitor. Once MySQL was down I backed up my data folder and ran the mysqlupgrade script. May be this all due to missing "debian-sys-maint" account in mysql.users table. I just noticed that even in my backed up mysql.user tables there is no "debian-sys-maint" user. I will spend some more time on it and will try to find out the pages and other related resources.

Revision history for this message
Sebastian Geiger (lanoxx) wrote :

I can confirm this bug, and that the solution from brian works. I have summed it up, changed the bug description and set status to in progress, since with this solution I was able to successfully upgrade Mysql.

Cheers Lanoxx

---Solution---
If the user is not in the database you can fix it with these statements:

1. Step one, get the password for "debian-sys-maint":
~$ sudo cat /etc/mysql/debian.cnf |grep debian -C 5
[client]
host = localhost
user = debian-sys-maint
password = XXXXXXXXXX
socket = /var/run/mysqld/mysqld.sock
[mysql_upgrade]
user = debian-sys-maint
password = XXXXXXXXXX
socket = /var/run/mysqld/mysqld.sock
basedir = /usr
2. Login to mysql as root and create the user "debian-sys-maint" with the password from above
~$mysql -uroot -p
***
>GRANT ALL ON *.* TO 'debian-sys-maint'@'localhost' IDENTIFIED BY 'XXXXXXXXXX';

description: updated
Changed in mysql-dfsg-5.1 (Ubuntu):
status: Invalid → In Progress
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.