LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 10-16-2007, 11:50 AM   #1
Russianspi
LQ Newbie
 
Registered: May 2007
Posts: 19

Rep: Reputation: 2
MySQL on Ubuntu Won't Start After Hard Reset


Hi everyone. I am running Ubuntu Feisty Fawn 7.04 Desktop. I am using it as a LAMP server for some hobby pages (A blog, pictures of my baby, etc.). It has some bad RAM that makes it freeze up every once in a while (1-2 times a month). I usually just put up with this, as it just requires a restart of my machine. The trouble is, when this happened most recently, my mysql server failed to start (silently). I noticed a few days later when I tried to access my blog and got an error. I used ssh to check on my machine, and sure enough, mysql was not running. In fact, even with /etc/init.d/mysql start, the result I got was: "failed". I' tried dmesg | tail and I also tried looking at /var/log/mysql.err and /var/log/mysql.log, but both seemed to be empty. Being set up just for the fun of it, I didn't think to backup my server (I know, stupid, and I promise I will back it up regularly if I can get it back up and running). Anyway, I'd love to get it back up and running, but I'm at a loss. I really don't want to reinstall mysql, because that means that I'd have to re-setup all of my LAMP applications. Any ideas?
 
Old 10-16-2007, 12:07 PM   #2
Road
Member
 
Registered: Jan 2002
Distribution: Debian Based only but have tried most others.
Posts: 82

Rep: Reputation: 15
Try to restart mysql and double check that nothing is showing up in the syslog or the mysql logs. Without any leads my gut instinct says you have a corrupt table that happened during the hard boot. This should be helpful:

http://dev.mysql.com/doc/refman/5.1/en/myisamchk.html

http://dev.mysql.com/doc/refman/5.1/...test-case.html
 
Old 10-16-2007, 12:09 PM   #3
selva146
Member
 
Registered: Oct 2007
Location: INDIA
Distribution: Rehat, Fedora, RHEL
Posts: 47

Rep: Reputation: 15
just check the /var/log/messages file for the reason mysql startup failure.

so check the file probably mysql.pid (i m not sure) in the system under /var/run/ (i am not sure).

if exists delete that file and then start the mysql service
 
Old 10-17-2007, 03:49 PM   #4
Russianspi
LQ Newbie
 
Registered: May 2007
Posts: 19

Original Poster
Rep: Reputation: 2
Thank you both for your answers. I tried killing all of the PID's and then restarting - still no luck. var/log/messages held no answers (no mention of mysql there). myisamchk is VERY cool. I really like it, and I'll tuck this tool away in my brain. Unfortunately, even after I run it with the -r option, I still can't start mysql. I have a question: If I backup my data directory and reinstall mysql, and then put my old data into the new data directory, will my databases come back, or would that not work?
 
Old 10-17-2007, 04:52 PM   #5
Road
Member
 
Registered: Jan 2002
Distribution: Debian Based only but have tried most others.
Posts: 82

Rep: Reputation: 15
Generally speaking yes they will and I have done that process exactly. If you have a SQL dump thats better but copying the tables by hand has worked for me in the past. The mysql hotcopy makes a physical copy, it just makes sure no transactions are happening. If your using binary logs that may cause issues but most likely you will be fine as I think that only happens when syncing between databases.

For testing purposes I would first backup all the files. For time sake you can try to reinstall.

apt-get --reinstall install packagename

if that does not work I would try a purge (make sure the tables are not left in the directory). Do an install. Then see if it starts. If it starts stop mysql, copy the tables back and then restart and see what happens (make sure permissions are correct on the tables).
 
Old 10-17-2007, 10:55 PM   #6
Russianspi
LQ Newbie
 
Registered: May 2007
Posts: 19

Original Poster
Rep: Reputation: 2
Well, progress...I suppose. I went to run Synaptic, and (upon getting an error message) I realized my problem: I was running Ubuntu Update when my system froze. That's what clobbered my mysql install. I tried backing up my data files and reinstalling, but still got errors:

Code:
dmay@mayfamily:~$ sudo dpkg --configure -a
Setting up mysql-server-5.0 (5.0.38-0ubuntu1.1) ...
 * Stopping MySQL database server mysqld                                 [fail] 
invoke-rc.d: initscript mysql, action "stop" failed.
 * Starting MySQL database server mysqld                                 [fail] 
invoke-rc.d: initscript mysql, action "start" failed.
dpkg: error processing mysql-server-5.0 (--configure):
 subprocess post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of mysql-server:
 mysql-server depends on mysql-server-5.0; however:
  Package mysql-server-5.0 is not configured yet.
