Giter VIP home page Giter VIP logo

udiskie's Introduction

udiskie

Version License: MIT Translations

udiskie is a udisks2 front-end that allows to manage removable media such as CDs or flash drives from userspace.

Screenshot

Its features include:

  • automount removable media
  • notifications
  • tray icon
  • command line tools for manual un-/mounting
  • LUKS encrypted devices
  • unlocking with keyfiles (requires udisks 2.6.4)
  • loop devices (mounting iso archives)
  • password caching (requires python keyutils 0.3)

All features can be individually enabled or disabled.

NOTE: support for python2 and udisks1 have been removed. If you need a version of udiskie that supports python2, please check out the 1.7.X releases or the maint-1.7 branch.

udiskie's People

Contributors

alejandro-perez avatar ammgws avatar byronclark avatar cherti avatar coldfix avatar colonelpanic8 avatar creshal avatar dependabot-preview[bot] avatar gbiggs avatar jose1711 avatar locutusofborg avatar mathstuf avatar mb720 avatar milibopp avatar moredread avatar mr-greywolf avatar mtorromeo avatar oersen avatar pbui avatar sealj553 avatar stebalien avatar stefano-mecocci avatar tlatsas avatar torstehu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

udiskie's Issues

udiskie not working properly with uefi partioned disks

There is a uefi partition on my usb disk /dev/sdb and There is also partition on /dev/sdb1 and files inside.

So udiskie mounting /dev/sdb but its not mounting /dev/sdb1 and gives following errors :

mounted /org/freedesktop/UDisks/devices/sdb on /media/Ubuntu 14.04 LTS amd64
failed to mount /org/freedesktop/UDisks/devices/sdb1: GDBus.Error:org.freedesktop.UDisks.Error.Failed: Error mounting: mount exited with exit code 1: helper failed with:
mount: /dev/sdb1 is already mounted or /media/usb0 busy

operation failed for device: /org/freedesktop/UDisks/devices/sdb1

[feature request] Triggering a script after mounting a device

Hi,

Thanks for udiskie!

I'm reading the documentation, and I don't find a way to do what I want. Basically, I would like to trigger a script once a device has been mounted and unlocked.

My use case would be an rsync script, that would need to receive the path of the mounted device as an argument. Is there a way to do that with udiskie?

I am flexible about the way this happens. I could rewrite my script such that it listens to dbus, or something like that.

Cannot unlock encrypted device: unhandled device

I have an USB stick with two partitions on it. The first one is regular NTFS
partition, the other one is LUKS-encrypted f2fs partition for my sensitive data.

When mounting with udiskie, the first partition is mounted as expected, but the
encrypted one is not. When I try to mount it manually (with udiskie-mount), I
get the following:

$ udiskie-mount /dev/sdb2                                                                                                                                                        TODO: 11 tasks, 4 H
not unlocking /org/freedesktop/UDisks2/block_devices/sdb2: unhandled device

Udiskie is configured to use Udisks2 per default.

Is there something I overloked, or did I find an issue?

Thanks in advance for any help.

udiskie runtime dependencies

Hi again, I recently spotted (with a Debian bug report) some missing runtime dependencies to the package.

Package: python-udiskie
Architecture: all
Depends: gettext,
         gobject-introspection,
         python-gi | python-gi-cairo,
         python-notify,
         python-pkg-resources,
         udisks2,
         ${misc:Depends},
         ${python:Depends}


Package: python3-udiskie
Architecture: all
Depends: gettext,
         gobject-introspection,
         python-notify,
         python3-gi | python3-gi-cairo,
         python3-pkg-resources,
         udisks2,
         ${misc:Depends},
         ${python3:Depends}

some of them (the python*:Depends) includes PyYAML and docopt, because they are listed in install_requires setup field.

I would like to know if they are really needed the above dependencies, and know if they can be added to the setup.py (at least maybe the gi, pkg-resources and the notify packages?)

thanks

Use kernel keyring to store passphrases

It'd be nice to have a device automatically unlocked via a keyring associated with the process. Basically, put the passphrase in the kernel (with an optional timeout) when unlocking a device and try it first.

See keyutils(7) and keyrings(7).

Thorough testing

Thorough unit tests for all features as well as integration tests should be added. The dbusmock module could be an interesting option, although it's API is somewhat quirky (relies on evaluating strings).

Cannot set a ignore rule

On one of my computers I have a LVM volume joining an internal volume with an USB one (I know it may sound weird, but I needed some extra space and I had an spare USB disk). The thing is that I do not want udiskie to handle /dev/sdb at all. So I put this on my config file:

ignore_device:
  device_file: /dev/sdb

But it fails:

