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

[Bug]: Network interfaces are not picked up at boot #466

Open
svenvg93 opened this issue Jan 21, 2025 · 4 comments
Open

[Bug]: Network interfaces are not picked up at boot #466

svenvg93 opened this issue Jan 21, 2025 · 4 comments
Labels
bug Something isn't working

Comments

@svenvg93
Copy link
Contributor

Description

Might be related to #416

When the binary agents starts after the system is start up, it does not pick up the network interfaces to collect the metrics. They are not shown in the agents status. I noticed this on mulitple x86 and arm64 machines

sven@pi5:~ $ systemctl status beszel-agent
● beszel-agent.service - Beszel Agent Service
     Loaded: loaded (/etc/systemd/system/beszel-agent.service; enabled; preset: enabled)
     Active: active (running) since Tue 2025-01-21 08:49:20 CET; 49s ago
   Main PID: 778 (beszel-agent)
      Tasks: 6 (limit: 4764)
     Memory: 12.7M
        CPU: 417ms
     CGroup: /system.slice/beszel-agent.service
             └─778 /opt/beszel-agent/beszel-agent

Jan 21 08:49:20 pi5 systemd[1]: Started beszel-agent.service - Beszel Agent Service.
Jan 21 08:49:20 pi5 beszel-agent[778]: 2025/01/21 08:49:20 INFO Detected root device name=nvme0n1p2
Jan 21 08:49:22 pi5 beszel-agent[778]: 2025/01/21 08:49:22 INFO Starting SSH server address=:45876

I need to restart the agent again for the network to be picked up. Seems we might need a bigger delay for the network to be fully really ?

Expected Behavior

Network interfaces are picked up when the agent starts

Steps to Reproduce

  1. Install the binary
  2. Check if the network interfaces are collected.
  3. Reboot the system
  4. Check if the network interfaces are collected.

OS / Architecture

amd64 & arm64

Beszel version

0.9.1

Installation method

Binary

Configuration

Service config;

sven@pi5:~ $ cat /etc/systemd/system/beszel-agent.service
[Unit]
Description=Beszel Agent Service
After=network.target

[Service]
Environment="PORT=45876"
Environment="KEY=ssh-ed25519 REDACTED"
# Environment="EXTRA_FILESYSTEMS=sdb"
ExecStart=/opt/beszel-agent/beszel-agent
User=beszel
Restart=always
RestartSec=5

[Install]
WantedBy=multi-user.target

Hub Logs

Agent Logs

@svenvg93 svenvg93 added the bug Something isn't working label Jan 21, 2025
@henrygd
Copy link
Owner

henrygd commented Jan 21, 2025

Thanks for reporting this!

Looks like we might need to swap network.target with network-online.target

So instead of this:

[Unit]
Description=Beszel Agent Service
After=network.target

We would want this:

[Unit]
Description=Beszel Agent Service
Wants=network-online.target
After=network-online.target

I'll see if I can replicate and whether this change fixes the issue.

@svenvg93
Copy link
Contributor Author

Changed the systemd service to below and now the interfaces are there after a reboot.

[Unit]
Description=Beszel Agent Service
Wants=network-online.target
After=network-online.target

@henrygd
Copy link
Owner

henrygd commented Jan 21, 2025

Great, thanks for checking! I'll update the install script and docs.

I may add a check for this in the agent, but for now here's a fix:

sudo sed -i 's/^After=network.target$/After=network-online.target\nWants=network-online.target/' /etc/systemd/system/beszel-agent.service
sudo systemctl daemon-reload
sudo systemctl restart beszel-agent.service

@svenvg93
Copy link
Contributor Author

svenvg93 commented Jan 21, 2025

Cool! Thanks!

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