[Bug 1226067] Re: ifquery fails with bad file descriptor
Bryan Quigley
gQuigs at gMail.com
Mon Sep 23 22:01:43 UTC 2013
On precise it appears that this never worked:
$ ifquery --list --allow auto
ifquery: failed to open statefile /run/network/ifstate: Permission denied
Which now shows up as:
$ ifquery --list --allow auto
ifquery: failed to open lockfile /run/network/.ifstate.lock: Permission denied
But when run with sudo they both now work correctly, so marking it as
verified.
** Tags added: verification-done-precise
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to ifupdown in Ubuntu.
https://bugs.launchpad.net/bugs/1226067
Title:
ifquery fails with bad file descriptor
Status in “ifupdown” package in Ubuntu:
Fix Released
Status in “ifupdown” source package in Precise:
Fix Committed
Status in “ifupdown” source package in Quantal:
Fix Committed
Status in “ifupdown” source package in Raring:
Fix Committed
Bug description:
== Begin SRU ==
[Impact]
This bug is a regression of the fix applied under bug 1160490.
The bug is that 'ifquery --list' will try to obtain a lock on a file in /run, which will fail with an error message of 'Bad file descriptor'.
The changes applied here are a backport of upstream fix fb3055c2c4f0
[1].
[Test Case]
Ideally both the test case from bug 1160490 [2] and the following test case should be done.
$ sudo ifquery --list --allow auto
lo
eth0
$ ifquery --list --allow auto
lo
eth0
Success is a list of the 'auto' interfaces that in
/etc/network/interfaces. (in a cloud image, thats eth0 and lo). This
should work both as root and non-root. Failure would show 'failed to
lock lockfile' or non-zero exit value.
Additionally, verify that you can query something other than the default interfaces file as root and non-root.
$ ( echo "auto eth1"; echo "iface eth1 inet dhcp"; ) > /tmp/my.interfaces
$ sudo ifquery --list --allow auto --interfaces=/tmp/my.interfaces
lo
eth1
$ ifquery --list --allow auto --interfaces=/tmp/my.interfaces
lo
eth1
the 'lo' output is expected as 'lo' is automatically auto. Failure
here would be the same 'failed to lock lockfile' or non-zero exit.
It also surely wouldn't hurt to do:
$ sudo ifdown eth0; sudo ifup eth0
Just to make sure that functions.
[Regression Potential]
* (from bug 1160490) This fix backports a change from upstream ifupdown. Instead of locking a statefile it locks a lockfile.
* the change here is very trivial. It chooses to not fail on failure to get lockfile if the operation is 'no_act' (see [1]).
[1] http://anonscm.debian.org/hg/collab-maint/ifupdown/rev/fb3055c2c4f0
[2] https://bugs.launchpad.net/ubuntu/+source/linux/+bug/996369/comments/35
=== End SRU ===
$ sudo ifquery --list --allow auto; echo $?;
ifquery: failed to lock lockfile /run/network/.ifstate.lock: Bad file descriptor
1
This seems possibly quite serious as /etc/network/if-up.d/upstart uses
this program to determine the "auto" interfaces and then emits static-
network-up.
This reproduces on a fresh saucy image with serial=20130916.
Also interesting, possibly related and possibly a bug in and of itself:
$ cp /etc/network/interfaces /tmp/interfaces
$ sudo ifquery --interfaces /tmp/interfaces --list --allow=auto
ifquery: failed to lock lockfile /run/network/.ifstate.lock: Bad file descriptor
Seems odd that it would do anything with /run/network/.ifstate.lock in
this case since, by doing so, it means i'd have to have privilege to
read that file in order to have it parse my provided --interfaces=
file.
For reference, on raring instance as non-root:
$ ifquery --list --allow auto
lo
eth0
Related bugs:
* bug 1160490: race condition updating statefile
ProblemType: Bug
DistroRelease: Ubuntu 13.10
Package: ifupdown 0.7.44ubuntu2
ProcVersionSignature: User Name 3.11.0-7.13-generic 3.11.0
Uname: Linux 3.11.0-7-generic x86_64
ApportVersion: 2.12.1-0ubuntu4
Architecture: amd64
Date: Mon Sep 16 14:02:41 2013
Ec2AMI: ami-000004dd
Ec2AMIManifest: FIXME
Ec2AvailabilityZone: nova
Ec2InstanceType: m1.tiny
Ec2Kernel: unavailable
Ec2Ramdisk: unavailable
MarkForUpload: True
ProcEnviron:
TERM=screen
PATH=(custom, no user)
XDG_RUNTIME_DIR=<set>
LANG=en_US.UTF-8
SHELL=/bin/bash
SourcePackage: ifupdown
UpgradeStatus: No upgrade log present (probably fresh install)
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/ifupdown/+bug/1226067/+subscriptions
More information about the foundations-bugs
mailing list