Traceback (most recent call last):
  File "/usr/bin/udiskie", line 9, in <module>
    load_entry_point('udiskie==1.1.1', 'console_scripts', 'udiskie')()
  File "/usr/lib/python3.4/site-packages/udiskie/cli.py", line 204, in main
    return cls(argv).run()
  File "/usr/lib/python3.4/site-packages/udiskie/cli.py", line 178, in __init__
    self._init(config, options)
  File "/usr/lib/python3.4/site-packages/udiskie/cli.py", line 311, in _init
    ignore_device=config.ignore_device,
  File "/usr/lib/python3.4/site-packages/udiskie/config.py", line 225, in ignore_device
    return FilterMatcher(map(IgnoreDevice, config_list), False)
  File "/usr/lib/python3.4/site-packages/udiskie/config.py", line 139, in __init__
    self._filters = list(filters)
  File "/usr/lib/python3.4/site-packages/udiskie/config.py", line 124, in __init__
    config_item = config_item.copy()
AttributeError: 'str' object has no attribute 'copy'

Regards

lost notifications with upgrade from 0.6.4--->1.1.1 gentoo

coldfix, with this week's update in portage, I seem to have lost all notifications. However, udiskie does seem to mount/unmount properly, so no actual functionality is lost. I notice the dependency on notify-python is gone now, but I doubt that is the culprit here, because adding it with the new version does not change things. However, downgrading to 0.6.4 pulls in notify-python, and solves the issue.

I am running xmonad with trayer, and it has worked perfectly through several versions of udiskie, so the problem is related to the upgrade.

I've read the new documentation and tried passing -n as well. I notice that the notification daemon is 'optional'. What should I be using (libnotify is installed ATM), and does it require configuration? Nothing has been necessary in the past.

This is the bug I have filed in gentoo's bugzilla, but I don't know if it is an actual ebuild bug because of a forgotten dependency or just some new configuration that I have not done: https://bugs.gentoo.org/show_bug.cgi?id=519026

How to execute udiskie without installing

Hello,

when I try to test new udiskie features directly from the github master branch, I don't really want to "sudo python2 setup.py install". Is there any friendlier way to execute udiskie without actually installing? (I tried to install to another location, but still does not work).

Thanks

"Device appeared" notification with action

When a device is mounted, the notifcation contains an action that opens the file manager.

When a device appears, the notifcation does not contain an action. It would be really helpful if the notication contained an action that mounts the just appeared device.

If there are multiple partitions on that device, there could be multiple actions, or just mount all of them.

Improve output of `--help`

The command line help should provide information about the usage of the configuration file. One possibility to improve the usefulness of --help very easily is to use docopt to parse the command line instead of the legacy optparse.

Mount option `compress=lzo' is not allowed

I want to mount my external HDD formatted in btrfs with these options: rw, nosuid, nodev, noatime, compress=lzo, space_cache, autodefrag

With this entry in /etc/fstab, it works fine.

/dev/disk/by-uuid/d40cbab5-85a1-43de-96ce-06dbfe2fa70b /run/media/USER/external_hdd btrfs rw,nosuid,nodev,noatime,compress=lzo,space_cache,autodefrag 0 0

Result from /etc/mtab

/dev/sdb1 /run/media/USER/external_hdd btrfs rw,nosuid,nodev,noatime,compress=lzo,space_cache,autodefrag 0 0

But, when I tries to use udiskie to mount it with the same options from config file, it doesn't seem to work properly

~ udiskie -c "$HOME/.config/udiskie/config.yml"
failed to mount /org/freedesktop/UDisks2/block_devices/sdb1: GDBus.Error:org.freedesktop.UDisks2.Error.OptionNotPermitted: Mount option `compress=lzo' is not allowed

Instead, it's mounted with (perhaps) default options.
Result from /etc/mtab

/dev/sdb1 /run/media/USER/external_hdd btrfs rw,nosuid,nodev,relatime,space_cache 0 0

My config file in $HOME/.config/udiskie/config.yml

udisks_version: 2
tray: false
automount: false
notify: true
mount_options:
    - id_uuid: d40cbab5-85a1-43de-96ce-06dbfe2fa70b
      options: [rw, nosuid, nodev, noatime, compress=lzo, space_cache, autodefrag]

Am I missing something?

Simplify device matching

There are two aspects

  • some device properties are lists for which any item should lead to a match rather than specifying the complete list or the first entry as is currently done with mount_points and device_id respectively
  • support wild cards?

automounting of devicemappers fails with udisks2-backend

background-setup:

external harddrive, luks-encrypted
-> udev-rule to call cryptsetup with a keyfile to open the harddrive automatically

problem description:

With udisks1 as a backend, udiskie then mounts the devicemapper that appears as a consequence of the udev-rule doing its work. The device itself (containing the LUKS-volume) gets correctly recognized as not-to-be-handled.

