snmpd fails to recognize Docker's overlay filesystem

Bug #2007856 reported by István Papp
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Net-SNMP
Fix Released
Unknown
net-snmp (Ubuntu)
Fix Released
High
Bryce Harrington
Lunar
Fix Released
High
Bryce Harrington

Bug Description

Ubuntu release: 22.04 (Jammy)
Package: https://packages.ubuntu.com/jammy/snmpd

The net-snmp project switched to a new implementation of the fsys hardware module at their 5.8 version. This was not mentioned in the release notes, because the decision was made earlier through the build system. The new version did not recognize the /etc/mtab entry of "overlay" as a supported filesystem, so monitoring / inside a Docker container fails after Bionic (5.7.3), likely in every Ubuntu since Focal (5.8).

The fix happened in this commit, already on their master: https://github.com/net-snmp/net-snmp/commit/798f206561b7de4bc54453c01ffd21de8ae59c87
Since it is an added item in a static list, it would be easy to backport to Jammy's 5.9.1, or most other releases really. A refactor happened at some point that makes backporting before a certain version a bit more interesting, but still easy based on the suggestions in this similar issue: https://github.com/net-snmp/net-snmp/issues/268

Steps to reproduce:
1. Extract the attached zip with a Dockerfile, a patch, and an snmpd.conf
2. Run "docker build -t repro . && docker run --rm -p 161:161/udp repro" to compile and start a Jammy container with a 5.9.1 snmpd inside.
3. Query the disk table from another terminal: "snmpwalk -v2c -c public 0.0.0.0:161 .1.3.6.1.4.1.2021.9"

There should be no OID found. Repeat steps 2 and 3 after uncommenting the two lines in the Dockerfile that apply the patch. Now proper data should arrive about the root filesystem.

I would like to get an SRU with this patch for Jammy.

There should be no risk except for snmpd users. The patch is recent and not released, so it is not widely tested yet. It should only impact snmpd users with Docker containers, since it only expands the list of recognized filesystems with "overlay". This feature was broken since Focal, so I assume there aren't many such users.

Tags: server-todo

Related branches

Revision history for this message
István Papp (number492) wrote :
affects: unattended-upgrades (Ubuntu) → net-snmp (Ubuntu)
Revision history for this message
Bryce Harrington (bryce) wrote :

Thanks for the steps to reproduce and link to the patch. It looks like this would affect kinetic and lunar as well, since the fix looks newer than the current 5.9.3 version included in those releases.

Changed in net-snmp (Ubuntu Lunar):
status: New → Triaged
tags: added: server-todo
Changed in net-snmp (Ubuntu Focal):
assignee: nobody → Bryce Harrington (bryce)
Changed in net-snmp (Ubuntu Jammy):
assignee: nobody → Bryce Harrington (bryce)
Changed in net-snmp (Ubuntu Kinetic):
assignee: nobody → Bryce Harrington (bryce)
Changed in net-snmp (Ubuntu Lunar):
assignee: nobody → Bryce Harrington (bryce)
Revision history for this message
Bryce Harrington (bryce) wrote :

Hi István,

I've packaged the patch for lunar (Ubuntu 23.04) and posted to a PPA for testing:
    - https://launchpad.net/~bryce/+archive/ubuntu/net-snmp-sru-lp2007856

Currently lunar is in beta-freeze, but I think there'll be time to land this prior to the release, so we can get the fix in for the latest Ubuntu version.

Regarding SRU to older versions, there's some criteria to meet that I'm not certain this qualifies for but perhaps you can help. First, changes which enable features tend to raise red flags as far as the SRU approval goes, since even though this is just a one-line patch it enables a capability that itself might be buggy or might trigger bugs in other conditions that haven't been well tested. I'm not sure how to evaluate that criteria in this case, maybe the feature is sufficiently limited in scope it's a non-issue, however if it's a recent patch not widely tested that makes me concerned there could be undiscovered issues... The second important criteria is "impact", IOW how widespread is this problem and would it help a sufficiently large number of users to be worth the risk of adding the change? From your bug report it kind of sounds like the impact might be narrow in this case?

Anyway, I'd love to hear your thoughts on the above before we proceed with the SRU to past releases. This is a nice improvement that would be great to get out to users, but for SRU approval we'll need to ensure there's a strong case to make on the above points.

Meanwhile, I can continue the packaging work to get the patch available on the LTS releases via the PPA. That will at least ensure the fix is available for users wanting this, and may help on the testing front to verify the fix does work properly and reduce the regression concern levels.

