plesk / centos2alma

CentOS 7 to AlmaLinux 8 conversion tool
Apache License 2.0
38 stars 8 forks source link

INFO - Failed to enable unit: Refusing to operate on linked unit file mysqld.service #315

Open nckdip opened 1 month ago

nckdip commented 1 month ago

A server upgrade was performed but we got the following error. The mariadb is running. The plesk webadmin is enabled and accessible from web.

The following error occured while resuming upgrade procedure. The server has the Warden Danami Antispam filter which had a problew with spamassasin, but this was fixed during previous upgrade error.

2024-07-27 21:37:37,853 - DEBUG - Repository file line: 2024-07-27 21:37:37,853 - DEBUG - Repository file line: [alma-plesk-ext-panel-migrator] 2024-07-27 21:37:37,853 - DEBUG - Repository file line: name=Alma panel-migrator extension repository 2024-07-27 21:37:37,853 - DEBUG - Repository file line: baseurl=http://autoinstall.plesk.com/PMM_0.1.11/dist-rpm-RedHat-el8-x86_64 2024-07-27 21:37:37,853 - DEBUG - Repository file line: enabled=1 2024-07-27 21:37:37,853 - DEBUG - Repository file line: gpgcheck=1 2024-07-27 21:37:37,853 - DEBUG - Repository file line: gpgkey=http://autoinstall.plesk.com/plesk.gpg 2024-07-27 21:37:38,218 - WARNING - There is no parameter ''dhparams_size'' in the sslmng output. 2024-07-27 21:37:38,960 - DEBUG - Detected mariadb version is: 10.3.39 2024-07-27 21:37:38,984 - DEBUG - Detected mariadb version is: 10.3.39 2024-07-27 21:37:39,002 - DEBUG - Resuming from the stage 'Handle packages and services' 2024-07-27 21:37:39,003 - DEBUG - Skipping the stage 'Reboot' due to resume mode 2024-07-27 21:37:39,003 - DEBUG - Skipping the stage 'Pause before reboot' due to resume mode 2024-07-27 21:37:39,003 - DEBUG - Skipping the stage 'Do convert' due to resume mode 2024-07-27 21:37:39,003 - DEBUG - Skipping the stage 'Update databases' due to resume mode 2024-07-27 21:37:39,003 - DEBUG - Skipping the stage 'First plesk start' due to resume mode 2024-07-27 21:37:39,003 - DEBUG - Skipping the stage 'Handle packages and services' due to resume mode 2024-07-27 21:37:39,004 - DEBUG - Starting the stage 'Handle plesk related services' 2024-07-27 21:37:39,004 - INFO - Start stage 'Handle plesk related services'. 2024-07-27 21:37:39,004 - DEBUG - Invoking action 'disable plesk related services' 2024-07-27 21:37:39,004 - INFO - Do: disable plesk related services 2024-07-27 21:37:39,004 - INFO - Running: ['/usr/bin/systemctl', 'enable', 'crond.service', 'dovecot.service', 'fail2ban.service', 'httpd.service', 'mailman.service', 'mariadb.service', 'mysqld.service', 'named-chroot.service', 'plesk-ext-monitoring-hcd.service', 'plesk-ssh-terminal.service', 'plesk-task-manager.service', 'plesk-web-socket.service', 'psa.service', 'sw-collectd.service', 'sw-cp-server.service', 'sw-engine.service', 'postfix.service', 'plesk-ip-remapping.service']. Output: 2024-07-27 21:37:39,028 - INFO - Failed to enable unit: Refusing to operate on linked unit file mysqld.service 2024-07-27 21:37:39,028 - ERROR - Command ['/usr/bin/systemctl', 'enable', 'crond.service', 'dovecot.service', 'fail2ban.service', 'httpd.service', 'mailman.service', 'mariadb.service', 'mysqld.service', 'named-chroot.service', 'plesk-ext-monitoring-hcd.service', 'plesk-ssh-terminal.service', 'plesk-task-manager.service', 'plesk-web-socket.service', 'psa.service', 'sw-collectd.service', 'sw-cp-server.service', 'sw-engine.service', 'postfix.service', 'plesk-ip-remapping.service'] failed with return code 1 2024-07-27 21:37:39,029 - ERROR - Failed: disable plesk related services. The reason: Command '['/usr/bin/systemctl', 'enable', 'crond.service', 'dovecot.service', 'fail2ban.service', 'httpd.service', 'mailman.service', 'mariadb.service', 'mysqld.service', 'named-chroot.service', 'plesk-ext-monitoring-hcd.service', 'plesk-ssh-terminal.service', 'plesk-task-manager.service', 'plesk-web-socket.service', 'psa.service', 'sw-collectd.service', 'sw-cp-server.service', 'sw-engine.service', 'postfix.service', 'plesk-ip-remapping.service']' returned non-zero exit status 1.

