can't use /sbin/ifconfig

Bug #1890748 reported by Bryce Harrington
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
logwatch (Ubuntu)
Fix Released
Undecided
Unassigned
Bionic
Invalid
Undecided
Unassigned
Focal
Fix Released
Medium
Michał Małoszewski
Jammy
Fix Released
Undecided
Unassigned
Kinetic
Fix Released
Undecided
Unassigned

Bug Description

[Impact]

On 20.04, when I install the logwatch package and try to get the activity report by typing:
$ sudo logwatch --detail Low --range today --service all --output stdout
I see the message:
can't use /sbin/ifconfig -a: No such file or directory at /usr/share/logwatch/scripts/services/zz-network line 356.
The situation is unfortunate for users who want to display the activity report.
The problem affects Focal. No other releases are affected - I have checked it.

[Test Plan]

** Reproduction **

Make a container for testing:

$ lxc launch ubuntu-daily: focal focal1
$ lxc shell focal1

1. First of all, update the apt packages index.
$ sudo apt update

2. Install logwatch package.
$ sudo apt install logwatch

3. Perform $ sudo logwatch --detail low --range today --service all --output stdout

Follow the reproduction steps above to ensure that the proposed solution works and the message vanished away.

Expected results:

1. $ sudo apt update
2. $ sudo apt install logwatch
3. $ sudo logwatch --detail low --range today --service all --output stdout
4. Network report is generated.

Actual results:

1. $ sudo apt update
2. $ sudo apt install logwatch
3. $ sudo logwatch --detail low --range today --service all --output stdout

4.
--------------------- Network Report Begin ------------------------

 can't use /sbin/ifconfig -a: No such file or directory at /usr/share/logwatch/scripts/services/zz-network line 356.

 ---------------------- Network Report End -------------------------

[Where problems could occur]

There is a possibility that more advanced users can figure out a solution themselves and install net-tools package which includes ifconfig and it would solve the problem, but the functionality of the script would suffer, because the ‘ip addr’ needs to be selected preferentially.

We decided to minimize behavioral change in the stable release by continuing to use ifconfig if it is available, but falling back to ip if not. Users might find this surprising because the behavior of the command will now depend on what other packages are installed, but this seems preferable to pulling in a new dependency in a stable release, or in changing existing report output for users who already have ifconfig available either by accident or by deliberately having worked around the bug.

If there were to be a regression caused by this change is likely to be around the availability of ip and/or ifconfig or a behavioral consequence of calling ip when we weren’t before.

Since logwatch is used just for generating reports, any regression would be limited in scope to the generation of use of the report.

-----------------------original report---------------------

On focal, logwatch is attempting to use ifconfig rather than ip addr:

$ sudo logwatch --detail Low --range today --service all --output stdout
...

 --------------------- Network Report Begin ------------------------

 can't use /sbin/ifconfig -a: No such file or directory at /usr/share/logwatch/scripts/services/zz-network line 356.

 ---------------------- Network Report End -------------------------

N.b. if you have ifconfig installed, the tool works, however looking at the zz-network script it appears to prefer use of ip, so it should work with net-tools uninstalled.

Related branches

Bryce Harrington (bryce)
description: updated
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in logwatch (Ubuntu):
status: New → Confirmed
Bryce Harrington (bryce)
Changed in logwatch (Ubuntu):
status: Confirmed → Triaged
importance: Undecided → Medium
Revision history for this message
Michał Małoszewski (michal-maloszewski99) wrote :

Assigning to myself.

Changed in logwatch (Ubuntu):
assignee: nobody → Michał Małoszewski (michal-maloszewski99)
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

The path is actually ok,
could the fix just be adding a dependency to net-tools?

So much for the potential SRUs, for future releases it might be better to change this to use "ip" instead of "ifconfig" is "ip" is available. And then submit that upstream so use the newer tools (IIRC net-tools is meant to be no more supported at some point in the future).

Bryce Harrington (bryce)
description: updated
description: updated
Bryce Harrington (bryce)
Changed in logwatch (Ubuntu Focal):
assignee: nobody → Michał Małoszewski (michal-maloszewski99)
Changed in logwatch (Ubuntu Kinetic):
assignee: Michał Małoszewski (michal-maloszewski99) → nobody
Changed in logwatch (Ubuntu Focal):
status: New → In Progress
Changed in logwatch (Ubuntu Kinetic):
status: Triaged → Fix Released
Changed in logwatch (Ubuntu Jammy):
status: New → Fix Released
Changed in logwatch (Ubuntu Bionic):
status: New → Invalid
Changed in logwatch (Ubuntu Focal):
importance: Undecided → Medium
Changed in logwatch (Ubuntu Kinetic):
importance: Medium → Undecided
Revision history for this message
Michał Małoszewski (michal-maloszewski99) wrote :

I've updated the [Impact] section after it was sponsored to explain that problem only affects Focal and say it explicitly to not introduce ambiguity.

description: updated
Revision history for this message
Timo Aaltonen (tjaalton) wrote : Please test proposed package

Hello Bryce, or anyone else affected,

Accepted logwatch into focal-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/logwatch/7.5.2-1ubuntu1.4 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-focal to verification-done-focal. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-focal. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in logwatch (Ubuntu Focal):
status: In Progress → Fix Committed
tags: added: verification-needed verification-needed-focal
Revision history for this message
Michał Małoszewski (michal-maloszewski99) wrote (last edit ):

Fix works, 7.5.2-1ubuntu1.4 fixes the bug.

I did it a bit differently than the Test Plan section suggests.
I've created the focal container and inside that container I typed in:

