MySQL Forums
Forum List  »  General

Staring mysqld with systemd hangs at "Activating" -- and there's not much on Google
Posted by: Authorized User
Date: January 22, 2022 10:20AM

Happy Saturday! I hope you weekend is going better than mine. I've been working on this for hours and hours...

I created a custom systemd unit file for our environment. It mostly works, except when you do 'systemctl start mysql@site622' it hangs forever until you Ctrl+C, and then it finally returns to a shell prompt. At that point, the status shows as "activating (start)"

[root@ha50a system]# systemctl status mysql@site622
mysql@site622.service - MySQL Service for site622
Loaded: loaded (/usr/lib/systemd/system/mysql@.service; static; vendor preset: disabled)
Active: activating (start) since Sat 2022-01-22 08:08:45 PST; 14s ago
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
Cntrl PID: 653317 (mysqld)
Tasks: 38 (limit: 3355442)
Memory: 254.9M
CGroup: /system.slice/system-mysql.slice/mysql@site622.service
└─653317 /usr/sbin/mysql57/bin/mysqld --defaults-file=/fs/site622/mysqld/my.cnf

mysqld starts with no errors and I can log into it.

If I then stop it with 'systemctl stop mysql@site622' the service and mysqld process terminate successfully.

The unit file looks like this...

[Unit]
Description=MySQL Service for %I
Documentation=man:mysqld(8)
Documentation=http://dev.mysql.com/doc/refman/en/using-systemd.html
After=network.target
After=syslog.target

[Service]
User=%I
Type=forking
PIDFile=/fs/%I/mysqld/mysqld.pid
EnvironmentFile=/fs/%I/mysqld/opts_file
StandardOutput=journal+console
StandardError=inherit
ExecStart=/usr/sbin/mysql57/bin/mysqld $MYSQLD_OPTS
TimeoutSec=0
PermissionsStartOnly=true
LimitNOFILE = 10000
Restart=on-failure
RestartPreventExitStatus=1
PrivateTmp=false

#--required for restart
Environment=MYSQLD_PARENT_PID=1

[Install]
#--WantedBy=multi-user.target

The opts_file referenced contains...

MYSQLD_OPTS=--defaults-file=/fs/site622/mysqld/my.cnf

From what I can see, the problem seems to be either that the mysqld process is not forking and exiting with a code, or systemd is not detecting the exit for some reason.

I have confirmed that the mysqld.pid file is getting created in the location that the unit file is configured to look for it...

[root@ha50a system]# cat /fs/site622/mysqld/mysqld.pid
653317

For what it's worth, the my.cnf file contains...

[mysqld]

#--site specific stuff
port=5622
datadir=/fs/site622/mysqld/data
socket=/fs/site622/mysqld/mysqld.sock
log-error=/fs/site622/mysqld/error.log
pid-file=/fs/site622/mysqld/mysqld.pid
plugin-dir=/usr/sbin/mysql57/lib/mysql/plugin
default-time-zone="-08:00"

#--where to find the messages
lc_messages_dir=/usr/sbin/mysql57/share
lc_messages=en_US

#--innodb tuning params
skip-log-bin
innodb_buffer_pool_size = 1G
innodb_flush_log_at_trx_commit = 1
innodb_log_file_size = 1G
innodb_log_group_home_dir = /fs/site622/mysqld/inno_logs
innodb_flush_neighbors = 0
innodb_fast_shutdown = 2
innodb_flush_method = O_DIRECT

#--all sites
skip_name_resolve
sql_mode=''
slow_query_log=1
long_query_time=3
log_output=TABLE
default_storage_engine=InnoDB
default_tmp_storage_engine=InnoDB

Options: ReplyQuote


Subject
Written By
Posted
Staring mysqld with systemd hangs at "Activating" -- and there's not much on Google
January 22, 2022 10:20AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.