However, when using udisks2 as a backend, udiskie ignores the upcoming devicemapper and asks for a password to unlock the harddrive (although it is already unlocked, the devicemapper is existing already, according to udiskie's debug-output below).

This behavior can be observed in version 1.2 with udisks2 as a default but in version 1.1.3 as well by explicitly using udisks2 as a backend. (earlier versions not tested, can be done if helpful).

output (with -v) of udiskie 1.2.0:

Output generated by a running udiskie when plugging in a harddrive of the sort in question.
(udiskie command used: udiskie -v -t -n -a [-(1|2)])

For udisks1 (-1):

DEBUG [2015-07-29 02:07:57,200] udiskie.config: IgnoreDevice(match={'is_external': False}, value=True) used for /org/freedesktop/UDisks/devices/dm_2d1
DEBUG [2015-07-29 02:07:57,359] udiskie.config: IgnoreDevice(match={'is_external': False}, value=True) used for /org/freedesktop/UDisks/devices/dm_2d1
DEBUG [2015-07-29 02:07:57,359] udiskie.mount: mounting /org/freedesktop/UDisks/devices/dm_2d1 with {'fstype': 'ext4', 'options': None}
INFO [2015-07-29 02:07:57,514] udiskie.mount: mounted /org/freedesktop/UDisks/devices/dm_2d1 on /media/Epsilon
INFO [2015-07-29 02:07:57,551] udiskie.mount: not unlocking /org/freedesktop/UDisks/devices/sde: already unlocked

for udisks2 (-2):

DEBUG [2015-07-29 02:00:51,724] udiskie.udisks2: +++ device_added: /org/freedesktop/UDisks2/block_devices/dm_2d1
DEBUG [2015-07-29 02:00:51,729] udiskie.config: IgnoreDevice(match={'is_external': False}, value=True) used for /org/freedesktop/UDisks2/block_devices/dm_2d1
DEBUG [2015-07-29 02:00:51,732] udiskie.udisks2: +++ device_added: /org/freedesktop/UDisks2/drives/WDC_WD30EURS_73TLHY0_WD_WMC4N0270075
DEBUG [2015-07-29 02:00:51,732] udiskie.config: IgnoreDevice(match={'is_block': False}, value=True) used for /org/freedesktop/UDisks2/drives/WDC_WD30EURS_73TLHY0_WD_WMC4N0270075
DEBUG [2015-07-29 02:00:51,741] udiskie.udisks2: +++ device_added: /org/freedesktop/UDisks2/block_devices/sde

should_automount is set to false for unlocked LUKS devices

I just noticed that the automount hint appears to be set to false by udisks for LUKS devices. This means that they won't be automounted or even shown in the tray menu by udiskie. Therefore, the naive rule {'should_automount': False, 'ignore': True} is not a viable default. I disabled the rule and uploaded a bug-fix release for now.

It might be possible to add a replacement rule like

- {'should_automount': False,
   'is_luks_cleartext': False,
   'ignore': True}

after some more careful testing.

@mathstuf Sorry for this inconvenience. If you need this rule, you can put it in your config file for now.

make browse() and prompt() commands overridable

These are suited for replacement by a user-defined functions. They could for example be customized in a ~/.config/udiskie/commands.py file, much like the configuration model of ranger. The runpy module might be of use here.

Other alternatives:

  • setuptools entry points (->plugins)
  • add command line parameters to extend pkg_resources.working_set and set option to a specific module:object

man page: Tray icon -t & -T

Hi there,

Thanks for udiskie, very nice tool!

I have a question regarding the man (--help) page:

  -t, --tray            show tray icon
  -T, --auto-tray       show tray icon

What is the exact difference between the two? Can the help page be more explicit on this?

Thanks!

Clean up if user pulls pen drive without unmounting?

As explained on unix.stackexchange.com, I'd like unused mount points to be automatically deleted. Scenario:

  1. User plugs in pen drive. On Ubuntu 14.04, it gets mounted to: /media/user/MYDRIVE

    On Arch with a udisks2/udiskie standard installation, and with mounting to /media/ enabled, the pen drive gets mounted to: /media/MYDRIVE

  2. User removes pen drive. On Ubuntu, the mount point gets removed, I believe by gvfs-udisks2-volume-monitor. On Arch, the directory remains.

  3. User plugs in pen drive again. On Ubuntu, it gets mounted again to /media/user/MYDRIVE.

    On Arch a new mount point is used (name could be slightly off - have to check):

    /media/user/MYDRIVE2
    

password prompt always appears on the left-most monitor

So this is fun. The window always pops on the left monitor, but my right monitor is the primary. The window size is determined by the screen where the pointer currently is, but my right monitor is 1080p versus 1440x900 for the left one, so the size gets proportioned and the buttons and input overlap. I think just popping up on the screen with the mouse (or keyboard focus; not sure which) would be better.

Exception check for missing Notify typelib.

When running udiskie without installed libnotify and leaving default options for the daemon in place, the daemon's setup fails when it tries to load nonexistent gi.repository.Notify.

Preliminary discussion on this topic in PR #77.

Ubuntu/Debian installation

Can you link to the wiki page I made on the homepage. This will make it much easier for low-resource computer users (like myself) to install this.

Change default mount location per user/device

Coppied over from the old bitbucket

I am actually going to start working on this... at some point... if I ever have time again...

It would be really awesome if there were a place to define where certain drives got mounted. like is someone wanted them always mounted in $XDG_RUNTIME_DIR/mounts it could be defined in $XDG_CONFIG_HOME/udiskie/config

or if there was a way to say this uuid if it shows up please mount it to $HOME/patriotflashdrive for me, then the default for everyone else or something similar.

Thanks

Latest version of python-setuptools breaks it

Updating python-setuptools to version 1:18.7-1 breaks my version of udiskie on Arch Linux.
Traceback looks like this:

Traceback (most recent call last): File "/usr/bin/udiskie", line 5, in from pkg_resources import load_entry_point File "/usr/lib/python3.5/site-packages/pkg_resources/**init**.py", line 3143, in @_call_aside File "/usr/lib/python3.5/site-packages/pkg_resources/__init__.py", line 3129, in _call_aside f(_args, *_kwargs) File "/usr/lib/python3.5/site-packages/pkg_resources/__init__.py", line 3156, in _initialize_master_working_set working_set = WorkingSet._build_master() File "/usr/lib/python3.5/site-packages/pkg_resources/__init__.py", line 649, in _build_master ws = cls() File "/usr/lib/python3.5/site-packages/pkg_resources/__init__.py", line 642, in **init** self.add_entry(entry) File "/usr/lib/python3.5/site-packages/pkg_resources/**init**.py", line 698, in add_entry for dist in find_distributions(entry, True): File "/usr/lib/python3.5/site-packages/pkg_resources/**init**.py", line 2136, in find_on_path path_item, entry, metadata, precedence=DEVELOP_DIST File "/usr/lib/python3.5/site-packages/pkg_resources/**init**.py", line 2518, in from_location version = cls._version_from_metadata(dist_path) or version File "/usr/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2841, in _version_from_metadata return _version_from_file(strm) File "/usr/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2483, in _version_from_file line = next(iter(version_lines), '') File "/usr/lib/python3.5/encodings/ascii.py", line 26, in decode return codecs.ascii_decode(input, self.errors)[0] UnicodeDecodeError: 'ascii' codec can't decode byte 0xc5 in position 116: ordinal not in range(128)

Allow timeouts on encrypted keys

I'd like my USB key to autolock after a timeout of no activity (though I don't know how "activity" is to be determined). This may be a UDisks2-level change instead.