$ apt install logwatch

Then:

$ apt policy logwatch

Here is the output:

logwatch:
  Installed: 7.5.2-1ubuntu1.3
  Candidate: 7.5.2-1ubuntu1.3
  Version table:
 *** 7.5.2-1ubuntu1.3 500
        500 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages
        100 /var/lib/dpkg/status
     7.5.2-1ubuntu1 500
        500 http://archive.ubuntu.com/ubuntu focal/main amd64 Packages

Then I have uploaded my PPA:

$ sudo add-apt-repository ppa:michal-maloszewski99/focal-logwatch-lp-1890748
$ sudo apt update

Typed in:

$ apt policy logwatch

The output:

logwatch:
  Installed: 7.5.2-1ubuntu1.4~ppa1
  Candidate: 7.5.2-1ubuntu1.4~ppa1
  Version table:
 *** 7.5.2-1ubuntu1.4~ppa1 500
        500 http://ppa.launchpad.net/michal-maloszewski99/focal-logwatch-lp-1890748/ubuntu focal/main amd64 Packages
        100 /var/lib/dpkg/status
     7.5.2-1ubuntu1.3 500
        500 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages
     7.5.2-1ubuntu1 500
        500 http://archive.ubuntu.com/ubuntu focal/main amd64 Packages

Then I checked, whether problem still exists.

------------- Network statistics ---------------

 ---------------------- Network Report End -------------------------

 ###################### Logwatch End #########################

The fix works.

tags: added: verification-done-focal
removed: verification-needed-focal
tags: added: verification-needed-focal
removed: verification-done-focal
tags: added: verification-failed verification-failed-focal
removed: verification-needed verification-needed-focal
Revision history for this message
Michał Małoszewski (michal-maloszewski99) wrote (last edit ):

7.5.2-1ubuntu1.4 version, which is in proposed, fails verification. That happened because the conditions in if statement are inverted and in that order, they do not solve the issue.
‘ip addr’ which needs to be selected preferentially was as an alternative condition, that should be met when first condition is not met and that's wrong order.

Revision history for this message
Steve Langasek (vorlon) wrote : Proposed package removed from archive

The version of logwatch in the proposed pocket of Focal that was purported to fix this bug report has been removed because one or more bugs that were to be fixed by the upload have failed verification and been in this state for more than 10 days.

Changed in logwatch (Ubuntu Focal):
status: Fix Committed → Confirmed
Changed in logwatch (Ubuntu Focal):
status: Confirmed → In Progress
Revision history for this message
Steve Langasek (vorlon) wrote : Please test proposed package

Hello Bryce, or anyone else affected,

Accepted logwatch into focal-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/logwatch/7.5.2-1ubuntu1.5 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-focal to verification-done-focal. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-focal. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in logwatch (Ubuntu Focal):
status: In Progress → Fix Committed
tags: added: verification-needed verification-needed-focal
removed: verification-failed verification-failed-focal
Revision history for this message
Michał Małoszewski (michal-maloszewski99) wrote :

The fix works, logwatch 7.5.2-1ubuntu1.5 fixes the bug.

I've created the focal container using steps from the [Test Plan] section listed above in the Bug Description and inside that container..

I have installed the logwatch package using:

$ apt install logwatch

Then checked:
$ apt policy logwatch

The output:

Installed: 7.5.2-1ubuntu1.3
  Candidate: 7.5.2-1ubuntu1.3
  Version table:
 *** 7.5.2-1ubuntu1.3 500
        500 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages
        100 /var/lib/dpkg/status
     7.5.2-1ubuntu1 500
        500 http://archive.ubuntu.com/ubuntu focal/main amd64 Packages

Then I have typed in:

$ sudo logwatch --detail low --range today --service all --output stdout

The issue did exist:

--------------------- Network Report Begin ------------------------

 can't use /sbin/ifconfig -a: No such file or directory at /usr/share/logwatch/scripts/services/zz-network line 356.

Then I've upgraded logwatch:
$ apt install logwatch=7.5.2-1ubuntu1.5

Later I've typed in:

$ apt policy logwatch
to check if installed version is changed and we see that we have new version installed (with fix)

 logwatch:
  Installed: 7.5.2-1ubuntu1.5
  Candidate: 7.5.2-1ubuntu1.5
  Version table:
 *** 7.5.2-1ubuntu1.5 500
        500 http://archive.ubuntu.com/ubuntu focal-proposed/main amd64 Packages
        100 /var/lib/dpkg/status
     7.5.2-1ubuntu1.3 500
        500 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages

Finally when I typed in:

$ sudo logwatch --detail low --range today --service all --output stdout

the problem did not exist, so the fix works.

tags: added: verification-done-focal
removed: verification-needed-focal
tags: added: verification-done
removed: verification-needed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package logwatch - 7.5.2-1ubuntu1.5

---------------
logwatch (7.5.2-1ubuntu1.5) focal; urgency=medium

  * d/p/focal-logwatch-ifconfig-fix.patch: Fix the if statement
    in the code to let the code to select ip addr preferentially.
    The SRU verification failed with previous version because the
    if statement was inverted (LP: #1890748)

 -- Michal Maloszewski <email address hidden> Thu, 17 Nov 2022 18:24:23 +0100

Changed in logwatch (Ubuntu Focal):
status: Fix Committed → Fix Released
Revision history for this message
Łukasz Zemczak (sil2100) wrote : Update Released

The verification of the Stable Release Update for logwatch has completed successfully and the package is now being released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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