1

To be honest i'm not using Ubuntu but Debian (7.8), but as the commands are almost alike and this doesn't seem like an OS related problem to me, I figured I'd ask it on this glorious forum.

I'm having a problem trying to upgrade my system. I've tried to run apt-get upgrade -f (this is all in root btw) but it return the following result:

root@*******:/# apt-get upgrade -f    
Reading package lists... Done  
Building dependency tree  
Reading state information... Done  
The following packages will be upgraded:  
  mysql-server-5.5  
1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.  
8 not fully installed or removed.  
Need to get 0 B/2,093 kB of archives.  
After this operation, 6,144 B of additional disk space will be used.  
Do you want to continue [Y/n]? y  
Reading changelogs... Done  
Preconfiguring packages ...  
(Reading database ... 77057 files and directories currently installed.)  
Preparing to replace mysql-server-5.5 5.5.38-0+wheezy1 (using .../mysql-server-5.5_5.5.40-0+wheezy1_amd64.deb) ...  
[FAIL] Stopping MySQL database server: mysqld failed!  
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 ...  
[FAIL] Stopping MySQL database server: mysqld failed!  
invoke-rc.d: initscript mysql, action "stop" failed.  
dpkg: error processing /var/cache/apt/archives/mysql-server-5.5_5.5.40-0+wheezy1_amd64.deb (--unpack):  
 subprocess new pre-removal script returned error exit status 1  
[FAIL] Stopping MySQL database server: mysqld failed!  
invoke-rc.d: initscript mysql, action "stop" failed.  
[ ok ] Starting MySQL database server: mysqld already running.  
Errors were encountered while processing:  
 /var/cache/apt/archives/mysql-server-5.5_5.5.40-0+wheezy1_amd64.deb  
E: Sub-process /usr/bin/dpkg returned an error code (1)  

Now I've tried searching for dpkg returning error code (1) but I can't really seem to solve this specific case of it.

I hope someone is able to offer me the help I need, I would really appreciate it.

Kind Regards,
Remy

EDIT >>

@vembutech I've tried looking into /var/lib/dpkg/status, and I I found the following about mysql-server-5.5 [http://pastebin.com/8DzKnY2x][1].

@Wang Xiaoyu I only get the following lines when doing that command:

Reading package lists... Done
Building dependency tree
Reading state information... Done

@octavian When I try to stop mysqld I get the following error:

root@149-210-180-7:~# service mysqld stop
mysqld: unrecognized service

Though when I try to stop mysql I get the following error:

[FAIL] Stopping MySQL database server: mysqld failed!

  • Try with the following command and check whether dpkg status. sudo -i, gedit /var/lib/dpkg/status. – vembutech Jan 13 '15 at 12:18
  • @vembutech I've replied with an edit – Handige Harrie Jan 14 '15 at 1:06
  • 1
    This slipped through migration but in future, please use unix.stackexchange.com – RolandiXor Mar 31 '15 at 5:47
  • I was unaware of that subdomain, I will use that one in the future. – Handige Harrie Apr 1 '15 at 7:23
3

It does look like you need to stop / kill the MySQL database first, then update:

[FAIL] Stopping MySQL database server: mysqld failed!  
invoke-rc.d: initscript mysql, action "stop" failed.

I'm not sure what the executable is called, but if it's got "sql" in it's name somewhere then running this should find it's pid (maybe among others):

ps aux | grep -i sql

Then try killing it (kill <pid> or kill -9 <pid> or sudo kill <pid>, etc...) and another ps just in case it's re-spawned.

Then install & it should work...?

  • Thank you so much! After killing the running mysqld process with the kill command everything upgraded just fine! – Handige Harrie Jan 14 '15 at 13:15
  • No problem, the accepted answer/check-mark, + upvote is thanks enough :-) As to why mysqld wouldn't stop, I'm not sure. Searching for mysql-server-5.5 5.5.38-0+wheezy1 had a similar hit superuser.com/questions/502822/… their answers were to replace "my-huge.cnf" with the original "my.cnf", or even purge "all the mysql application" and delete /var/lib/mysql but that would also delete your data/databse, so I don't like that idea without a good backup first (should backup before an upgrade too, to be a "perfect user" ;-) – Xen2050 Jan 14 '15 at 20:53
0

It looks to me as if you had mysql-server-5.5 already installed, at least the daemon mysqld is running. dpkg fails to stop this daemon. Try stopping it manually before running apt-get upgrade -f via sudo service mysqld stop.

  • I've replied with an edit – Handige Harrie Jan 14 '15 at 1:06
  • Ok, let's check if the service is running at all: ps aux | grep mysql – octavian Jan 14 '15 at 12:14
0

ok,it looks some wrong with installing. So, you can try

dpkg -C or sudo apt-get check

to find information about error code 1.

  • I've replied with an edit – Handige Harrie Jan 14 '15 at 1:06
  • i have found it which is E: Sub-process /usr/bin/dpkg returned an error code (1) . you know , if apt-get upgrade operation generates some error code, such as error code(1), which can be found some log information by using dpkg -C command. are u sure to do dpkg -C command? – Wang Xiaoyu Jan 14 '15 at 1:22

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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