Changed in net-snmp (Ubuntu Lunar):
importance: Undecided → High
status: Triaged → In Progress
Revision history for this message
István Papp (number492) wrote :

Hi Bryce,

Thanks a lot for handling this issue!

I would be happy to have this backported to Jammy, so I don't have to maintain my own build of net-snmp. To be honest, I'm not sure it qualifies either.

Pros:
- This feature worked in an earlier version of net-snmp, so any other component that might encounter this behaviour should not be surprised.
- It could count as a fix, since it worked before, and now it doesn't.
- The code under the feature haven't changed much in the last few years, we're just reenabling it for overlay filesystems too.

Cons:
- The patch is very recent, I opened this bug days after I made and submitted the fix. There's no release yet that would contain the patch, and I guess no distros picked it up yet.
- I found no online mention of this issue at all, and it's been broken for several Ubuntu releases. I have to assume that either virtually nobody is using snmpd to query Docker container filesystem metrics, or they are still on 18.04 or similarly aged releases of other distributions. Both are equally possible.

I'm afraid I don't have a strong argument for an SRU. As I see, this fix impacts a very small number of users, is very small risk, and got very little testing.

Revision history for this message
Bryce Harrington (bryce) wrote :

Thanks for the quick reply István!

I've added builds to the PPA for kinetic and jammy. Hopefully you can make use of this for your needs. Ping this bug if the jammy build gets out of date and you want an update.

   https://launchpad.net/~bryce/+archive/ubuntu/net-snmp-sru-lp2007856

For focal, the patch looks a bit more involved to construct due to upstream's refactoring between 5.8 and 5.9.1, however offhand the fix still looks valid just will need to be coded up differently. Since at this time sounds like we wouldn't pursue SRU on this, I'll leave that backporting to a future task.

Thanks so much for your assessment, and I think that's a good take. What might swing things is if others run into this same problem, so let's leave this bug open and see if anyone else comments here as also affected, and then we'll re-evaluate.

Changed in net-snmp (Ubuntu Focal):
assignee: Bryce Harrington (bryce) → nobody
Changed in net-snmp (Ubuntu Jammy):
assignee: Bryce Harrington (bryce) → nobody
Changed in net-snmp (Ubuntu Kinetic):
assignee: Bryce Harrington (bryce) → nobody
Bryce Harrington (bryce)
no longer affects: net-snmp (Ubuntu Kinetic)
no longer affects: net-snmp (Ubuntu Jammy)
no longer affects: net-snmp (Ubuntu Focal)
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Can someone please clarify what "monitoring inside a docker container fails" in the statement below:

"The new version did not recognize the /etc/mtab entry of "overlay" as a supported filesystem, so monitoring / inside a Docker container fails after Bionic (5.7.3), likely in every Ubuntu since Focal (5.8)."

What exactly fails? What is this scenario, is the docker container acting as a snmp server, and it won't start up? Or is it running snmpwalk against other snmp servers? Or is the snmpd server not listing the overlay filesystems in its filesystem status output, and that is just a missing piece of information, as all the others are? Or does it crash?

Revision history for this message
István Papp (number492) wrote :

"Or is the snmpd server not listing the overlay filesystems in its filesystem status output, and that is just a missing piece of information, as all the others are?"

This is the one. An snmpd server running inside a Docker container won't see the filesystem related information, like the container root's free space for example.

Revision history for this message
Bryce Harrington (bryce) wrote :

Thanks for the feedback István, the proposed fix to Ubuntu lunar was approved and I've uploaded it. It should be available in lunar-proposed shortly, and if there are no migration issues should move from there to lunar-release. I'll follow up if there are migration problems.

I've also added a mention of this fix to the Ubuntu 23.04 Release Notes:
  - https://discourse.ubuntu.com/t/lunar-lobster-release-notes/31910

Changed in net-snmp (Ubuntu Lunar):
importance: High → Undecided
status: In Progress → New
Bryce Harrington (bryce)
Changed in net-snmp (Ubuntu Lunar):
importance: Undecided → High
status: New → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package net-snmp - 5.9.3+dfsg-2ubuntu3

---------------
net-snmp (5.9.3+dfsg-2ubuntu3) lunar; urgency=medium

  * d/p/add-overlay-support.patch: Add Docker's "overlay" filesystem
    (LP: #2007856)

 -- Bryce Harrington <email address hidden> Wed, 22 Mar 2023 18:42:02 -0700

Changed in net-snmp (Ubuntu Lunar):
status: Fix Committed → Fix Released
Changed in netsnmp:
status: Unknown → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Related questions

Remote bug watches

Bug watches keep track of this bug in other bug trackers.