package mariadb-server-5.5 install/upgrade/remove returned error exit status 1 due to mysqld restart not being OK

Bug #1318163 reported by Pieroxy
28
This bug affects 4 people
Affects Status Importance Assigned to Milestone
mariadb-5.5 (Ubuntu)
Fix Released
Undecided
Otto Kekäläinen

Bug Description

I just clicked on "Install updates" (right click menu on the Software Updater icon on the launcher) and it reported a problem upgrading mariadb...

ProblemType: Package
DistroRelease: Ubuntu 14.04
Package: mariadb-server-5.5 5.5.36-1
ProcVersionSignature: Ubuntu 3.13.0-24.46-generic 3.13.9
Uname: Linux 3.13.0-24-generic x86_64
ApportVersion: 2.14.1-0ubuntu3
Architecture: amd64
Date: Sat May 10 14:04:21 2014
DuplicateSignature: package:mariadb-server-5.5:5.5.36-1:subprocess new pre-removal script returned error exit status 1
ErrorMessage: subprocess new pre-removal script returned error exit status 1
InstallationDate: Installed on 2014-04-29 (11 days ago)
InstallationMedia: Ubuntu 14.04 LTS "Trusty Tahr" - Release amd64 (20140417)
SourcePackage: mariadb-5.5
Title: package mariadb-server-5.5 5.5.36-1 failed to install/upgrade: subprocess new pre-removal script returned error exit status 1
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Pieroxy (pierregrimaud) wrote :
tags: removed: need-duplicate-check
Revision history for this message
Pieroxy (pierregrimaud) wrote :

The problem seems to be with dpkg not being able to stop mysqld, as showh when I typed in "sudo apt-get -f upgrade":

 * Stopping MariaDB database server mysqld [fail]
invoke-rc.d: initscript mysql, action "stop" failed.

Then I (naively) tried "sudo killall mysqld" and then tried again. dpkg went a step further and then I got a kernel panic... Trying again as you read this.

Revision history for this message
Pieroxy (pierregrimaud) wrote :

Well... Here is what I did next after my reboot:

sudo apt-get update
<lots of things ...>
E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.
pieroxy:~$ sudo dpkg --configure -a
Setting up empathy-common (3.8.6-0ubuntu9.1) ...
Setting up libpanel-applet-4-0 (1:3.8.0-1ubuntu12) ...
Setting up mariadb-server-5.5 (5.5.37-0ubuntu0.14.04.1) ...
 * Stopping MariaDB database server mysqld [fail]
invoke-rc.d: initscript mysql, action "stop" failed.
 * Starting MariaDB database server mysqld [ OK ]
Setting up gettext-base (0.18.3.1-1ubuntu3) ...
<lots of things ...>

and now sudo apt-get upgrade doesn't see anything to upgrade. I wonder in what kind of decayed state my mariadb is right now...

Revision history for this message
Pieroxy (pierregrimaud) wrote :

Just so you know, I installed my system last week. So it is a "fresh" install. At your disposal for any help you might need/

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in mariadb-5.5 (Ubuntu):
status: New → Confirmed
Revision history for this message
mevdschee (mevdschee) wrote :

maurits@maurits-Aspire-X3960:~$ sudo apt-get install -f
[sudo] password for maurits:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following extra packages will be installed:
  mariadb-server-5.5
Suggested packages:
  mailx mariadb-test tinyca
The following packages will be upgraded:
  mariadb-server-5.5
1 upgraded, 0 newly installed, 0 to remove and 5 not upgraded.
1 not fully installed or removed.
Need to get 0 B/3843 kB of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n]
Preconfiguring packages ...
(Reading database ... 167500 files and directories currently installed.)
Preparing to unpack .../mariadb-server-5.5_5.5.37-0ubuntu0.14.04.1_amd64.deb ...
 * Stopping MariaDB database server mysqld [fail]
invoke-rc.d: initscript mysql, action "stop" failed.
dpkg: warning: subprocess old pre-removal script returned error exit status 1
dpkg: trying script from the new package instead ...
 * Stopping MariaDB database server mysqld [fail]
invoke-rc.d: initscript mysql, action "stop" failed.
dpkg: error processing archive /var/cache/apt/archives/mariadb-server-5.5_5.5.37-0ubuntu0.14.04.1_amd64.deb (--unpack):
 subprocess new pre-removal script returned error exit status 1
 * Stopping MariaDB database server mysqld [fail]
invoke-rc.d: initscript mysql, action "stop" failed.
 * Starting MariaDB database server mysqld [ OK ]
Errors were encountered while processing:
 /var/cache/apt/archives/mariadb-server-5.5_5.5.37-0ubuntu0.14.04.1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

Revision history for this message
mevdschee (mevdschee) wrote :

Fresh install here too.. Fixed it by typing:

sudo killall mysqld
sudo apt-get -f install

Hope it helps for you :-)

Revision history for this message
Otto Kekäläinen (otto) wrote :

I suspect this is related: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=752203

Does any of you have mysqld related lines in your syslogs when MariaDB/mysqld fails to restart?

summary: - package mariadb-server-5.5 5.5.36-1 failed to install/upgrade:
- subprocess new pre-removal script returned error exit status 1
+ package mariadb-server-5.5 install/upgrade/remove returned error exit
+ status 1 due to mysqld restart not being OK
Revision history for this message
Otto Kekäläinen (otto) wrote :

Does the issue get fixed to anybody by running 'sudo rm -rf /var/lib/mysql/debian-*.flag' ?

If you encounter this again, please send a copy-paste of the apt-get output. The stuff apport automatically sends is useless in this case, what I really need is the printed output the user sees.