A clear and concise description of what the bug is.

Feedback archive Please attach a feedback archive to the bug report. [Uploading centos2alma_feedback.zip…]()

You could create it by calling centos2alma --prepare-feedback. The archive will help us investigate the problem better and faster.

nckdip commented 1 month ago

https://drive.google.com/file/d/1XSZvwL2u8V_N1PRAKjbwsMriIAb2_dgY/view?usp=sharing

SandakovMM commented 1 month ago

The issue is likely caused by starting up MariaDB and the linked mysqld service as part of certain MariaDB packages. I discovered this problem recently and will fix it in version 1.3.3.

nckdip commented 1 month ago

I don't mention that the first error we fixed for MariaDB during the upgrade was Comment out the : plugin-load-add=auth_gssapi.so because MariaDB was not starting file: /etc/my.cnf.d/auth_gssapi.cnf [mariadb]

plugin-load-add=auth_gssapi.so

After that we resume the "centos2alma --resume" and the current thread error started.

Despite this problem the Plesk was running and all sites seem ok. MariaDB 10.3 was running. But the "centos2alma --resume" command still had the same errors.

So we decide to fix anything from the logs and use the server in production.

a) we updated the dovecot configuration as it was not working using the command :

:> plesk sbin sslmng --service dovecot --strong-dh --dhparams-size=2048

and also create a new configuration for dovecot:

:> cd /etc/dovecot/conf.d/

:> doveconf -Pn > dovecot-new.conf

b) We also umask the mysql and mysqld links from /etc/systemd/system We tried to recover it by creating new symbolic links to mysqld.service -> /usr/lib/systemd/system/mariadb.service mysql.service -> /usr/lib/systemd/system/mariadb.service

We rebooted the server and tried to resume the upgrade. And now we get the following error but we think the upgrade procedure finished.

:> ./centos2alma --resume

Couldn't resume from '/usr/local/psa/var/centos2alma/resume.json': [Errno 2] No such file or directory: '/usr/local/psa/var/centos2alma/resume.json' Traceback (most recent call last): File "/user/tools/06.upgrade.centos2alma/centos2alma/pleskdistup/main.py", line 424, in main resume_data = read_resume_data(options.resume_path) File "/user/tools/06.upgrade.centos2alma/centos2alma/pleskdistup/main.py", line 285, in read_resume_data with open(resume_path, "r") as f: FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/psa/var/centos2alma/resume.json'

Everything seems to work fine. / postfix / dovecot imap / web sites / Plesk admin /

Can you please confirm if this is a normal result to use the server in production after all these steps ?

SandakovMM commented 1 month ago

There are several actions you need to perform. However, we could try to restore the resume.json file. This should allow us to use the centos2alma --resume command. Please find the attached resume.json

nckdip commented 1 month ago

Something is happening with the MariaDB but the server is running normally.

