From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1LlNIT-0002ve-Mp for garchives@archives.gentoo.org; Sun, 22 Mar 2009 13:01:02 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id D15E3E07EC; Sun, 22 Mar 2009 13:01:00 +0000 (UTC) Received: from smtp4-g21.free.fr (smtp4-g21.free.fr [212.27.42.4]) by pigeon.gentoo.org (Postfix) with ESMTP id A6FC8E07EC for ; Sun, 22 Mar 2009 13:00:59 +0000 (UTC) Received: from smtp4-g21.free.fr (localhost [127.0.0.1]) by smtp4-g21.free.fr (Postfix) with ESMTP id 64BA34C80CA for ; Sun, 22 Mar 2009 14:00:55 +0100 (CET) Received: from localhost (4be54-1-81-56-5-110.fbx.proxad.net [81.56.5.110]) by smtp4-g21.free.fr (Postfix) with ESMTP id 728FE4C81AC for ; Sun, 22 Mar 2009 14:00:53 +0100 (CET) Date: Sun, 22 Mar 2009 14:00:53 +0100 From: gibboris@gmail.com To: gentoo-user@lists.gentoo.org Subject: Re: [gentoo-user] start X at startup without a login manager Message-ID: <20090322130053.GA6292@b1b1.lan> References: <5cd9791d0903200809h27b4704ci9c44cb00a9561ee@mail.gmail.com> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@lists.gentoo.org Reply-to: gentoo-user@lists.gentoo.org MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="bg08WKrSYDhXBjb5" Content-Disposition: inline In-Reply-To: <5cd9791d0903200809h27b4704ci9c44cb00a9561ee@mail.gmail.com> User-Agent: Mutt/1.5.19 (2009-01-05) X-Archives-Salt: 08f480b3-db42-4702-845e-ac16e353c0e7 X-Archives-Hash: 9ff95d81026cf06c8a95be09f3a2f188 --bg08WKrSYDhXBjb5 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline I was thinking about the proper way to set-up the autologin some time ago. Some hints which came to my mind : 1) should be started as a service so restart/start/stop may be used and doesn't leave an open root shell 2) should be restarted with ctrl+alt+backspace without losing the keyboard focus (may be a problem when not using telinit) 3) try to avoid the numerous wrappers of login managers in /etc/X11 4) should be able to come back to login manager by modifying only one conf.d file (or env.d ?) --- so below is the way I have set it up for the moment : I did a kind of merge of the xdm and startUS.sh (script found on the gentoo forums) so I don't have x11-apps/xdm but I have a xdm init script (which should have another name but it's just a modified version of the original xdm script) [xdm patch attached] To avoid the unresponsive keyboard : I always use telinit so : x:a:once:/etc/X11/startDM.sh is appended in my /etc/inittab. In startDM.sh a modification is done to make start-stop-daemon drop its privs and set the minimum env needed by startx then xinit. [startDM.sh patch attached] Notice two facts : env X=y start-stop-daemon is used because I was not able to use several --env options. My user's .xinitrc sources its .bash_profile (which source /etc/profile) to initialize the other variables. (I would like to export the bash completion to my whole X session, but it's another problem...) An alternative is the make start-stop-daemon launch 'su -- -l' but it's dirty because of the need to store the pid. So the first problem is that the xdm script doesn't know the pid of xinit because even without 'su', start-stop-daemon knows about startx, not xinit. The second one is that ctrl+alt+backspace isn't trapped correctly. Should 'xinit restart' be the direct work of the daemon in the autologin case ? In the autologin case which imho implies the user has a .xinitrc, startx is only useful for the 2 or 3 lines around mcookie. Should startx be directly in /etc/init.d . (as said in the header it's a old sample of this script) and the deep meaning of runlevel (multiuser / graphic) should be think from the beginning to understand the right way to organise the X11 launch stuff. What about putting startx's $defaultserverarg and $enable_xauth in a /etc/conf.d/xdm (or better : /etc/conf.d/xinit) ? (the local.start is a hacky but short and understandable way to do though :), a quick heavier case is there : http://www.gentoo-wiki.info/TIP_Passwordless_Login) Anyway, I'm still a bit lost in the quest of the cleanest way from system init to ~/xinitrc. So any comment, advice, whatever ... would be greatly appreciated. Raph On Fri, Mar 20, 2009 at 11:09:56PM +0800, fei huang wrote: > I don't have any "xdm", "gdm" stuff but would like to start my windows > manager directly at startup, cause I'm the only one that use it. > > here is my solution: > I use runlevel 3 as default, and add a line of code in > "/etc/conf.d/local.start": > > su - myname -c startx& > > this works just fine except my scim panel would not shown as before, but if > I login in normally with my user name, and type "startx" manually, > everything works perfect. I'm wondering what is the difference with those > two steps that cause the problem, > "ps" shows the scim processes are just running normally, for reference, I > pasted my "xinitrc" here: > > export XMODIFIERS='@im=SCIM' > export GTK_IM_MODULE=scim > scim -d > > xrdb -merge ~/.Xresources > urxvtd -q -f -o > > conky -q & > > exec awesome > > > any ideas? > > thanks > > fei --bg08WKrSYDhXBjb5 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="init.d_xdm.patch" --- xdm.old 2009-02-06 12:11:29.000000000 +0100 +++ xdm 2009-02-06 12:15:53.000000000 +0100 @@ -85,6 +85,12 @@ EXE=/usr/bin/wdm PIDFILE= ;; + none) + test -n "$(id -u ${XUSER} 2>/dev/null)" && \ + EXE=/usr/bin/startx \ + PIDFILE=/var/run/x.pid \ + NAME=startx + ;; *) EXE= # Fix #65586, where MY_XDM is empty so EXE=somedir @@ -140,6 +146,7 @@ save_options "service" "${EXE}" save_options "name" "${NAME}" save_options "pidfile" "${PIDFILE}" + save_options "xuser" "${XUSER}" if [ -n "${CHECKVT-y}" ] ; then if vtstatic "${CHECKVT:-7}" ; then @@ -154,7 +161,11 @@ fi fi - /etc/X11/startDM.sh + if [ -n "${XUSER}" ] && [ -x /sbin/telinit ]; then + telinit a >/dev/null 2>&1 + else + /etc/X11/startDM.sh + fi eend 0 } --bg08WKrSYDhXBjb5 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="X11_startDM.sh.patch" --- startDM.sh.old 2009-03-22 00:33:04.000000000 +0100 +++ startDM.sh 2009-03-22 00:34:32.000000000 +0100 @@ -14,17 +14,27 @@ [ -r "${svclib}"/sh/rc-services.sh ] && . "${svclib}"/sh/rc-services.sh fi -# Great new Gnome2 feature, AA -# We enable this by default -export GDK_USE_XFT=1 export SVCNAME=xdm EXEC="$(get_options service)" NAME="$(get_options name)" PIDFILE="$(get_options pidfile)" +XUSER="$(get_options xuser)" + +if test -z "${XUSER}"; then + # Great new Gnome2 feature, AA + # We enable this by default + export GDK_USE_XFT=1 + start-stop-daemon --start --exec ${EXEC} \ ${NAME:+--name} ${NAME} ${PIDFILE:+--pidfile} ${PIDFILE} || \ eerror "ERROR: could not start the Display Manager" +else + env USER=${XUSER} HOME=$(getent passwd ${XUSER}|cut -d: -f6) \ + start-stop-daemon --start --background --make-pidfile -c ${XUSER} --exec ${EXEC} \ + ${NAME:+--name} ${NAME} ${PIDFILE:+--pidfile} ${PIDFILE} || \ + eerror "ERROR: could not start ${EXEC} for ${XUSER}" +fi # vim:ts=4 --bg08WKrSYDhXBjb5--