• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

After server reboot session table always corrupts

Big Dan

Active member
#1
Hi Guys,

I see an issue on my server and am not sure if it's just me or other people see the same problem. Every time I have to reboot my VPS when it comes back online the session table is corrupted and has to be repaired. A quick mySQL repair fixes it but I'm wondering why it happens and if it can be prevented.

I've tried both turning the forum off before reboot and not. It doesn't seem to have an effect. Is there something I can to do prevent this? I'm running a vanilla WHM install atop CentOS.

Thanks,
Dan
 

rainmotorsports

Well-known member
#4
The question is it shutting down properly when you issue a reboot to the vps. All critical applied actions need to be shutting down properly before the vps decides to restart. I am sure there are logs for the shutdown as well as mysql logging wether or not it shutdown properly. If its just getting killed you are always risking corruption.
 

The Dark Wizard

Well-known member
#5
I assume I'd have to do that from the command line? WHM only gives the option to restart the service not start/stop.
According to the WHM Manuel, a graceful reboot will first wait for all connections to come to an end and then it stops mysql and other processes before rebooting the server.

If you aren't using the Graceful one try that. Your table should stop corrupting.
 

Big Dan

Active member
#7
Thanks Guys. I'm using the Solus VM Control Panel my host provides to restart. I guess it's too much to expect it to wait for everything exit gracefully. :confused:

If I stop mySQL from the command line doesn't cPanel try to "automagicly" restart it?

Would I be better off just doing a shutdown -r 0 as root?
 

melbo

Well-known member
#8
I stop Apache and mysqld and then reboot system after counting to 10 or so. I don't like to take chances with abrupt shutdowns.

I don't use a CP though so am not sure what options you have in cpanel.
 

Big Dan

Active member
#9
I stop Apache and mysqld and then reboot system after counting to 10 or so. I don't like to take chances with abrupt shutdowns.

I don't use a CP though so am not sure what options you have in cpanel.
Thanks Melbo. When cPanel detects a critical service (apache, mysql, imap, etc) has stopped or crashed it tries to restart it automatically. I'm going to talk to my host and see if I'm working from the command line does the CP still try and restart. If so, how do I prevent that from happening.
 

Mike Edge

Well-known member
#12
You should only ever reboot from SolusVM or WHM in the event the server is not responsive to SSH. Using graceful in WHM is lighter then doing a hard reboot, but it doesn't verify the process had stopped so it can still and often have the effect of a hard reboot, esp if you have a lot of open httpd connections or larger databases. Command line is the safest way.
 

Big Dan

Active member
#13
You should only ever reboot from SolusVM or WHM in the event the server is not responsive to SSH. Using graceful in WHM is lighter then doing a hard reboot, but it doesn't verify the process had stopped so it can still and often have the effect of a hard reboot, esp if you have a lot of open httpd connections or larger databases. Command line is the safest way.
Thanks Mike. I'm a little confused if I reboot from the CL, cPanel won't try to restart the processes as the server is stopping them?
 

Tracy Perry

Well-known member
#14
I don't use a panel... But I've always done a shutdown -r now (since i'm the only user) on the system. It always shuts down the associated services and then restarts the server.

Command issued from SSH CLI
Screen-Shot-2015-02-03-at-5.48.43-PM.jpg

Results of the command as I'm monitoring the VM in a console from my ProxMox center
Screen-Shot-2015-02-03-at-5.48.34-PM.jpg
 

MattW

Well-known member
#16
-r will prevent any process from restarting during the stopping process to reboot
Not quite
Code:
DESCRIPTION
       shutdown arranges for the system to be brought down in a safe way.  All logged-in users are notified that the system is going down and, within the last five minutes of TIME, new logins are prevented.

       TIME  may have different formats, the most common is simply the word 'now' which will bring the system down immediately.  Other valid formats are +m, where m is the number of minutes to wait until shutting
       down and hh:mm which specifies the time on the 24hr clock.

       Once TIME has elapsed, shutdown sends a request to the init(8) daemon to bring the system down into the appropriate runlevel.

       This is performed by emitting the runlevel(7) event, which includes the new runlevel in the RUNLEVEL environment variable  as  well  as  the  previous  runlevel  (obtained  from  the  environment  or  from
       /var/run/utmp)  in  the  PREVLEVEL variable.  An additional INIT_HALT variable may be set, this will contain the value HALT when bringing the system down for halt and POWEROFF when bringing the system down
       for power off.

OPTIONS
       -r     Requests that the system be rebooted after it has been brought down.

       -h     Requests that the system be either halted or powered off after it has been brought down, with the choice as to which left up to the system.

       -H     Requests that the system be halted after it has been brought down.

       -P     Requests that the system be powered off after it has been brought down.

       -c     Cancels a running shutdown.  TIME is not specified with this option, the first argument is MESSAGE.

       -k     Only send out the warning messages and disable logins, do not actually bring the system down.
 

Tracy Perry

Well-known member
#18
Shutdown should be fully compliant with a clean shutdown - halting any and all running processes and then performing the appropriate choice of restart, halt or powered down.
When issuing it, I've never had any problems with corruption on a Debian system nor the 3 CentOS systems I have set up.
 

Tracy Perry

Well-known member
#20
I just always use this command on ssh "reboot".
:rolleyes:
Any disadvantage on that command? :cautious:
From the man reboot
DESCRIPTION

halt notes that the system is being brought down in the file /var/log/wtmp, and then either tells the kernel to halt, reboot or power-off the system.
If halt or reboot is called when the system is not in runlevel 0 or 6, in other words when it's running normally, shutdown will be invoked instead (with the -h or -r flag). For more info see the shutdown(8) man page.
The rest of this manpage describes the behaviour in runlevels 0 and 6, that is when the systems shutdown scripts are being run.
NOTES

Under older sysvinit releases , reboot and halt should never be called directly. From release 2.74 on halt and reboot invoke shutdown(8) if the system is not in runlevel 0 or 6. This means that if halt or reboot cannot find out the current runlevel (for example, when /var/run/utmp hasn't been initialized correctly) shutdown will be called, which might not be what you want. Use the -f flag if you want to do a hard halt or reboot.
The -h flag puts all hard disks in standby mode just before halt or power-off. Right now this is only implemented for IDE drives. A side effect of putting the drive in stand-by mode is that the write cache on the disk is flushed. This is important for IDE drives, since the kernel doesn't flush the write cache itself before power-off.
The halt program uses /proc/ide/hd* to find all IDE disk devices, which means that /proc needs to be mounted when halt or poweroff is called or the -h switch will do nothing.
man shutdown

DESCRIPTION

shutdown brings the system down in a secure way. All logged-in users are notified that the system is going down, and login(1) is blocked. It is possible to shut the system down immediately or after a specified delay. All processes are first notified that the system is going down by the signal SIGTERM. This gives programs like vi(1) the time to save the file being edited, mail and news processing programs a chance to exit cleanly, etc. shutdown does its job by signalling the init process, asking it to change the runlevel. Runlevel 0 is used to halt the system, runlevel 6 is used to reboot the system, and runlevel 1 is used to put to system into a state where administrative tasks can be performed; this is the default if neither the -h or -r flag is given to shutdown. To see which actions are taken on halt or reboot see the appropriate entries for these runlevels in the file /etc/inittab.
I'll use shutdown myself due to the fact that's what I'm used to.