2024-07-29 12:09:12,271 - INFO - Complete! 2024-07-29 12:09:12,331 - INFO - Command ['/usr/bin/yum', 'install', '-y', 'mariadb', 'mariadb-server'] finished successfully 2024-07-29 12:09:12,331 - INFO - Running: ['/usr/bin/systemctl', 'start', 'mariadb']. Output: 2024-07-29 12:09:12,348 - INFO - Command ['/usr/bin/systemctl', 'start', 'mariadb'] finished successfully 2024-07-29 12:09:12,349 - INFO - Running: ['/usr/bin/mysql_upgrade', '-uadmin', '-p$AES-128-CBC$pysHqoQ5tDlkHulFWzPlPA==$uBjQ585bejlJneUSf6QZ5Q==']. Output: 2024-07-29 12:09:12,401 - INFO - This installation of MariaDB is already upgraded to 10.3.39-MariaDB. 2024-07-29 12:09:12,402 - INFO - Command ['/usr/bin/mysql_upgrade', '-uadmin', '-p$AES-128-CBC$pysHqoQ5tDlkHulFWzPlPA==$uBjQ585bejlJneUSf6QZ5Q=='] finished successfully 2024-07-29 12:09:12,402 - DEBUG - Action 'updating mariadb databases' completed in 2 s with result: ActionResult(state=<ActionState.SUCCESS: 'success'>, info=None, reboot_requested=None, next_phase=None) 2024-07-29 12:09:12,402 - INFO - Success: updating mariadb databases 2024-07-29 12:09:12,402 - DEBUG - _track_flow(phase=None, stage='Update databases') 2024-07-29 12:09:12,403 - DEBUG - flow_tracker(phase=None, stage='Update databases') 2024-07-29 12:09:12,403 - DEBUG - ResumeTracker: phase=None, stage='Update databases' 2024-07-29 12:09:12,403 - DEBUG - Writing ResumeData(phase=<Phase.FINISH: 'finish'>, argv=['./centos2alma', '--upgrade-postgres', '--no-reboot'], upgrader_name='Plesk::Centos2AlmaConverter', stage='Update databases') to '/usr/local/psa/var/centos2alma/resume.json' 2024-07-29 12:09:12,404 - DEBUG - Starting the stage 'First plesk start' 2024-07-29 12:09:12,404 - INFO - Start stage 'First plesk start'. 2024-07-29 12:09:12,404 - DEBUG - Invoking action 'starting plesk services' 2024-07-29 12:09:12,404 - INFO - Do: starting plesk services 2024-07-29 12:09:12,404 - INFO - Running: ['/usr/bin/systemctl', 'stop', 'mariadb.service']. Output: 2024-07-29 12:09:13,699 - INFO - Command ['/usr/bin/systemctl', 'stop', 'mariadb.service'] finished successfully 2024-07-29 12:09:13,700 - INFO - Running: ['/usr/bin/systemctl', 'enable', 'mariadb.service', 'mysqld.service', 'plesk-task-manager.service', 'plesk-web-socket.service', 'sw-cp-server.service', 'sw-engine.service']. Output: 2024-07-29 12:09:13,715 - INFO - Failed to enable unit: Refusing to operate on linked unit file mysqld.service 2024-07-29 12:09:13,716 - ERROR - Command ['/usr/bin/systemctl', 'enable', 'mariadb.service', 'mysqld.service', 'plesk-task-manager.service', 'plesk-web-socket.service', 'sw-cp-server.service', 'sw-engine.service'] failed with return code 1 2024-07-29 12:09:13,716 - ERROR - Failed: starting plesk services. The reason: Command '['/usr/bin/systemctl', 'enable', 'mariadb.service', 'mysqld.service', 'plesk-task-manager.service', 'plesk-web-socket.service', 'sw-cp-server.service', 'sw-engine.service']' returned non-zero exit status 1.


The dist-ugrade process has failed. See the /var/log/plesk/centos2alma.log file for more information. The last 100 lines of the file are shown above. For assistance, call 'centos2alma --prepare-feedback' and follow the instructions.


SandakovMM commented 1 month ago

Ah yes, there is a problem with mysqld. Give me several hours to fix it

nckdip commented 1 month ago

OK - I just realised. The mysql was shut down but didn't start. I started it manually using systemctl start mysql or systemctl start mysqld

SandakovMM commented 1 month ago

The issue with mysqld should be resolved by #317. Attached is centos2alma.zip containing the fix, or you can get it from this build I've checked it on my side, but not sure in my STR

nckdip commented 1 month ago

I get this after running your latest release. Is there a command to validate the results ?

[root@cpanel02 1.3.x]# ./centos2alma --resume [> ( stage Handle packages and services / action re-installing plesk components ) ] 00:05 / 08:31 Last metadata expiration check: 1:30:16 ago on Mon 29 Jul 2024 04:02:34 PM EEST. [========> ( stage Prepare configurations / action restore Dovecot configuration ) ] 01:27 / 08:31 [root@cpanel02 1.3.x]#

SandakovMM commented 1 month ago

You could check the utility return code using echo $?. Alternatively, you might look at the end of the /var/log/plesk/centos2alma.log file. It should end with a message like "Dist-upgrade process completed, cleaning up".