The lvm utilities apparently whinge if they inherit any fds other than 0,1,2. This is quite unreasonable. There is nothing wrong with executing a program with some inherited fd >2 and there are many reasons why one might want to do so. If lvm needs to fork off a daemon or some such then fine, it ought to close them, but it should do so silently. Ian. root@lalonde:~# lvs LV VG Attr LSize Origin Snap% Move Log Copy% adt_gutsy_base glalonde -wi-a- 3.00G adt_gutsy_cowdata glalonde -wi-a- 2.50G bigscratch glalonde -wi-a- 10.00G root@lalonde:~# lvs 3>/dev/null File descriptor 3 left open LV VG Attr LSize Origin Snap% Move Log Copy% adt_gutsy_base glalonde -wi-a- 3.00G adt_gutsy_cowdata glalonde -wi-a- 2.50G bigscratch glalonde -wi-a- 10.00G root@lalonde:~# dpkg -s lvm2 Package: lvm2 Status: install ok installed Priority: optional Section: admin Installed-Size: 848 Maintainer: Debian LVM Team <pkg-lvm-maintainers@lists.alioth.debian.org> Architecture: i386 Version: 2.02.06-4 Provides: lvm-binaries Depends: libc6 (>= 2.3.6-6), libdevmapper1.02 (>= 2:1.02.02-2), libncurses5 (>= 5.4-5), libreadline5 (>= 5.2), libselinux1 (>= 1.32), libsepol1 (>= 1.14), lvm-common (>> 1.5.8) Pre-Depends: debconf (>= 1.4.69) | debconf-2.0 Suggests: dmsetup Conffiles: /etc/lvm/lvm.conf 69799c527604d709cadde015d4d82135 Description: The Linux Logical Volume Manager This is LVM2, the rewrite of The Linux Logical Volume Manager. LVM supports enterprise level volume management of disk and disk subsystems by grouping arbitrary disks into volume groups. The total capacity of volume groups can be allocated to logical volumes, which are accessed as regular block devices. root@lalonde:~#
Do you have any examples? The warning has originally added upstream to help prove that a bug originally reported against lvm2 was actually elsewhere. The messages can be suppressed at runtime by setting the environment variable LVM_SUPPRESS_FD_WARNINGS. Alasdair
Alasdair G Kergon writes ("Re: Bug#432986: lvm utilities complain about fds >2"):
plumbing. For example, a debconf-using postinst ends up reexeced with
an fd onto the debconf frontend. In my application, I "park" stdout
so that I can use it for debugging output later if I care to.
In any situation like this:
your_script -calls-> some_utility -calls-> rune_specified_by_your_script
it is often useful to pass an fd to the rune. This involves running
some_utility with nonstandard fds, and expects that some_utility
doesn't mess with those fds and instead passes them unharmed onto the
sub-rune.
LVM doesn't (AFAIK) call user-specified programs in this way but
either `your_script' or rune above might use LVM utilities - or might
use other programs which use LVM utilities - and in general it is
not possible to know whether there are any such other fds.
I don't think debugging some particular other bug is a good reason for
printing warnings for perfectly reasonable situations.
This should be made the default in Debian. I don't mind if the
feature can be turned on again (although I would question whether lvm
would be the right place to do this - maybe a /bin/{ba,}sh wrapper
would be a better choice).
Ian.
After any use of LVM command-line utilities, I always get these two lines: File descriptor 3 left open File descriptor 4 left open example: mordor:/home/gpall# pvdisplay File descriptor 3 left open File descriptor 4 left open --- Physical volume --- PV Name /dev/dm-0 VG Name evg PV Size 105.32 GB / not usable 1.43 MB Allocatable yes (but full) PE Size (KByte) 4096 Total PE 26962 Free PE 0 Allocated PE 26962 PV UUID s8Y5OB-QI6E-XvDs-59ve-pvIo-cGXw-5RddKQ
#432986 and #466138 contain:
* Complaints from:
Ian Jackson
Giorgos Pallas
Ross Boylan
* Responses from the upstream maintainer Alasdair Kergon
defending the current behaviour (which AFAICT he implemented)
* Counterarguments from:
Ian Jackson
Andras Korn
which I find convincing (but then I guess I would).
I attach a patch which changes the default to be to not print these
warnings. I have tested this on my squeeze laptop. I think this
patch should be applied in Debian.
Do the Debian LVM team have an opinion ?
Thanks,
Ian.
It seems like LVM still does not supress such warnings by default - I can see them when running grub-install (see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=592834). Or is it grub's bug?