[debian-mysql] Bug#742900: Bug#742900: [Pkg-systemd-maintainers] No mysqld.service File

Clint Byrum spamaps at debian.org
Mon Mar 31 21:33:11 UTC 2014


Excerpts from merc1984's message of 2014-03-31 13:52:37 -0700:
> 
> On Mon, Mar 31, 2014, at 10:47, Michael Stapelberg wrote:
> > Hi merc,
> > 
> > merc1984 at f-m.fm writes:
> > > On Fri, Mar 28, 2014, at 16:16, Michael Biebl wrote:
> > >> You can certainly depend within a .service file on a sysv init script
> > >> 
> > >> Since the SysV init script is named /etc/init.d/mysql, you'd have to use
> > >> something like
> > >
> > > That's very nice in theory, but I am telling you in practice it does not
> > > work.  That's why I'm having to go to all this trouble.
> > “It does not work” is not a proper description of a problem. As you seem
> > to be convinced that this is broken, may I ask you to file a bug report
> > against systemd? That will include more information (state dump) to
> > start with. Also, please increase the log level to “debug” — see
> > https://wiki.debian.org/systemd#Debugging — and provide the output of
> > journalctl -b.
> > 
> > Thanks.
> > 
> > -- 
> > Best regards,
> > Michael
> 
> Those are your best regards?  I'd hate to see your worst ones...
> 

Antagonizing those who are trying to help is really not going to be
productive. I for one have moved your emails and this thread to the
bottom of my priority stack here on out.

> Unfortunately the problem is not with systemd.  It is with Debian for
> not having a .service file suited to its structure.  I've tried to adapt
> the Arch and Fedora .service files, but can't make them work.  The
> failures are diverse, and depend on the nature of differing  adaptations
> I've made in them for Debian.  The solution is not to describe how my
> attempts fail six ways from Sunday.  The solution is to specify an
> official file which actually works in Debian.
> 

Or perhaps the problem is that you refuse to believe me that you could
solve this with a single line for loop? No.. right.. polling bad.

> The primary problem with my .service file is that it simply does not
> start mysqld on boot.  I've concentrated on adapting the Fedora file, as
> it's more likely to be credible, given that it's used in RHEL.
> 
> My mysql.service:
> ---------------------------------------------------------------------------------------
> # Adapted  from Fedora
> 
> # For more info about custom unit files, see systemd.unit(5) or
> #
> http://fedoraproject.org/wiki/Systemd#How_do_I_customize_a_unit_file.2F_add_a_custom_unit_file.3F
> 
> # For example, if you want to increase mysql's open-files-limit to
> 10000,
> # you need to increase systemd's LimitNOFILE setting, so create a file
> named
> # "/etc/systemd/system/mariadb.service.d/limits.conf" containing:
> #       [Service]
> #       LimitNOFILE=10000
> 
> # Note: /usr/lib/... is recommended in the .include line though /lib/... 
> # still works.
> # Don't forget to reload systemd daemon after you change unit
> configuration:
> # root> systemctl --system daemon-reload
> 
> [Unit]
> Description=MySQL database server
> After=syslog.target network.target
> 
> [Service]
> Type=simple
> User=mysql
> Group=mysql
> 
> ExecStartPre=/usr/local/bin/mysql-prepare-db-dir %n
> # Note: we set --basedir to prevent probes that might trigger SELinux
> alarms,
> # per bug #547485
> ExecStart=/usr/bin/mysqld_safe --basedir=/usr
> ExecStartPost=/usr/local/bin/mysql-wait-ready $MAINPID
> 
> # Give a reasonable amount of time for the server to start up/shut down
> TimeoutSec=300
> 
> # Security
> PrivateTmp=yes
> #InaccessibleDirectories=/boot /.config /home/backups /home/bill
> /home/sleeper /lib32 /media /mnt /opt /proc /root /srv /sys
> #ReadOnlyDirectories=/bin /etc /sbin /usr
> #CapabilityBoundingSet=~CAP_SYS_PTRACE
> #DeviceAllow=/dev/null rw
> #NoNewPrivileges=yes
> 
> [Install]
> WantedBy=multi-user.target
> 
> systemctl status mysqld
> ---------------------------------------------------------------------------------------
> # systemctl status mysqld
> mysqld.service - MySQL database server
>    Loaded: loaded (/usr/local/lib/systemd/system/mysqld.service;
>    enabled)
>    Active: failed (Result: exit-code) since Mon 2014-03-31 12:39:46 PDT;
>    1h 3min ago
>   Process: 2341 ExecStartPost=/usr/local/bin/mysql-wait-ready $MAINPID
>   (code=exited, status=1/FAILURE)
>   Process: 2340 ExecStart=/usr/bin/mysqld_safe --basedir=/usr
>   (code=exited, status=0/SUCCESS)
>   Process: 2004 ExecStartPre=/usr/local/bin/mysql-prepare-db-dir %n
>   (code=exited, status=0/SUCCESS)
> 
> Mar 31 12:39:28 cygnus mysqld_safe[2340]: 140331 12:39:28 mysqld_safe
> Can't log to error log and syslog at the same time.  Remove all
> --log-error configuration options for --syslog to take effect.
> Mar 31 12:39:28 cygnus mysqld_safe[2340]: 140331 12:39:28 mysqld_safe
> Logging to '/var/log/mysql/error.log'.
> Mar 31 12:39:28 cygnus mysqld_safe[2340]: mkdir: cannot create directory
> ‘/var/run/mysqld’: Permission denied

You likely need an ExecStartPre to mkdir this.

> Mar 31 12:39:28 cygnus mysqld_safe[2340]: chown: cannot access
> ‘/var/run/mysqld’: No such file or directory
> Mar 31 12:39:28 cygnus mysqld_safe[2340]: chmod: cannot access
> ‘/var/run/mysqld’: No such file or directory
> Mar 31 12:39:29 cygnus mysqld_safe[2340]: 140331 12:39:29 mysqld_safe
> Starting mysqld daemon with databases from /var/lib/mysql
> Mar 31 12:39:46 cygnus mysqld_safe[2340]: 140331 12:39:46 mysqld_safe
> mysqld from pid file /var/run/mysqld/mysqld.pid ended
> Mar 31 12:39:46 cygnus systemd[1]: mysqld.service: control process
> exited, code=exited status=1
> Mar 31 12:39:46 cygnus systemd[1]: Failed to start MySQL database
> server.
> Mar 31 12:39:46 cygnus systemd[1]: Unit mysqld.service entered failed
> state.
> #



More information about the pkg-mysql-maint mailing list