You are not logged in.

#1 2011-06-04 09:16:21

litemotiv
Forum Fellow
Registered: 2008-08-01
Posts: 5,026

[Solved] Getting consolekit to work with autologin

I'm trying to get consolekit to work with autologin, in order to mount stuff as a user in pcmanfm.

When i start X from the shell with xinit everything works:

.xinitrc:

if test -z "$DBUS_SESSION_BUS_ADDRESS"; then
        eval "$(dbus-launch --sh-syntax --exit-with-session)"
fi

/usr/bin/urxvtd -q -o -f
/usr/bin/urxvtc
/usr/bin/ck-launch-session /usr/bin/dwm

pstree:

|-login---zsh---xinit-+-.xinitrc--ck-launch-sessi---dwm---pcmanfm
|                     `-X

ck-list-sessions:

Session1:
        unix-user = '1000'
        realname = ''
        seat = 'Seat1'
        session-type = ''
        active = FALSE
        x11-display = ''
        x11-display-device = ''
        display-device = '/dev/tty1'
        remote-host-name = ''
        is-local = TRUE
        on-since = '2011-06-04T09:06:26.199904Z'
        login-session-id = '1'
Session2:
        unix-user = '1000'
        realname = ''
        seat = 'Seat1'
        session-type = ''
        active = TRUE
        x11-display = ':0'
        x11-display-device = '/dev/tty7'
        display-device = '/dev/tty1'
        remote-host-name = ''
        is-local = TRUE
        on-since = '2011-06-04T09:06:32.334032Z'
        login-session-id = '1'

and i can mount as user, although i'm not sure where that second session comes from.

When i autologin like this:

/bin/su litemotiv -l -c "/bin/sh --login -c xinit"

This doesn't work, there is only one FALSE session and the user is not authorized.

pstree:

|─su───xinit─┬─.xinitrc───ck-launch-sessi───dwm---pcmanfm
|            `-X

ck-list-sessions:

Session1:
        unix-user = '1000'
        realname = ''
        seat = 'Seat2'
        session-type = ''
        active = FALSE
        x11-display = ':0'
        x11-display-device = '/dev/tty7'
        display-device = ''
        remote-host-name = ''
        is-local = FALSE
        on-since = '2011-06-04T08:38:44.753057Z'
        login-session-id = '4294967295

What am i missing here? Why doesn't "su username" work as expected? And where is that extra consolekit session coming from?


ᶘ ᵒᴥᵒᶅ

Offline

#2 2011-06-06 13:01:26

superchango
Member
From: Tenochtitlan
Registered: 2009-01-22
Posts: 133

Re: [Solved] Getting consolekit to work with autologin

Try with this:

/bin/su litemotiv -l -c "ck-launch-session dbus-launch /bin/sh --login -c xinit"

Ok.


"Yo creo que los muertos son tiernos. ¿Nos besamos?"

Offline

#3 2011-06-06 13:37:51

litemotiv
Forum Fellow
Registered: 2008-08-01
Posts: 5,026

Re: [Solved] Getting consolekit to work with autologin

superchango wrote:

Try with this:

/bin/su litemotiv -l -c "ck-launch-session dbus-launch /bin/sh --login -c xinit"

Ok.

Hmm no that doesn't work, still getting a Not Authorized then..


ᶘ ᵒᴥᵒᶅ

Offline

#4 2011-06-06 21:13:59

superchango
Member
From: Tenochtitlan
Registered: 2009-01-22
Posts: 133

Re: [Solved] Getting consolekit to work with autologin

Ok, try with this alternative  .xinitrc:

urxvtd -q -o -f &
urxvtc &
exec ck-launch-session dbus-launch dwm

and with my other code:

/bin/su litemotiv -l -c "ck-launch-session dbus-launch /bin/sh --login -c xinit"

"Yo creo que los muertos son tiernos. ¿Nos besamos?"

Offline

#5 2011-06-07 09:26:20

litemotiv
Forum Fellow
Registered: 2008-08-01
Posts: 5,026

