Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 398811 - sys-process/psmisc: fuser does not locate unix sockets on mounted filesystems
Summary: sys-process/psmisc: fuser does not locate unix sockets on mounted filesystems
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo's Team for Core System packages
URL: https://sourceforge.net/tracker/?func...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-13 21:34 UTC by Piotr Karbowski (RETIRED)
Modified: 2012-08-31 07:35 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 Piotr Karbowski (RETIRED) gentoo-dev 2012-01-13 21:34:16 UTC
As in the summary, while umounting filesystems the fuser is not able to detect open sockets and in my example fail to umount /home as is 'in use'. Thats because ssh-agent's socket file is in my $HOME. Thats really nasty.

The workaround is put 'killall ssh-agent' in for example /etc/local.d/kill-ssh-agents.stop script, but that will handle only ssh-agent.



Reproducible: Always
Comment 1 William Hubbs gentoo-dev 2012-01-16 14:57:21 UTC
Please post your emerge --info with any bug report that you post.

Also, I need the steps to reproduce this bug.

Thanks,

William
Comment 2 Piotr Karbowski (RETIRED) gentoo-dev 2012-01-18 16:37:04 UTC
the emerge --info is usualy at least useless, the problem is with using fuser, anyway....

Portage 2.2.0_alpha84 (default/linux/amd64/10.0, gcc-4.5.3, glibc-2.13-r4, 3.1.9-frontier x86_64)
=================================================================
System uname: Linux-3.1.9-frontier-x86_64-Intel-R-_Core-TM-_i5_CPU_M_480_@_2.67GHz-with-gentoo-2.1
Timestamp of tree: Wed, 18 Jan 2012 13:00:01 +0000
ccache version 3.1.7 [enabled]
app-shells/bash:          4.2_p20
dev-lang/python:          2.7.2-r3, 3.2.2
dev-util/ccache:          3.1.7
dev-util/cmake:           2.8.6-r4
dev-util/pkgconfig:       0.26
sys-apps/baselayout:      2.1
sys-apps/openrc:          0.9.8.1
sys-apps/sandbox:         2.5
sys-devel/autoconf:       2.13, 2.68
sys-devel/automake:       1.9.6-r3, 1.11.2
sys-devel/binutils:       2.21.1-r1
sys-devel/gcc:            4.5.3-r1
sys-devel/gcc-config:     1.5-r2
sys-devel/libtool:        2.4.2
sys-devel/make:           3.82-r3
sys-kernel/linux-headers: 3.1 (virtual/os-headers)
sys-libs/glibc:           2.13-r4
Repositories: gentoo foo-overlay lcd-filtering
Installed sets: 
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -march=native -mtune=generic -fno-var-tracking"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -pipe -march=native -mtune=generic -fno-var-tracking"
DISTDIR="/var/portage/distfiles"
FEATURES="assume-digests binpkg-logs ccache distlocks ebuild-locks fixlafiles news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"
FFLAGS=""
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LC_ALL="en_US.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="en pl"
MAKEOPTS="--quiet -j4"
PKGDIR="/var/portage/packages"
PORTAGE_COMPRESS="bzip2"
PORTAGE_COMPRESS_FLAGS="-9"
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="/var/portage/tree"
PORTDIR_OVERLAY="/var/lib/layman/foo-overlay /var/lib/layman/lcd-filtering"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X acl amd64 berkdb bzip2 cli cracklib crypt cups cxx dbus dri fontconfig fortran gdbm gif gpm iconv ipv6 jpeg lcdfilter logrotate mmx modules mudflap multilib ncurses nls nptl nptlonly opengl openmp pam pcre png pppd readline session sse sse2 ssl sysfs tcpd threads truetype unicode vim-syntax xft xorg zlib zsh-completion" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" 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" CALLIGRA_FEATURES="kexi words flow plan stage tables krita karbon braindump" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="synaptics evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en pl" PHP_TARGETS="php5-3" QEMU_SOFTMMU_TARGETS="x86_64 i386" QEMU_USER_TARGETS="x86_64 i386" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="nouveau nvidia" 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, INSTALL_MASK, LANG, PORTAGE_BUNZIP2_COMMAND, PORTAGE_RSYNC_EXTRA_OPTS

Steps to reproduce:
ssh-agent -s -a /path/to/mountpoint/foo.socket

just run ssh-agent with the socket outside rootfs.
Comment 3 SpanKY gentoo-dev 2012-01-25 04:57:36 UTC
not a bug in openrc.  reproduces fine for me, thanks for that.

fuser does open /proc/net/unix, so that's good ...
Comment 4 Samuli Suominen (RETIRED) gentoo-dev 2012-01-28 06:11:42 UTC
How is psmisc-22.15?
Comment 5 SpanKY gentoo-dev 2012-01-30 06:39:18 UTC
same behavior.  here's the copy & paste to reproduce:

mkdir -p /mnt/tmp
mount -t tmpfs tmpfs /mnt/tmp
eval $(ssh-agent -s -a /mnt/tmp/foo.socket)
fuser -v / |& grep $SSH_AGENT_PID
fuser -v /mnt/tmp |& grep $SSH_AGENT_PID
kill $SSH_AGENT_PID

you can see that the first fuser identifies the ssh-agent, but the 2nd one doesn't.  i've long mounted my /tmp as tmpfs and always wondered why on shutdown, i get the "could not unmount as it's in use" even though fuser should have found + killed the stuff.
Comment 6 Piotr Karbowski (RETIRED) gentoo-dev 2012-02-04 21:40:37 UTC
The quick_and_dirty solution would be run lsof to find open sockets on mountpoint and kill them.

lsof -U | awk -v mountpoint="^/home/" '$5 ~ /^unix$/ && $9 ~ mountpoint { system("kill "$2) }'

instead of /home/ there can be mountpoint="^${mountpoint}".

The awk is example, that can be done with pure sh. I would vote for adding something like it as a fallback to fuser being unable to find open sockets.

I found some reports about fuser being unable to find open socket from 2007, also, busybox's fuser can't find it either.
Comment 7 Samuli Suominen (RETIRED) gentoo-dev 2012-03-12 14:18:21 UTC
22.16 in Portage and reported this to upstream (see URL field)
Comment 8 SpanKY gentoo-dev 2012-04-21 17:30:42 UTC
(In reply to comment #6)

perhaps, but that's not something i want to add to our init scripts
Comment 9 Samuli Suominen (RETIRED) gentoo-dev 2012-08-31 07:35:48 UTC
+*psmisc-22.19-r1 (31 Aug 2012)
+
+  31 Aug 2012; Samuli Suominen <ssuominen@gentoo.org> +psmisc-22.19-r1.ebuild:
+  Upstream patch for fuser to work with unix sockets wrt #398811. Thanks to
+  Piotr Karbowski and Mike Frysinger.

http://psmisc.git.sourceforge.net/git/gitweb.cgi?p=psmisc/psmisc;a=commit;h=be54c4182c7826ab633d3f39904db441e960e497