Welcome, Guest. Please login or register.
Did you miss your activation email?

Author Topic: [EN]  (solved) mysql and lirc services not starting correctly with Systemd  (Read 9085 times)

Offline terroreek

  • User
  • Posts: 202
Hi Folks,

I am having a couple of issue with mysql and lirc needing to be restarted after booting into the system inorder for them to work correctly.

So after a fresh boot, when I launch xbmc or try to access mysql directly I cannot.  When I do; systemctl status mysql I get the following;

Code: [Select]
mysql.service - LSB: Start and stop the mysql database server daemon
   Loaded: loaded (/etc/init.d/mysql)
   Active: active (exited) since Tue 2014-04-15 20:29:40 EDT; 1h 6min ago
  Process: 1257 ExecStart=/etc/init.d/mysql start (code=exited, status=0/SUCCESS)

Apr 15 20:29:09 darthvader systemd[1]: Starting LSB: Start and stop the mysql database server daemon...
Apr 15 20:29:40 darthvader mysql[1257]: Starting MySQL database server: mysqld . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . failed!
Apr 15 20:29:40 darthvader mysql[1257]: Please take a look at the syslog ... failed!
Apr 15 20:29:40 darthvader systemd[1]: Started LSB: Start and stop the mysql database server daemon.

However when I do a systemctl restart mysql.service
Code: [Select]
mysql.service - LSB: Start and stop the mysql database server daemon
   Loaded: loaded (/etc/init.d/mysql)
   Active: active (running) since Tue 2014-04-15 21:36:37 EDT; 1s ago
  Process: 2335 ExecStop=/etc/init.d/mysql stop (code=exited, status=0/SUCCESS)
  Process: 2363 ExecStart=/etc/init.d/mysql start (code=exited, status=0/SUCCESS)
   CGroup: name=systemd:/system/mysql.service
           ├─2390 /bin/sh /usr/bin/mysqld_safe
           └─2739 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib/mysql/plugin --use...

Apr 15 21:36:35 darthvader systemd[1]: Starting LSB: Start and stop the mysql database server daemon...
Apr 15 21:36:37 darthvader mysql[2363]: Starting MySQL database server: mysqld ..
Apr 15 21:36:37 darthvader mysql[2363]: Checking for tables which need an upgrade, are corrupt or were
Apr 15 21:36:37 darthvader systemd[1]: Started LSB: Start and stop the mysql database server daemon.
[code]

Now everything, works my guess is that because its using the old init scripts its not booting properly. 

I have the same problem with lirc as well; status after a fresh boot
[code]
lirc.service - LIRC Daemon
   Loaded: loaded (/lib/systemd/system/lirc.service; enabled)
   Active: active (running) since Tue 2014-04-15 20:29:09 EDT; 1h 10min ago
  Process: 1401 ExecStart=/usr/sbin/lircd -d /dev/lirc0 -P /run/lirc/lircd.pid (code=exited, status=0/SUCCESS)
  Process: 1398 ExecStartPre=/bin/ln -s /run/lirc/lircd /dev/lircd (code=exited, status=0/SUCCESS)
  Process: 1372 ExecStartPre=/bin/rm -f /run/lirc/lircd (code=exited, status=0/SUCCESS)
  Process: 1366 ExecStartPre=/bin/rm -f /dev/lircd (code=exited, status=0/SUCCESS)
  Process: 1232 ExecStartPre=/bin/mkdir -p /run/lirc (code=exited, status=0/SUCCESS)
 Main PID: 1490 (lircd)
   CGroup: name=systemd:/system/lirc.service
           └─1490 /usr/sbin/lircd -d /dev/lirc0 -P /run/lirc/lircd.pid

Apr 15 20:29:09 darthvader systemd[1]: Starting LIRC Daemon...
Apr 15 20:29:09 darthvader lircd-0.9.0-pre1[1490]: lircd(default) ready, using /var/run/lirc/lircd
Apr 15 20:29:09 darthvader systemd[1]: Started LIRC Daemon.