not automounting anymore?!

It seems as if udiskie v1.0.2 is not automounting anymore.
Using arch with latest stuff.
However I can mount with: "udiskie-mount -a"

No popup when left clicking the tray icon

prompt >> udiskie -s          
/usr/lib/python3.4/site-packages/gi/overrides/Gtk.py:50: RuntimeWarning: You have imported the Gtk 2.0 module.  Because Gtk 2.0 was not designed for use with introspection some of the interfaces and API will fail.  As such this is not supported by the pygobject development team and we encourage you to port your app to Gtk 3 or greater. PyGTK is the recomended python module to use with Gtk 2.0
  warnings.warn(warn_msg, RuntimeWarning)
not mounting /org/freedesktop/UDisks/devices/sdb1: already mounted
Traceback (most recent call last):
  File "/usr/lib/python3.4/site-packages/udiskie/tray.py", line 400, in _left_click_event
    m.popup(parent_menu_shell=None,
AttributeError: 'Menu' object has no attribute 'popup'

environment: i3wm on Arch Linux

Is there anything I can do to fix this? Thanks in advance.

Couldn't register with accessibility bus

(udiskie:549): WARNING **: Couldn't register with accessibility bus: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.

I'm not really sure how to debug this. I use archlinux.

the package doesn't build in a pbuilder environment (like Debian and Ubuntu buildds)

This is the full build log [1]
and the snip of the log


dh_auto_clean
I: pybuild base:170: python2.7 setup.py clean 
gdk_mir_display_open
Failed to connect to Mir: Failed to connect to server socket: No such file or directory
Unable to init server: Could not connect: Connection refused
running clean
removing '/build/buildd/python-udiskie-1.2.0/.pybuild/pythonX.Y_2.7/build' (and everything under it)
'build/bdist.linux-x86_64' does not exist -- can't clean it
'build/scripts-2.7' does not exist -- can't clean it
I: pybuild base:170: python3.4 setup.py clean 
gdk_mir_display_open
Failed to connect to Mir: Failed to connect to server socket: No such file or directory
Unable to init server: Could not connect: Connection refused
Traceback (most recent call last):
  File "setup.py", line 51, in <module>
    metadata = exec_file('udiskie/__init__.py')
  File "setup.py", line 48, in exec_file
    exec(f.read(), namespace, namespace)
  File "/usr/lib/python3.4/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 307: ordinal not in range(128)
E: pybuild pybuild:256: clean: plugin distutils failed with: exit code=1: python3.4 setup.py clean 
dh_auto_clean: pybuild --clean -i python{version} -p 3.4 --dir . returned exit code 13
debian/rules:9: recipe for target 'override_dh_auto_clean' failed
make[1]: *** [override_dh_auto_clean] Error 13
make[1]: Leaving directory '/build/buildd/python-udiskie-1.2.0'
debian/rules:6: recipe for target 'clean' failed

[1] https://launchpadlibrarian.net/209762733/buildlog_ubuntu-wily-amd64.python-udiskie_1.2.0-1_BUILDING.txt.gz

tries to connect to X and dbus during build on buildd machines

Hi again, this isn't a real issue, but I would like to understand more why the buildd reports a try to connect to X and dbus during the build

I: pybuild base:170: python2.7 setup.py clean 
gdk_mir_display_open
Failed to connect to Mir: Failed to connect to server socket: No such file or directory
Unable to init server: Could not connect: Connection refused
running clean

are them really required?

Another issue I'm wondering is this one:

WARNING:root:[Errno 2] No such file or directory: 'gtk-update-icon-cache'

it seems to be failing only for python3

thanks!

Password prompt is not a dialog

I looked at the code and it looks fine, but xprop tells me it is not getting the dialog properties:

_NET_WM_USER_TIME(CARDINAL) = 524565221
_NET_WM_STATE(ATOM) = 
_NET_WM_DESKTOP(CARDINAL) = 0
WM_STATE(WM_STATE):
                window state: Normal
                icon window: 0x0
WM_HINTS(WM_HINTS):
                Client accepts input or input focus: True
                Initial state is Normal State.
                window id # of group leader: 0x2000001
XdndAware(ATOM) = BITMAP
_NET_WM_OPAQUE_REGION(CARDINAL) = 0, 0, 718, 883
_NET_WM_WINDOW_TYPE(ATOM) = _NET_WM_WINDOW_TYPE_DIALOG
_NET_WM_SYNC_REQUEST_COUNTER(CARDINAL) = 33554437, 33554438
_NET_WM_USER_TIME_WINDOW(WINDOW): window id # 0x2000004
WM_CLIENT_LEADER(WINDOW): window id # 0x2000001
_NET_WM_PID(CARDINAL) = 29565
WM_LOCALE_NAME(STRING) = "en_US.UTF-8"
WM_CLIENT_MACHINE(STRING) = "bronto-burt"
WM_NORMAL_HINTS(WM_SIZE_HINTS):
                program specified location: 0, 0
                program specified minimum size: 207 by 105
                program specified base size: 0 by 0
                window gravity: NorthWest
WM_PROTOCOLS(ATOM): protocols  WM_DELETE_WINDOW, WM_TAKE_FOCUS, _NET_WM_PING, _NET_WM_SYNC_REQUEST
WM_CLASS(STRING) = "udiskie-mount", "Udiskie-mount"
WM_ICON_NAME(STRING) = "udiskie"
_NET_WM_ICON_NAME(UTF8_STRING) = "udiskie"
WM_NAME(STRING) = "udiskie"
_NET_WM_NAME(UTF8_STRING) = "udiskie"

shell autocompletion

A while back, I created zsh autocompletion files for the CLI utilities. Some of that is copied from my /usr/share/zsh/functions/Completion/Unix/_mount. So, I am not 100% sure that I can just add this to this repository. I believe there should be no problem, but better be sure.

generalize command line options

The config file makes it possible to give defaults for program options. Unfortunately, for some options, there is currently no way to negate the config file setting on the command line (there is no --no-suppress or --automount for example).

Crashes on startup

Trying to start udiskie I get the following error:

Traceback (most recent call last):
  File "/usr/local/bin/udiskie", line 9, in <module>
    load_entry_point('udiskie==1.0.0', 'console_scripts', 'udiskie')()
  File "/usr/local/lib/python2.7/dist-packages/udiskie/cli.py", line 204, in main
    return cls(argv).run()
  File "/usr/local/lib/python2.7/dist-packages/udiskie/cli.py", line 178, in __init__
    self._init(config, options)
  File "/usr/local/lib/python2.7/dist-packages/udiskie/cli.py", line 307, in _init
    daemon = get_backend('Daemon', options['udisks_version'])
  File "/usr/local/lib/python2.7/dist-packages/udiskie/cli.py", line 52, in get_backend
    msg = sys.exc_info()[1].get_dbus_message()
AttributeError: 'GError' object has no attribute 'get_dbus_message'

Do I use an incompatible version of some library ? I'm not sure where to look right now.

crashes at startup when using config.yml

Hi again,

I'm having an issue where udiskie crashes when trying to use config.yml (I'm using the default config) which gives a traceback:

