LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 07-28-2014, 02:23 PM   #1
simon1tanismypassword
LQ Newbie
 
Registered: Jul 2014
Posts: 18

Rep: Reputation: Disabled
[Solved] mysql won't start due to bash-completion errors


So after upgrading my debian system, mysql does not start anymore with command "service mysql start". I get:
Job for mysql.service failed. See 'systemctl status mysql.service' and 'journalctl -xn' for details.
linksys:/home/users/stan# journalctl -xn
-- Logs begin at Mon 2014-07-28 10:03:56 PDT, end at Mon 2014-07-28 12:07:07 PDT. --
Jul 28 12:07:07 linksys mysql[5509]: -su: 89: /usr/share/bash-completion/bash_completion: complete: not found
Jul 28 12:07:07 linksys mysql[5509]: -su: 92: /usr/share/bash-completion/bash_completion: complete: not found
Jul 28 12:07:07 linksys mysql[5509]: -su: 101: /usr/share/bash-completion/bash_completion: Syntax error: "(" unexpected (expec
Jul 28 12:07:07 linksys su[5536]: pam_unix(su:session): session closed for user mysql
Jul 28 12:07:07 linksys systemd[1]: mysql.service: control process exited, code=exited status=2
Jul 28 12:07:07 linksys systemd[1]: Failed to start LSB: Start and stop the mysql database server daemon.
-- Subject: Unit mysql.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman.../systemd-devel
--
-- Unit mysql.service has failed.

Looking at /etc/init.d/mysql it looks like the command to start mysql is: su - mysql -s /bin/sh -c "/usr/bin/mysqld_safe > /dev/null 2>&1 &" but I get more bash_completion errors:
-su: 29: /usr/share/bash-completion/bash_completion: [[: not found
-su: 35: /usr/share/bash-completion/bash_completion: [[: not found
-su: 51: /usr/share/bash-completion/bash_completion: shopt: not found
-su: 57: /usr/share/bash-completion/bash_completion: complete: not found
-su: 62: /usr/share/bash-completion/bash_completion: complete: not found
-su: 65: /usr/share/bash-completion/bash_completion: complete: not found
-su: 68: /usr/share/bash-completion/bash_completion: complete: not found
-su: 71: /usr/share/bash-completion/bash_completion: complete: not found
-su: 74: /usr/share/bash-completion/bash_completion: complete: not found
-su: 77: /usr/share/bash-completion/bash_completion: complete: not found
-su: 80: /usr/share/bash-completion/bash_completion: complete: not found
-su: 83: /usr/share/bash-completion/bash_completion: complete: not found
-su: 86: /usr/share/bash-completion/bash_completion: complete: not found
-su: 89: /usr/share/bash-completion/bash_completion: complete: not found
-su: 92: /usr/share/bash-completion/bash_completion: complete: not found
-su: 101: /usr/share/bash-completion/bash_completion: Syntax error: "(" unexpected (expecting "}")

No logs in /var/log/mysql/. Any ideas?

Last edited by simon1tanismypassword; 07-29-2014 at 02:51 AM. Reason: Solved
 
Old 07-28-2014, 03:14 PM   #2
MfromH
LQ Newbie
 
Registered: Jul 2014
Distribution: openSuse 12.2, SLES11.3, RHEL 5,
Posts: 15

Rep: Reputation: Disabled
to me this looks like a serious linux problem.

anyway: I assume you had mysql installed as a usual package, so it has been upgraded together with your linux. Try to start mysql from command line:
su - mysql
/usr/bin/mysqld_safe --defaults-file=/etc/my.cnf

make sure the path to mysqld_safe and to my.cnf is still the same and the my.cnf contains an entry like "log-error=...", we will see much clearer if we have a logfile from mysql.

Try to find out the new version of mysql.

regards M.
 
Old 07-28-2014, 03:35 PM   #3
simon1tanismypassword
LQ Newbie
 
Registered: Jul 2014
Posts: 18

Original Poster
Rep: Reputation: Disabled
/usr/bin/mysqld_safe --defaults-file=/etc/mysql/my.cnf starts fine with root. Unable to su - mysql, asks for a password which I do not have.

The package didn't upgrade with my aptitude upgrade. I upgraded them manually(using aptitude) because other packages required it. Yes, I did use the Debian packages. I can live with starting it this way but something is not right and surprised more people are not getting this problem. Why do you suppose the command in init.d/mysql(su - mysql -s /bin/sh -c "/usr/bin/mysqld_safe > /dev/null 2>&1 &") would call bash_completion even though the user mysql does not use the bash shell. Maybe I am looking in the wrong place system I am running systemd now. Different startup file somewhere else?
 
Old 07-28-2014, 03:46 PM   #4
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,278

Rep: Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694
Yeah,.. you upgraded from init to systemd.

You won't be using 'service mysqld restart' or 'tail /var/log/messages' anymore. You have to use the systemctl and journal commands.

Services are called 'units' now.

# list failed units
Code:
systemctl --failed
# status of mysql
Code:
systemctl status mysql
But,. your actual issue seems to be part of the systemd bash completion... What is your version information? System, previous, upgraded to, any additional output you have from the upgrade,. etc...
 
Old 07-28-2014, 03:56 PM   #5
simon1tanismypassword
LQ Newbie
 
Registered: Jul 2014
Posts: 18

Original Poster
Rep: Reputation: Disabled
systemctl status mysql.service shows:
mysql.service - LSB: Start and stop the mysql database server daemon
Loaded: loaded (/etc/init.d/mysql)
Active: failed (Result: exit-code) since Mon 2014-07-28 13:49:19 PDT; 49s ago
Process: 12845 ExecStop=/etc/init.d/mysql stop (code=exited, status=0/SUCCESS)
Process: 13000 ExecStart=/etc/init.d/mysql start (code=exited, status=2)

Jul 28 13:49:19 linksys mysql[13000]: -su: 77: /usr/share/bash-completion/bash_completion: complete: not found
Jul 28 13:49:19 linksys mysql[13000]: -su: 80: /usr/share/bash-completion/bash_completion: complete: not found
Jul 28 13:49:19 linksys mysql[13000]: -su: 83: /usr/share/bash-completion/bash_completion: complete: not found
Jul 28 13:49:19 linksys mysql[13000]: -su: 86: /usr/share/bash-completion/bash_completion: complete: not found
Jul 28 13:49:19 linksys mysql[13000]: -su: 89: /usr/share/bash-completion/bash_completion: complete: not found
Jul 28 13:49:19 linksys mysql[13000]: -su: 92: /usr/share/bash-completion/bash_completion: complete: not found
Jul 28 13:49:19 linksys mysql[13000]: -su: 101: /usr/share/bash-completion/bash_completion: Syntax error: "(" unexpec...g "}")
Jul 28 13:49:19 linksys systemd[1]: mysql.service: control process exited, code=exited status=2
Jul 28 13:49:19 linksys systemd[1]: Failed to start LSB: Start and stop the mysql database server daemon.
Jul 28 13:49:19 linksys systemd[1]: Unit mysql.service entered failed state.

journalctl -xn shows:
-- Logs begin at Mon 2014-07-28 10:03:56 PDT, end at Mon 2014-07-28 13:49:19 PDT. --
Jul 28 13:49:19 linksys mysql[13000]: -su: 101: /usr/share/bash-completion/bash_completion: Syntax error: "(" unexpected (expe
Jul 28 13:49:19 linksys systemd-journal[149]: Forwarding to syslog missed 5 messages.
-- Subject: One or more messages could not be forwarded to syslog
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman.../systemd-devel
--
-- One or more messages could not be forwarded to the syslog service
-- running side-by-side with journald. This usually indicates that the
-- syslog implementation has not been able to keep up with the speed of
-- messages queued.
Jul 28 13:49:19 linksys su[13027]: pam_unix(su:session): session closed for user mysql
Jul 28 13:49:19 linksys systemd[1]: mysql.service: control process exited, code=exited status=2
Jul 28 13:49:19 linksys systemd[1]: Failed to start LSB: Start and stop the mysql database server daemon.
-- Subject: Unit mysql.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman.../systemd-devel
--
-- Unit mysql.service has failed.
--
-- The result is failed.
Jul 28 13:49:19 linksys systemd[1]: Unit mysql.service entered failed state.
Jul 28 13:49:19 linksys systemd-logind[1333]: Removed session c15.
-- Subject: A session c15 has been terminated
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman.../systemd-devel
-- Documentation: http://www.freedesktop.org/wiki/Soft...temd/multiseat
--
-- A session with the ID c15 has been terminated.
Jul 28 13:49:19 linksys sudo[12997]: pam_unix(sudo:session): session closed for user root
Jul 28 13:49:19 linksys console-kit-daemon[1767]: console-kit-daemon[1767]: GLib-CRITICAL: Source ID 503 was not found when at
Jul 28 13:49:19 linksys console-kit-daemon[1767]: GLib-CRITICAL: Source ID 503 was not found when attempting to remove it


I changed my init.d/mysql to "/usr/bin/mysqld_safe --defaults-file=/etc/mysql/my.cnf > /dev/null 2>&1 &"(used to be this: su - mysql -s /bin/sh -c "/usr/bin/mysqld_safe > /dev/null 2>&1 &") bypassing /bin/sh and it works. Going to reinstall bash-completion package and see if that helps...nope.
 
Old 07-28-2014, 04:08 PM   #6
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,278

Rep: Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694
If its debian/ubuntu, it might be having problems with using 'dash' instead of 'bash'. So change your default shell back to real bash:

Code:
dpkg-reconfigure dash
Also, if you don't have a gui and don't need console-kit, I would try purging it to fix the GLib-CRITICAL errors.

Code:
apt-get purge consolekit

Last edited by szboardstretcher; 07-28-2014 at 04:09 PM.
 
Old 07-28-2014, 04:25 PM   #7
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
As a side note, using su - mysql -s /bin/sh -c "/usr/bin/mysqld_safe > /dev/null 2>&1 &" will get you bash errors... you told it to use sh. Now unless /usr/bin/mysqld_safe has "!/bin/bash" as the first line, that will cause the errors you are showing - "[[" is not a standard shell token; it is a bash token.

I don't know about debian, but fedora modified MySQL to allow it to be used by systemd. The service startup is different, so the systemd startup won't work with the older MySQL daemon.

Last edited by jpollard; 07-28-2014 at 04:28 PM.
 
Old 07-28-2014, 04:26 PM   #8
MfromH
LQ Newbie
 
Registered: Jul 2014
Distribution: openSuse 12.2, SLES11.3, RHEL 5,
Posts: 15

Rep: Reputation: Disabled
the mysql server should not be run as user root, thats why the user mysql is created on install, and the startscript in init.d switches to this user, even if it is called as root. Anyway, for testing we can start as root.
please provide the version of your mysql software, since there are many changes in configuration for the newer versions 5.5 and 5.6.
and please try to produce a logfile for the mysql server as given with "log-error=<path-to-logfile>" in the mysqld section of my.cnf

greetings from H.
M.
 
Old 07-29-2014, 02:49 AM   #9
simon1tanismypassword
LQ Newbie
 
Registered: Jul 2014
Posts: 18

Original Poster
Rep: Reputation: Disabled
Yes, I understand the it should be run with mysql user. This is only a development machine, so not too worried about security
right now..more worried about getting up and developing . Version is 5.6
ii mysql-common 5.5.37-1
ii mysql-common-5.6 5.6.19-1~exp1
ii mysql-server-5.6 5.6.19-1~exp1
ii mysql-server-core-5.6 5.6.19-1~exp1

I don't think I am going to be able to create a log file because it fails at the su so mysql command does not ever run. This is not a problem with mysql, more like a bash issue.

Yes, Debian AMD64. 'echo $0' shows I am running bash. Your command 'dpkg-reconfigure dash' seems to configure the shell to dash. You meant to say bash right? I did run the command but said no to changing to dash and it configured bash so now I'm getting this which is a step forward, no more weird bash-completion errors:

mysql.service - LSB: Start and stop the mysql database server daemon
Loaded: loaded (/etc/init.d/mysql)
Active: failed (Result: exit-code) since Tue 2014-07-29 00:15:41 PDT; 2min 20s ago

Jul 29 00:15:09 linksys systemd[1]: Starting LSB: Start and stop the mysql database server daemon...
Jul 29 00:15:10 linksys su[4636]: Successful su for mysql by root
Jul 29 00:15:10 linksys su[4636]: + ??? root:mysql
Jul 29 00:15:10 linksys su[4636]: pam_unix(su:session): session opened for user mysql by (uid=0)
Jul 29 00:15:41 linksys mysql[4608]: Starting MySQL database server: mysqld . . . . . . . . . . . . . . . . . . . . ....ailed!
Jul 29 00:15:41 linksys systemd[1]: mysql.service: control process exited, code=exited status=1
Jul 29 00:15:41 linksys systemd[1]: Failed to start LSB: Start and stop the mysql database server daemon.
Jul 29 00:15:41 linksys systemd[1]: Unit mysql.service entered failed state.
Hint: Some lines were ellipsized, use -l to show in full.


After removing a few more packages and disabling some service, it is finally running. Not exactly sure what fixed it though but szboardstretcher's idea definitely lead to the answer(thank you very much and thanks to all who contributed). I think I was in a dash shell. I know I installed dash because it is smaller and faster. Something is not right with it if it tries to do something bash-completion(that'll be a bug for Debian folks to work out maybe). Also learned a couple of new things about Linux. Here is a command history if it will help anyone in the future(I had 2 consoles open...):
aptitude remove console-kit
502 scite /etc/init.d/mysql
503 ps -A
504 ps -A | grep mysql
505 ps axf
506 aptitude remove pykaraoke
507 aptitude remove timidity
508 ps -A | grep smb
509 update-rc.d disable smbd 2 3 4 5
510 update-rc.d smbd disable 2 3 4 5
511 systemctl --help
512 systemctl disable smbd.service
513 systemctl stop smbd.service
514 ps -A | grep smb
515 ps A
516 ps axf
517 systemctl stop proftpd.service
518 systemctl disable proftpd.service
519 systemctl stop gpm.service
520 systemctl disable gpm.service
521 systemctl stop nmbd.service
522 systemctl disable nmbd.service
523 systemctl disable scanlogd.service
524 systemctl stop scanlogd.service
525 ps axf
526 dpkg -l | grep udisks
527 service udisks status
528 service udisks sttop
529 service udisks stop
530 service udisks start
531 service udisks status
532* service udisks st
533 service udisks status
534 service udisks2 start
535 service udisks status
536 service udisks2 status
537 dpkg -l | grep udisk
538 aptitude remove udisks
539 ps -A
540 ps axf
543 cat /var/log/mysql/error.log
544 rm /var/log/mysql/error.log
545 ps axf | grep mysql
546 scite /etc/init.d/mysql

528 aptitude purge consolekit
529 sudo aptitude purge consolekit
530 dpkg remove foomatic-filters ghostscript-cups udisk2 upower udisks libcolord2
531 sudo aptitude remove foomatic-filters ghostscript-cups udisk2 upower udisks libcolord2
532 dpkg-reconfigure dash
533 sudo dpkg-reconfigure dash
534 echo $0
535 sudo service mysql start
536 systemctl status mysql.service
537 journalctl -xn
538 systemctl start mysql
539 sudo systemctl start mysql
540 journalctl -xn
541 sudo systemctl start apache2
542 sudo systemctl stop mysql
543 sudo systemctl start mysql

@jpollard, in Debian, this su - mysql -s /bin/sh -c "/usr/bin/mysqld_safe > /dev/null 2>&1 &" thing was in a init script so I used it. I just ran it in bash and it does run now, it wasn't running before.
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
MySQL won't start. nathacof Linux - Server 13 08-23-2011 05:03 AM
MySQL won't start, and no /etc/init.d/mysql--my stdout and syslog after trying... ineloquucius Linux - Server 8 01-31-2010 11:24 AM
Won't start MYSQL! expl Linux - Newbie 5 04-26-2008 06:36 AM
MySQL won't start! dezza Linux - Software 5 01-01-2005 07:21 AM
MySQL won't start Ephracis Linux - Software 3 12-27-2004 08:54 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 02:34 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