after restarting

Code: [Select]
lirc.service - LIRC Daemon
   Loaded: loaded (/lib/systemd/system/lirc.service; enabled)
   Active: active (running) since Tue 2014-04-15 21:40:47 EDT; 2s ago
  Process: 21607 ExecStopPost=/bin/rm -fR /run/lirc (code=exited, status=0/SUCCESS)
  Process: 21605 ExecStopPost=/bin/rm -f /dev/lircd (code=exited, status=0/SUCCESS)
  Process: 21623 ExecStart=/usr/sbin/lircd -d /dev/lirc0 -P /run/lirc/lircd.pid (code=exited, status=0/SUCCESS)
  Process: 21619 ExecStartPre=/bin/ln -s /run/lirc/lircd /dev/lircd (code=exited, status=0/SUCCESS)
  Process: 21616 ExecStartPre=/bin/rm -f /run/lirc/lircd (code=exited, status=0/SUCCESS)
  Process: 21614 ExecStartPre=/bin/rm -f /dev/lircd (code=exited, status=0/SUCCESS)
  Process: 21611 ExecStartPre=/bin/mkdir -p /run/lirc (code=exited, status=0/SUCCESS)
 Main PID: 21624 (lircd)
   CGroup: name=systemd:/system/lirc.service
           └─21624 /usr/sbin/lircd -d /dev/lirc0 -P /run/lirc/lircd.pid

Apr 15 21:40:47 darthvader systemd[1]: Starting LIRC Daemon...
Apr 15 21:40:47 darthvader lircd-0.9.0-pre1[21624]: lircd(default) ready, using /var/run/lirc/lircd
Apr 15 21:40:47 darthvader systemd[1]: Started LIRC Daemon.

Now this one is weird becausae it looks like lirc is working, but I cannot use some of the buttons on my remote without having to restart it.

Now I have tried to create my own service files for mysql and lirc, for the Arch and gentoo wikis but I am not sure what the correct procedure is to update them.  When I try the services just flat out refuse to start or work. 
« Last Edit: 2014/04/20, 05:25:44 by terroreek »

Offline devil

  • Administrator
  • User
  • *****
  • Posts: 4.842
Re: mysql and lirc services not starting correctly with Systemd
« Reply #1 on: 2014/04/16, 07:13:39 »
I would take this to IRC channel #debian-systemd on OFTC.


greetz
devil

Offline piper

  • User
  • Posts: 1.785
  • we are the priests ... of the temples of syrinx
Re: mysql and lirc services not starting correctly with Systemd
« Reply #2 on: 2014/04/17, 13:11:32 »
Quote from: devil
I would take this to IRC channel #debian-systemd on OFTC.


greetz
devil
Would be the best advise, if you want to tinker and break your system, you could try

Make sure you put your service file for msql in /lib/systemd/system



Code: [Select]
systemctl stop mysql.service

systemctl start mysql.service

systemctl --system daemon-reload

systemctl enable mysql.service

ln -s '/lib/systemd/system/mysql.service' '/etc/systemd/system/multi-user.target.wants/mysql.service'

make sure mysql is working

systemctl status mysql.service

reboot to test

If above don't work and possibly break your system even more a good read here

http://arobenko-tech.blogspot.com/2012/09/install-mysql-on-beagleboardbeaglebone.html
Free speech isn't just fucking saying what you want to say, it's also hearing what you don't want to fucking hear

I either give too many fucks or no fucks at all, it's like I cannot find a middle ground for a moderate fuck distribution, it's like what the fuck

Offline terroreek

  • User
  • Posts: 202
Re: mysql and lirc services not starting correctly with Systemd
« Reply #3 on: 2014/04/17, 20:10:00 »
Quote from: devil
I would take this to IRC channel #debian-systemd on OFTC.


