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

Debian buster package does not play systemctl daemon-reload after installation #509

Open
nervo opened this issue Dec 26, 2022 · 4 comments
Labels
bug Something isn't working

Comments

@nervo
Copy link

nervo commented Dec 26, 2022

I've tested with current release 0.30.1-1. Here is a simple test scenario:

# Start debian buster docker systemd container
docker run --rm -ti --name grafana-agent-buster --privileged -v /sys/fs/cgroup:/sys/fs/cgroup:rw --cgroupns host jrei/systemd-debian:buster

# In an another terminal, shell on it
docker exec -ti grafana-agent-buster bash

# Install grafana agent
apt update && apt install -y wget gnupg
wget -q https://apt.grafana.com/gpg.key -O- | apt-key add -
echo "deb https://apt.grafana.com stable main" > /etc/apt/sources.list.d/grafana.list
apt update && apt install -y grafana-agent

# Now let's check service status
systemctl status grafana-agent
> Unit grafana-agent.service could not be found.

# Ok let's reload...
systemctl daemon-reload
# And now \o/
systemctl status grafana-agent
> * grafana-agent.service - Monitoring system and forwarder
>    Loaded: loaded (/usr/lib/systemd/system/grafana-agent.service; disabled; vendor preset: enabled)
>    Active: inactive (dead)
>      Docs: https://grafana.com/docs/agent/latest/

I've also tested it on debian bullseye, but this time grafana-agent service is well detected:

docker run --rm -ti --name grafana-agent-bullseye --privileged -v /sys/fs/cgroup:/sys/fs/cgroup:rw --cgroupns host jrei/systemd-debian:bullseye
docker exec -ti grafana-agent-bullseye bash
...
...
systemctl status grafana-agent
> * grafana-agent.service - Monitoring system and forwarder
>    Loaded: loaded (/usr/lib/systemd/system/grafana-agent.service; disabled; vendor preset: enabled)
>    Active: inactive (dead)
>      Docs: https://grafana.com/docs/agent/latest/

I suppose it's related to how debian package tools automatically handle service found in deb packages, and differences between buster and bullseye versions.
Anyway, i also see that it's a common practice to force daemon-reload in postinst scripts, just like - for instance - hashicorp consul: https://github.com/hashicorp/consul/blob/main/.release/linux/postinstall

@rfratto
Copy link
Member

rfratto commented Jan 4, 2023

Hmm, it looks like we're supposed to reload it, but only if RESTART_ON_UPGRADE is set.

@jdbaldry initially contributed the system packages; @jdbaldry do you remember why the RESTART_ON_UPGRADE check was added?

@jdbaldry
Copy link
Member

jdbaldry commented Jan 5, 2023

My understanding is that is is useful to have RESTART_ON_UPGRADE as a safety mechanism to prevent unintended restarts of stateful services by configuration management tools or otherwise.

However, this should only be considered for upgrades and it makes sense to me that the service should start automatically on install so introducing the logic to do that seems reasonable.

@rfratto rfratto added the bug Something isn't working label Apr 9, 2024
@rfratto
Copy link
Member

rfratto commented Apr 11, 2024

Hi there 👋

On April 9, 2024, Grafana Labs announced Grafana Alloy, the spirital successor to Grafana Agent and the final form of Grafana Agent flow mode. As a result, Grafana Agent has been deprecated and will only be receiving bug and security fixes until its end-of-life around November 1, 2025.

To make things easier for maintainers, we're in the process of migrating all issues tagged variant/flow to the Grafana Alloy repository to have a single home for tracking issues. This issue is likely something we'll want to address in both Grafana Alloy and Grafana Agent, so just because it's being moved doesn't mean we won't address the issue in Grafana Agent :)

@rfratto rfratto transferred this issue from grafana/agent Apr 11, 2024
@Skaronator
Copy link

We just run in the same issue while upgrading alloy from 1.2.0 to 1.3.0. Weirdly, half of our server fleet just updated correctly, the other half did not.

As you can see here:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
No open projects
Development

No branches or pull requests

4 participants