Re: [Solved] Getting consolekit to work with autologin

That doesn't work, it also doesn't seem like a sensible approach to stack multiple consolekit sessions.

Have you tried these suggestions on your own system?


ᶘ ᵒᴥᵒᶅ

Offline

#6 2011-06-07 21:32:03

Glaucous
Member
Registered: 2010-11-06
Posts: 41

Re: [Solved] Getting consolekit to work with autologin

I'm having the very same problem, and none of the alternatives work for me either. Using it with systemd, and logging in normally and using startx works properly with console kit, but not autologin.

Offline

#7 2011-06-09 15:43:29

thestinger
Package Maintainer (PM)
From: Toronto, Canada
Registered: 2010-01-23
Posts: 478

Re: [Solved] Getting consolekit to work with autologin

You have to start X from a TTY (a getty or a display manager) so it counts as a local session.

You can use mingetty's autologin feature to get consolekit working without a display manager:

https://wiki.archlinux.org/index.php/St … sh_profile

Last edited by thestinger (2011-06-09 15:45:03)

Offline

#8 2011-06-09 16:07:06

litemotiv
Forum Fellow
Registered: 2008-08-01
Posts: 5,026

Re: [Solved] Getting consolekit to work with autologin

That's excellent information thestinger, thanks. smile


ᶘ ᵒᴥᵒᶅ

Offline

#9 2011-07-05 21:08:50

el mariachi
Member
Registered: 2007-11-30
Posts: 595

Re: [Solved] Getting consolekit to work with autologin

Isn't there a way to make this method https://wiki.archlinux.org/index.php/Au … in_program work? It's faster than the mingetty way -- considerably faster (at least for me). And it works with systemd.

Offline

#10 2011-07-06 20:19:26

Glaucous
Member
Registered: 2010-11-06
Posts: 41

Re: [Solved] Getting consolekit to work with autologin

I did it this way:
I didn't want to edit the getty@.service in /lib, so I created a new one (/etc/systemd/system/getty2@.service).

#  This file is part of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 2 of the License, or
#  (at your option) any later version.

[Unit]
Description=Getty on %I
BindTo=dev-%i.device
After=dev-%i.device systemd-user-sessions.service plymouth-quit-wait.service
After=rc-local.service

# If additional gettys are spawned during boot then we should make
# sure that this is synchronized before getty.target, even though
# getty.target didn't actually pull it in.
Before=getty.target

[Service]
Environment=TERM=linux
ExecStart=-/sbin/agetty %I 38400
Restart=always
RestartSec=0
UtmpIdentifier=%I
TTYPath=/dev/%I
TTYReset=yes
TTYVHangup=yes
TTYVTDisallocate=yes
KillMode=process

# Unset locale for the console getty since the console has problems
# displaying some internationalized messages.
Environment=LANG= LC_CTYPE= LC_NUMERIC= LC_TIME= LC_COLLATE= LC_MONETARY= LC_MESSAGES= LC_PAPER= LC_NAME= LC_ADDRESS= LC_TELEPHONE= LC_MEASUREMENT= LC_IDENTIFICATION=

# Some login implementations ignore SIGTERM, so we send SIGHUP
# instead, to ensure that login terminates cleanly.
KillSignal=SIGHUP

[Install]
Alias=getty.target.wants/getty2@tty2.service getty.target.wants/getty2@tty3.service getty.target.wants/getty2@tty4.service getty.target.wants/getty2@tty5.service getty.target.wants/getty2@tty6.service

I simply removed one of the install ttys (the first one).
Then I created another one (/etc/systemd/system/getty2-auto@.service)

#  This file is part of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 2 of the License, or
#  (at your option) any later version.

[Unit]
Description=Getty on %I
BindTo=dev-%i.device
After=dev-%i.device systemd-user-sessions.service plymouth-quit-wait.service
After=rc-local.service

# If additional gettys are spawned during boot then we should make
# sure that this is synchronized before getty.target, even though
# getty.target didn't actually pull it in.
Before=getty.target

[Service]
Environment=TERM=linux
ExecStart=-/sbin/agetty %I 38400 -n -l /usr/bin/autologin
Restart=always
RestartSec=0
UtmpIdentifier=%I
TTYPath=/dev/%I
TTYReset=yes
TTYVHangup=yes
TTYVTDisallocate=yes
KillMode=process

# Unset locale for the console getty since the console has problems
# displaying some internationalized messages.
Environment=LANG= LC_CTYPE= LC_NUMERIC= LC_TIME= LC_COLLATE= LC_MONETARY= LC_MESSAGES= LC_PAPER= LC_NAME= LC_ADDRESS= LC_TELEPHONE= LC_MEASUREMENT= LC_IDENTIFICATION=

# Some login implementations ignore SIGTERM, so we send SIGHUP
# instead, to ensure that login terminates cleanly.
KillSignal=SIGHUP

[Install]
Alias=getty.target.wants/getty2-auto@tty1.service

Removed all except tty1, and edited the ExecStart line (ExecStart=-/sbin/agetty %I 38400 -n -l /usr/bin/autologin).

And then just
# systemctl disable getty@.service
# systemctl enable getty2@.service
# systemctl enable getty2-auto@.service

Offline

#11 2011-07-06 20:21:10

el mariachi
Member
Registered: 2007-11-30
Posts: 595

Re: [Solved] Getting consolekit to work with autologin

and does that give you a working console-kit session?

Offline

#12 2011-07-06 21:14:35

Glaucous
Member
Registered: 2010-11-06
Posts: 41

Re: [Solved] Getting consolekit to work with autologin

Yes it does.

Offline

#13 2011-07-06 22:26:23

el mariachi
Member
Registered: 2007-11-30
Posts: 595

Re: [Solved] Getting consolekit to work with autologin

I'll try it then, as soon as I get systemd to work again.
But anyway, your method isn't anything fancy, why won't the classic inittab method work? Is you autologin script the same as the wiki's?

using the wiki's autologin program a ck session is launched correctly if I logout. So I don't get it.. is it too "fast" for ck if getty autologins with that program? because after I issue $ exit I get autologged in and ck works.

(Should I open a new thread?)

Last edited by el mariachi (2011-07-06 23:06:00)

Offline

#14 2011-07-07 11:02:26

Glaucous
Member
Registered: 2010-11-06
Posts: 41

Re: [Solved] Getting consolekit to work with autologin

No my method isn't anything fancy, why would it be? I agree it would be a lot less work with inittab.
Inittab works, if you're not using systemd.

Yes the program is exactly the same.

Last edited by Glaucous (2011-07-07 11:05:38)

Offline

#15 2011-07-07 11:30:37

el mariachi
Member
Registered: 2007-11-30
Posts: 595

Re: [Solved] Getting consolekit to work with autologin

I must have messed something. CK won't work no matter what (mingetty method, autologin.c method, systemd method, inittab, manual login, ...)
I'll have to fresh install and try again. So in theory using inittab with agetty launching the autologin program would work as well as using mingetty's autologin right?

Offline

#16 2011-07-07 19:06:27

Glaucous
Member
Registered: 2010-11-06
Posts: 41

Re: [Solved] Getting consolekit to work with autologin

Yes, yes it would.

Offline

#17 2011-07-07 20:33:50

litemotiv
Forum Fellow
Registered: 2008-08-01
Posts: 5,026

Re: [Solved] Getting consolekit to work with autologin

I decided to give that C approach a try too, it works fine indeed, seems slightly faster than the mingetty solution but not much.


ᶘ ᵒᴥᵒᶅ

Offline

#18 2011-07-07 20:37:30

el mariachi
Member
Registered: 2007-11-30
Posts: 595

Re: [Solved] Getting consolekit to work with autologin

Glad I (was) am not the only one sensing that smile
I'll backup and reinstall everything, my laptop has already crossed the point of no return in terms of experimentation..
Thanks for the tips Glaucous and litemotiv.

Offline

Board footer

Powered by FluxBB