Re: [gentoo-user] USB automount
Am 25.09.2012 18:49, schrieb Canek Peláez Valdés: > On Tue, Sep 25, 2012 at 3:32 AM, Stefan G. Weichinger wrote: >> Am 25.09.2012 10:09, schrieb Stefan G. Weichinger: >> >>> So if I don't use systemd right now, it would be better to keep >>> consolekit? I give it a try now ... compiling stuff without that flag >>> for a test. >> >> Did not work. Rather easy to understand, if neither systemd or >> consolekit is there, how should things work ... >> >> Re-enabled USE-flag "consolekit" for now, re-emerged 4 pkgs, ok now. >> >> Maybe I will try systemd again soon ... > > It's not only the use flag; if you set USE=systemd, you need to boot > with systemd. Otherwise, set USE="consolekit -systemd". I think this should go into the wiki or so. I always assumed that adding the flag "systemd" just somehow enhanced my packages with systemd-compatibility and I could then simply switch between init-systems as I like. It wasn't clear to me that it somehow disabled stuff or made my binaries incompatible with eg. consolekit. For now I stay with my working openrc-based setup, I have other things to test and will only re-compile stuff for systemd when I find more time again. Thanks so far for your investigation on this bug, Stefan
Re: [gentoo-user] USB automount
On Tue, Sep 25, 2012 at 3:32 AM, Stefan G. Weichinger wrote: > Am 25.09.2012 10:09, schrieb Stefan G. Weichinger: > >> So if I don't use systemd right now, it would be better to keep >> consolekit? I give it a try now ... compiling stuff without that flag >> for a test. > > Did not work. Rather easy to understand, if neither systemd or > consolekit is there, how should things work ... > > Re-enabled USE-flag "consolekit" for now, re-emerged 4 pkgs, ok now. > > Maybe I will try systemd again soon ... It's not only the use flag; if you set USE=systemd, you need to boot with systemd. Otherwise, set USE="consolekit -systemd". Regards. -- Canek Peláez Valdés Posgrado en Ciencia e Ingeniería de la Computación Universidad Nacional Autónoma de México
Re: [gentoo-user] USB automount
Am 25.09.2012 10:09, schrieb Stefan G. Weichinger: > So if I don't use systemd right now, it would be better to keep > consolekit? I give it a try now ... compiling stuff without that flag > for a test. Did not work. Rather easy to understand, if neither systemd or consolekit is there, how should things work ... Re-enabled USE-flag "consolekit" for now, re-emerged 4 pkgs, ok now. Maybe I will try systemd again soon ... Thanks, Stefan
Re: [gentoo-user] USB automount
Am 25.09.2012 08:33, schrieb Canek Peláez Valdés: > On Mon, Sep 17, 2012 at 10:45 AM, Stefan G. Weichinger wrote: >> Am 16.09.2012 20:45, schrieb Canek Peláez Valdés: >> >>> This workaround also works in my systemd-only overlay. So, if you have >>> the systemd flag in any of those four packages, disable it and >>> everything should work. Just to be explicit, the versions are: >>> >>> gnome-base/gdm-3.4.1-r1 >>> gnome-base/gnome-session-3.4.2.1 >>> gnome-base/gnome-shell-3.4.2 >>> sys-auth/polkit-0.107:0 >> >> confirming this. I have exactly your mentioned versions with >> USE="-systemd" and suspend/hibernate option returns, I could mount/use a >> DVD right now ... yes! > > OK; now I can put this whole thing behind me. You can read the bug again: > > https://bugs.freedesktop.org/show_bug.cgi?id=53905 > > but the short answer is that you cannot let both systemd and > consolekit to manage sessions. The problem (in my case) was that I was > using accountsservice 0.6.22, which depends on consolekit. I upgraded > to accountsservice 0.6.24 (which can depend on systemd), I removed all > consolekit USE-flags (except for bluez: bluez uses consolekit to pull > either consolekit or systemd; I reported a bug[1]), and after an > emerge -uDNv world, I removed consolekit (I didn't had any other > package depending on it). > > Now everything works as it should, in both my overlay and in the > vanilla Gentoo tree. Be aware: it works *with systemd*; maybe it works > without it, but I don't know (nor care). All the GNOME session > management is moving to systemd, and I think it's a great idea. > Support for consolekit (which is no longer maintained) is still there, > but I don't know for how long. > > If you want to keep using (the unmaintained) consolekit, be sure to > set "-systemd" in your USE flags. Do not mix systemd and consolekit, > or this bug will hit you. > > Regards. > > [1] https://bugs.gentoo.org/show_bug.cgi?id=436180 Thanks a lot for the feedback. So if I don't use systemd right now, it would be better to keep consolekit? I give it a try now ... compiling stuff without that flag for a test. Stefan
Re: [gentoo-user] USB automount
On Mon, Sep 17, 2012 at 10:45 AM, Stefan G. Weichinger wrote: > Am 16.09.2012 20:45, schrieb Canek Peláez Valdés: > >> This workaround also works in my systemd-only overlay. So, if you have >> the systemd flag in any of those four packages, disable it and >> everything should work. Just to be explicit, the versions are: >> >> gnome-base/gdm-3.4.1-r1 >> gnome-base/gnome-session-3.4.2.1 >> gnome-base/gnome-shell-3.4.2 >> sys-auth/polkit-0.107:0 > > confirming this. I have exactly your mentioned versions with > USE="-systemd" and suspend/hibernate option returns, I could mount/use a > DVD right now ... yes! OK; now I can put this whole thing behind me. You can read the bug again: https://bugs.freedesktop.org/show_bug.cgi?id=53905 but the short answer is that you cannot let both systemd and consolekit to manage sessions. The problem (in my case) was that I was using accountsservice 0.6.22, which depends on consolekit. I upgraded to accountsservice 0.6.24 (which can depend on systemd), I removed all consolekit USE-flags (except for bluez: bluez uses consolekit to pull either consolekit or systemd; I reported a bug[1]), and after an emerge -uDNv world, I removed consolekit (I didn't had any other package depending on it). Now everything works as it should, in both my overlay and in the vanilla Gentoo tree. Be aware: it works *with systemd*; maybe it works without it, but I don't know (nor care). All the GNOME session management is moving to systemd, and I think it's a great idea. Support for consolekit (which is no longer maintained) is still there, but I don't know for how long. If you want to keep using (the unmaintained) consolekit, be sure to set "-systemd" in your USE flags. Do not mix systemd and consolekit, or this bug will hit you. Regards. [1] https://bugs.gentoo.org/show_bug.cgi?id=436180 -- Canek Peláez Valdés Posgrado en Ciencia e Ingeniería de la Computación Universidad Nacional Autónoma de México
Re: [gentoo-user] USB automount
Am 16.09.2012 20:45, schrieb Canek Peláez Valdés: > This workaround also works in my systemd-only overlay. So, if you have > the systemd flag in any of those four packages, disable it and > everything should work. Just to be explicit, the versions are: > > gnome-base/gdm-3.4.1-r1 > gnome-base/gnome-session-3.4.2.1 > gnome-base/gnome-shell-3.4.2 > sys-auth/polkit-0.107:0 confirming this. I have exactly your mentioned versions with USE="-systemd" and suspend/hibernate option returns, I could mount/use a DVD right now ... yes! thanks, Stefan
Re: [gentoo-user] USB automount
Am 16.09.2012 20:45, schrieb Canek Peláez Valdés: > On Fri, Sep 14, 2012 at 12:42 AM, Stefan G. Weichinger wrote: > [snip] >> Great to hear, thanks so far. >> Looking forward to his reply > > Stefan, do you use systemd? I don't boot with systemd now (yes, kinda green) ... but have the USE-flags set. I will re-compile the mentioned packages without that flag now, to test. Right now I have some weird issue with an erratic mouse, maybe this gets fixed with today's updates as well (just returned to my office now ...) Reports soon, thanks!
Re: [gentoo-user] USB automount
On Fri, Sep 14, 2012 at 12:42 AM, Stefan G. Weichinger wrote: [snip] > Great to hear, thanks so far. > Looking forward to his reply Stefan, do you use systemd? David told me that he could only check the bug on monday, so I did a little research on the weekend. I installed Gentoo in a QEMU VM (using gnome-boxes), to see if I could reproduce the bug in a unmodified Gentoo installation (I use my systemd-only overlay). I could reproduce the bug, but I found a reasonable workaround: cat /etc/portage/package.use/no-systemd gnome-base/gdm -systemd gnome-base/gnome-session-systemd gnome-base/gnome-shell -systemd sys-auth/polkit -systemd If those four packages have systemd support disabled, then everything works as expected (the suspend/hibernate options returns, I can mount/umount USB sticks, etc.) If at least one of those packages have the systemd USE flag, then the bug appears. I updated the bug report (and I'm not really sure the bug is in polkit or gnome-shell): https://bugs.freedesktop.org/show_bug.cgi?id=53905 This workaround also works in my systemd-only overlay. So, if you have the systemd flag in any of those four packages, disable it and everything should work. Just to be explicit, the versions are: gnome-base/gdm-3.4.1-r1 gnome-base/gnome-session-3.4.2.1 gnome-base/gnome-shell-3.4.2 sys-auth/polkit-0.107:0 I was really looking forward to use the integration of systemd into GNOME, but I suppose it's still a little green. Hopefully we will find and fix the exact bug soon; meanwhile, this workaround is much more usable than using pmount, pm-suspend, etc. Regards. -- Canek Peláez Valdés Posgrado en Ciencia e Ingeniería de la Computación Universidad Nacional Autónoma de México
Re: [gentoo-user] USB automount
Am 2012-09-13 20:56, schrieb Canek Peláez Valdés: > On Thu, Sep 13, 2012 at 1:08 PM, Stefan G. Weichinger wrote: >> Am 13.09.2012 19:48, schrieb Canek Peláez Valdés: >>> On Thu, Sep 13, 2012 at 12:29 PM, Canek Peláez Valdés >>> wrote: >>> [snip] I actually hadn't thought about downgrading polkit, since it was working with the same version in GNOME 3.2. Or maybe it was a fluke (the bug is reproducible, but sometimes I need to try several times). I will try downgrading. >>> >>> Didn't work with 0.106-r7 (which I had to hunt from the Attic), and I >>> cannot downgrade to 0.104 since udisks:2 depends on it. So I suppose >>> we need to nudge David again. >> >> Yes, that conflict sounds familiar ... I hit that one also! > > I took another look at polkit's and gnome-shell's source code. I > didn't do it before since I have work to do and (as I said) the > problems are somewhat workaroundables. After looking at the code, the > plot thickens: > > gnome-shell registers itself to polkit as a PolkitUnixSession: > > http://git.gnome.org/browse/gnome-shell/tree/src/shell-polkit-authentication-agent.c?id=3.4.2#n106 > > polkit will not deal with that in subject_to_jsval: > > http://cgit.freedesktop.org/polkit/tree/src/polkitbackend/polkitbackendjsauthority.c?id=0.107#n730 > > The funny thing? Both code paths were written by David Zeuthen, which > by the way is the one handling the bug. > > It gets better: I changed gnome-shell's code so it registers itself as > PolkitUnixProcess (which supposedly is handled by subject_to_jsval), > and I put printf's in the function subject_to_jsval. It turns out > that, no matter that it actually gets registered as unix-process, > gnome-shell it's also registered (at some point) as unix-session. > > My feeling is that gnome-shell should get registered as > system-bus-name (which it does), and that should be the "primary" > interface of gnome-shell for polkit. However, in Gentoo (I haven't > found any other mention of this bug in any other distro), somehow the > unix-session interface takes control. > > I updated the bug: > > https://bugs.freedesktop.org/show_bug.cgi?id=53905 > > and I hope David will respond soon. Great to hear, thanks so far. Looking forward to his reply Stefan
Re: [gentoo-user] USB automount
On Thu, Sep 13, 2012 at 09:19:19AM -0500, Canek Pel??ez Vald??s wrote > On Thu, Sep 13, 2012 at 1:50 AM, Walter Dnes wrote: > > A normal user can pumount *WHAT THAT SAME USER* has pmounted. Now try > > for a general solution. > > The general solution is using something like udisks+polkit. That is a > true general solution; otherwise you end up like the author of > calibre, with a security mess on his hands: > > https://bugs.launchpad.net/calibre/+bug/885027 To expand on what Neil said... * my configuration does not use suid. It passes a parameter to a script that runs under sudo * pmount and pumount are abreviations for "policy mount" and "policy umount". It has its own security policy, namely that it will only mount/unmount devices in /media -- Walter Dnes I don't run "desktop environments"; I run useful applications
Re: [gentoo-user] USB automount
On Thu, Sep 13, 2012 at 1:08 PM, Stefan G. Weichinger wrote: > Am 13.09.2012 19:48, schrieb Canek Peláez Valdés: >> On Thu, Sep 13, 2012 at 12:29 PM, Canek Peláez Valdés >> wrote: >> [snip] >>> I actually hadn't thought about downgrading polkit, since it was >>> working with the same version in GNOME 3.2. Or maybe it was a fluke >>> (the bug is reproducible, but sometimes I need to try several times). >>> I will try downgrading. >> >> Didn't work with 0.106-r7 (which I had to hunt from the Attic), and I >> cannot downgrade to 0.104 since udisks:2 depends on it. So I suppose >> we need to nudge David again. > > Yes, that conflict sounds familiar ... I hit that one also! I took another look at polkit's and gnome-shell's source code. I didn't do it before since I have work to do and (as I said) the problems are somewhat workaroundables. After looking at the code, the plot thickens: gnome-shell registers itself to polkit as a PolkitUnixSession: http://git.gnome.org/browse/gnome-shell/tree/src/shell-polkit-authentication-agent.c?id=3.4.2#n106 polkit will not deal with that in subject_to_jsval: http://cgit.freedesktop.org/polkit/tree/src/polkitbackend/polkitbackendjsauthority.c?id=0.107#n730 The funny thing? Both code paths were written by David Zeuthen, which by the way is the one handling the bug. It gets better: I changed gnome-shell's code so it registers itself as PolkitUnixProcess (which supposedly is handled by subject_to_jsval), and I put printf's in the function subject_to_jsval. It turns out that, no matter that it actually gets registered as unix-process, gnome-shell it's also registered (at some point) as unix-session. My feeling is that gnome-shell should get registered as system-bus-name (which it does), and that should be the "primary" interface of gnome-shell for polkit. However, in Gentoo (I haven't found any other mention of this bug in any other distro), somehow the unix-session interface takes control. I updated the bug: https://bugs.freedesktop.org/show_bug.cgi?id=53905 and I hope David will respond soon. Regards -- Canek Peláez Valdés Posgrado en Ciencia e Ingeniería de la Computación Universidad Nacional Autónoma de México
Re: [gentoo-user] USB automount
Am 13.09.2012 19:48, schrieb Canek Peláez Valdés: > On Thu, Sep 13, 2012 at 12:29 PM, Canek Peláez Valdés > wrote: > [snip] >> I actually hadn't thought about downgrading polkit, since it was >> working with the same version in GNOME 3.2. Or maybe it was a fluke >> (the bug is reproducible, but sometimes I need to try several times). >> I will try downgrading. > > Didn't work with 0.106-r7 (which I had to hunt from the Attic), and I > cannot downgrade to 0.104 since udisks:2 depends on it. So I suppose > we need to nudge David again. Yes, that conflict sounds familiar ... I hit that one also! S
Re: [gentoo-user] USB automount
Am 13.09.2012 19:31, schrieb Canek Peláez Valdés: > Oh, BTW; I just run /usr/sbin/libvirtd --verbose as my user before > starting boxes; everything works. It also works invoking qemu by hand. I rebuilt libvirt without the polkit-USE-flag. Standalone box for myself, unix-auth is enough ... IMO. S
Re: [gentoo-user] USB automount
Am 13.09.2012 19:29, schrieb Canek Peláez Valdés: > $ /usr/lib/polkit-1/polkitd --replace --no-debug I think you want debug ... so: $ /usr/lib/polkit-1/polkitd --replace right? No additional output here, tried clicking user-menu (upper right) as mentioned in your bug-report ... >> I fixed it by downgrading polkit afai remember (weeks ago). Gave >> the new ebuild a try and still these issues. > > I actually hadn't thought about downgrading polkit, since it was > working with the same version in GNOME 3.2. Or maybe it was a fluke > (the bug is reproducible, but sometimes I need to try several > times). I will try downgrading. I think it worked with the latest stable polkit. Would have to retry, right now I have to leave my office ... Thanks, Stefan
Re: [gentoo-user] USB automount
On Thu, Sep 13, 2012 at 12:29 PM, Canek Peláez Valdés wrote: [snip] > I actually hadn't thought about downgrading polkit, since it was > working with the same version in GNOME 3.2. Or maybe it was a fluke > (the bug is reproducible, but sometimes I need to try several times). > I will try downgrading. Didn't work with 0.106-r7 (which I had to hunt from the Attic), and I cannot downgrade to 0.104 since udisks:2 depends on it. So I suppose we need to nudge David again. Regards. -- Canek Peláez Valdés Posgrado en Ciencia e Ingeniería de la Computación Universidad Nacional Autónoma de México
Re: [gentoo-user] USB automount
On Thu, Sep 13, 2012 at 12:14 PM, Stefan G. Weichinger wrote: > Am 13.09.2012 18:41, schrieb Canek Peláez Valdés: > >> It doesn't, but I was under the assumption it was because I'm using >> systemd. Since I installed gnome-shell-3.4 this has stopped working; >> my findings can be seen on the bug to freedesktop.org: >> >> https://bugs.freedesktop.org/show_bug.cgi?id=53905 >> >> It hits not only USB mounting; it also hits suspend/hibernate (I'm no >> longer allowed to suspend as user), setting up printers, and basically >> everything related to polkit. > > correct! Same stuff here ... additionally accessing libvirt (if compiled > with polkit). Oh, BTW; I just run /usr/sbin/libvirtd --verbose as my user before starting boxes; everything works. It also works invoking qemu by hand. Regards. -- Canek Peláez Valdés Posgrado en Ciencia e Ingeniería de la Computación Universidad Nacional Autónoma de México
Re: [gentoo-user] USB automount
On Thu, Sep 13, 2012 at 12:14 PM, Stefan G. Weichinger wrote: > Am 13.09.2012 18:41, schrieb Canek Peláez Valdés: > >> It doesn't, but I was under the assumption it was because I'm using >> systemd. Since I installed gnome-shell-3.4 this has stopped working; >> my findings can be seen on the bug to freedesktop.org: >> >> https://bugs.freedesktop.org/show_bug.cgi?id=53905 >> >> It hits not only USB mounting; it also hits suspend/hibernate (I'm no >> longer allowed to suspend as user), setting up printers, and basically >> everything related to polkit. > > correct! Same stuff here ... additionally accessing libvirt (if compiled > with polkit). > >> Could you run polkitd without the --no-debug option (I don't have >> OpenRC installed, nor /etc/init.d, so I don't know if that is how it's >> run under OpenRC) and see on the logs if you see the following? >> >> ** >> ERROR:polkitbackendjsauthority.c:730:subject_to_jsval: code should not be >> reached > > I wonder how to start it without that option. When I have Gnome running > and kill the polkit, then restart it ... I see it running but the last > line is: > > Acquired the name org.freedesktop.PolicyKit1 on the system bus $ /usr/lib/polkit-1/polkitd --replace --no-debug >> If so, please state it in the bug. David hasn't answered in three >> weeks; two of them he was at the Kernel Summit in San Diego, but I >> think it's time for me to nudge him again. An independent report >> should help. >> >> I'm running GNOME 3 unstable and with my systemd-only overlay, so I'm >> used to this kind of things happening from time to time. Also, it has >> easy workarounds (pmount, pm-suspend, etc.), so I haven't been really >> concerned into fixing it. > > I fixed it by downgrading polkit afai remember (weeks ago). > Gave the new ebuild a try and still these issues. I actually hadn't thought about downgrading polkit, since it was working with the same version in GNOME 3.2. Or maybe it was a fluke (the bug is reproducible, but sometimes I need to try several times). I will try downgrading. Regards. -- Canek Peláez Valdés Posgrado en Ciencia e Ingeniería de la Computación Universidad Nacional Autónoma de México
Re: [gentoo-user] USB automount
Am 13.09.2012 18:41, schrieb Canek Peláez Valdés: > It doesn't, but I was under the assumption it was because I'm using > systemd. Since I installed gnome-shell-3.4 this has stopped working; > my findings can be seen on the bug to freedesktop.org: > > https://bugs.freedesktop.org/show_bug.cgi?id=53905 > > It hits not only USB mounting; it also hits suspend/hibernate (I'm no > longer allowed to suspend as user), setting up printers, and basically > everything related to polkit. correct! Same stuff here ... additionally accessing libvirt (if compiled with polkit). > Could you run polkitd without the --no-debug option (I don't have > OpenRC installed, nor /etc/init.d, so I don't know if that is how it's > run under OpenRC) and see on the logs if you see the following? > > ** > ERROR:polkitbackendjsauthority.c:730:subject_to_jsval: code should not be > reached I wonder how to start it without that option. When I have Gnome running and kill the polkit, then restart it ... I see it running but the last line is: Acquired the name org.freedesktop.PolicyKit1 on the system bus > If so, please state it in the bug. David hasn't answered in three > weeks; two of them he was at the Kernel Summit in San Diego, but I > think it's time for me to nudge him again. An independent report > should help. > > I'm running GNOME 3 unstable and with my systemd-only overlay, so I'm > used to this kind of things happening from time to time. Also, it has > easy workarounds (pmount, pm-suspend, etc.), so I haven't been really > concerned into fixing it. I fixed it by downgrading polkit afai remember (weeks ago). Gave the new ebuild a try and still these issues. S
Re: [gentoo-user] USB automount
On Thu, Sep 13, 2012 at 11:21 AM, Stefan G. Weichinger wrote: > Am 13.09.2012 16:19, schrieb Canek Peláez Valdés: > >> The general solution is using something like udisks+polkit. > > I have troubles with that combo for a month or so ... seems as if > polkit-0.107 somehow is responsible for stuff not mounted here. > > ~amd64 btw, gnome-3-context. > > udisks comes (/is installed) in both slot 0 and 2, correct? > > [I] sys-fs/udisks > Available versions: > (0) 1.0.4-r2 (~)1.0.4-r3 > (2) (~)1.99.0 (~)1.99.0-r1 > > Does it work for all of you? It doesn't, but I was under the assumption it was because I'm using systemd. Since I installed gnome-shell-3.4 this has stopped working; my findings can be seen on the bug to freedesktop.org: https://bugs.freedesktop.org/show_bug.cgi?id=53905 It hits not only USB mounting; it also hits suspend/hibernate (I'm no longer allowed to suspend as user), setting up printers, and basically everything related to polkit. The root of the problem seems to be that (somehow) gnome-shell gets registered as PolitUnixSession instead of PolkitUnixProcess or PolkitSystemBusName, and that case is not covered in subject_to_jsval. Could you run polkitd without the --no-debug option (I don't have OpenRC installed, nor /etc/init.d, so I don't know if that is how it's run under OpenRC) and see on the logs if you see the following? ** ERROR:polkitbackendjsauthority.c:730:subject_to_jsval: code should not be reached If so, please state it in the bug. David hasn't answered in three weeks; two of them he was at the Kernel Summit in San Diego, but I think it's time for me to nudge him again. An independent report should help. I'm running GNOME 3 unstable and with my systemd-only overlay, so I'm used to this kind of things happening from time to time. Also, it has easy workarounds (pmount, pm-suspend, etc.), so I haven't been really concerned into fixing it. Regards. -- Canek Peláez Valdés Posgrado en Ciencia e Ingeniería de la Computación Universidad Nacional Autónoma de México
Re: [gentoo-user] USB automount
Am 13.09.2012 16:19, schrieb Canek Peláez Valdés: > The general solution is using something like udisks+polkit. I have troubles with that combo for a month or so ... seems as if polkit-0.107 somehow is responsible for stuff not mounted here. ~amd64 btw, gnome-3-context. udisks comes (/is installed) in both slot 0 and 2, correct? [I] sys-fs/udisks Available versions: (0) 1.0.4-r2 (~)1.0.4-r3 (2) (~)1.99.0 (~)1.99.0-r1 Does it work for all of you? scratching my head ... Stefan
Re: [gentoo-user] USB automount
On Thu, Sep 13, 2012 at 9:42 AM, Neil Bothwick wrote: > On Thu, 13 Sep 2012 09:19:19 -0500, Canek Peláez Valdés wrote: > >> > A normal user can pumount *WHAT THAT SAME USER* has pmounted. Now >> > try for a general solution. >> >> The general solution is using something like udisks+polkit. That is a >> true general solution; otherwise you end up like the author of >> calibre, with a security mess on his hands: >> >> https://bugs.launchpad.net/calibre/+bug/885027 >> >> If you dismiss the security implications of sudoing pmount, because >> you care only about *your* use cases, on *your* machine, by definition >> that is not a "general solution". > > You should never need to sudo pmount, it is supposed to run as a normal > user. Walter is using sudo to run pumount, which is nothing like the > situation described in that bug. Even pmount avoids the situations > described in that bug because it is only capable of operating in /media. OK, noted. It is still not "a general solution", which is my main point. Regards. -- Canek Peláez Valdés Posgrado en Ciencia e Ingeniería de la Computación Universidad Nacional Autónoma de México
Re: [gentoo-user] USB automount
On Thu, 13 Sep 2012 09:19:19 -0500, Canek Peláez Valdés wrote: > > A normal user can pumount *WHAT THAT SAME USER* has pmounted. Now > > try for a general solution. > > The general solution is using something like udisks+polkit. That is a > true general solution; otherwise you end up like the author of > calibre, with a security mess on his hands: > > https://bugs.launchpad.net/calibre/+bug/885027 > > If you dismiss the security implications of sudoing pmount, because > you care only about *your* use cases, on *your* machine, by definition > that is not a "general solution". You should never need to sudo pmount, it is supposed to run as a normal user. Walter is using sudo to run pumount, which is nothing like the situation described in that bug. Even pmount avoids the situations described in that bug because it is only capable of operating in /media. -- Neil Bothwick A man wrapped up in himself makes a very small package. signature.asc Description: PGP signature
Re: [gentoo-user] USB automount
On Thu, Sep 13, 2012 at 1:50 AM, Walter Dnes wrote: > On Wed, Sep 12, 2012 at 09:03:50AM +0100, Neil Bothwick wrote > >> I don't understand, why are you using sudo to run pmount when its core >> purpose is to be run by normal users? >> >> % whatis pmount >> pmount (1) - mount arbitrary hotpluggable devices as normal user > > A normal user can pumount *WHAT THAT SAME USER* has pmounted. Now try > for a general solution. The general solution is using something like udisks+polkit. That is a true general solution; otherwise you end up like the author of calibre, with a security mess on his hands: https://bugs.launchpad.net/calibre/+bug/885027 If you dismiss the security implications of sudoing pmount, because you care only about *your* use cases, on *your* machine, by definition that is not a "general solution". Of course, udisks/polkit/etc. goes hand in hand with udev, so you are probably not interested in using them. That is completely fine. Just don't call it a "general solution". Regards. -- Canek Peláez Valdés Posgrado en Ciencia e Ingeniería de la Computación Universidad Nacional Autónoma de México
Re: [gentoo-user] USB automount
On Thu, 13 Sep 2012 02:50:27 -0400, Walter Dnes wrote: > > I don't understand, why are you using sudo to run pmount when its core > > purpose is to be run by normal users? > > > > % whatis pmount > > pmount (1) - mount arbitrary hotpluggable devices as normal user > > A normal user can pumount *WHAT THAT SAME USER* has pmounted. Ah, sorry. I didn't read your post carefully enough and saw pmount when you were using pumount. Using sudo for that makes sense. > Now try > for a general solution. If you're the only user on the system, it's > probably safe to keep an open xterm logged in to root. The problem is > that inserting a USB device sets off a kernel event, that is passed to > mdev, which looks for a script name in /etc/mdev.conf. If a script is > found that matches the device spec (i.e. sd[a-z].*), e.g. my automount > script, then the script is launched *AS ROOT*. Given that root has > mounted the device, only root can unmount it. It's exactly the same problem when udev is used to mount a device, which is why I prefer to have a process running as the logged in user doing that, whether it be something incorporated into the DE or a separate daemon started from ~/.xinitrc. It gets messy if you are running a multi-seat system, but if only one user is running X at a time, it is the cleanest way. Of course, as you are having mdev run a script, you could get that script to check which user is logged into X and use su to mount it for them, avoiding the umount issues. -- Neil Bothwick Like an atheist in a grave: all dressed up and no place to go. signature.asc Description: PGP signature
Re: [gentoo-user] USB automount
On Wed, Sep 12, 2012 at 09:03:50AM +0100, Neil Bothwick wrote > I don't understand, why are you using sudo to run pmount when its core > purpose is to be run by normal users? > > % whatis pmount > pmount (1) - mount arbitrary hotpluggable devices as normal user A normal user can pumount *WHAT THAT SAME USER* has pmounted. Now try for a general solution. If you're the only user on the system, it's probably safe to keep an open xterm logged in to root. The problem is that inserting a USB device sets off a kernel event, that is passed to mdev, which looks for a script name in /etc/mdev.conf. If a script is found that matches the device spec (i.e. sd[a-z].*), e.g. my automount script, then the script is launched *AS ROOT*. Given that root has mounted the device, only root can unmount it. E.g. when root pmounts a device and normal user tries to pumount it, I get... waltdnes@d531 ~ $ pumount sdb1 Error: device /dev/sdb1 was not mounted by you Note also that the automount script has to first create a directory in /media, before mounting it. Since /media is drwxr-xr-x the directory has to be created by root, or else I have to open up /media to writing and directory creation by all users. The most secure approach is to have the system do things as root without user intervention, as much as possible. -- Walter Dnes I don't run "desktop environments"; I run useful applications
Re: [gentoo-user] USB automount
120911 Neil Bothwick was worried at the idea of leaving a root console open for all to access: My machine is not accessible to anyone else, so it's not a problem here. Yes, it's not a good idea if you're in a data centre or open-plan office. -- ,, SUPPORT ___//___, Philip Webb ELECTRIC /] [] [] [] [] []| Cities Centre, University of Toronto TRANSIT`-O--O---' purslowatchassdotutorontodotca
Re: [gentoo-user] USB automount
On Tue, 11 Sep 2012 22:47:21 -0400, Walter Dnes wrote: > Fully agree that's a bad idea. My system uses sudoers. I.e. in > /etc/sudoers.d/001 I have the lines... > > user2 d531 = (root) NOPASSWD: /usr/local/bin/ux * > waltdnes d531 = (root) NOPASSWD: /usr/local/bin/ux * > > ...where /usr/local/bin/ux consists of... > > #!/bin/busybox ash > pumount ${1} > > ...and in my home directory I have ~/bin/um which consists of... > > #! /bin/busybox ash > sudo /usr/local/bin/ux ${1} > > ...So I can, as a regular user, execute at the commandline... > > um sdb1 > > ...and /media/sdb1 is unmounted. No need to log on as root or have a > root shell. I don't understand, why are you using sudo to run pmount when its core purpose is to be run by normal users? % whatis pmount pmount (1) - mount arbitrary hotpluggable devices as normal user -- Neil Bothwick Life's a cache, and then you flush... signature.asc Description: PGP signature
Re: [gentoo-user] USB automount
On Tue, Sep 11, 2012 at 11:51:30PM +0100, Neil Bothwick wrote > It's the idea of leaving a root console open for all to access that is > the issue, not the commands you run in it. Fully agree that's a bad idea. My system uses sudoers. I.e. in /etc/sudoers.d/001 I have the lines... user2 d531 = (root) NOPASSWD: /usr/local/bin/ux * waltdnes d531 = (root) NOPASSWD: /usr/local/bin/ux * ...where /usr/local/bin/ux consists of... #!/bin/busybox ash pumount ${1} ...and in my home directory I have ~/bin/um which consists of... #! /bin/busybox ash sudo /usr/local/bin/ux ${1} ...So I can, as a regular user, execute at the commandline... um sdb1 ...and /media/sdb1 is unmounted. No need to log on as root or have a root shell. -- Walter Dnes I don't run "desktop environments"; I run useful applications
Re: [gentoo-user] USB automount
On Tue, 11 Sep 2012 17:55:41 -0400, Walter Dnes wrote: > > > I goto the root console which is always open on one of my desktops > > > & enter 'musb', which is a Bash alias for a 'mount' command; > > > > Leaving aside the implications of leaving open a root console, > > My scripts use pmount and pumount, which are hard-coded to only > mount/unmount devices in directory /media. It's the idea of leaving a root console open for all to access that is the issue, not the commands you run in it. > > that mounts the stick as root. That's fine for a FAT filesystem as > > you can specify mount options to make it world-readable, but what > > about an external drive formatted with ext? What about an external > > drive with multiple partitions? > > pmount/pumount to the rescue. See... > http://manpages.ubuntu.com/manpages/natty/man1/pmount.1.html I know about pmount, I use it myself. It mounts as the user running it, which is fine from a (non-root) terminal, but udevd is running as root, as are any programs it runs. -- Neil Bothwick Top Oxymorons Number 40: Same difference signature.asc Description: PGP signature
Re: [gentoo-user] USB automount
On Tue, Sep 11, 2012 at 5:55 PM, Walter Dnes wrote: > On Tue, Sep 11, 2012 at 10:41:22AM +0100, Neil Bothwick wrote > > > > I goto the root console which is always open on one of my desktops > > > & enter 'musb', which is a Bash alias for a 'mount' command; > > > > Leaving aside the implications of leaving open a root console, > > My scripts use pmount and pumount, which are hard-coded to only > mount/unmount devices in directory /media. > > > that mounts the stick as root. That's fine for a FAT filesystem as > > you can specify mount options to make it world-readable, but what > > about an external drive formatted with ext? What about an external > > drive with multiple partitions? > > pmount/pumount to the rescue. See... > http://manpages.ubuntu.com/manpages/natty/man1/pmount.1.html > > I didn't know about that. That's...awesome. And it'll save me trouble. This is why I like this list; I learn stuff just by listening in. -- :wq
Re: [gentoo-user] USB automount
On Tue, Sep 11, 2012 at 10:41:22AM +0100, Neil Bothwick wrote > > I goto the root console which is always open on one of my desktops > > & enter 'musb', which is a Bash alias for a 'mount' command; > > Leaving aside the implications of leaving open a root console, My scripts use pmount and pumount, which are hard-coded to only mount/unmount devices in directory /media. > that mounts the stick as root. That's fine for a FAT filesystem as > you can specify mount options to make it world-readable, but what > about an external drive formatted with ext? What about an external > drive with multiple partitions? pmount/pumount to the rescue. See... http://manpages.ubuntu.com/manpages/natty/man1/pmount.1.html -- Walter Dnes I don't run "desktop environments"; I run useful applications
Re: [gentoo-user] USB automount
On Tue, Sep 11, 2012 at 10:30 AM, Chris Stankevitz wrote: > On Mon, Sep 10, 2012 at 10:03 PM, Walter Dnes wrote: >> Every time that a USB device is inserted or removed, an >> "event" is triggered by the kernel. What's required is an "event >> handler" that reacts appropriately to those events. This is usually >> udev, but mdev will also work. I've replaced udev with mdev on my >> machine ( see https://wiki.gentoo.org/wiki/Mdev ) and I've implemented >> USB automounting under mdev, using scripts. It works even in text >> console mode. See https://wiki.gentoo.org/wiki/Mdev/Automount_USB > > Walter, > > Thank you. What I'm hearing is: > > 1. There are many ways to get USB automount Correct. > 2. One way is to install udev and fabricate the correct scripting to > cause the automount to take place That it's the "I want to do it by hand" way. > 3. By some magic a GUI system such as GNOME, XFCE, TWM, etc will > recognize when (2) happens and show an icon on the desktop [I'm > talking somewhat tongue in cheek WRT TWM] That is the automagical™ way. > If this is correct, I'd like to know: > > a) what is the scripting I need to fabricate to get (2) to work correctly. I you want to do it by hand (which is as useful as trying to drive a car as the Flinstones, i.e., with your own feet), you need to create an udev rule. An old tutorial on that is: http://www.reactivated.net/writing_udev_rules.html It's a little outdated, since from some years ago it has been working "out-of-the-box" in almost all Linux distros, specially if they install and configure udev as intended by its upstream. So the need for users to handle udev rules has been greatly reduced. > b) what is the magic by which (3) happens. It's not magic; just the modern desktop environments install a program (or programs) that installs udev rules, and that handle things like the pretty icons (or notifications, or whatever). In GNOME 3 case, the program is udisks (version 2), which installs: /usr/lib/udev/rules.d/80-udisks2.rules Then it handles everything for you. Please also note that USB stick mounting is just *ONE* of the gazillion things udev (and other parts of the stack) takes care of. For example, in this screenshot: https://plus.google.com/115256116066287398549/posts/JX6kRciZ9zA I'm configuring Skype to use my bluetooth head set for input/output of sound, while the rest of my system keeps using the desktop sound card. The whole shebang is powered by udev (for detecting the headset as source/sink for audio), bluez (for pairing it), pulseaudio (for switching sound streams on the fly), etc. You can (of course) do all of this by hand, but it gets pretty convoluted after a while. Mounting USB sticks is easy; as Philip said, you can do it with "mount" in a terminal as root (for example). It could be argued about how smart is to do it, but it's easy alright. I care more about stuff like the above screenshot; I could argue that it's easier (or at least not as difficult) to set up a BT headset for use with Skype on the fly on Linux than on Mac OS X or Windows. For that level of easiness and automagicality™, you need the whole stack working correctly. It is nice to learn how to do all of that by hand; if you have the time (and the interest) is a nice thing to do. For doing real work, it's not very useful. Regards. -- Canek Peláez Valdés Posgrado en Ciencia e Ingeniería de la Computación Universidad Nacional Autónoma de México
Re: [gentoo-user] USB automount
On Mon, Sep 10, 2012 at 10:03 PM, Walter Dnes wrote: > Every time that a USB device is inserted or removed, an > "event" is triggered by the kernel. What's required is an "event > handler" that reacts appropriately to those events. This is usually > udev, but mdev will also work. I've replaced udev with mdev on my > machine ( see https://wiki.gentoo.org/wiki/Mdev ) and I've implemented > USB automounting under mdev, using scripts. It works even in text > console mode. See https://wiki.gentoo.org/wiki/Mdev/Automount_USB Walter, Thank you. What I'm hearing is: 1. There are many ways to get USB automount 2. One way is to install udev and fabricate the correct scripting to cause the automount to take place 3. By some magic a GUI system such as GNOME, XFCE, TWM, etc will recognize when (2) happens and show an icon on the desktop [I'm talking somewhat tongue in cheek WRT TWM] If this is correct, I'd like to know: a) what is the scripting I need to fabricate to get (2) to work correctly. b) what is the magic by which (3) happens. Thank you, Chris
Re: [gentoo-user] USB automount
On Tue, 11 Sep 2012 04:56:21 -0400, Philip Webb wrote: > Why do people want to automount these sticks ? Because it is easy and convenient, something computers are supposed to be good for. > I goto the root console which is always open on one of my desktops > & enter 'musb', which is a Bash alias for a 'mount' command; Leaving aside the implications of leaving open a root console, that mounts the stick as root. That's fine for a FAT filesystem as you can specify mount options to make it world-readable, but what about an external drive formatted with ext? What about an external drive with multiple partitions? -- Neil Bothwick X-Modem- A device on the losing end of an encounter with lightning. signature.asc Description: PGP signature
Re: [gentoo-user] USB automount
120911 Walter Dnes wrote: > On Mon, Sep 10, 2012 Chris Stankevitz asked how to automount a USB stick : > A GUI is not necessary. Every time a USB device is inserted or removed, > an "event" is triggered by the kernel. What's required is > an "event handler" that reacts appropriately to those events. > This is usually udev, but mdev will also work. > See https://wiki.gentoo.org/wiki/Mdev/Automount_USB Why do people want to automount these sticks ? I goto the root console which is always open on one of my desktops & enter 'musb', which is a Bash alias for a 'mount' command; when I've finished, I enter 'uusb' & wait for the prompt to come back, which shows the stick has been successfully dismounted; I can check its status via 'df' whenever I want. I rarely want to use > 1 stick at the same time, but it wb easy to create several aliases for different dev-mnt pairs. -- ,, SUPPORT ___//___, Philip Webb ELECTRIC /] [] [] [] [] []| Cities Centre, University of Toronto TRANSIT`-O--O---' purslowatchassdotutorontodotca
Re: [gentoo-user] USB automount
On Mon, Sep 10, 2012 at 03:56:20PM -0700, Chris Stankevitz wrote > Also, ideally after I know about it I'd like to be able to > "understand" and derive on my own the answer to this question: > "is it possible for TWM to recognize when I plug in a USB thumbdrive > and display it for me to use." A GUI is not necessary. TWM by itself is not only not enough, it's not relevant. Every time that a USB device is inserted or removed, an "event" is triggered by the kernel. What's required is an "event handler" that reacts appropriately to those events. This is usually udev, but mdev will also work. I've replaced udev with mdev on my machine ( see https://wiki.gentoo.org/wiki/Mdev ) and I've implemented USB automounting under mdev, using scripts. It works even in text console mode. See https://wiki.gentoo.org/wiki/Mdev/Automount_USB My approach may not be appropriate for a Gentoo newbie. In GNOME/KDE etc, automounting is one of a ton of extra goodies in "the kitchen sink" and it "just works". My approach requires doing some manual setting up before it works. However, if you want an idea of the mechanics involved my USB automount page provides the background... because I had to ask a question similar to yours, and spend a few weeks searching for answers on the web. It helps that I'm retired, and have the necessary time. -- Walter Dnes I don't run "desktop environments"; I run useful applications
[gentoo-user] USB automount
Hello, Can someone refer me to a source that explains how when I plug in a USB "thumb drive" it appears on my XFCE4 desktop (or any other WM)? Ideally the answer will use words like: daemon hal udev policykit consolekit /etc/init.d/* hotplug gvfs mount automount pmount gnome-volume-manager udisks fstab mtab Also, ideally after I know about it I'd like to be able to "understand" and derive on my own the answer to this question: "is it possible for TWM to recognize when I plug in a USB thumbdrive and display it for me to use." Thank you! Chris
Re: [gentoo-user] USB automount with LXDE
On 11/17/2011 04:54 P, Neil Bothwick wrote: > I thought that pcmanfm, the LXDE file manager, had a context menu > option to unmount. > Me too, and I think that a long time ago I did have it, but now it's not there. Probably I'd better try on the lxde mailing list. thanks, raf
Re: [gentoo-user] USB automount with LXDE
On Thu, 17 Nov 2011 15:58:03 +0100, Raffaele BELARDI wrote: > The ArchWiki link on Udev posted by James shows how to set a rule for > un-mounting: > > ACTION=="remove", ENV{dir_name}!="", RUN+="/bin/su tomk -c > '/usr/bin/pumount /media/%E{dir_name}'" > > Based on your feedback I suppose the same can be done (or is done?) > with uam. The problem with such a rule is that it is executed after the device is removed, so it cannot unmount the filesystem cleanly. The only way to do that would be for udev to know you were going to remove the drive before you actually unplugged. I thought that pcmanfm, the LXDE file manager, had a context menu option to unmount. -- Neil Bothwick It's no use crying over spilt milk -- it only makes it salty for the cat. signature.asc Description: PGP signature
Re: [gentoo-user] USB automount with LXDE
On 11/17/2011 03:06 PM, Neil Bothwick wrote: > On Thu, 17 Nov 2011 14:22:35 +0100, Raffaele BELARDI wrote: >> 3. uam: does not require fiddling with udev rules but cannot >> un-mount > > 3 is wrong, you can unmount with pmount, exactly the same as with > 1. > > uam is basically a set of udev rules that effectively does 1 for > you. That's why I described it as the simplest option. > Ok, I got a wrong impression reading the README: "The pmount utility can be used to manually unmount removable devices mounted by uam which can't be done by uam due to its reliance on udev triggers." The ArchWiki link on Udev posted by James shows how to set a rule for un-mounting: ACTION=="remove", ENV{dir_name}!="", RUN+="/bin/su tomk -c '/usr/bin/pumount /media/%E{dir_name}'" Based on your feedback I suppose the same can be done (or is done?) with uam. raffaele
Re: [gentoo-user] USB automount with LXDE
On Thu, 17 Nov 2011 14:22:35 +0100, Raffaele BELARDI wrote: > 1. udev rules: mounts automatically, with pmount can do non-root > un-mounting 2. mdev: according to the man page works only at system boot > 3. uam: does not require fiddling with udev rules but cannot un-mount > > I suppose I'll go with 1. 3 is wrong, you can unmount with pmount, exactly the same as with 1. uam is basically a set of udev rules that effectively does 1 for you. That's why I described it as the simplest option. -- Neil Bothwick WinErr 013: Unexpected error - Huh ? signature.asc Description: PGP signature
Re: [gentoo-user] USB automount with LXDE
On 11/17/2011 11:37 AM, Neil Bothwick wrote: > On Thu, 17 Nov 2011 10:07:11 +0100, Raffaele BELARDI wrote: >> When I need to mount a removable USB device on LXDE (~amd64) I currently >> manually issue the mount command. What do I need to do to make >> automounting possible? > > The simplest option is to emerge uam. > Thanks to all, summarizing: 1. udev rules: mounts automatically, with pmount can do non-root un-mounting 2. mdev: according to the man page works only at system boot 3. uam: does not require fiddling with udev rules but cannot un-mount I suppose I'll go with 1. Next question: will pcmanfm automatically display an icon for the newly mounted media and delete it once it is unmounted? raffaele
Re: [gentoo-user] USB automount with LXDE
On Thu, 17 Nov 2011 10:07:11 +0100, Raffaele BELARDI wrote: > When I need to mount a removable USB device on LXDE (~amd64) I currently > manually issue the mount command. What do I need to do to make > automounting possible? The simplest option is to emerge uam. -- Neil Bothwick Will the last human please uninstall internet.exe. signature.asc Description: PGP signature
Re: [gentoo-user] USB automount with LXDE
On Nov 17, 2011 4:51 PM, "James Broadhead" wrote: > > On 17 November 2011 09:07, Raffaele BELARDI wrote: > > When I need to mount a removable USB device on LXDE (~amd64) I currently > > manually issue the mount command. What do I need to do to make > > automounting possible? > > > > According to LXDE wiki (1) you need HAL, which I don't have on my > > system. I found several suggestions on the net but none seems promising. > > Any hints to point me in the right direction? > > > > raffaele > > > > (1) > > http://wiki.lxde.org/en/LXDE:Questions#Does_LXDE_automount_plugged_in_removable_devices_.28USB_drives.2C_Flash_disks.2C_etc.29.3F > > udev can do it - here's an Arch guide which is probably helpful: > https://wiki.archlinux.org/index.php/Udev#Auto_mounting_USB_devices > > Personally, I use pmount, which allows plugdev-users to mount without sudo. > > gentoo-wiki has an article on "AutoFS", but I've no idea about that. > What about mdev? Can it do that too? Rgds,
Re: [gentoo-user] USB automount with LXDE
On 17 November 2011 09:07, Raffaele BELARDI wrote: > When I need to mount a removable USB device on LXDE (~amd64) I currently > manually issue the mount command. What do I need to do to make > automounting possible? > > According to LXDE wiki (1) you need HAL, which I don't have on my > system. I found several suggestions on the net but none seems promising. > Any hints to point me in the right direction? > > raffaele > > (1) > http://wiki.lxde.org/en/LXDE:Questions#Does_LXDE_automount_plugged_in_removable_devices_.28USB_drives.2C_Flash_disks.2C_etc.29.3F udev can do it - here's an Arch guide which is probably helpful: https://wiki.archlinux.org/index.php/Udev#Auto_mounting_USB_devices Personally, I use pmount, which allows plugdev-users to mount without sudo. gentoo-wiki has an article on "AutoFS", but I've no idea about that.
[gentoo-user] USB automount with LXDE
When I need to mount a removable USB device on LXDE (~amd64) I currently manually issue the mount command. What do I need to do to make automounting possible? According to LXDE wiki (1) you need HAL, which I don't have on my system. I found several suggestions on the net but none seems promising. Any hints to point me in the right direction? raffaele (1) http://wiki.lxde.org/en/LXDE:Questions#Does_LXDE_automount_plugged_in_removable_devices_.28USB_drives.2C_Flash_disks.2C_etc.29.3F