unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
From: Ricardo Wurmus <rekado@elephly.net>
To: Pierre Neidhardt <ambrevar@gmail.com>
Cc: "help-guix@gnu.org" <help-guix@gnu.org>
Subject: Re: Nitrokey and udev rules
Date: Tue, 22 May 2018 14:41:35 +0200	[thread overview]
Message-ID: <87lgcbooao.fsf@elephly.net> (raw)
In-Reply-To: <87603gj70o.fsf@gmail.com>


Pierre Neidhardt <ambrevar@gmail.com> writes:

> I'm trying to use my nitrokey on GuixSD.
>
> --8<---------------cut here---------------start------------->8---
>> gpg --card-status
> gpg: selecting openpgp failed: No such device
> gpg: OpenPGP card not available: No such device
> --8<---------------cut here---------------end--------------->8---
>
> It turns out that the nitrokey needs some udev rules to be driven by
> gpg:
>
> 	https://www.nitrokey.com/documentation/installation#p:nitrokey-start&os:linux
>
> Thus I tried to configure the following rule:
>
> --8<---------------cut here---------------start------------->8---
> (define %nitrokey-udev-rule
>   (udev-rule
>    "41-nitrokey.rules"
>    (string-append "ACTION==\"add\", SUBSYSTEM==\"usb\", "
>                   "ATTR{idVendor}==\"20a0\", ATTR{idProduct}==\"4211\", "
>                   "ENV{ID_SMARTCARD_READER}=\"1\", ENV{ID_SMARTCARD_READER_DRIVER}=\"gnupg\", GROUP+=\"users\", TAG+=\"uaccess\"")))
>
> ; ...
>  (modify-services
>    %desktop-services
>    (udev-service-type config =>
>                       (udev-configuration
>                        (inherit config)
>                        (rules (append (udev-configuration-rules config)
>                                       (list %nitrokey-udev-rule))))))
> --8<---------------cut here---------------end--------------->8---

This looks correct to me.  I do something similar for udev rules for my
digital oscilloscope, the Axoloti audio development board, and an AVR
programmer.

> I've tried the "plugdev" (as suggested on the website) and "users"
> GROUP, to no avail: I get the same error from `gpg --card-status`.
>
> I tried testing the rule with udevadm:
>
> --8<---------------cut here---------------start------------->8---
> sudo udevadm test ${udevadm info -q path -n /dev/bus/usb/001/008}
[…]
> Reading rules file: /gnu/store/if6kkgnbwx1lmb5wp8p8g68i8s9hqs58-eudev-3.2.5/lib/udev/rules.d/[…]
[…]
> As you can see, 41-nitrokey.rules does not show here.  In fact I can't
> find it on the filesystem.  I don't understand how GuixSD manages the
> udev rules.  Am I missing something?

FWIW, udevadm on my machine also doesn’t show all udev rules, because it
only seems to look in the rules.d directory of the eudev package.  When
you reconfigure your system you actually get a directory like this:

   /gnu/store/crjkqwqsc42sq8zmd1slgpb4jhx9h524-udev-rules/lib/udev/rules.d/

that is the union of all rules, including your custom rules.

--
Ricardo

  reply	other threads:[~2018-05-22 13:27 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-22 10:53 Nitrokey and udev rules Pierre Neidhardt
2018-05-22 12:41 ` Ricardo Wurmus [this message]
2018-05-22 14:30   ` Pierre Neidhardt
2018-05-22 15:42 ` Marius Bakke
2018-05-23  8:47   ` Pierre Neidhardt
2018-05-23  9:09     ` Pierre Neidhardt
2018-05-23  9:51       ` Pierre Neidhardt
2018-05-24  4:30 ` Mike Gerwitz
2018-05-24 14:04   ` Pierre Neidhardt
2018-05-25  1:44     ` Mike Gerwitz
2018-05-25  5:22       ` Ricardo Wurmus
2018-05-25 13:37         ` Pierre Neidhardt
2018-05-25 14:46           ` Pierre Neidhardt
2018-05-26  1:22             ` Mike Gerwitz
2018-05-26  1:16         ` Mike Gerwitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87lgcbooao.fsf@elephly.net \
    --to=rekado@elephly.net \
    --cc=ambrevar@gmail.com \
    --cc=help-guix@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).