Page 1 of 2

udisk problem

Posted: 22. Nov 2012, 10:06
by toothandnail
This problem applies to 14rc2. Apart from the wonderful idea of mounting removable media in /run/media/<username>/<media-name>, udisk works with polkit and sets things like execute permissions without bothering to ask. Great....

Problem I've got is that I need to be able to execute a bash script on a Vfat-formatted flash drive. The script is not executable, nor are any of the progams that the script executes. While I can understand the reasons for doing things like this, I really object to having my control of what I want the system to do removed. And I need to be able to execute the script....

So, can anyone tell me how the rules regarding mount parameters are set? I've done some hunting, but so far can't work out how to modify the mount rules.

This isn't a Salix/Slackware problem - all distros that are going to udisk or udisk2 have the same defaults. Reminds me far too much of Windows.... :evil:

Paul.

Re: udisk problem

Posted: 22. Nov 2012, 11:32
by gapan
I have no idea how to change those settings with udisks.

Alternatives for you might be:
1. Run the script directly with: sh /path/to/script (might not work if the scripts calls other scripts directly. Maybe you can preppend those calls with sh too).
2. Mount the device with pmount. It allows you to set the options you want.
3. Put the device in fstab and mount with the mount command. You could edit the sudoers file to allow you to mount/unmount without having to enter the root password.

And yes, it sucks.

Re: udisk problem

Posted: 22. Nov 2012, 16:43
by toothandnail
gapan wrote:I have no idea how to change those settings with udisks.
:cry: I've made a few attempts to work out how its done, so far, no information at all....
Alternatives for you might be:
1. Run the script directly with: sh /path/to/script (might not work if the scripts calls other scripts directly. Maybe you can preppend those calls with sh too).
Tried that, fails, though I've not tired modifying the script to add sh calls. I'll have to try that....
2. Mount the device with pmount. It allows you to set the options you want.
Haven't used pmount in years, but I installed it and tried it. Nice idea, but whatever is setting the permissions overrides it. I used the -e option when mounting, but the file still has no execute permissions.
3. Put the device in fstab and mount with the mount command. You could edit the sudoers file to allow you to mount/unmount without having to enter the root password.
Thought that might do it, since the permission bits were showing up on 'ls -l', but another failure - when I attempt to execute the script, I get permission denied, even doing so as root.
And yes, it sucks.
It certainly does. I guess I'll have to go back to trying to find out how to modify the original settings in polkit. I think what I really object to is the fact that, if it is documented, its obviously not been done so any normal user can find the information.

:( I've recently hit a similar problem - Firefox, in its attempts to make things safer, no longer lets write operations be performed on local files. So WoaS, which I've been using for years for documentation, will no longer work under Firefox. No way that a user can make an informed decision and override the settings. Fortunately, at least in that case, it does work when run in Midori.

Anyhow, thanks for the suggestions. If I find a solution, I'll post it here for others.

Paul.

Re: udisk problem

Posted: 22. Nov 2012, 22:42
by toothandnail
A quick follow up, in case its useful to anyone else. While I still want to know how udisk/polkit sets mount options, I have found a way round the original problem, which may be useful for anyone wanting to prepare a flash drive for use with the live version of Salix.

I tried adding an entry to /etc/fstab, which didn't help. I also tried pmount, with the -e option, which also failed to fix the problem.

Following a suggestion from the Arch general mailing list, I've just tried manually mounting the flash drive:

Code: Select all

mount -t vfat -o exec /dev/sdb1 /mnt/usbdisk
That option worked and I was able to run the install script without further problems...

:? Wish I knew what the difference between that manual mount and a mount via fstab is, but it works....

Paul.

Re: udisk problem

Posted: 22. Nov 2012, 23:27
by jayseye
Thanks, Paul - Where's the +1 button when you need it here? :wink: The manual addition of "-o exec" sounds like a no brainer, and I'm confident that the equivalent parameter could be specficied in /etc/fstab. Wish I could supply the solution; just very busy ATM so the best I can do is to provide the encouragement instead. :cool:

Re: udisk problem

Posted: 27. Jul 2013, 10:15
by Akuna
Would this help?
http://udisks.freedesktop.org/docs/late ... ctl.1.html

(although it specifically says it is not meant to be used by scripts, it's still useful for simple backup....)

Re: udisk problem

Posted: 27. Jul 2013, 13:03
by mimosa
Does this mean that install-on-USB.sh will not work for 14.0 Live, at least not without some such fix?

I do vaguely rememember having some trouble with this with djemos's Live.

Re: udisk problem

Posted: 2. Aug 2013, 09:49
by mimosa
See this thread from LinuxQuestions for some alternative approaches:

http://www.linuxquestions.org/questions ... 2?posted=1

with thanks to rsal for spotting this.

Re: udisk problem

Posted: 2. Aug 2013, 10:17
by djemos
mimosa wrote:Does this mean that install-on-USB.sh will not work for 14.0 Live, at least not without some such fix?

I do vaguely rememember having some trouble with this with djemos's Live.
install-on-USB.sh is working on 14.0 Live.
I will write again here how someone can do it.
First mount the usb stick. It has to be fat32 formatted
Then type in a terminal (replace mount points and usb with yours)

Code: Select all

su
mount -o loop /run/media/djemos/7890d096-3e87-4ec1-b07c-9d171217331f/tjemos/salixlive-xfce-14.0.1-32-beta2.iso /tmp/iso
cp -r /tmp/iso/* /run/media/djemos/USB_stick/
cd /run/media/djemos/USB_stick/boot
sh install-on-USB.sh
on prompt say "y" twice
cd  /home/djemos/
umount USB_stick device and iso
Unplug your USB_stick
Plug it again.
Reboot and boot from USB

Re: udisk problem

Posted: 2. Aug 2013, 11:19
by mimosa
But if the stick is mounted read only, it won't work. This post is about hard disk partitions, but I believe it sometimes happens with removeable media, too - because of the way udisks and polkit work. Further up in this thread, gapan posted to say there is no easy solution.

I'm not sure why it doesn't always occur, or under which circumstances. Manual mounting will of course always work.