You are not logged in.

#1 2019-06-08 10:10:10

jopicornell
Member
Registered: 2019-04-16
Posts: 11

[Solved] Udev being ignored after xinit command (inside my wm)

Hello there guys!

I bought a Security Key by Yubico and tried to make it work on my arch. I installed everything the arch wiki told me, researched a bit and found that Yubico recommends this udev rules. But I had still no luck making it work. I didn't know that much about udev rules, so I researched and learned a bit of them, as they are really simple at first glance. I contacted Yubico support and they told me that I should try using sudo, and if it works, then I have to play with my permissions. And you know... sudo worked. Then, replied to them and the final message was "As arch linux is do-it-yourself, do it yourslef" (not like this, but at the end it was the meaning). I don't blame them, the support was great...

I started wondering what was happening and had a look on the udev rules. I applied some changes. Seems like plugdev group is deprecated and I put my user's group. But I saw a TAG+="uaccess" and didn't know what was doing. ACL, interesting. But... not that much information about it. The final thing I tried was rebooting my computer and trying to run "ykman mode" to see if it worked before I run my xinit with bspwm. And it worked! I ran getfacl on the device, and the output was nice:

➜ getfacl /dev/hidraw4
getfacl: Removing leading '/' from absolute path names
# file: dev/hidraw4
# owner: root
# group: myusergroup
user::rw-
user:myuser:rw-
group::rw-
mask::rw-
other::---

But look at this after I ran the same command on a terminal emulator over my wm (on the same user, for sure):

➜ getfacl /dev/hidraw4
getfacl: Removing leading '/' from absolute path names
# file: dev/hidraw4
# owner: root
# group: myusergroup
user::rw-
group::rw-
mask::rw-
other::---

What's wrong here?? I managed to make it work changing the "GROUP=myusergroup" but seems like ACL is not being applied when I start my wm... And I'm worried that in future I have problems with more usb devices that require special udev rules.

Thanks a lot guys!!!

Last edited by jopicornell (2019-06-09 10:51:42)

Offline

#2 2019-06-08 13:10:10

seth
Member
Registered: 2012-09-03
Posts: 51,299

Re: [Solved] Udev being ignored after xinit command (inside my wm)

run

loginctl session-status

in either context. Are both active sessions?

Offline

#3 2019-06-09 08:53:40

jopicornell
Member
Registered: 2019-04-16
Posts: 11

Re: [Solved] Udev being ignored after xinit command (inside my wm)

Thanks for your reply seth!

This is the output before xinit:

1 - jopicornell (1000)
	   Since: Sun 2019-06-09 12:41:22 CEST; 1h 58min left
	  Leader: 877 (login)
	    Seat: seat0; vc1
	     TTY: tty1
	 Service: login; type tty; class user
	   State: active
	    Unit: session-1.scope
		  ├─ 877 login -- jopicornell
		  ├─ 991 -fish
		  ├─1356 redshift
		  └─1750 loginctl session-status

and this is the output of it after xinit:

1 - jopicornell (1000)
	   Since: Sun 2019-06-09 12:41:22 CEST; 1h 58min left
	  Leader: 877 (login)
	    Seat: seat0; vc1
	     TTY: tty1
	 Service: login; type tty; class user
	   State: online
	    Unit: session-1.scope
		  ├─ 877 login -- jopicornell
		  ├─ 991 -fish
		  ├─1356 redshift
		  ├─1808 xinit
		  ├─1809 /usr/lib/Xorg :0
		  ├─1816 sh /home/jopicornell/.xinitrc
		  ├─1821 sxhkd
		  ├─1822 bspwm
		  ├─1824 sxhkd
		  ├─1855 polybar top
		  ├─1869 compton --config /home/jopicornell/.config/compton/config -b
		  ├─1873 redshift
		  ├─1906 dunst
		  ├─1911 /usr/bin/fish -c termite
		  ├─1915 termite
		  ├─1924 /usr/bin/fish
		  └─1992 loginctl session-status

One is Online and the other is active... I've done a quick search but I didn't find anything about online status hmm

Offline

#4 2019-06-09 10:33:55

seth
Member
Registered: 2012-09-03
Posts: 51,299

Re: [Solved] Udev being ignored after xinit command (inside my wm)

Post your xinitrc.

Offline

#5 2019-06-09 10:39:45

jopicornell
Member
Registered: 2019-04-16
Posts: 11

Re: [Solved] Udev being ignored after xinit command (inside my wm)

Here it is!

#!/bin/sh
SXHKD_SHELL=/usr/bin/sh
userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
sysresources=/etc/X11/xinit/.Xresources
sysmodmap=/etc/X11/xinit/.Xmodmap

# merge in defaults and keymaps

if [ -f $sysresources ]; then
    xrdb -merge $sysresources
fi

if [ -f $sysmodmap ]; then
    xmodmap $sysmodmap
fi

if [ -f "$userresources" ]; then
    xrdb -merge "$userresources"

fi

if [ -f "$usermodmap" ]; then
    xmodmap "$usermodmap"
fi

# start some nice programs

if [ -d /etc/X11/xinit/xinitrc.d ] ; then
 for f in /etc/X11/xinit/xinitrc.d/?*.sh ; do
  [ -x "$f" ] && . "$f"
 done
 unset f
fi
setxkbmap -layout es
sxhkd &
bspwm
#i3

In case you are wondering what's on xinitrc.d folder scripts, there's one script that may interest you:

#!/bin/sh

systemctl --user import-environment DISPLAY XAUTHORITY

if command -v dbus-update-activation-environment >/dev/null 2>&1; then
        dbus-update-activation-environment DISPLAY XAUTHORITY
fi

The others are cadence and gtk modules.

Last edited by jopicornell (2019-06-09 10:40:22)

Offline

#6 2019-06-09 10:46:04

seth
Member
Registered: 2012-09-03
Posts: 51,299

Re: [Solved] Udev being ignored after xinit command (inside my wm)

Yeah that's the crucial (and often omitted) bit. Still the online state means the session is not in the foreground.
That's either because you ran this from a different TTY  or because bspwm doesn't replace the xinit process (lacking "exec") - I never tried what effect the latter has on the state.

Offline

#7 2019-06-09 10:51:21

jopicornell
Member
Registered: 2019-04-16
Posts: 11

Re: [Solved] Udev being ignored after xinit command (inside my wm)

Great info! thank you.

I'll review my xinitrc and bspwm scripts to see if there's something I can improve. I'll have to research about sessions and the state of them. I've reviewed the man of loginctl, systemd and sd-login but there's no info about states. Any man or documentation useful about sessions on online state?

Offline

#8 2019-06-09 10:56:17

seth
Member
Registered: 2012-09-03
Posts: 51,299

Offline

Board footer

Powered by FluxBB