LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   MySQL on Ubuntu Won't Start After Hard Reset (https://www.linuxquestions.org/questions/linux-server-73/mysql-on-ubuntu-wont-start-after-hard-reset-592288/)

Russianspi 10-16-2007 11:50 AM

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?

Road 10-16-2007 12:07 PM

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

selva146 10-16-2007 12:09 PM

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

Russianspi 10-17-2007 03:49 PM

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?

Road 10-17-2007 04:52 PM

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).

Russianspi 10-17-2007 10:55 PM

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?

Russianspi 10-18-2007 02:05 AM

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.

Road 10-18-2007 10:39 AM

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.

Russianspi 10-18-2007 12:31 PM

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...

Road 10-18-2007 04:52 PM

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.

Russianspi 10-23-2007 12:37 AM

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!

Road 10-23-2007 11:11 AM

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.

Russianspi 10-29-2007 04:56 PM

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.


All times are GMT -5. The time now is 01:47 AM.