Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 338766 - sys-apps/util-linux: /sbin/losetup -f broken by udev disabling devfs-compat by default
Summary: sys-apps/util-linux: /sbin/losetup -f broken by udev disabling devfs-compat b...
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-09-26 09:57 UTC by Alexander Holler
Modified: 2011-06-11 17:32 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Holler 2010-09-26 09:57:24 UTC
New stable udev disabled support for devfs-compat and breaks losetup -f which only outputs /dev/loop/* (even in util-linux-2.18). So this will break many scripts.

Reproducible: Always
Comment 1 Samuli Suominen (RETIRED) gentoo-dev 2010-09-26 10:13:43 UTC
Seems to be working fine here:

# losetup -f
/dev/loop0

[ebuild   R   ] sys-apps/util-linux-2.18-r1  USE="crypt nls perl unicode -loop-aes -old-linux (-selinux) -slang (-uclibc)" 0 kB
[ebuild   R   ] sys-fs/udev-162  USE="extras (-selinux) -test" 0 kB
Comment 2 Samuli Suominen (RETIRED) gentoo-dev 2010-09-26 10:14:41 UTC
I guess provide at least `emerge --info` and `emerge -pv util-linux udev` outputs for maintainers.
Comment 3 Alexander Holler 2010-09-26 13:14:07 UTC
eiche linux # emerge --info
Portage 2.1.8.3 (default/linux/arm/10.0/server, gcc-4.5.1, glibc-2.11.2-r0, 2.6.35.5-dockstar-00006-g0562ec4 armv5tel)
=================================================================
System uname: Linux-2.6.35.5-dockstar-00006-g0562ec4-armv5tel-Feroceon_88FR131_rev_1_-v5l-with-gentoo-1.12.13
Timestamp of tree: Fri, 24 Sep 2010 08:00:01 +0000
app-shells/bash:     4.0_p37
dev-lang/python:     2.6.5-r3
dev-util/cmake:      2.8.1-r2
sys-apps/baselayout: 1.12.13
sys-apps/sandbox:    1.6-r2
sys-devel/autoconf:  2.13, 2.65-r1
sys-devel/automake:  1.8.5-r4, 1.9.6-r3, 1.10.3, 1.11.1
sys-devel/binutils:  2.20.1-r1
sys-devel/gcc:       4.3.5, 4.5.1
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.6b
sys-devel/make:      3.81-r2
virtual/os-headers:  2.6.35
ACCEPT_KEYWORDS="arm"
ACCEPT_LICENSE="* -@EULA"
CBUILD="armv5tel-softfloat-linux-gnueabi"
CFLAGS="-Os -march=armv5te -pipe -fomit-frame-pointer -fno-tree-vectorize -std=gnu99"
CHOST="armv5tel-softfloat-linux-gnueabi"
CONFIG_PROTECT="/etc /var/bind"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/eselect/postgresql /etc/fonts/fonts.conf /etc/gconf /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-Os -march=armv5te -pipe -fomit-frame-pointer -fno-tree-vectorize -std=gnu++0x -fvisibility-inlines-hidden"
DISTDIR="/usr/portage/distfiles"
FEATURES="assume-digests distlocks fixpackages news parallel-fetch protect-owned sandbox sfperms strict unmerge-logs unmerge-orphans userfetch"
GENTOO_MIRRORS="ftp://sunsite.informatik.rwth-aachen.de/pub/Linux/gentoo http://linux.rz.ruhr-uni-bochum.de/download/gentoo-mirror http://gentoo.oregonstate.edu http://www.ibiblio.org/pub/Linux/distributions/gentoo"
LANG="de_DE.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--enable-new-dtags -Wl,--sort-common -Wl,--as-needed"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/ebuilds"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="acl apache2 arm berkdb bzip2 cli cracklib crypt cups cxx fortran gdbm gpm iconv ipv6 ldap modules mudflap mysql ncurses nls nptl nptlonly openmp pam pcre perl pppd python readline reflection session snmp ssl sysfs tcpd truetype unicode xml xorg zlib" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="fbdev glint mach64 mga nv r128 radeon savage sis tdfx trident  voodoo" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account" 
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LC_ALL, LINGUAS, MAKEOPTS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

eiche linux # emerge -pv util-linux udev

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild     UD] sys-apps/util-linux-2.17.2 [2.18-r1] USE="crypt nls perl unicode -loop-aes -old-linux (-selinux) -slang (-uclibc)" 0 kB
[ebuild   R   ] sys-fs/udev-151-r4  USE="devfs-compat -extras -old-hd-rules (-selinux) -test" 0 kB

Total: 2 packages (1 downgrade, 1 reinstall), Size of downloads: 0 kB

 * IMPORTANT: 2 news items need reading for repository 'gentoo'.
 * Use eselect news to read news items.

eiche linux # losetup -f
/dev/loop/2
Comment 4 SpanKY gentoo-dev 2010-09-26 20:59:37 UTC
/dev/loop/# is displayed if you have a /dev/loop/ dir.  this is sane behavior.
Comment 5 Alexander Holler 2010-09-27 06:51:35 UTC
As I can't mount a new loop-device with that what losetup -f offers (because those doesn't exist through new udev), this is clearly an error. At least it would be nice if the udev-ebuild would warn if any loop-device is already mounted when installing a non-devfs-compat-version and suggest to the user to either unmount that loop-device or reboot.
Anyway I leave the bug as resolved invalid.
Comment 6 SpanKY gentoo-dev 2010-09-27 06:59:15 UTC
so you're saying that if you reboot, everything works fine ?

what if you `rmdir /dev/loop` ?

`losetup -f` shouldnt care about the status of existing loop setups/mounts.  it merely checks for /dev/loop/, and then proceeds to query each /dev/loop/# to see if it is free.  that is all.  you can easily verify this by running it through strace (you should post that log as an attachment too):
  strace -o log losetup -f

i'm having a hard time imagining the sequence of events required to get into the state you're describing.
Comment 7 Alexander Holler 2010-09-27 07:32:29 UTC
Thats just what I'm have done while you've typed in the last comment. ;)

I've unmounted existing loop-devices, reemerged udev (again without devs-compat) and have done a rm -f /dev/loop afterwards. rmdir doesn't work because /dev/loop is still filled. My suggestion would be to check (in the ebuild) with losetup -a if any loop-device is mounted and if not to do that rm. If any loop is mounted a warning for the user should be displayed.

Anyway thanks for the explanation, I was too lazy to look at what losetup does. ;)
Comment 8 SpanKY gentoo-dev 2010-09-27 07:40:23 UTC
your description still doesnt sound like the output is problematic.  udev not creating the symlinks *in the future* has no bearing at all on already created symlinks.  it isnt like the /dev/loop/0 symlink to /dev/loop0 suddenly becomes invalid because of some config file.

if you have /dev/loop/ and it has symlinks to /dev/loop#, then there is nothing wrong with `losetup -f` outputting /dev/loop/#.  you havent clearly described a problem.  all you've said is "scripts will break".
Comment 9 Alexander Holler 2010-09-27 07:53:19 UTC
I assume I've run into the problem because the machine in question usually has a loop-device mounted. A reboot should had helped too, but this is scheduled when 2.6.35.6 is compiled. ;)
The problem is that when an udev without devfs-compat got installed all subsequent 

losetup $(/sbin/losetup -f) ...

will fail until /dev/loop disapears (which should be go away through a reboot, at least here, too).
Comment 10 Alexander Holler 2010-09-27 08:20:21 UTC
And I don't know how /dev/loop/0 disappeared. I've only seen /dev/loop/1-7 which explains why using /dev/loop/0 (the output from losetup -f) failed.
Comment 11 SpanKY gentoo-dev 2010-09-27 09:09:52 UTC
so your only issue is:
 - upgrade udev
 - running `losetup $(/sbin/losetup -f) ...` failed

if /dev/loop/ exists but is empty, then your proposed command will fail.
Comment 12 Alexander Holler 2010-09-27 15:10:13 UTC
The problem seems to be that /dev/loop/0 disappears (I assume through the update) and afterwards /dev/loop/0, which is the result from losetup -f is not usable.

Anyway, for me it is solved and if others will run into the same problem after updating udev (and not rebooting), they might find this invalid bug and might be happy.
Comment 13 SpanKY gentoo-dev 2010-09-27 18:00:29 UTC
`losetup -f` has logic so that it only outputs things it finds.  if /dev/loop/0 does not exist, i dont see how it would output it.

this is where the strace output would be useful.
Comment 14 Matthias Schwarzott gentoo-dev 2010-09-27 19:15:06 UTC
(In reply to comment #5)
> At least it
> would be nice if the udev-ebuild would warn if any loop-device is already
> mounted when installing a non-devfs-compat-version and suggest to the user to
> either unmount that loop-device or reboot.
> 
Well as far as I tested it, the easiest thing todo is, that udev ebuild should warn if the directory /dev/loop exists. And I need some text to be written for the warning.
I think to add the warning to udev-151-r4 and udev-162 and remove the ~arch versions between.
Is this fine?
Comment 15 SpanKY gentoo-dev 2010-09-27 21:11:41 UTC
i would even go so far as to have udev do `rmdir "${ROOT}"/dev/loop 2>/dev/null` in its pkg_postinst
Comment 16 Alexander Holler 2010-10-26 13:01:24 UTC
Just removing /dev/loop with rm -rf might work too. rmdir would fail because the directory won't be empty. I don't know if the symlinks in /dev/loop are still needed (e.g. by mounted loopbacks) after udev was upgraded. At least that rm would make new uses of losetup -f working. 
Comment 17 Matthias Schwarzott gentoo-dev 2010-10-30 13:54:37 UTC
I now added rmdir "$ROOT"/dev/loop and a warning if dir then still exists.