Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 220347

Summary: pmount doesn't work with 2.6.25 kernels (with deprecated sysfs off?)
Product: Gentoo Linux Reporter: Petteri Räty (RETIRED) <betelgeuse>
Component: Current packagesAssignee: Greg Kroah-Hartman (RETIRED) <gregkh>
Status: RESOLVED WONTFIX    
Severity: normal CC: base-system, gentoo, kernel, leon+gentoo, mgorny, openhs
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 218127    
Attachments: Patch to sysfsutils fixing pmount for 2.6.25

Description Petteri Räty (RETIRED) gentoo-dev 2008-05-05 10:47:25 UTC
betelgeuse@pena ~ $ pmount /dev/sde1
Error: device /dev/sde1 is not removable

betelgeuse@pena ~ $ pmount -d /dev/sde1 | tail
Error: device /dev/sde1 is not removable
find_sysfs_device: checking whether /dev/sde1 is on /sys/block/dm-27 (253:27)
find_sysfs_device: checking whether /dev/sde1 is on /sys/block/dm-28 (253:28)
find_sysfs_device: checking whether /dev/sde1 is on /sys/block/sde (8:64)
find_sysfs_device: major device numbers match
find_sysfs_device: minor device numbers do not match, checking partitions...
find_sysfs_device: checking whether device /dev/sde1 matches partition 8:64
find_sysfs_device: checking whether device /dev/sde1 matches partition 8:65
find_sysfs_device: -> partition matches, belongs to block device /sys/block/sde
device_removable: could not find a sysfs device for /dev/sde1
policy check failed