Traceback (most recent call last):
  File "/usr/bin/udiskie", line 9, in <module>
    load_entry_point('udiskie==1.3.2', 'console_scripts', 'udiskie')()
  File "/usr/lib/python3.5/site-packages/udiskie/cli.py", line 214, in main
    return cls(argv).run()
  File "/usr/lib/python3.5/site-packages/udiskie/cli.py", line 180, in __init__
    config = udiskie.config.Config.from_file(config_file)
  File "/usr/lib/python3.5/site-packages/udiskie/config.py", line 197, in from_file
    return cls.from_file(path)
  File "/usr/lib/python3.5/site-packages/udiskie/config.py", line 215, in from_file
    return cls(load(f))
  File "/usr/lib/python3.5/site-packages/yaml/__init__.py", line 94, in safe_load
    return load(stream, SafeLoader)
  File "/usr/lib/python3.5/site-packages/yaml/__init__.py", line 72, in load
    return loader.get_single_data()
  File "/usr/lib/python3.5/site-packages/yaml/constructor.py", line 35, in get_single_data
    node = self.get_single_node()
  File "/usr/lib/python3.5/site-packages/yaml/composer.py", line 36, in get_single_node
    document = self.compose_document()
  File "/usr/lib/python3.5/site-packages/yaml/composer.py", line 55, in compose_document
    node = self.compose_node(None, None)
  File "/usr/lib/python3.5/site-packages/yaml/composer.py", line 84, in compose_node
    node = self.compose_mapping_node(anchor)
  File "/usr/lib/python3.5/site-packages/yaml/composer.py", line 133, in compose_mapping_node
    item_value = self.compose_node(node, item_key)
  File "/usr/lib/python3.5/site-packages/yaml/composer.py", line 82, in compose_node
    node = self.compose_sequence_node(anchor)
  File "/usr/lib/python3.5/site-packages/yaml/composer.py", line 110, in compose_sequence_node
    while not self.check_event(SequenceEndEvent):
  File "/usr/lib/python3.5/site-packages/yaml/parser.py", line 98, in check_event
    self.current_event = self.state()
  File "/usr/lib/python3.5/site-packages/yaml/parser.py", line 393, in parse_block_sequence_entry
    "expected <block end>, but found %r" % token.id, token.start_mark)
