Jump to content

RX/TX stats on welcome banner (motd script): Refine RegEx to match real network interfaces only but ignore virtual interfaces by Docker & Co


Go to solution Solved by atone,

Recommended Posts

Posted (edited)

Environment:

Armbian on an Odroid-HC2 (Homecloud 2) which uses the odroid-xu4 firmware.

Reproduction:

  1. After initial installation on the welcome banner "RX today:" always shows a nice value.
  2. Install and run some docker containers. This changes /sys/class/net/ . AFAIK it adds so called "virtual network interfaces".
  3. From then on the Armbian welcome screen displays like this:
  • Error: Interface "veth•••••••" not found in database.
  • Note: • redacted by me.


Analysis:

/etc/default/armbian-motd

PRIMARY_INTERFACE="$(ls -1 /sys/class/net/ | grep -v lo | egrep "enp|eth" | head -1)"



The current regular expression falsely matches veth••••••• (created by Docker).

$ ls -1 /sys/class/net/
br-••••••••••••
docker0
enx••••••••••••
lo
veth•••••••



I fixed it for myself by changing PRIMARY_INTERFACE to this:

"$(ls -1 /sys/class/net/ | grep -v lo | egrep "^en" | head -1)"



Fix Proposal:
A developer with proper knowhow of the network interface naming conventions changes the default regular expression / pipe for PRIMARY_INTERFACE so that it safely only matches a real hardware interface for all typical systems, also working fine when using docker or other software which may create virtual network interfaces or other stub like entries there.

Notes:

  • This bug was already discussed in a forum thread in a "how to help yourself" manner.
  • This here now is a formal bug report with the inquiry to please fix it.
Edited by porg
Added note that this is a bug report

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines