Service ssh.service not found.

24 views
Skip to first unread message

nontriv...@gmail.com

unread,
Nov 8, 2020, 12:51:37 PM11/8/20
to Rex Users
Hello,

I've been happily using Rex for several years now to manage several servers but I have suddenly run into a problem I can't solve. I like to use standard repositories and my servers are currently running Ubuntu 18.04, so I am currently using rex version 1.6.0.

One of the things I do is every night I verify that several options in /etc/ssh/sshd_config are set correctly and if there are any changes then I restart the service. One of the servers just started throwing a "Service ssh.service not found" error even though I changed nothing on that server. None of the other servers are having that issue and unfortunately I can't figure out how rexify finds a service to try and figure out why it thinks it doesn't exist. I have tried reinstalling openssh-server and rebooting the server, ssh works just fine, and I can restart the service just fine on the command line.

Any help is greatly appreciated.

nontriv...@gmail.com

unread,
Nov 8, 2020, 1:17:01 PM11/8/20
to Rex Users
I just removed the code concerning SSH and it failed in the exact same way when I similarly check the mail (postfix) config. So how does rexify determine if a service exist so I can try and troubleshoot why apparently doesn't thing any services exist on that server?

nontriv...@gmail.com

unread,
Nov 10, 2020, 10:27:26 AM11/10/20
to Rex Users
I've dug into this a bit and it seems that the magic command is "systemctl --no-pager show %s | grep LoadState=loaded", which runs just fine on my problem server except that it also returns an error message "Failed to parse bus message: Invalid argument". It looks like the command is being run in a catch block and if an error is caught then it assumes that the command failed. Mr Google generally says this error has been fixed, update the latest version of systemd, nothing to see here, please move along. However I have done that and it's still No Bueno. So I updated the file cd /usr/share/perl5/Rex/Service/Redhat/systemd.pm and changed the command to "systemctl --no-pager -p LoadState show %s | grep LoadState=loaded"  which does not seem to trigger the error and allows rexify to complete successfully. Go Team!

James
Reply all
Reply to author
Forward
0 new messages