yaml.parser.ParserError: while parsing a block collection
  in "/home/frank604/.config/udiskie/config.yml", line 8, column 5
expected <block end>, but found '?'
  in "/home/frank604/.config/udiskie/config.yml", line 9, column 5

Below is my basic config.yml

  1 program_options:                                                                    
  2     udisks_version: 2
  3     tray: false
  4     automount: true
  5     notify: true
  6     file_manager: xdg-open
  7 mount_options:
  8     - id_type: exfat
  9     options: [noatime, flush]

udiskie works fine when not using the config.yml as well as when I only have lines 1-6 in config.yml. Thank you for your time.

[feature request] getting the password for unlocking devices from an external program

Hi,

Again, I have been reading the documentation and I don't think udiskie supports that, so apologies if it does.

I am using gnome-keyring to manage my passwords. I suppose others are using different programs.

It would be nice to be able to set udiskie to get the password for unlocking a LUKS encrypted disk from the standard output of another program. Basically, invoking:

%s <uuid of the device>

Where %s would be replaced with a user string (in my case, I would use "gnome-keyring-query get ").

This way, people could automatically extract their passwords from the keyring.

Cheers

There is a warning when i mount with udisks2

device is mounted success, but is there any way to disable this warning?

[lsm@em ~]$ udiskie-mount -2 -a

** (udiskie-mount:1035): WARNING **: Couldn't register with accessibility bus: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.
mounted /org/freedesktop/UDisks2/block_devices/sdc on /run/media/lsm/Arch
[lsm@em ~]$ 

I try to add an ignore rule to cli.py, but no effect:

[lsm@em ~]$ grep warning /usr/lib/python3.4/site-packages/udiskie/cli.py 
import warnings
warnings.filterwarnings("ignore", ".*could not open display.*", Warning)
warnings.filterwarnings("ignore", ".*g_object_unref.*", Warning)
warnings.filterwarnings("ignore", ".*register with accessibility bus.*", Warning)
            log.warning(_('Failed to connect Udisks2 dbus service..\n'
[lsm@em ~]$

GDBus Permission Denied

I get the following error in two situations:

GDBus.Error:org.freedesktop.UDisks.Error.PermissionDenied: Authentication is required

I started udiskie with this command:

udiskie -a -2

It successfully mounts a inserted USB-Stick. When I try to unmount it using

udiskie-umount /media/<id>

I get the error I posted above.
I also get this error message if I launch udiskie using this systemd user-service file:

[Unit]
Description=Udiskie service

[Service]
ExecStart=/usr/bin/udiskie -2 -a

[Install]
WantedBy=default.target

Because both error messages are the same I reckon they have the same reason. The permissions have been set with polkit:

polkit.addRule(function(action, subject) {
    var YES = polkit.Result.YES;
    var permission = {
        "org.freedesktop.udisks2.filesystem-mount": YES
        "org.freedesktop.udisks2.filesystem-mount-system": YES
        "org.freedesktop.udisks2.encrypted-unlock": YES
        "org.freedesktop.udisks2.eject-media": YES
        "org.freedesktop.udisks2.power-off-drive": YES
    };
    if (subject.isInGroup("storage")) {
        return permission[action.id];
    }
});

I hope you can tell me what I am doing wrong or whether this is an issue with udiskie.

setting default mount point directory

hi guys,
udiskie config problem here.
When automount with "udiskie -2" the tool use as default mount point: /var/run/media/...

I want to change mount point but I can't find any documentation about that.

Does anybody can help me ?

config:

$ cat .config/udiskie/config.yml
program_options:
 udisks_version: 2
 tray: auto
 notify: true
 file_manager: xdg-open

Sdcard gets remapped from /dev/sdb1 to /dev/sdc1 sometimes after suspend which fails mounting

Love the work you do coldfix. I have an issue in regards to my sdcard which I leave permanently in. 9/10 suspends it remounts perfectly after a suspend. On those rare occassions, I notice that the mapping changes from /dev/sdb1 to /dev/sdc1 which results in a failed mounting at /media. Not sure if this is a udiskie issue but thought I'd try to seek your help first.

Oct 06 11:54:48 AeriusX systemd[1]: Stopped TLP suspend/resume.
Oct 06 11:54:48 AeriusX kernel: usb 2-3: new SuperSpeed USB device number 2 using xhci_hcd
Oct 06 11:54:48 AeriusX kernel: usb-storage 2-3:1.0: USB Mass Storage device detected
Oct 06 11:54:48 AeriusX kernel: scsi host5: usb-storage 2-3:1.0
Oct 06 11:54:48 AeriusX kernel: usb 1-3: new full-speed USB device number 2 using xhci_hcd
Oct 06 11:54:48 AeriusX kernel: usb 1-3: ep 0x81 - rounding interval to 1024 microframes, ep desc says 2040 microframes
Oct 06 11:54:48 AeriusX kernel: hub 1-3:1.0: USB hub found
Oct 06 11:54:48 AeriusX kernel: hub 1-3:1.0: 3 ports detected
Oct 06 11:54:48 AeriusX mtp-probe[16092]: checking bus 2, device 2: "/sys/devices/pci0000:00/0000:00:14.0/usb2/2-3"
Oct 06 11:54:48 AeriusX mtp-probe[16092]: bus: 2, device: 2 was not an MTP device
Oct 06 11:54:48 AeriusX kernel: usb 1-5: new full-speed USB device number 3 using xhci_hcd
Oct 06 11:54:48 AeriusX kernel: usb 1-3.1: new full-speed USB device number 4 using xhci_hcd
Oct 06 11:54:48 AeriusX kernel: apple 0003:05AC:0291.0011: hiddev0,hidraw0: USB HID v1.10 Device [Apple Inc. Apple Internal Keyboard / Trackpad] on usb-0000:00:14.0-5/input0
Oct 06 11:54:48 AeriusX kernel: input: Apple Inc. Apple Internal Keyboard / Trackpad as /devices/pci0000:00/0000:00:14.0/usb1/1-5/1-5:1.1/0003:05AC:0291.0012/input/input26
Oct 06 11:54:48 AeriusX kernel: usb 1-3.1: ep 0x81 - rounding interval to 64 microframes, ep desc says 80 microframes
Oct 06 11:54:48 AeriusX kernel: input: HID 05ac:820a as /devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3.1/1-3.1:1.0/0003:05AC:820A.0013/input/input27
Oct 06 11:54:48 AeriusX kernel: apple 0003:05AC:0291.0012: input,hiddev0,hidraw1: USB HID v1.10 Keyboard [Apple Inc. Apple Internal Keyboard / Trackpad] on usb-0000:00:14.0-5/i
Oct 06 11:54:48 AeriusX kernel: input: bcm5974 as /devices/pci0000:00/0000:00:14.0/usb1/1-5/1-5:1.2/input/input28
Oct 06 11:54:49 AeriusX systemd-udevd[16110]: error opening ATTR{/sys/devices/pci0000:00/0000:00:14.0/usb2/2-3/2-3:1.0/host5/scsi_host/host5/link_power_management_policy} for w
Oct 06 11:54:49 AeriusX kernel: hid-generic 0003:05AC:820A.0013: input,hidraw2: USB HID v1.11 Keyboard [HID 05ac:820a] on usb-0000:00:14.0-3.1/input0
Oct 06 11:54:49 AeriusX mtp-probe[16114]: checking bus 1, device 3: "/sys/devices/pci0000:00/0000:00:14.0/usb1/1-5"
Oct 06 11:54:49 AeriusX mtp-probe[16114]: bus: 1, device: 3 was not an MTP device
Oct 06 11:54:49 AeriusX kernel: usb 1-3.2: new full-speed USB device number 5 using xhci_hcd
Oct 06 11:54:49 AeriusX kernel: usb 1-3.2: ep 0x81 - rounding interval to 64 microframes, ep desc says 80 microframes
Oct 06 11:54:49 AeriusX kernel: input: HID 05ac:820b as /devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3.2/1-3.2:1.0/0003:05AC:820B.0014/input/input29
Oct 06 11:54:49 AeriusX kernel: hid-generic 0003:05AC:820B.0014: input,hidraw3: USB HID v1.11 Mouse [HID 05ac:820b] on usb-0000:00:14.0-3.2/input0
Oct 06 11:54:49 AeriusX kernel: usb 1-3.3: new full-speed USB device number 6 using xhci_hcd
Oct 06 11:54:49 AeriusX kernel: scsi 5:0:0:0: Direct-Access     APPLE    SD Card Reader   3.00 PQ: 0 ANSI: 6
Oct 06 11:54:49 AeriusX mtp-probe[16158]: checking bus 1, device 6: "/sys/devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3.3"
Oct 06 11:54:49 AeriusX mtp-probe[16161]: checking bus 1, device 4: "/sys/devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3.1"
Oct 06 11:54:49 AeriusX mtp-probe[16161]: bus: 1, device: 4 was not an MTP device
Oct 06 11:54:49 AeriusX mtp-probe[16159]: checking bus 1, device 5: "/sys/devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3.2"
Oct 06 11:54:49 AeriusX mtp-probe[16159]: bus: 1, device: 5 was not an MTP device
Oct 06 11:54:49 AeriusX mtp-probe[16158]: bus: 1, device: 6 was not an MTP device
Oct 06 11:54:49 AeriusX kernel: sd 5:0:0:0: [sdc] 251394048 512-byte logical blocks: (128 GB/119 GiB)
Oct 06 11:54:49 AeriusX kernel: sd 5:0:0:0: [sdc] Write Protect is off
Oct 06 11:54:49 AeriusX kernel: sd 5:0:0:0: [sdc] Mode Sense: 23 00 00 00
Oct 06 11:54:49 AeriusX kernel: sd 5:0:0:0: [sdc] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
Oct 06 11:54:49 AeriusX kernel:  sdc: sdc1
Oct 06 11:54:49 AeriusX kernel: sd 5:0:0:0: [sdc] Attached SCSI removable disk
Oct 06 11:54:50 AeriusX kernel: EXT4-fs (sdc1): recovery complete
Oct 06 11:54:50 AeriusX kernel: EXT4-fs (sdc1): mounted filesystem with writeback data mode. Opts: (null)
Oct 06 11:54:50 AeriusX udisksd[1735]: Mounted /dev/sdc1 at /media/Jetdrive on behalf of uid 1000
Oct 06 11:54:50 AeriusX systemd[1]: media-Jetdrive.mount: Unit is bound to inactive unit dev-sdb1.device. Stopping, too.
Oct 06 11:54:50 AeriusX systemd[1]: Unmounting /media/Jetdrive...
Oct 06 11:54:50 AeriusX udisksd[1735]: Cleaning up mount point /media/Jetdrive (device 8:33 is not mounted)
Oct 06 11:54:50 AeriusX org.freedesktop.Notifications[1393]: Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged.
Oct 06 11:54:50 AeriusX systemd[1]: Unmounted /media/Jetdrive.
Oct 06 11:54:50 AeriusX systemd[1]: media-Jetdrive.mount: Unit entered failed state.
Oct 06 11:59:47 AeriusX kernel: EXT4-fs error (device sdb1): ext4_wait_block_bitmap:493: comm lftp: Cannot read block bitmap - block_group = 635, block_bitmap = 20447243
Oct 06 11:59:47 AeriusX kernel: EXT4-fs error (device sdb1): ext4_discard_preallocations:4020: comm lftp: Error reading block bitmap for 635
Oct 06 11:59:51 AeriusX kernel: EXT4-fs error (device sdb1): ext4_put_super:800: Couldn't clean up the journal
Oct 06 11:59:51 AeriusX kernel: EXT4-fs (sdb1): Remounting filesystem read-only

Browse (Device Name) Error

Hi, I have recently built a chroot ISO and installed in a VM including udiskie in the install.
When I mount the Guest Additions (Virtual Box) There is the option to 'Browse' the folder.
However clicking this opens a terminal... does this use xdg-open to open, or does it look for a specific file manager, or use some other method to choose what program to open? I am currently using Rox, JWM and Ubuntu as the base system... It is built extremely minimally.
I have set Rox to handle inode/directory
i.e. I made a rox.desktop file and:
xdg-mime default rox.desktop inode/directory
Thanks for your help...
I will also try installing this to some metal and see what happens :)

Change status icon: USB instead of CDROM

Hi,

I was wondering how complicated would it be changing the status icon from the current CDROM to a USB PENDRIVE. Nowadays, CDROM are not much used, as opposed to USB drives (HDDs, PENDRIVES...). Would it be possible to change the default icon?

Another option would be making it change depending on the kind of device attached. For instance, HDD, PENDRIVE, CDROM.

Regards

Use non-blocking operations

Currently, the daemon uses synchronous operations. This makes the UI unresponsive when a long running task is going on. This might be improvable by resorting to asynchronous operations.

The following functions are affected:

  • get_password_XXX()
  • udiskie.mount.Mounter.XXX methods

Fixes:

  1. Worker thread

    At first sight, this looks easy to do. But the doubts follow just as fast:

    • how to communicate return values/results back to main thread?
    • race conditions when job fails (dbus event in main loop + error message exception in worker)
    • if having only one worker thread, we need a thread-safe queue function, since it might be called from either main or worker thread
    • spawning threads is ugly and probably prone to many more errors when looking more closely
  2. use async variants of dbus functions and non-modal dialog.

    This looks like it might require a lot more code-changes, especially since we want to support both async/sync variants, but is probably the correct way to go. It might actually be implementable with not too many code changes using decorators.

See also: Why you shouldn't block on D-Bus calls

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.