Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Service status shown incorrectly for non-root users #142

Open
tknerr opened this issue Mar 18, 2022 · 1 comment
Open

Service status shown incorrectly for non-root users #142

tknerr opened this issue Mar 18, 2022 · 1 comment

Comments

@tknerr
Copy link

tknerr commented Mar 18, 2022

When starting a service with sudo privileges, the service's active state will be shown correctly with sudo privileges only, but not with user privileges.

Example: consider the apache2 service.

At first it is not running yet, no matter if we check with or without sudo:

vagrant@cb9578505fac:/$ systemctl status apache2
apache2.service - The Apache HTTP Server
    Loaded: loaded (/usr/lib/systemd/system/apache2.service, disabled)
    Active: inactive (dead)
vagrant@cb9578505fac:/$ sudo systemctl status apache2
apache2.service - The Apache HTTP Server
    Loaded: loaded (/usr/lib/systemd/system/apache2.service, disabled)
    Active: inactive (dead)

Then, when "apache2" is started, it shows up as "active (running)" when checked with sudo permissions:

vagrant@cb9578505fac:/$ sudo systemctl start apache2
vagrant@cb9578505fac:/$ sudo systemctl status apache2
apache2.service - The Apache HTTP Server
    Loaded: loaded (/usr/lib/systemd/system/apache2.service, disabled)
    Active: active (running)

However, when checking the status without sudo permissions, it shows up as "inactive (dead)":

vagrant@cb9578505fac:/$ systemctl status apache2
apache2.service - The Apache HTTP Server
    Loaded: loaded (/usr/lib/systemd/system/apache2.service, disabled)
    Active: inactive (dead)

Even though, checking again with sudo permissions, it is still "active (running)":

vagrant@cb9578505fac:/$ sudo systemctl status apache2
apache2.service - The Apache HTTP Server
    Loaded: loaded (/usr/lib/systemd/system/apache2.service, disabled)
    Active: active (running)

Is this intended behaviour, or a bug?

At least on my Ubuntu system (with original systemctl) you can successfully query the correct status of the services, no matter if they were started with sudo privileges or not...

@alepinio
Copy link

alepinio commented May 6, 2024

Hi, I'm facing the same problem with mosquitto.

It would be very useful to know if this is intended behavior or a bug.

EDIT: I'm using docker-systemctl-replacement 1.5.8066.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants