App::USBKeyCopyCon::Troubleshooting - Hints for making usb-key-copy-con work on your system
This package relies on some fairly low-level system services. It was developed on an Ubuntu 9.04 ('Jaunty') system running the GNOME desktop. If you're running a different OS or indeed the same OS with different preference settings then your mileage may vary.
The default behaviour of GNOME/Nautlus is to automatically mount any USB storage device when it is plugged in and then pop up a file browser window. This behaviour conflicts with
usb-key-copy-con because it causes the scripted formatting and mounting operations to fail with 'Device Busy' errors.
The application is meant to disable media-automount on start-up and to restore it on exit. If you get file browser windows popping up while key copying is running then
usb-key-copy-con failed to disable the function. You will either need to manually disable media-automount or patch the code to use comands that work for turning this function on and off on your system.
This command turns it off on the developer's system:
gconftool-2 --type bool --set \ /apps/nautilus/preferences/media_automount false
and this command turns it back on:
gconftool-2 --type bool --set \ /apps/nautilus/preferences/media_automount true
Different versions of GNOME may use different configuration keys. Other desktop environments (e.g.: KDE) will use different config mechanisms altogether. Feedback on how to manage this better is welcome.
It is safest to run
usb-key-copy-con when only one user is logged on to your workstation. If you log in one user and then 'switch users' to log in a second user, the desktop of the first user may continue to respond to USB device add/remove events and cause conflicts with the copying process.
usb-key-copy-con program needs root privileges to format and mount/unmount devices. If the program is run by a non-root user then it will use either gksudo or sudo to run the sub-commands that need privilege. If gksudo is installed then password prompts should appear in a graphical window, if not, they may appear in the console window where the command was originally run. You may wish to configure sudo so that no password prompt is needed.
You can run the whole
usb-key-copy-con program as root:
However in this mode it will not be able to access the original user's GConf settings to disable media-automount so you will need to do that manually.
usb-key-copy-con program passes the USB device parameters to the copying script via environment variables. Unfortunately sudo can strip out variables passed to child processes. Also the mechanism for passing environment variables through sudo vs gksudo is different.
If you see a message like this:
USB_BLOCK_DEVICE not set
Then your system is not passing environment variables through sudo to the child process. You may need to either change your sudo configuration or run the whole program as root (see above) with the caveat that you will need to manually disable media-automount first.
Copyright 2009 Grant McLean <firstname.lastname@example.org>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.