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

Post Install Permission Issue when running Alloy as Systemd Service #2869

Open
SnowyJaguar1034 opened this issue Feb 27, 2025 · 1 comment
Open
Labels
bug Something isn't working

Comments

@SnowyJaguar1034
Copy link

What's wrong?

I get the following error when I try to run Alloy

Feb 25 23:28:16 semaphore alloy[29809]: Error: failed to create the remotecfg service: mkdir data-alloy: permission denied

I am trying to run Alloy as a systemd service on my Debian 12 system, under the Alloy user

I used the Alloy config generator (https://grafana.github.io/alloy-configurator/) to make a basic config, when using the Alloy format checker tool it doesn't produce any errors.

I have not manually adjusted any permissions of any directories post install as I assumed the installation should set them, My permissions are

snowy@semaphore:~$ sudo ls -l /etc/alloy/
total 5
-rw-r--r-- 1 root root   57 Feb 25 23:26 alloy.env
-rw-r--r-- 1 root root 1066 Feb 25 23:24 config.alloy
snowy@semaphore:~$ sudo ls -l /etc/systemd/system/alloy.service 
-rw-r--r-- 1 root root 275 Feb 25 23:27 /etc/systemd/system/alloy.service
snowy@semaphore:~$ sudo ls -l /var/lib/alloy/
total 1
drwxrwx--- 2 alloy alloy 2 Feb 25 22:52 data
snowy@semaphore:~$ 

This is my first time making an "official" bug report, for any project really, so if I've got somehting wrong or am missing required information please let me know.

Steps to reproduce

  • Download & Install Alloy
sudo mkdir -p /etc/apt/keyrings/
wget -q -O - https://apt.grafana.com/gpg.key | gpg --dearmor | sudo tee /etc/apt/keyrings/grafana.gpg > /dev/null
echo "deb [signed-by=/etc/apt/keyrings/grafana.gpg] https://apt.grafana.com stable main" | sudo tee /etc/apt/sources.list.d/grafana.list

sudo apt-get update

sudo apt-get install alloy
  • Upload Alloy config
  • Create systemd service file
# Systemd Service Configuration
# Save as: /etc/systemd/system/alloy.service
[Unit]
Description=Grafana Alloy Service
After=network.target

[Service]
User=alloy
ExecStart=/usr/bin/alloy run /etc/alloy/config.alloy
Restart=always

[Install]
WantedBy=multi-user.target
  • Run the systemd service file that was created
  • Receive the failed to create the remotecfg service: mkdir data-alloy: permission denied error

System information

Debian 12 on X86

Software version

v1.7.0

Configuration

prometheus.remote_write "local" {
  endpoint {
    url = "http://192.168.86.19:8428/api/v1/push"
  }
}

loki.write "local" {
  endpoint {
    url = "http://192.168.86.19:3100/loki/api/v1/push"
  }
}

prometheus.scrape "linux_node" {
  targets = prometheus.exporter.unix.node.targets
  forward_to = [
    prometheus.remote_write.local.receiver,
  ]
}

prometheus.exporter.unix "node" {
}

loki.relabel "journal" {
  forward_to = []

  rule {
    source_labels = ["__journal__systemd_unit"]
    target_label  = "unit"
  }
  rule {
    source_labels = ["__journal__boot_id"]
    target_label  = "boot_id"
  }
  rule {
    source_labels = ["__journal__transport"]
    target_label  = "transport"
  }
  rule {
    source_labels = ["__journal_priority_keyword"]
    target_label  = "level"
  }
  rule {
    source_labels = ["__journal__hostname"]
    target_label  = "instance"
  }
}

loki.source.journal "read" {
  forward_to = [
    loki.write.local.receiver,
  ]
  relabel_rules = loki.relabel.journal.rules
  labels = {
    "job" = "integrations/node_exporter",
  }
}

Logs

snowy@semaphore:~$ sudo journalctl -u alloy --no-pager --lines=150
Feb 25 23:14:21 semaphore systemd[1]: alloy.service: Failed with result 'exit-code'.
Feb 25 23:14:21 semaphore systemd[1]: alloy.service: Scheduled restart job, restart counter is at 3.
Feb 25 23:14:21 semaphore systemd[1]: Stopped alloy.service - Grafana Alloy Service.
Feb 25 23:14:21 semaphore systemd[1]: Started alloy.service - Grafana Alloy Service.
Feb 25 23:14:22 semaphore alloy[29464]: Error: unknown flag: --config.file
Feb 25 23:14:22 semaphore systemd[1]: alloy.service: Main process exited, code=exited, status=1/FAILURE
Feb 25 23:14:22 semaphore systemd[1]: alloy.service: Failed with result 'exit-code'.
Feb 25 23:14:22 semaphore systemd[1]: alloy.service: Scheduled restart job, restart counter is at 4.
Feb 25 23:14:22 semaphore systemd[1]: Stopped alloy.service - Grafana Alloy Service.
Feb 25 23:14:22 semaphore systemd[1]: Started alloy.service - Grafana Alloy Service.
Feb 25 23:14:22 semaphore alloy[29471]: Error: unknown flag: --config.file
Feb 25 23:14:22 semaphore systemd[1]: alloy.service: Main process exited, code=exited, status=1/FAILURE
Feb 25 23:14:22 semaphore systemd[1]: alloy.service: Failed with result 'exit-code'.
Feb 25 23:14:22 semaphore systemd[1]: alloy.service: Scheduled restart job, restart counter is at 5.
Feb 25 23:14:22 semaphore systemd[1]: Stopped alloy.service - Grafana Alloy Service.
Feb 25 23:14:22 semaphore systemd[1]: alloy.service: Start request repeated too quickly.
Feb 25 23:14:22 semaphore systemd[1]: alloy.service: Failed with result 'exit-code'.
Feb 25 23:14:22 semaphore systemd[1]: Failed to start alloy.service - Grafana Alloy Service.
Feb 25 23:21:15 semaphore systemd[1]: Started alloy.service - Grafana Alloy Service.
Feb 25 23:21:15 semaphore alloy[29527]: Error: unknown flag: --config.file
Feb 25 23:21:15 semaphore systemd[1]: alloy.service: Main process exited, code=exited, status=1/FAILURE
Feb 25 23:21:15 semaphore systemd[1]: alloy.service: Failed with result 'exit-code'.
Feb 25 23:21:15 semaphore systemd[1]: alloy.service: Scheduled restart job, restart counter is at 1.
Feb 25 23:21:15 semaphore systemd[1]: Stopped alloy.service - Grafana Alloy Service.
Feb 25 23:21:15 semaphore systemd[1]: Started alloy.service - Grafana Alloy Service.
Feb 25 23:21:15 semaphore alloy[29534]: Error: unknown flag: --config.file
Feb 25 23:21:15 semaphore systemd[1]: alloy.service: Main process exited, code=exited, status=1/FAILURE
Feb 25 23:21:15 semaphore systemd[1]: alloy.service: Failed with result 'exit-code'.
Feb 25 23:21:15 semaphore systemd[1]: alloy.service: Scheduled restart job, restart counter is at 2.
Feb 25 23:21:15 semaphore systemd[1]: Stopped alloy.service - Grafana Alloy Service.
Feb 25 23:21:15 semaphore systemd[1]: Started alloy.service - Grafana Alloy Service.
Feb 25 23:21:16 semaphore alloy[29541]: Error: unknown flag: --config.file
Feb 25 23:21:16 semaphore systemd[1]: alloy.service: Main process exited, code=exited, status=1/FAILURE
Feb 25 23:21:16 semaphore systemd[1]: alloy.service: Failed with result 'exit-code'.
Feb 25 23:21:16 semaphore systemd[1]: alloy.service: Scheduled restart job, restart counter is at 3.
Feb 25 23:21:16 semaphore systemd[1]: Stopped alloy.service - Grafana Alloy Service.
Feb 25 23:21:16 semaphore systemd[1]: Started alloy.service - Grafana Alloy Service.
Feb 25 23:21:16 semaphore alloy[29548]: Error: unknown flag: --config.file
Feb 25 23:21:16 semaphore systemd[1]: alloy.service: Main process exited, code=exited, status=1/FAILURE
Feb 25 23:21:16 semaphore systemd[1]: alloy.service: Failed with result 'exit-code'.
Feb 25 23:21:16 semaphore systemd[1]: alloy.service: Scheduled restart job, restart counter is at 4.
Feb 25 23:21:16 semaphore systemd[1]: Stopped alloy.service - Grafana Alloy Service.
Feb 25 23:21:16 semaphore systemd[1]: Started alloy.service - Grafana Alloy Service.
Feb 25 23:21:17 semaphore alloy[29555]: Error: unknown flag: --config.file
Feb 25 23:21:17 semaphore systemd[1]: alloy.service: Main process exited, code=exited, status=1/FAILURE
Feb 25 23:21:17 semaphore systemd[1]: alloy.service: Failed with result 'exit-code'.
Feb 25 23:21:17 semaphore systemd[1]: alloy.service: Scheduled restart job, restart counter is at 5.
Feb 25 23:21:17 semaphore systemd[1]: Stopped alloy.service - Grafana Alloy Service.
Feb 25 23:21:17 semaphore systemd[1]: alloy.service: Start request repeated too quickly.
Feb 25 23:21:17 semaphore systemd[1]: alloy.service: Failed with result 'exit-code'.
Feb 25 23:21:17 semaphore systemd[1]: Failed to start alloy.service - Grafana Alloy Service.
Feb 25 23:26:49 semaphore systemd[1]: Started alloy.service - Grafana Alloy Service.
Feb 25 23:26:49 semaphore alloy[29669]: Error: unknown flag: --config.file
Feb 25 23:26:49 semaphore systemd[1]: alloy.service: Main process exited, code=exited, status=1/FAILURE
Feb 25 23:26:49 semaphore systemd[1]: alloy.service: Failed with result 'exit-code'.
Feb 25 23:26:50 semaphore systemd[1]: alloy.service: Scheduled restart job, restart counter is at 1.
Feb 25 23:26:50 semaphore systemd[1]: Stopped alloy.service - Grafana Alloy Service.
Feb 25 23:26:50 semaphore systemd[1]: Started alloy.service - Grafana Alloy Service.
Feb 25 23:26:50 semaphore alloy[29676]: Error: unknown flag: --config.file
Feb 25 23:26:50 semaphore systemd[1]: alloy.service: Main process exited, code=exited, status=1/FAILURE
Feb 25 23:26:50 semaphore systemd[1]: alloy.service: Failed with result 'exit-code'.
Feb 25 23:26:50 semaphore systemd[1]: alloy.service: Scheduled restart job, restart counter is at 2.
Feb 25 23:26:50 semaphore systemd[1]: Stopped alloy.service - Grafana Alloy Service.
Feb 25 23:26:50 semaphore systemd[1]: Started alloy.service - Grafana Alloy Service.
Feb 25 23:26:50 semaphore alloy[29683]: Error: unknown flag: --config.file
Feb 25 23:26:50 semaphore systemd[1]: alloy.service: Main process exited, code=exited, status=1/FAILURE
Feb 25 23:26:50 semaphore systemd[1]: alloy.service: Failed with result 'exit-code'.
Feb 25 23:26:51 semaphore systemd[1]: alloy.service: Scheduled restart job, restart counter is at 3.
Feb 25 23:26:51 semaphore systemd[1]: Stopped alloy.service - Grafana Alloy Service.
Feb 25 23:26:51 semaphore systemd[1]: Started alloy.service - Grafana Alloy Service.
Feb 25 23:26:51 semaphore alloy[29690]: Error: unknown flag: --config.file
Feb 25 23:26:51 semaphore systemd[1]: alloy.service: Main process exited, code=exited, status=1/FAILURE
Feb 25 23:26:51 semaphore systemd[1]: alloy.service: Failed with result 'exit-code'.
Feb 25 23:26:51 semaphore systemd[1]: alloy.service: Scheduled restart job, restart counter is at 4.
Feb 25 23:26:51 semaphore systemd[1]: Stopped alloy.service - Grafana Alloy Service.
Feb 25 23:26:51 semaphore systemd[1]: Started alloy.service - Grafana Alloy Service.
Feb 25 23:26:51 semaphore alloy[29697]: Error: unknown flag: --config.file
Feb 25 23:26:51 semaphore systemd[1]: alloy.service: Main process exited, code=exited, status=1/FAILURE
Feb 25 23:26:51 semaphore systemd[1]: alloy.service: Failed with result 'exit-code'.
Feb 25 23:26:51 semaphore systemd[1]: alloy.service: Scheduled restart job, restart counter is at 5.
Feb 25 23:26:51 semaphore systemd[1]: Stopped alloy.service - Grafana Alloy Service.
Feb 25 23:26:51 semaphore systemd[1]: alloy.service: Start request repeated too quickly.
Feb 25 23:26:51 semaphore systemd[1]: alloy.service: Failed with result 'exit-code'.
Feb 25 23:26:51 semaphore systemd[1]: Failed to start alloy.service - Grafana Alloy Service.
Feb 25 23:27:51 semaphore systemd[1]: Started alloy.service - Grafana Alloy Service.
Feb 25 23:27:52 semaphore alloy[29719]: Error: unknown flag: --config.file
Feb 25 23:27:52 semaphore systemd[1]: alloy.service: Main process exited, code=exited, status=1/FAILURE
Feb 25 23:27:52 semaphore systemd[1]: alloy.service: Failed with result 'exit-code'.
Feb 25 23:27:52 semaphore systemd[1]: alloy.service: Scheduled restart job, restart counter is at 1.
Feb 25 23:27:52 semaphore systemd[1]: Stopped alloy.service - Grafana Alloy Service.
Feb 25 23:27:52 semaphore systemd[1]: Started alloy.service - Grafana Alloy Service.
Feb 25 23:27:52 semaphore alloy[29726]: Error: unknown flag: --config.file
Feb 25 23:27:52 semaphore systemd[1]: alloy.service: Main process exited, code=exited, status=1/FAILURE
Feb 25 23:27:52 semaphore systemd[1]: alloy.service: Failed with result 'exit-code'.
Feb 25 23:27:52 semaphore systemd[1]: alloy.service: Scheduled restart job, restart counter is at 2.
Feb 25 23:27:52 semaphore systemd[1]: Stopped alloy.service - Grafana Alloy Service.
Feb 25 23:27:52 semaphore systemd[1]: Started alloy.service - Grafana Alloy Service.
Feb 25 23:27:53 semaphore alloy[29733]: Error: unknown flag: --config.file
Feb 25 23:27:53 semaphore systemd[1]: alloy.service: Main process exited, code=exited, status=1/FAILURE
Feb 25 23:27:53 semaphore systemd[1]: alloy.service: Failed with result 'exit-code'.
Feb 25 23:27:53 semaphore systemd[1]: alloy.service: Scheduled restart job, restart counter is at 3.
Feb 25 23:27:53 semaphore systemd[1]: Stopped alloy.service - Grafana Alloy Service.
Feb 25 23:27:53 semaphore systemd[1]: Started alloy.service - Grafana Alloy Service.
Feb 25 23:27:53 semaphore alloy[29740]: Error: unknown flag: --config.file
Feb 25 23:27:53 semaphore systemd[1]: alloy.service: Main process exited, code=exited, status=1/FAILURE
Feb 25 23:27:53 semaphore systemd[1]: alloy.service: Failed with result 'exit-code'.
Feb 25 23:27:53 semaphore systemd[1]: alloy.service: Scheduled restart job, restart counter is at 4.
Feb 25 23:27:53 semaphore systemd[1]: Stopped alloy.service - Grafana Alloy Service.
Feb 25 23:27:53 semaphore systemd[1]: Started alloy.service - Grafana Alloy Service.
Feb 25 23:27:54 semaphore alloy[29747]: Error: unknown flag: --config.file
Feb 25 23:27:54 semaphore systemd[1]: alloy.service: Main process exited, code=exited, status=1/FAILURE
Feb 25 23:27:54 semaphore systemd[1]: alloy.service: Failed with result 'exit-code'.
Feb 25 23:27:54 semaphore systemd[1]: alloy.service: Scheduled restart job, restart counter is at 5.
Feb 25 23:27:54 semaphore systemd[1]: Stopped alloy.service - Grafana Alloy Service.
Feb 25 23:27:54 semaphore systemd[1]: alloy.service: Start request repeated too quickly.
Feb 25 23:27:54 semaphore systemd[1]: alloy.service: Failed with result 'exit-code'.
Feb 25 23:27:54 semaphore systemd[1]: Failed to start alloy.service - Grafana Alloy Service.
Feb 25 23:28:14 semaphore systemd[1]: Started alloy.service - Grafana Alloy Service.
Feb 25 23:28:14 semaphore alloy[29779]: Error: failed to create the remotecfg service: mkdir data-alloy: permission denied
Feb 25 23:28:14 semaphore systemd[1]: alloy.service: Main process exited, code=exited, status=1/FAILURE
Feb 25 23:28:14 semaphore systemd[1]: alloy.service: Failed with result 'exit-code'.
Feb 25 23:28:14 semaphore systemd[1]: alloy.service: Scheduled restart job, restart counter is at 1.
Feb 25 23:28:14 semaphore systemd[1]: Stopped alloy.service - Grafana Alloy Service.
Feb 25 23:28:14 semaphore systemd[1]: Started alloy.service - Grafana Alloy Service.
Feb 25 23:28:14 semaphore alloy[29787]: Error: failed to create the remotecfg service: mkdir data-alloy: permission denied
Feb 25 23:28:14 semaphore systemd[1]: alloy.service: Main process exited, code=exited, status=1/FAILURE
Feb 25 23:28:14 semaphore systemd[1]: alloy.service: Failed with result 'exit-code'.
Feb 25 23:28:14 semaphore systemd[1]: alloy.service: Scheduled restart job, restart counter is at 2.
Feb 25 23:28:14 semaphore systemd[1]: Stopped alloy.service - Grafana Alloy Service.
Feb 25 23:28:14 semaphore systemd[1]: Started alloy.service - Grafana Alloy Service.
Feb 25 23:28:15 semaphore alloy[29795]: Error: failed to create the remotecfg service: mkdir data-alloy: permission denied
Feb 25 23:28:15 semaphore systemd[1]: alloy.service: Main process exited, code=exited, status=1/FAILURE
Feb 25 23:28:15 semaphore systemd[1]: alloy.service: Failed with result 'exit-code'.
Feb 25 23:28:15 semaphore systemd[1]: alloy.service: Scheduled restart job, restart counter is at 3.
Feb 25 23:28:15 semaphore systemd[1]: Stopped alloy.service - Grafana Alloy Service.
Feb 25 23:28:15 semaphore systemd[1]: Started alloy.service - Grafana Alloy Service.
Feb 25 23:28:15 semaphore alloy[29802]: Error: failed to create the remotecfg service: mkdir data-alloy: permission denied
Feb 25 23:28:15 semaphore systemd[1]: alloy.service: Main process exited, code=exited, status=1/FAILURE
Feb 25 23:28:15 semaphore systemd[1]: alloy.service: Failed with result 'exit-code'.
Feb 25 23:28:15 semaphore systemd[1]: alloy.service: Scheduled restart job, restart counter is at 4.
Feb 25 23:28:15 semaphore systemd[1]: Stopped alloy.service - Grafana Alloy Service.
Feb 25 23:28:15 semaphore systemd[1]: Started alloy.service - Grafana Alloy Service.
Feb 25 23:28:16 semaphore alloy[29809]: Error: failed to create the remotecfg service: mkdir data-alloy: permission denied
Feb 25 23:28:16 semaphore systemd[1]: alloy.service: Main process exited, code=exited, status=1/FAILURE
Feb 25 23:28:16 semaphore systemd[1]: alloy.service: Failed with result 'exit-code'.
Feb 25 23:28:16 semaphore systemd[1]: alloy.service: Scheduled restart job, restart counter is at 5.
Feb 25 23:28:16 semaphore systemd[1]: Stopped alloy.service - Grafana Alloy Service.
Feb 25 23:28:16 semaphore systemd[1]: alloy.service: Start request repeated too quickly.
Feb 25 23:28:16 semaphore systemd[1]: alloy.service: Failed with result 'exit-code'.
Feb 25 23:28:16 semaphore systemd[1]: Failed to start alloy.service - Grafana Alloy Service.
snowy@semaphore:~$
@SnowyJaguar1034 SnowyJaguar1034 added the bug Something isn't working label Feb 27, 2025
@patrickbland
Copy link

I am trying to do the same thing just following the basic quick start documentation for grafana cloud (looking to switch from datadog for prod) -- no clue and currently don't know jack about grafana right now... a bit challenging

https://xxxxxx.grafana.net/connections/add-new-connection/linux-node?page=alloy

following direction to a T on this page does not work -- I opened a support ticket too

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
None yet
Development

No branches or pull requests

2 participants