greetz
devil
Would be the best advise, if you want to tinker and break your system, you could try

Make sure you put your service file for msql in /lib/systemd/system



Code: [Select]
systemctl stop mysql.service

systemctl start mysql.service

systemctl --system daemon-reload

systemctl enable mysql.service

ln -s '/lib/systemd/system/mysql.service' '/etc/systemd/system/multi-user.target.wants/mysql.service'

make sure mysql is working

systemctl status mysql.service

reboot to test

If above don't work and possibly break your system even more a good read here

http://arobenko-tech.blogspot.com/2012/09/install-mysql-on-beagleboardbeaglebone.html

That did it.  I used the mysql.service in the link as well as create the symlink you suggested.

ok so this is what my /lib/systemd/system/mysql.service looks like and then I linked it to '/etc/systemd/system/multi-user.target.wants/mysql.service'

Code: [Select]
[Unit]
Description=MySQL database server
After=syslog.target
After=network.target

[Service]
ExecStart=/usr/bin/mysqld_safe
ExecStop=/bin/kill -15 $MAINPID
PIDFile=/var/lib/mysql/mysqld.pid
 # We rely on systemd, not mysqld_safe, to restart mysqld if it dies
Restart=always

[Install]
WantedBy=multi-user.target

Offline devil

  • Administrator
  • User
  • *****
  • Posts: 4.842

Offline terroreek

  • User
  • Posts: 202
So yeah, I was able to get lirc working but I am almost positive I am not doing this correctly.  So this is what the service file looks like;

Code: [Select]
[Unit]
Description=LIRC Daemon
After = graphical.target

[Service]
Type=forking
PIDFile=/run/lirc/lircd.pid
ExecStartPre=/bin/mkdir -p /run/lirc
ExecStartPre=/bin/rm -f /dev/lircd
ExecStartPre=/bin/rm -f /run/lirc/lircd
ExecStartPre=/bin/ln -s /run/lirc/lircd /dev/lircd

ExecStart=/usr/sbin/lircd -d /dev/lirc0 -P /run/lirc/lircd.pid
ExecStopPost=/bin/rm -f /dev/lircd
ExecStopPost=/bin/rm -fR /run/lirc

[Install]
WantedBy=graphical.target

and I have to symlink

Code: [Select]
ln -s /lib/systemd/system/lirc.service /etc/systemd/system/graphical.target.wants/lirc.service
however get this error in the console during boot up.

Code: [Select]
systemd[1]: Job inputlirc.service/start deleted to break ordering cycle starting with graphical.target/start
So what doesn't make sense to me, why is it, when I create a loop, and systemd breaks the loop, but lirc works correctly but when I don't loop I need to restart lirc before it starts working.

-mods- is it ok if I remove the solved tag since lirc isn't working?

Offline piper

  • User
  • Posts: 1.785
  • we are the priests ... of the temples of syrinx
I can't help with lirc as I haven't used it since mythtv .019 (using version .027 now)

The best remote for mythtv is my nexus 5 and a app called mythremote  :)

I removed the (solved) tag per op's request as it was me who marked it solved
Free speech isn't just fucking saying what you want to say, it's also hearing what you don't want to fucking hear

I either give too many fucks or no fucks at all, it's like I cannot find a middle ground for a moderate fuck distribution, it's like what the fuck

Offline terroreek

  • User
  • Posts: 202
Re: mysql and lirc services not starting correctly with Systemd
« Reply #7 on: 2014/04/20, 05:25:30 »
Hi Piper,

I went to the debian-systemd group, they suggested modify the lirc.service file as such.
Wants/After=systemd-udev-settle.service

I gave both a shot it really didn't work.  I decided to ditch lirc and not use it, and opted to use xbmcremote on both my nexus 7 and nexus 4. 

That being said my ugly hack worked, but its far from doing it the right way.  I'll mark the thread as solved, because technically there is a solution, not pretty but technically a solution.