DNS plugin crashes retina-agent when debugfs is not mounted
- Dominant language
- Go
- Stars
- 3.2k
- Forks
- 304
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 78
Description
**Describe the bug**
When running `retina-agent` with the DNS plugin enabled on a system where `debugfs` is not mounted, an underlying dependency ([inspektor-gadget](https://github.com/inspektor-gadget/inspektor-gadget)) emits the following error to stderr:
`error: filesystems debugfs not mounted (did you try --auto-mount-filesystems?)`
Shortly after, it terminates the agent process ungracefully.
This behavior originates from [this line](https://github.com/microsoft/retina/blob/192ddfb5326b4a7cf50e279e2002c45f67f965c9/pkg/plugin/dns/dns_linux.go#L51), which uses `pkg/utils/host` from inspektor-gadget.
That package doesn't appear to be designed for library use, as [these lines in `host.go`](https://github.com/inspektor-gadget/inspektor-gadget/blob/b9ce0c3614ad0b225050aaabd5c91107a6132e76/pkg/utils/host/host.go#L97) directly writes to stderr and calls `os.Exit(1)`, not returning any error for handling upstream.
**To Reproduce**
I'm running Talos Linux, which is hardened by default and does not mount `debugfs`. Installing retina via the helm chart with the DNS plugin enabled always causes the agent to crash.
Command line I've used:
```sh
helm upgrade --install retina oci://ghcr.io/microsoft/retina/charts/retina-hubble \
--version $VERSION \
--namespace retina \
--set operator.enabled=true \
--set operator.repository=ghcr.io/microsoft/retina/retina-operator \
--set operator.tag=$VERSION \
--set agent.enabled=true \
--set agent.repository=ghcr.io/microsoft/retina/retina-agent \
--set agent.tag=$VERSION \
--set agent.init.enabled=true \
--set agent.init.repository=ghcr.io/microsoft/retina/retina-init \
--set agent.init.tag=$VERSION \
--set enabledPlugin_linux="\[dropreason\,packetforward\,linuxutil\,dns\]" \
--set namespace=retina \
--set logLevel=debug
```
**Expected behavior**
Either retina-agent should execute with no errors, or handle the error, logging properly and gracefully exiting.
**Platform (please complete the following information):**
- OS: Talos Linux v1.9.4
- Kubernetes Version: v1.32.2
- Host: Self-host
- Retina Version: v0.0.35
Contributor guide
Assessment
This issue has not been assessed yet.