Nitrokey / nitrokey-app

Nitrokey's Application (Win, Linux, Mac)
https://www.nitrokey.com/
288 stars 55 forks source link

Nitrokey app doesn't detect nitrokey unless in sudo, #352

Closed FrostKnight closed 6 years ago

FrostKnight commented 6 years ago

-Nitrokey app 1.3 Hyperbola x86_64 Linux-kernel 4.9.94 Nitrokey Storage 0.50 firmware usb port 2.0 Very often this has happened where I cannot get it to work without using sudo.

This bug is fascinating to me, I wonder why it works that way? EDIT: I don't think it matters anymore, My distro's devs added the package for me. Sooner than I expected too, so you may lock if you wish. :)

szszszsz commented 6 years ago

Hi! If this occurs every time, then you probably do not have UDEV rules installed (in case make install was run then libnitrokey should have them installed, but it perhaps it has not detected the right UDEV directory during installation). Please see https://www.nitrokey.com/download/source for the rules file (or /data/41-nitrokey.rules in source code repository). As for the destination, installer uses pkg-config --variable=udevdir udev to determine the path. If you would like to have the installation reversible, I could recommend checkinstall tool for the installation (instead of make install that is). Please let me know, if that helped.

FrostKnight commented 6 years ago

On 04/23/18 01:20, Szczepan Zalega wrote:

Hi! If this occurs every time, then you probably do not have UDEV rules installed (in case make install was run then libnitrokey should have them installed, but it perhaps it has not detected the right UDEV directory during installation). Please see https://www.nitrokey.com/download/source for the rules file (or /data/41-nitrokey.rules in source code repository). As for the destination, installer uses pkg-config --variable=udevdir udev to determine the path. If you would like to have the installation reversible, I could recommend checkinstall tool for the installation (instead of make install that is). Please let me know, if that helped.

Hmm... Ah okay, but I did download that. Odd yes?

I will try checkinstall though.

ps, is this where udev is supposed to be? /usr/lib/udev

szszszsz commented 6 years ago

Do you mean the Udev file? It should be in repository.

This is distro-dependent. For Ubuntu 18.04 the output is:

$ pkg-config --variable=udevdir udev
/lib/udev

There you should find the rules.d directory, where the rules are stored.

$ find `pkg-config --variable=udevdir udev`
/lib/udev
/lib/udev/rules.d
/lib/udev/rules.d/73-usb-net-by-mac.rules
/lib/udev/rules.d/61-gnome-settings-daemon-rfkill.rules
/lib/udev/rules.d/50-udev-default.rules
# (....)
FrostKnight commented 6 years ago

Hmm... okay. How can I fix this? It says I do not have the rules.d in udev. How do I fix persay?

actually edit: nevermind, I do forget what I said. still, it isn't quite working without root, is there a simple easy fix?

szszszsz commented 6 years ago

To sum up the issue, device is never detected by the Nitrokey App, unless the latter is not run with administrator's privileges - do I get this right?

I believe that device is not detected due to lack of hardware access privileges, which root has. One of the method to give them to user is through Udev system. App should copy its Udev rules file to the OS directory, shown by pkg-config, but it apparently has not worked for you.

I am afraid I cannot help you with it further since I do not know your distro enough (and I do not even know, is it Udev running there - guessed since it is based on Arch/Debian). Could you ask on Hyperbola's forum / mailing list about that?

FrostKnight commented 6 years ago

I will ask them about it soon, I wonder if there is a way to disable the root requirement for nitrokey-app...

ps, yes it does run udev. I tried the forum just now, will tell you if it works out at all.

alex-nitrokey commented 6 years ago

As for Arch Linux (vanilla) it would be either in /usr/lib/udev/rules.d (if installed) or in /etc/udev/rules.d if the user decided to add it manually (which always is an option). The file in etc is preferred by udev.

I do not see, why this should be different in Arch based Hyperbola, but indeed I have no clou about this distro :smile:

FrostKnight commented 6 years ago

Well, interestingly enough, I found out that it is in the arch location. Although, If need be, I can wait I guess for 1.4's AppImage. I would guess a month or two down the road will be when this is released right? If so I hope that error that annoys me is fixed. If not, Oh well. I have asked my distro to add the package. I am sure sooner or later they will.

ps, you may close if you wish.

alex-nitrokey commented 6 years ago

I don't understand, what's the issue here. Do you have the correct udev file installed or not? Where is it? Do you have both, self-downloaded and installed by App? Or neither? Or to put it in another way: Are you saying you do need sudo although the udev file is in place?

And: how did you install the App or did you use AppImage only?

FrostKnight commented 6 years ago

On 04/30/18 03:47, alex-nitrokey wrote:

I don't understand, what's the issue here. Do you have the correct udev file installed or not? Where is it? Do you have both, self-downloaded and installed by App? Or neither? Or to put it in another way: Are you saying you do need sudo although the udev file is in place?

And: how did you install the App or did you use AppImage only? Nope, I used the compiled source.

alex-nitrokey commented 6 years ago

You mean 'make install' style? And you did copy the udev-file under /etc/udev/rules.d?

FrostKnight commented 6 years ago

I meant make install. but it doesn't matter anymore, My distro added the nitrokey-app! I don't know if this will be a problem in the future, but yeah, the debian 1.2 backports version worked great once they added it. So if you want you can lock this as solved or doesn't matter anymore or w/e you want. :)

ps, how often do you add packages to the debian backports? Just wondering... ;)

szszszsz commented 6 years ago

Great! Debian package should be updated soon. While the update would lag, the Appimage should be an answer, once it will be fixed. If that is possible, perhaps using our Launchpad's PPA (for Ubuntu) would help as well.

szszszsz commented 6 years ago

Closing due to issue being solved indirectly.