LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > CentOS
User Name
Password
CentOS This forum is for the discussion of CentOS Linux. Note: This forum does not have any official participation.

Notices


Reply
  Search this Thread
Old 01-17-2019, 06:30 AM   #1
imperialguy
LQ Newbie
 
Registered: Jul 2012
Posts: 7

Rep: Reputation: Disabled
Angry RHEL/CentOS 7: Problem with systemctl --root= option


It is my understanding that --root= option in systemctl command is used to explicitly specify an alternate root path to find the service unit files.

On RHEL/CentOS 7, the following error occurs when attempting to use the above mentioned systemctl option:

Code:
[root@server-02 system]# systemctl --root=/myservices/mds start xyz.service
Failed to get D-Bus connection: Operation not permitted
Please note that the above command is run as root.

So, the idea behind the above command is that I am telling systemctl to find the service called xyz.service in the path /myservices/mds, as opposed to the default search paths like /etc/systemd/system or /run/systemd/system

Any idea why this is not working? If --root is not going to work, is there any other way to specify a custom search path?

Would really appreciate the help.

Last edited by imperialguy; 01-17-2019 at 07:09 AM.
 
Old 01-17-2019, 06:41 AM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,120

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
The message tells why it is not working. Try sudo.
 
Old 01-17-2019, 07:00 AM   #3
imperialguy
LQ Newbie
 
Registered: Jul 2012
Posts: 7

Original Poster
Rep: Reputation: Disabled
@syg00 I am running the command as root
 
Old 01-17-2019, 07:07 AM   #4
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Quote:
Originally Posted by imperialguy View Post
@syg00 I am running the command as root
Then remove the sudo. It might remove some environment variables that are required for this to work (just guessing).

EDIT: From the man page:
Code:
--root=

    When used with enable/disable/is-enabled (and related commands), 
    use the specified root path when looking for unit files. 
    If this option is present, systemctl will operate on the file system 
    directly, instead of communicating with the systemd daemon to carry out
    changes.
It says nothing about starting a service.

Last edited by berndbausch; 01-17-2019 at 07:09 AM.
 
Old 01-17-2019, 07:08 AM   #5
imperialguy
LQ Newbie
 
Registered: Jul 2012
Posts: 7

Original Poster
Rep: Reputation: Disabled
@berndbausch Still doesn't work
 
Old 01-17-2019, 07:13 AM   #6
imperialguy
LQ Newbie
 
Registered: Jul 2012
Posts: 7

Original Poster
Rep: Reputation: Disabled
Now I am getting this:

Code:
[root@server-02 ~]# systemctl --root=/myservices/mds enable xyz.service
Operation failed: No such file or directory
 
  


Reply

Tags
centos7, path, rhel7, root, systemd



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Systemctl Services in RHEL 7 LXer Syndicated Linux News 0 04-16-2018 11:02 AM
Restart systemctl*daemon​ - systemctl command not found cjosephl Linux - Newbie 7 11-11-2017 04:53 PM
Problem with MySQL install on virt CentOS,no /var/lib/mysql/mysql.sock , systemctl start mysqld.service dont run the service Positive1 CentOS 1 08-13-2016 03:33 AM
systemctl vs init.d on Centos 7 Ryanms3030 Linux - Newbie 8 11-04-2014 07:55 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > CentOS

All times are GMT -5. The time now is 02:57 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration