You are not logged in.

#1 2011-01-31 22:48:33

.:B:.
Forum Fellow
Registered: 2006-11-26
Posts: 5,819

[Solved] Register auto-login session with Consolekit

Since the last consolekit upgrade you either need to log in manually or use a login manager that supports console-kit to have your session register properly with it (and be able to shut down/suspend/resume/... as a user).

However, when you set up your system to log in automatically (like I do with my HTPC running Xbmc), that doesn't seem to work anymore (the session is reported as not being local, and you're denied access to reboot/shutdown/etc.). Apparently that's due to using the inittab method (as said in the wiki entry on starting X). X is launched from .xinitrc, and through ck-launch-session.

Since I am not exactly looking to SSH into my HTPC every single time (or attach a keyboard, I have a remote for that thing) to log in manually and start X, or shut down over SSH, I was wondering if there was an autologin alternative to the inittab method - or a way to make console-kit accept the session as local. As I understand it there doesn't seem to be a way to tell console-kit to think differently on existing session except through program calls (e.g. you can't just prefix /usr/bin/xbmc with /usr/bin/console-kit-deamon like you can do with dbus-launch or ck-launch-session). I think GDM and KDM can be used for auto-login, but they're quite heavy (especially since Xbmc can run right on top of X, so there's no need for any WM/DE whatsoever). Xdm apparently seems unable to do auto-login (and doesn't support console-kit yet); Slim should support it, but doesn't provide console-kit support (yet) either.

Any pointers are appreciated. Ideally I'd like to do this without a login manager, of course. With 256 MB of RAM (AppleTV) every MB saved is welcome smile.


Got Leenucks? :: Arch: Power in simplicity :: Get Counted! Registered Linux User #392717 :: Blog thingy

Offline

#2 2011-02-02 08:22:58

.:B:.
Forum Fellow
Registered: 2006-11-26
Posts: 5,819

Re: [Solved] Register auto-login session with Consolekit

Looks like this is another one for the list wink


Got Leenucks? :: Arch: Power in simplicity :: Get Counted! Registered Linux User #392717 :: Blog thingy

Offline

#3 2011-02-02 08:36:54

Velophile
Member
Registered: 2009-12-15
Posts: 48

Re: [Solved] Register auto-login session with Consolekit

Same situation here, I've rolled consolekit back to the previous release for the time being.

You may have already seen it but Aphanic's posted (#36) a potential fix/workaround on this thread.

Offline

#4 2011-02-02 08:59:57

thestinger
Trusted User (TU)
From: Toronto, Canada
Registered: 2010-01-23
Posts: 478

Re: [Solved] Register auto-login session with Consolekit

I added a note to the page a few days ago about the possibility of combining mingetty (has autologin) + the .bash_profile/.zprofile method. It works as well as the inittab one but you are properly logged in (locally) so consolekit works. Even `w` and `who` in a terminal won't show you as logged in when starting via inittab.

You'll also save some RAM by using mingetty tongue (a few KB at least xD).

Here's what I use atm, it works fine with consolekit, although I don't actually use ck at the moment.

at the end of .zprofile:

if [[ -z $DISPLAY && $(tty) = /dev/tty2 ]]; then
    exec xinit ~/.config/xinitrc -- /usr/bin/X -nolisten tcp vt08 &>/dev/null
fi

relevant section from inittab:

c2:2345:respawn:/sbin/mingetty --autologin thestinger tty2 linux
c3:2345:respawn:/sbin/mingetty --autologin thestinger --loginpause tty3 linux
c4:2345:respawn:/sbin/mingetty --autologin thestinger --loginpause tty4 linux
c5:2345:respawn:/sbin/mingetty --autologin thestinger --loginpause tty5 linux
c6:2345:respawn:/sbin/mingetty --autologin thestinger --loginpause tty6 linux
c7:2345:respawn:/sbin/mingetty --autologin thestinger --loginpause tty7 linux

Last edited by thestinger (2011-02-02 09:05:16)

Offline

#5 2011-02-02 10:21:04

ichbinesderelch
Member
Registered: 2008-01-17
Posts: 203

Re: [Solved] Register auto-login session with Consolekit

the method described by testhinger works fine, thanks for sharing wink

Offline

#6 2011-02-02 11:02:44

.:B:.
Forum Fellow
Registered: 2006-11-26
Posts: 5,819

Re: [Solved] Register auto-login session with Consolekit

Thanks thestinger, I'll try that this evening ^_^.


Got Leenucks? :: Arch: Power in simplicity :: Get Counted! Registered Linux User #392717 :: Blog thingy

Offline

#7 2011-02-02 14:08:27

TigTex
Member
From: Portugal
Registered: 2008-06-19
Posts: 301

Re: [Solved] Register auto-login session with Consolekit

Well, that method works but even if you boot in runlevel3, X tries to start. And it's a little slower than inittab (.xinitrc) method on my pentium4 xbmc box (+2 seconds)... Meh, I want the old inittab back sad


.::. TigTex @ Portugal .::.

Offline

#8 2011-02-02 14:54:33

Aphanic
Member
From: Verín or Madrid (Spain)
Registered: 2008-12-31
Posts: 27

Re: [Solved] Register auto-login session with Consolekit

Thanks for the info thestinger!

@TigTex: to be able to use runlevel 3 as usual without starting X it might be interesting to parse the output of "who -r" and add another condition to the profile configuration file.

For example:

if [[ -z $DISPLAY && $(tty) = /dev/tty2 && `who -r | cut -c20` = 5 ]]; then
        # Start X
fi

Offline

#9 2011-02-02 14:57:02

Inxsible
Forum Fellow
From: Chicago
Registered: 2008-06-09
Posts: 9,105

Re: [Solved] Register auto-login session with Consolekit

I don't use consolekit at all. I am not a 100% sure if i3 supports it or not, but I have always auto-logged-in using the inittab method and given NOPASSWD to reboot and shutdown through visudo. Hasn't given me any problems yet.


Forum Rules

There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !

Offline

#10 2011-02-02 16:13:08

.:B:.
Forum Fellow
Registered: 2006-11-26
Posts: 5,819

Re: [Solved] Register auto-login session with Consolekit

Same here with Openbox, sudo doesn't care about the consolekit stuff. Xbmc does though wink.

Edit: thanks thestinger, works excellently smile.


Got Leenucks? :: Arch: Power in simplicity :: Get Counted! Registered Linux User #392717 :: Blog thingy

Offline

#11 2011-02-03 16:54:56

lynix
Member
From: Karlsruhe, Germany
Registered: 2008-04-23
Posts: 227

Re: [Solved] Register auto-login session with Consolekit

just another method of starting XBMC without login manager:

# /etc/inittab
(...)
x:5:respawn:/bin/su alex -l -c "/bin/bash --login -c 'startx xbmc'>/dev/null 2>&1"

with following as .xinitrc:

#!/bin/sh

nvidia-settings -l

if [ "$2" == "xbmc" ]; then
    # start XBMC
    exec ck-launch-session /usr/bin/dbus-launch --exit-with-session /usr/bin/xbmc --standalone -fs
else
    # start openbox session
    exec ck-launch-session openbox-session
fi

The parameter for .xinitrc gives me the ability to quickly fire up an openbox session on my media pc, for browsing etc.

Maybe it's useful for someone smile

Offline

#12 2011-02-03 18:05:40

.:B:.
Forum Fellow
Registered: 2006-11-26
Posts: 5,819

Re: [Solved] Register auto-login session with Consolekit

The issue is not about starting up without a login manager, but to do so and have it register with consolekit as a local session. I appreciate you're willing to help but it has nothing to do with the topic smile.


Got Leenucks? :: Arch: Power in simplicity :: Get Counted! Registered Linux User #392717 :: Blog thingy

Offline

Board footer

Powered by FluxBB