fogine / udiskie-dmenu

Manage removable devices in couple of keystrokes!
MIT License
43 stars 5 forks source link

How to set it up #2

Closed ghost closed 5 years ago

ghost commented 5 years ago

Hello, Great idea on this, I have installed thru AUR and have no idea how to set it up. I have configured in my i3 config and executes showing up:/dev/sdb: + the device number, by hitting enter I would expect the drive to be a mount? I have no idea how this works. Can you guide me?

fogine commented 5 years ago

do you use rofi or dmenu? Do you have all dependencies installed?

Whats the output of commands:

> which notify-send
> which udiskie-dmenu
> which udiskie

Also what versions of dmenu/rofi, udiskie do you use?

Upon removable device selection it should have mounted/unmounted the device from /run/media/*

ghost commented 5 years ago

Hello @fogine Here I am using dmenu version 4.8; I am not sure but I guess the dependencies are all good I got it from the AUR here is the dependencies List:

dmenu (dmenu-xft-mouse-height-fuzzy-history, dmenu-xft-wxy-mouse, dmenu-pango-imlib, dmenu-ee-git, dmenu-git, rofi-dmenu, dmenux-git, dmenu-xyw-mouse-msel, dmenu-wayland-git, dmenu-mouse-geometry, dmenu2, dmenu-height) libnotify (libnotify-gtk2, libnotify-id-git, libnotify-id) nodejs (nodejs-git, nodejs-0.12, nodejs6-bin, nodejs-lts-boron, nodejs-lts-carbon, nodejs-lts-dubnium) udiskie git (git-git) (make) rofi (rofi-wayland-git, rofi-git) (optional) – use rofi as the front-end

which notify-send >> /usr/bin/notify-send which udiskie-dmenu >> /usr/bin/udiskie-dmenu which udiskie >> /usr/bin/udiskie

Running udiskie 1.7.5

Upon removable device selection, it should have mounted/unmounted the device from /run/media/*

     *That is exactly what I was expecting but is not mounting.. 

How should I go about this?

fogine commented 5 years ago

I've tested it with the same dmenu & udiskie versions and haven't encountered a bug in the udiskie-dmenu implementation. It could be an issue with permissions.

udiskie-dmenu uses udiskie-info & udiskie-mount & udiskie-umount & notify-send and dmenu executables, check the permissions of the files. Also whats the output of the following command?

udiskie-info -C -2 -a -o '"label":"{ui_label}", "isLuks":"{is_luks}", "mountPath": "{mount_path}"'

if you use udiskie manually, does it work? Try the following commands for mounting & umounting devices:

#mount a device
> udiskie-mount -r /dev/$device  #replace $device with a particular device name (you can see available devices with lsblk -f command)

#umount the device
> udiskie-umount /run/media/$username/$device_mount_name

Do all the above command work as expected?

Also check whether the directory named after your user name exists in /run/media/ eg. /run/media/annata83. if it exists, then what are the permissions set on the directory?

ghost commented 5 years ago

Hi @fogine, I have checked the permission conditions for the requested files and are as follow: ...................................Owner.........Group.......Execute udiskie-info: ............root ..........root.........anyone udiskie-mount: ..........root ..........root..........anyone udiskie-unmount:.......root............root.........anyone dmenu:.........................root............root..........anyone notify-send: "I couldn't find the file." ......................... I have notify-send working fine ( I tested with a simple "hello world" ).

The output of the command -c -2 -a ... = None, nothing, no output.

udiskie manually works on mount and unmount as well.

And finally the directory after media only exist when devices are mounted & only for root Owner and only for root group.

fogine commented 5 years ago

notify-send: "I couldn't find the file." ......................... I have notify-send working fine ( I tested with a simple "hello world" ).

Well, that might be one issue, notify-send should be available in your path as its used by the udiskie-dmenu. It looks like that notify-send is available only when tty is attached - meaning notify-send is available only to your terminal and not to the non-interactive scripts. In result you do not get any notification about possible errors.

The output of the command -c -2 -a ... = None, nothing, no output.

The command:

udiskie-info -C -2 -a -o '"label":"{ui_label}", "isLuks":"{is_luks}", "mountPath": "{mount_path}"'

should print available devices to umount & mount in special format so make sure a device is available to mount or umount prior executing the command, then it must print something otherwise dmenu would not show anything.

Try to run udiskie-dmenu from your terminal and see whether it prints any errors to stderr upon dmenu device selection. That way you will get around notify-send not working for you. When an error occurs it should exit with status code > 0

Also make sure you are not executing udiskie-dmenu as root user but rather as the one your are logged in to.

fogine commented 5 years ago

@annata83 notify-send is part of extra/libnotify package on archlinux, make sure its installed.

ghost commented 5 years ago

Alright, @fogine seems like we are getting close to find the solution to this aren't we :+1:

Well, that might be one issue, notify-send should be available in your path as its used by the udiskie-dmenu. It looks like that notify-send is available only when tty is attached - meaning notify-send is available only to your terminal and not to the non-interactive scripts. In result you do not get any notification about possible errors.

fogine commented 5 years ago

I'm quite confused to be honest. In the first post you said udiskie-dmenu shows available device up:/dev/sdb: + the device number but it does nothing upon selection.
Yet we are at point where udiskie-dmenu or even udiskie-info does not show anything.
Also we checked location of notify-send which should be located at /usr/bin/notify-send based on your response - are you sure it does not exist there?

You can also show all installed package files by pacman -Ql libnotify which should list a path to notify-send executable. If you can not find the file, then your system environment is broken or not setup correctly.

The main issue is that the command udiskie-info .... does not show any available removable device and it does not print any errors either. This is telling me that you are executing udiskie-dmenu without any removable device available to your system eg. flash card or external hdd.
Be aware that udiskie only works with removable (hot plugged) devices, it's not gonna work with internal drives connected to sata ports etc...

ghost commented 5 years ago

I'm quite confused to be honest. In the first post you said udiskie-dmenu shows available device up:/dev/sdb: + the device number but it does nothing upon selection.

My bad @fogine, I type the command without an external device; udiskie-dmenu opens up dmenu with /dev/sdb : "deviceNumber" as I have previously mention.

Yet we are at point where udiskie-dmenu or even udiskie-info does not show anything.

udiskie-info prints:

Usage:
    udiskie-info [options] [-o OUTPUT] [-f FILTER]... (-a | DEVICE...)
    udiskie-info (--help | --version

Also we checked location of notify-send which should be located at /usr/bin/notify-send based on your response - are you sure it does not exist there?

Indeed it does! notify-send is in /usr/bin/notify-send Previusly I use the find command like this: find / notify-send with this result:

find: ‘notify-send’: No such file or directory

but now that you point me out where it is I went there and there it is. Maybe I am using the find command the wrong way "Again My Bad"

You can also show all installed package files by pacman -Ql libnotify which should list a path to notify-send executable. If you can not find the file, then your system environment is broken or not setup correctly.

I totally miss that command wich it does print the correct output: pacman -Ql libnotify libnotify /usr/ libnotify /usr/bin/ libnotify /usr/bin/notify-send libnotify /usr/include/ libnotify /usr and so on...

The main issue is that the command udiskie-info .... does not show any available removable device and it does not print any errors either. This is telling me that you are executing udiskie-dmenu without any removable device available to your system eg. flash card or external hdd. Be aware that udiskie only works with removable (hot plugged) devices, it's not gonna work with internal drives connected to sata ports etc...

Rigth on it! I didt pay attention I am sorry.

Now: udiskie-menu opens dmenu with: /dev/sdb 5891-B613 By using ENTER device still not mount.

udiskie-info /dev/sdb 5891-B613 prints:

/ » udiskie-info /dev/sdb 5891-B613 /dev/sdb /dev/sdb

/ »

@fogine I am sorry for the mistakes and for the late response i wanted to give you a brake on this.

fogine commented 5 years ago

You still haven't provided me with the output of command I requested 12 days ago:

udiskie-info -C -2 -a -o '"label":"{ui_label}", "isLuks":"{is_luks}", "mountPath": "{mount_path}"'

Make sure a device is available to mount prior executing the command.

ghost commented 5 years ago

udiskie-info -C -2 -a -o '"label":"{ui_label}", "isLuks":"{is_luks}", "mountPath": "{mount_path}"

Returns: "label":"/dev/sdb: 5891-B613", "isLuks":"False", "mountPath": ""

fogine commented 5 years ago

Hmm, interesting... I see the problem now. The device path of a partition is expected to have a number at the end eg.: /dev/sdb1... as the device path which does not end with number is considered the whole device identifier... Looks like there is no partition on the device... Could you post output of lsblk -f when your device is attached, please?

ghost commented 5 years ago

hey @fogine; I see what you mean, here is output of lsblk -f: lsblk -f NAME FSTYPE LABEL UUID FSAVAIL FSUSE% MOUNTPOINT
sda ├─sda1 ext2.../boot
├─sda2 swap
└─sda3 ext4.../ sdb vfa 5891-B613

lsblk-f

fogine commented 5 years ago

@annata83 Your device doesnt have a partition table but rather the filesystem is created on the device itself which was unexpected and may lead to similar issues in other applications.
https://unix.stackexchange.com/questions/14010/the-merits-of-a-partitionless-filesystem I'd recommend creating a partition on the device.
Anyway, I've updated udiskie-dmenu so that it tries to mount a device without partition, meaning it should work for you.

I've committed the changes to a separate branch. You can test that by executing the new udiskie-dmenu executable.

As for notifications not showing up, you can run udiskie as daemon on system startup (see man udiskie) so that you get notifications about mount & umount actions. If the daemon is not running, you should still be notified about any errors if they occur and mount & umount should also work, you will just not be notified when a device was successfully mounted & umounted...

fogine commented 5 years ago

@annata83 could you let me know whether everything works for you in the featured branch? So I can merge it to master and close this thread.
I dont have currently any storage device I could test it against. Thanks.

ghost commented 5 years ago

How you doing @fogine, thanks for all the well-done support up to here, actually I didn't closet yet because I haven't had time to test it yet, I suffer from a full system crash on my last upgrade and I am working on restoring it!. Last night I fork your new branch and tonight I will definitely give it a test & will come back hopefully with great news.

ghost commented 5 years ago

FeedBack

I try it and went all the way back to the beginning, here is some data


which notify-send /usr/bin/notify-send which udiskie-dmenu /home/niko/.scripts/udiskie-dmenu-master/udiskie-dmenu which udiskie /usr/bin/udiskie


udiskie-info -C -2 -a -o '"label":"{ui_label}", "isLuks":"{is_luks}", "mountPath": "{mount_path}"' "label":"/dev/sdb: 5891-B613", "isLuks":"False", "mountPath": ""`


udiskie-mount -r /dev/sdb/5891-B613 no device found owning "/dev/sdb/5891-B613 udiskie-umount /run/media/niko/5891-B61 no device found owning "/run/media/niko/5891-B61


Unfortunaly It didnt succed on mounting.

I dont mind keep testing for you if you like me to since like you said when a USB has a partition it actually works very well I did try it with a partition one and is all good the only thing I notice is that it didnt notify me when mounting or unmounting. ( in the case that it was supouse to send one )

Just let me know what to do.

ghost commented 5 years ago

By the way because I fresh install Arch I notice that when I try to first run it fail on line 2, I think nodejs should be added as a dependency

fogine commented 5 years ago

udiskie-mount -r /dev/sdb/5891-B613 no device found owning "/dev/sdb/5891-B613 udiskie-umount /run/media/niko/5891-B61 no device found owning "/run/media/niko/5891-B61

Correct command for mounting the device is udiskie-mount -r /dev/sdb
NOT udiskie-mount -r /dev/sdb/5891-B613

After you manage to successfully mount the device using udiskie-mount then you can try mouning it with udiskie-dmenu.

ghost commented 5 years ago

ok @fogine udiskie-mount -r /dev/sdb does mount the device correctly.

Nowudiskie-dmenu does nothing after that because the device is already mount, if I unmount the device and try udiskie-dmenu nothing happens as previously said.

Don't worry anymore @fogine I guess devices should always be formatted before right.

fogine commented 5 years ago

@annata83 , are you sure you used the modified udiskie-dmenu executable I created in the separate branch. In order to test it you would have to copy the file somewhere into your filesystem, and set executable flag on it in order to allow it to be executed.
Attach your device to the computer and try running these commands in order:

> cd /tmp
> wget https://raw.githubusercontent.com/fogine/udiskie-dmenu/support-partitionless-devices/udiskie-dmenu
> chmod +x /tmp/udiskie-dmenu
> /tmp/udiskie-dmenu