betelgeuse@pena ~ $ emerge --info
Portage 2.1.5_rc6 (default-linux/x86/2006.1/desktop, gcc-4.2.3, glibc-2.7-r2, 2.6.25-gentoo-r1 i686)
=================================================================
System uname: 2.6.25-gentoo-r1 i686 Intel(R) Core(TM)2 CPU 6600 @ 2.40GHz
Timestamp of tree: Unknown
distcc 2.18.3 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [disabled]
ccache version 2.4 [enabled]
app-shells/bash:     3.2_p33
dev-java/java-config: 1.3.7, 2.1.6
dev-lang/python:     2.5.2-r2
dev-util/ccache:     2.4-r7
sys-apps/baselayout: 2.0.0
sys-apps/openrc:     0.2.2
sys-apps/sandbox:    1.2.18.1-r2
sys-devel/autoconf:  2.13, 2.62
sys-devel/automake:  1.4_p6, 1.5, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10.1
sys-devel/binutils:  2.18-r1
sys-devel/gcc-config: 1.4.0-r4
sys-devel/libtool:   2.2.2
virtual/os-headers:  2.6.25-r1
ACCEPT_KEYWORDS="x86 ~x86"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -march=native -pipe -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /opt/openjms/config /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/kde/4.0/env /usr/kde/4.0/share/config /usr/kde/4.0/shutdown /usr/share/config /var/lib/hsqldb"
CONFIG_PROTECT_MASK="/etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/splash /etc/terminfo /etc/texmf/web2c /etc/udev/rules.d"
CXXFLAGS="-O2 -march=native -pipe -fomit-frame-pointer"
DISTDIR="/var/distfiles"
FEATURES="ccache collision-protect distlocks fixpackages parallel-fetch sandbox sfperms sign strict unmerge-orphans userfetch userpriv usersandbox verify-rdepend"
GENTOO_MIRRORS=" http://trumpetti.atm.tut.fi/gentoo"
LANG="en_US.utf8"
LC_ALL="en_US.utf8"
LDFLAGS="-Wl,--as-needed -Wl,-O1"
LINGUAS="fi"
PKGDIR="/home/pkg/"
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="/mnt/checkouts/overlays/flameeyes-overlay /mnt/checkouts/overlays/openrc /mnt/checkouts/overlays/jokey /mnt/checkouts/overlays/postgresql-testing /mnt/checkouts/overlays/sunrise /mnt/checkouts/overlays/betelgeuse"
SYNC="rsync://192.168.150.1/portage"
USE="a52 aac acl acpi alsa audiofile bash-completion berkdb bluetooth branding bzip2 cairo caps cdb cddb cdparanoia cdr cli cracklib crypt cups dbus dri dts dvd dvdr dvdread emboss fam ffmpeg firefox gif gstreamer hal iconv isdnlog java jpeg kde kdeenablefinal kdehiddenvisibility libnotify logitech-mouse mad mikmod mjpeg mmx mp3 mpeg mudflap ncurses network nptl nptlonly nsplugin nvidia offensive ogg opengl openmp pam pcre png ppds pppd pulseaudio qt3 quicktime readline real reflection rtc samba session spell spl sse sse2 ssl startup-notification subversion svg symlink theora threads truetype udev unicode usb userlocales vim-syntax vorbis win32codecs x86 xcb xcomposite xinerama xml xorg xv xvid xvmc zlib" ALSA_CARDS="hda-intel" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter 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 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="evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="fi" USERLAND="GNU" VIDEO_CARDS="none nvidia"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, MAKEOPTS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Doug Goldstein gentoo-dev 2008-05-05 14:05:39 UTC
Can't turn the deprecated sysfs stuff for IDE bits off. That's a known thing. That being said, if you actually use this package and want to maintain it. Please feel free to take it. I haven't used it or built it on my machine in over a year.
Comment 2 Petteri Räty (RETIRED) gentoo-dev 2008-05-06 01:13:44 UTC
(In reply to comment #1)
> Can't turn the deprecated sysfs stuff for IDE bits off. That's a known thing.
> That being said, if you actually use this package and want to maintain it.
> Please feel free to take it. I haven't used it or built it on my machine in
> over a year.
> 

What do you suggest for command line mounting instead?
Comment 3 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2008-05-06 15:54:50 UTC
To me, it rather looks like an bug in -lsysfs, where sysfs_get_link() incorrectly resolves last-level, relative symbolic link without resolving higher ones.

$ strace pmount /dev/sdc1
[…]
readlink("/sys/block/sdc/device", "../../../4:0:0:0", 256) = 16
lstat("/4:0:0:0", 0x7fff18645f00)       = -1 ENOENT (No such file or directory)
[…]
Comment 4 Doug Goldstein gentoo-dev 2008-05-07 00:29:50 UTC
(In reply to comment #2)
> (In reply to comment #1)
> > Can't turn the deprecated sysfs stuff for IDE bits off. That's a known thing.
> > That being said, if you actually use this package and want to maintain it.
> > Please feel free to take it. I haven't used it or built it on my machine in
> > over a year.
> > 
> 
> What do you suggest for command line mounting instead?

this app along with ivman. I just have no need for command line mounting for a while which is why I offered you to take it over.
> 

Comment 5 Petteri Räty (RETIRED) gentoo-dev 2008-05-07 00:43:21 UTC
(In reply to comment #3)
> To me, it rather looks like an bug in -lsysfs, where sysfs_get_link()
> incorrectly resolves last-level, relative symbolic link without resolving
> higher ones.
> 
> $ strace pmount /dev/sdc1
> […]
> readlink("/sys/block/sdc/device", "../../../4:0:0:0", 256) = 16
> lstat("/4:0:0:0", 0x7fff18645f00)       = -1 ENOENT (No such file or directory)
> […]
> 

My first thought was that upgrading to 2.6.25 broke this but perhaps it was pciutils-3.0.0
Comment 6 Petteri Räty (RETIRED) gentoo-dev 2008-05-07 00:46:05 UTC
(In reply to comment #5)
> 
> My first thought was that upgrading to 2.6.25 broke this but perhaps it was
> pciutils-3.0.0
> 

plah I mean sysfsutils. But looking at qlop -l doesn't look like it:

Tue Jan 30 18:56:31 2007 >>> sys-fs/sysfsutils-2.1.0
Comment 7 Rafał Mużyło 2008-05-07 18:59:41 UTC
I'm just about to slaughter a few (dozen) people, but I think I figured it out.
One of the things pmount does is call sysfs_open_device_path after calling sysfs_get_link.
The problem is that i.e. I've got /sys/block/sr0, for /sys/block/sr0/device, sysfs_get_link returns ../../../2:0:0:0
Well, the catch is that this breaks sysfs_open_device_path, cause it expects a dir (checked by sysfs_path_is_dir) and then it should call sysfs_get_name_from_path which seems to transform that dir to bus_id, which we already got (2:0:0:0).
I think this should work again if in sysfs_open_device_path we drop sysfs_path_is_dir.
Of course, this will probably make the modified sysfsutils incompatible with earlier kernels.
Comment 8 Rafał Mużyło 2008-05-07 19:04:02 UTC
Actually, it's lstat in sysfs_path_is_dir that fails.
Comment 9 Rafał Mużyło 2008-05-07 19:35:24 UTC
Created attachment 152337 [details, diff]
Patch to sysfsutils fixing pmount for 2.6.25

OK, I don't know what this patch breaks, but it fixes pmount.
Comment 10 Rafał Mużyło 2008-06-18 13:40:33 UTC
It looks like a better patch was posted to the project's mailing list.
It at http://sourceforge.net/mailarchive/forum.php?thread_name=87skwmofp8.fsf%40denkblock.local&forum_name=linux-diag-devel
Comment 11 Doug Goldstein gentoo-dev 2008-06-18 16:19:48 UTC
Not really sure why base-system is CC'd on here. And I'm no longer interested in this package as stated in comment #1. I actually would be in favor of kicking it from gentopia to maintainer-needed... steev? compnerd?
Comment 12 Rafał Mużyło 2008-07-14 19:09:47 UTC
The real problem is that this is NOT pmount but,
it's sysfsutils one.
Comment 13 Petteri Räty (RETIRED) gentoo-dev 2008-07-23 19:27:34 UTC
(In reply to comment #11)
> Not really sure why base-system is CC'd on here. And I'm no longer interested
> in this package as stated in comment #1. I actually would be in favor of
> kicking it from gentopia to maintainer-needed... steev? compnerd?
> 

for sysfsutils
Comment 14 Rafał Mużyło 2008-08-01 18:29:14 UTC
And now for something special.
Straight from kernel Documentation/sysfs-rules.txt (2.6.26, quote):

- Do not use libsysfs
  It makes assumptions about sysfs which are not true. Its API does not
  offer any abstraction, it exposes all the kernel driver-core
  implementation details in its own API. Therefore it is not better than
  reading directories and opening the files yourself.
  Also, it is not actively maintained, in the sense of reflecting the
  current kernel development. The goal of providing a stable interface
  to sysfs has failed; it causes more problems than it solves. It
  violates many of the rules in this document.
Comment 15 Greg Kroah-Hartman (RETIRED) gentoo-dev 2008-09-16 00:06:54 UTC
don't use sysfsutils, it's abandonded, broken, and useless.
Comment 16 Nick White 2009-07-01 13:50:31 UTC
The latest version of pmount in the tree (currently keyworded), no longer uses sysfsutils, and now works correctly when depreciated sysfs stuff is switched off.