Changed in mariadb-5.5 (Ubuntu):
assignee: nobody → Otto Kekäläinen (otto)
Revision history for this message
Otto Kekäläinen (otto) wrote :
Download full text (3.3 KiB)

Did your syslog contain any line similar to these?

/etc/mysql/debian-start[3138]: Upgrading MySQL tables if necessary.
/etc/mysql/debian-start[3141]: /usr/bin/mysql_upgrade: the '--basedir' option is always ignored
/etc/mysql/debian-start[3141]: Looking for 'mysql' as: /usr/bin/mysql
/etc/mysql/debian-start[3141]: Looking for 'mysqlcheck' as: /usr/bin/mysqlcheck
/etc/mysql/debian-start[3141]: This installation of MySQL is already upgraded to 10.0.9-MariaDB, use --force if you still need to run mysql_upgrade
/etc/mysql/debian-start[3152]: Checking for insecure root accounts.
/etc/mysql/debian-start[3157]: Triggering myisam-recover for all MyISAM tables
/etc/mysql/debian-start[3719]: Upgrading MySQL tables if necessary.
/etc/mysql/debian-start[3722]: /usr/bin/mysql_upgrade: the '--basedir' option is always ignored
/etc/mysql/debian-start[3722]: Looking for 'mysql' as: /usr/bin/mysql
/etc/mysql/debian-start[3722]: Looking for 'mysqlcheck' as: /usr/bin/mysqlcheck
/etc/mysql/debian-start[3722]: This installation of MySQL is already upgraded to 10.0.9-MariaDB, use --force if you still need to run mysql_upgrade
/etc/mysql/debian-start[3733]: Checking for insecure root accounts.
/etc/mysql/debian-start[3738]: Triggering myisam-recover for all MyISAM tables
mysqld_safe[5671]:
mysqld_safe[5671]: Installation of system tables failed! Examine the logs in
mysqld_safe[5671]: /var/lib/mysql for more information.
mysqld_safe[5671]:
mysqld_safe[5671]: The problem could be conflicting information in an external
mysqld_safe[5671]: my.cnf files. You can ignore these by doing:
mysqld_safe[5671]:
mysqld_safe[5671]: shell> /usr/scripts/scripts/mysql_install_db --defaults-file=~/.my.cnf
mysqld_safe[5671]:
mysqld_safe[5671]: You can also try to start the mysqld daemon with:
mysqld_safe[5671]:
mysqld_safe[5671]: shell> /usr/sbin/mysqld --skip-grant --general-log &
mysqld_safe[5671]:
mysqld_safe[5671]: and use the command line tool /usr/bin/mysql
mysqld_safe[5671]: to connect to the mysql database and look at the grant tables:
mysqld_safe[5671]:
mysqld_safe[5671]: shell> /usr/bin/mysql -u root mysql
mysqld_safe[5671]: mysql> show tables
mysqld_safe[5671]:
mysqld_safe[5671]: Try 'mysqld --help' if you have problems with paths. Using
mysqld_safe[5671]: --general-log gives you a log in /var/lib/mysql that may be helpful.
mysqld_safe[5671]:
mysqld_safe[5671]: The latest information about mysql_install_db is available at
mysqld_safe[5671]: https://mariadb.com/kb/en/installing-system-tables-mysql_install_db
mysqld_safe[5671]: MariaDB is hosted on launchpad; You can find the latest source and
mysqld_safe[5671]: email lists at http://launchpad.net/maria
mysqld_safe[5671]:
mysqld_safe[5671]: Please check all of the above before submitting a bug report
mysqld_safe[5671]: at http://mariadb.org/jira
mysqld_safe[5671]:
/etc/init.d/mysql[6513]: 0 processes alive and '/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf ping' resulted in
/etc/init.d/mysql[6513]: #007/usr/bin/mysqladmin: connect to server at 'localhost' failed
/etc/init.d/mysql[6513]: error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)'
/etc/i...

Read more...

Revision history for this message
Otto Kekäläinen (otto) wrote :

What if you run 'rm /var/lib/mysql/ib_logfile*' and then try again to install/upgrade MariaDB and run it?

It helps if your /var/log/mysql/error.log contains something like:
InnoDB: Error: log file ./ib_logfile0 is of different size 0 50331648 bytes
InnoDB: than specified in the .cnf file 0 5242880 bytes!

That is a case that easily happens if a newly installed my.cnf does not match the data in /var/lib/mysql

Revision history for this message
Jeffrey Bouter (jbouter) wrote :

Fixed it by doing:
dpkg --configure -a
killall mysqld
apt-get install -f

After the apt-get install -f I got the question if I "really wanted to migrate to mariadb" (which I think is weird, since it's what was installed in the first place), after answering "Yes", all went fine.

Revision history for this message
Otto Kekäläinen (otto) wrote :

The init file has got some fixes in upstream Debian and I believe they fix this issue as well.

Changed in mariadb-5.5 (Ubuntu):
status: Confirmed → Fix Committed
Revision history for this message
muqeem saifi (mohdmuqeemkhan3) wrote :

subprocess new pre-installation script returned error exit status 255
E: Sub-process /usr/bin/dpkg returned an error code (1)

Revision history for this message
Otto Kekäläinen (otto) wrote :

This was fixed in http://anonscm.debian.org/cgit/pkg-mysql/mariadb-5.5.git/commit/?id=f8035cbf and will enter Ubuntu 14.04 and 14.10 via the stable release update path of 5.5.41.

Otto Kekäläinen (otto)
Changed in mariadb-5.5 (Ubuntu):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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