dpkg: error processing mysql-server (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 mysql-server-5.0
 mysql-server
Any Ideas?
 
Old 10-18-2007, 02:05 AM   #7
Russianspi
LQ Newbie
 
Registered: May 2007
Posts: 19

Original Poster
Rep: Reputation: 2
At a loss

Wow, I am at a loss. I did an apt-get purge mysql-server mysql-server-5.0 (after backing up my data directory) and still got "invoke-rc.d: initscript mysql, action "start" failed". Thinking that maybe my hard crash had corrupted a .deb download, I cleared /var/cache/apt/archives/. This time, when I ran apt-get install mysql-server mysql-server-5.0, it downloaded the .deb file again. Unfortunately, it still fails, just like before.
 
Old 10-18-2007, 10:39 AM   #8
Road
Member
 
Registered: Jan 2002
Distribution: Debian Based only but have tried most others.
Posts: 82

Rep: Reputation: 15
ahh so it was during an update well this gets a bit more interesting. Lets try to keep it simple and see what happens.

If you have aptitude installed lets see if we can start from scratch

aptitude update
aptitude upgrade

See if that gets the dependencies. Also try:

dpkg-reconfigure package-name

and see if that gets you anywhere. If your still stuck it has to do with the package management that can be a bit tricky to get to come back alive.
 
Old 10-18-2007, 12:31 PM   #9
Russianspi
LQ Newbie
 
Registered: May 2007
Posts: 19

Original Poster
Rep: Reputation: 2
Tried the aptitude update/aptitude-upgrade last night. Here is all of my command line output from the upgrade:

Code:
 aptitude upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
Building tag database... Done
No packages will be installed, upgraded, or removed.
0 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0B of archives. After unpacking 0B will be used.
Setting up mysql-server-5.0 (5.0.38-0ubuntu1.1) ...
 * Stopping MySQL database server mysqld                                 [ OK ]
 * Starting MySQL database server mysqld                                 [fail]
invoke-rc.d: initscript mysql, action "start" failed.
(Hangs here, a CTRL-C moves it along...)
Code:
dpkg: error processing mysql-server-5.0 (--configure):
 subprocess post-installation script killed by signal (Interrupt)
dpkg: dependency problems prevent configuration of mysql-server:
 mysql-server depends on mysql-server-5.0; however:
  Package mysql-server-5.0 is not configured yet.
dpkg: error processing mysql-server (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 mysql-server-5.0
 mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
A package failed to install.  Trying to recover:
Setting up mysql-server-5.0 (5.0.38-0ubuntu1.1) ...
 * Stopping MySQL database server mysqld                                 [fail]
invoke-rc.d: initscript mysql, action "stop" failed.
 * Starting MySQL database server mysqld                                 [fail]
invoke-rc.d: initscript mysql, action "start" failed.
dpkg: error processing mysql-server-5.0 (--configure):
 subprocess post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of mysql-server:
 mysql-server depends on mysql-server-5.0; however:
  Package mysql-server-5.0 is not configured yet.
dpkg: error processing mysql-server (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 mysql-server-5.0
 mysql-server

Here's what dpkg-reconfigure does:
Code:
root@mayfamily:~# dpkg-reconfigure mysql-server
/usr/sbin/dpkg-reconfigure: mysql-server is broken or not fully installed
root@mayfamily:~# dpkg-reconfigure mysql-server-5.0
/usr/sbin/dpkg-reconfigure: mysql-server-5.0 is broken or not fully installed

A new version of Ubuntu came out today. I may try a dist-upgrade when my torrent finishes downloading, if no one has any ideas by then...
 
Old 10-18-2007, 04:52 PM   #10
Road
Member
 
Registered: Jan 2002
Distribution: Debian Based only but have tried most others.
Posts: 82

Rep: Reputation: 15
Check out the Debian reference guide and see if you can get any help there.

http://www.debian.org/doc/manuals/re...ackage.en.html

Section 6.3 covers problems with the package manager.
 
Old 10-23-2007, 12:37 AM   #11
Russianspi
LQ Newbie
 
Registered: May 2007
Posts: 19

Original Poster
Rep: Reputation: 2
Smile Thanks for all of the help...

Thanks selva146, and especially Road for all of your help. I finally got my mysql server working. The Distro Upgrade did it. I tried the stuff in the Debian manual, but I was STUCK. The sad thing is that somewhere along the way, a couple of my databases got clobbered. Most of my databases, however, survived. Thanks again, guys!
 
Old 10-23-2007, 11:11 AM   #12
Road
Member
 
Registered: Jan 2002
Distribution: Debian Based only but have tried most others.
Posts: 82

Rep: Reputation: 15
Now that you got it back I highly suggest using mysqlhotcopy.

http://dev.mysql.com/doc/refman/5.0/...qlhotcopy.html

Even just doing it to the same hard drive is better than nothing. Since you know your computer could go down at anytime your chances of messing your mysql up go up significantly. This way you could just copy the tables back over if you got actual corrupt files.
 
Old 10-29-2007, 04:56 PM   #13
Russianspi
LQ Newbie
 
Registered: May 2007
Posts: 19

Original Poster
Rep: Reputation: 2
OK. I am backing up now that my server and databases are back up, as promised. I'm using MySqlAdmin to do it for now, because I know it well, and it was 1:30 am when I set it up last night and I wanted to go to bed. I looked at mysqlhotcopy and will probably shift to that soon. Thanks again.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Mysql password reset etch the_Case Debian 11 05-30-2007 04:08 AM
MySQL - Canot reset password texmansru47 Linux - Software 1 10-10-2005 05:19 PM
How do I start mysql in Ubuntu? IvanLow Ubuntu 4 07-12-2005 09:47 AM
Router needs hard reset spotslayer Linux - Wireless Networking 2 05-26-2005 08:29 PM
Cannot boot after hard reset! KyPeN Linux - General 5 04-16-2004 02:01 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 04:13 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration