View previous topic :: View next topic |
Author |
Message |
dos14hk n00b
Joined: 12 Jul 2006 Posts: 41 Location: Hong Kong
|
Posted: Sat Jul 15, 2006 11:19 pm Post subject: Start Desktop Without XDM (Fast Start/Shutdown) [EDITED] |
|
|
Here is a fast and efficient way to start your desktop on gentoo without using xdm/gdm/kdm:
Startup to a clean terminal window, enter your name and password and automatically start your desktop environment. When done, logout from your desktop to a clean terminal window. Enter a single command to shutdown or reboot.
The main point here is that you have a choice when you've booted your pc whether to do 'root' things at the terminal; emerging, updating, cleaning or go on to a users desktop and do non-root desktop things like watch videos, write novels and browse the net. This choice to me is a better alternative to being automatically logged in to a desktop every time you boot - just a preference, thats all.
EDITED
(1A) /etc/conf.d/local.start
( on startup change from vt1 [busy default] to vt2 [clear screen] )
EDITED
(1B) /etc/profile
( on startup stop console blanking )
EDITED
(2.) /etc/rc.conf
( set the default xsession )
(3) console and /root/.bashrc
(c opy user bash to root and edit )
Code: | # cp /home/user?/.bashrc /root && cp /home/user?/.bash_profile /root |
.. /root/.bashrc (plain text version)
Code: | source /etc/profile
if [ -z "$DISPLAY" ] && [ $(tty) = /dev/tty2 ]; then
echo
echo "Gentoo-Linux 2006.0 : shutdown [ halt -n ] : restart [ exit exit ]"
echo
fi |
.. /root/.bashrc (coloured text version)
Code: | echo -e "\033[40;32;1m Gentoo-Linux 2006.0 \033[0m : shutdown [ \033[40;31;1m halt-n \033[0m ] : restart [ \033[40;36;1m exit exit \033[0m ]" |
(4) console and /home/user?/.bashrc
(edit the users bashrc to startup on login and logout to su)
Code: | source /etc/profile
if [ -z "$DISPLAY" ] && [ $(tty) = /dev/tty2 ]; then
startx > /dev/null 2>&1
clear
su
fi |
(5) /etc/pam.d/su
(allow users in the wheel group to su without password)
.. /etc/pam.d/su
Code: | auth sufficient pam_rootok.so
auth sufficient pam_wheel.so use_uid trust
auth requiredpam_wheel.so use_uid
auth include system-auth
account include system-auth
password include system-auth
session include system-auth
session required pam_env.so
session optional pam_xauth.so |
Now, when you startup you will enter a clean vt. When you login to your user account gnome will start quickly. If you syncronise the wallpaper chosen in xinitrc with your desktop then the process looks fully integrated.
In gnome session control (Applications/Desktop Preferences/Advanced/Sessions) remove show splashscreen, prompt on logout and enable Automatically save changes to session. This speeds up the start process further.
Now when you logout you return to a clean terminal as root. From here you can do three things:
(A) Reboot: #reboot
(B) Shutdown: #halt -n (or) Ctrl+Alt+Del
(C) Restart: #exit (as root) #exit (as user) : login to restart.
Starting up from the console means that you can do admin stuff quickly without the burden of X hugging resources:
(A). Start Gentoo. Wait for boot process to stop. login as user......
(B). Start Gentoo. Wait for boot process to stop. Alt+F3, login as root and do admin stuff. Exit. Alt+F2. Login as user ......
You will soon get used to the speed of startup and close down and can extend this idea to use different terminals to login different users, etc. If you really want to fly then make sure you install splashutils and compile the initrd directly into the kernel - makes windoz boot look really slow! Bye. _________________ GIGABYTE GA-G1975X-C | Pent(D)3GHz | FSB:800MHz | 2GB:DDR2:667MHz | Seagate 80G SATAII x 2 : RAID 0 | Gentoo ~x86 DEV 2007.0 Desktop |
Last edited by dos14hk on Mon Oct 16, 2006 1:42 pm; edited 3 times in total |
|
Back to top |
|
|
truc Advocate
Joined: 25 Jul 2005 Posts: 3199
|
Posted: Sun Jul 16, 2006 7:09 pm Post subject: |
|
|
That's good to know.
I hope you, dos14hk, don't see any problem if I post an other way of doing this for those who don't have/use pam, it's described on the french gentoo-wiki but it's currently down, I will copy and paste it for everyone Quote: | append to /etc/inittab:
Code: | xu:b:once:/etc/X11/startUS.sh |
Now create /etc/init.d/xuser: | #!/sbin/runscript
# Copyright 1999-2004 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License, v2 or later
# This script is largely inspired from /etc/init.d/xdm
#
# Don't forget to set XUSER to the desired username in /etc/conf.d/xuser
#
# Yoann Aubineau
# yoann@yaubi.com
# 2004.03.10
# Start X Font Server before X
depend() {
use xfs hotplug
}
start() {
USER="$(echo ${XUSER} | awk '{ print tolower($1) }')"
ebegin "Starting X session for ${USER}"
save_options "user" "${USER}"
/sbin/telinit b &>/dev/null
eend 0
}
stop() {
local retval=0
local curvt="$(fgconsole)"
ebegin "Stopping X session"
rm -f ${svcdir}/options/xuser/user
if [ "$(ps -A | grep -e "startx")" ]
then
start-stop-daemon --stop \
--name "startx"
retval=$?
fi
#switch back to original vt
chvt "${curvt}" &>/dev/null
eend ${retval} "Error stopping ${myservice}."
return ${retval}
} |
You also need to create /etc/X11/startUS.sh: | #!/bin/sh
source /etc/init.d/functions.sh
source /etc/profile
if [ -e ${svcdir}/options/xuser/user ]
then
retval=0
USER="`cat ${svcdir}/options/xuser/user`"
export GDK_USE_XFT=1
/sbin/start-stop-daemon --start --background \
--exec "/bin/su" -- - ${USER} -l -c "/usr/X11R6/bin/startx &> /dev/null"
retval=$?
#wait; sleep 2
if [ "${retval}" -ne 0 ]
then
einfo "ERROR: could not start the X session..."
killall -9 "startx" &> /dev/null
fi
fi |
Now replace xdm, gdm or whatever you're using: Code: | rc-update del xdm
chmod 755 /etc/init.d/xuser
rc-update add xuser default
chmod 755 /etc/X11/startUS.sh |
And create /etc/conf.d/xuser: |
# Config file for /etc/init.d/xuser
XUSER=yoann #type your username here
|
|
And for initng users, I've made an i-file to startx (the idea is taken from the previous link I gave, but I ended with something far simpler):
/etc/initng/daemon/xuser.i: | #!/sbin/itype
# This is a i file, used by initng parsed by install_service
daemon daemon/xuser/gnome-settings-daemon {
use = daemon/xuser;
conflict = daemon/xuser/xfce-mcs-manager;
env_file = /etc/conf.d/xuser;
stderr = /dev/null;
script daemon = /bin/su - ${X_USER} -l -c "DISPLAY=:${X_DISPLAY} /usr/libexec/gnome-settings-daemon";
}
daemon daemon/xuser/xfce-mcs-manager {
need = system/bootmisc;
use = daemon/xuser;
conflict = daemon/xuser/gnome-settings-daemon;
env_file = /etc/conf.d/xuser;
stderr = /dev/null;
script daemon = /bin/su - -l -c "DISPLAY=:${X_DISPLAY} /usr/bin/xfce-mcs-manager";
}
daemon daemon/xuser {
need = system/bootmisc;
conflict = daemon/gdm daemon/kdm daemon/wdm daemon/xdm;
use = system/modules system/coldplug system/faketty daemon/xfs;
provide = virtual/dm;
stdall = /dev/null;
env_file = /etc/conf.d/xuser;
also_stop = daemon/xuser/gnome-settings-daemon daemon/xuser/xfce-mcs-manager;
script daemon = /bin/su - ${X_USER} -l -c "/usr/bin/startx -- :${X_DISPLAY} ${X_defaultservargs}";
}
|
This i-file requires:
/etc/conf.d/xuser: | # Config file for /etc/initng/daemon/xuser
# type your username here
X_USER=truc
# Display number for the X server
X_DISPLAY=0
# Default X server args
X_defaultservargs="-nolisten tcp -br" |
then ng-update add xuser default |
|
Back to top |
|
|
dos14hk n00b
Joined: 12 Jul 2006 Posts: 41 Location: Hong Kong
|
Posted: Thu Jul 20, 2006 4:00 pm Post subject: |
|
|
Quote: | I hope you, dos14hk, don't see any problem if I post an other way of doing this for those who don't have/use pam |
Also good to know, too. Thanks for the input truc. |
|
Back to top |
|
|
GrimSage n00b
Joined: 13 Sep 2004 Posts: 42
|
Posted: Thu Aug 17, 2006 3:14 am Post subject: |
|
|
I am trying to do this but I am not positive where to put the stuff from part 2
here is my xitintrc
Code: |
!/bin/sh
# $Xorg: xinitrc.cpp,v 1.3 2000/08/17 19:54:30 cpqbld Exp $
userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
xinitdir=/etc/X11
sysresources=$xinitdir/Xresources
sysmodmap=$xinitdir/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
# First try ~/.xinitrc
if [ -f "$HOME/.xinitrc" ]; then
XINITRC="$HOME/.xinitrc"
if [ -x $XINITRC ]; then
# if the x bit is set on .xinitrc
# it means the xinitrc is not a
# shell script but something else
exec $XINITRC
else
exec /bin/sh "$HOME/.xinitrc"
fi
# If not present, try the system default
elif [ -n "`/etc/X11/chooser.sh`" ]; then
exec "`/etc/X11/chooser.sh`"
# Failsafe
else
# start some nice programs
twm &
xclock -geometry 50x50-1+1 &
xterm -geometry 80x50+494+51 &
xterm -geometry 80x20+494-0 &
exec xterm -geometry 80x66+0+0 -name login
fi
xhost +local:
|
where am I supposed to put
Code: |
else
xv -quit -root /usr/local/wallpapers/*.jpg &
exec kde-3.5 #choose your desktop version#
fi
|
|
|
Back to top |
|
|
dos14hk n00b
Joined: 12 Jul 2006 Posts: 41 Location: Hong Kong
|
Posted: Thu Aug 31, 2006 2:18 am Post subject: |
|
|
GrimSage wrote: | I am trying to do this but I am not positive where to put the stuff from part 2
here is my xitintrc
Code: |
!/bin/sh
# $Xorg: xinitrc.cpp,v 1.3 2000/08/17 19:54:30 cpqbld Exp $
userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
xinitdir=/etc/X11
sysresources=$xinitdir/Xresources
sysmodmap=$xinitdir/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
# First try ~/.xinitrc
if [ -f "$HOME/.xinitrc" ]; then
XINITRC="$HOME/.xinitrc"
if [ -x $XINITRC ]; then
# if the x bit is set on .xinitrc
# it means the xinitrc is not a
# shell script but something else
exec $XINITRC
else
exec /bin/sh "$HOME/.xinitrc"
fi
# If not present, try the system default
elif [ -n "`/etc/X11/chooser.sh`" ]; then
exec "`/etc/X11/chooser.sh`"
# Failsafe
else
# start some nice programs
twm &
xclock -geometry 50x50-1+1 &
xterm -geometry 80x50+494+51 &
xterm -geometry 80x20+494-0 &
exec xterm -geometry 80x66+0+0 -name login
fi
xhost +local:
|
where am I supposed to put
Code: |
else
xv -quit -root /usr/local/wallpapers/*.jpg &
exec kde-3.5 #choose your desktop version#
fi
|
|
Code: | !/bin/sh
# $Xorg: xinitrc.cpp,v 1.3 2000/08/17 19:54:30 cpqbld Exp $
userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
xinitdir=/etc/X11
sysresources=$xinitdir/Xresources
sysmodmap=$xinitdir/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
# First try ~/.xinitrc
if [ -f "$HOME/.xinitrc" ]; then
XINITRC="$HOME/.xinitrc"
if [ -x $XINITRC ]; then
# if the x bit is set on .xinitrc
# it means the xinitrc is not a
# shell script but something else
exec $XINITRC
else
exec /bin/sh "$HOME/.xinitrc"
fi
# If not present, try the system default
elif [ -n "`/etc/X11/chooser.sh`" ]; then
exec "`/etc/X11/chooser.sh`"
# Failsafe
#else
# # start some nice programs
# twm &
# xclock -geometry 50x50-1+1 &
# xterm -geometry 80x50+494+51 &
# xterm -geometry 80x20+494-0 &
# exec xterm -geometry 80x66+0+0 -name login
else
xv -quit -root /usr/local/wallpapers/mywallpaper.jpg &
exec kde-3.5
fi |
Slot it in at the bottom of the file. It replaces the twm session quoted-out (#) above it |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|