Difference between revisions of "Start X at boot (Italiano)"

From ArchWiki
Jump to: navigation, search
m (fixed double redirect)
 
(7 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{translateme}}
+
#REDIRECT [[Start X at Login (Italiano)]]
[[Category:Amministrazione del sistema (italiano)]]
 
 
 
 
 
==== Q: How can I start X at boot time in Arch?====
 
 
 
 
 
A: Edit your <code>/etc/inittab</code>
 
The first uncommented line should be something like this:
 
id:3:initdefault:
 
 
 
Change it to:
 
id:5:initdefault:
 
 
 
[http://bbs.archlinux.org/viewtopic.php?t=863 Forum Topic]
 
 
 
You may also want to change the last line of the <code>/etc/inittab</code> to [[Adding a login manager (KDM, GDM, or XDM) to automatically boot on startup | start kdm or gdm instead of xdm]].
 
 
 
----
 
Another way to the same result is to add a display manager (<code>kdm</code>, <code>gdm</code>, or <code>xdm</code>) to the DAEMONS array in <code>/etc/rc.conf</code>
 
----
 
An alternative is to add something like the following to the bottom of your <code>~/.bash_profile</code> (if not is ~/.bash_profile yuo can create it):
 
<pre>
 
if [[ -z "$DISPLAY" ]] && [[ $(tty) = /dev/vc/1 ]]; then
 
  startx
 
  logout
 
fi
 
</pre>
 
or
 
<pre>
 
if [[ -z "$DISPLAY" ]] && [[ $(tty) = /dev/vc/1 ]]; then
 
  xinit
 
  logout
 
fi
 
</pre>
 
This way X is automatically started when you log in at the first console.  Furthermore your user will be logged out when you kill X using ctrl+alt+backspace.  next time you log in, X will start again automatically, and if you followed the mingetty instructions in [[Automatically_login_some_user_to_a_virtual_console_on_startup]] you will be able to have X automatically respawn with a fresh environment and everything ready to go.
 
 
 
==== Starting X as prefered user without logging in ====
 
 
 
A way of circumventing display managers and boot straight into prefered window manager or desktop environment is the following.<br>
 
In <code>/etc/inittab</code> change:<br>
 
id:3:initdefault:
 
 
[...]
 
 
x:5:respawn:/usr/X11R6/bin/xdm -nodaemon
 
 
 
to
 
id:5:initdefault:
 
 
[...]
 
 
x:5:once:/bin/su PREFERED_USER -l -c "/bin/bash --login -c startx >/dev/null 2>&1"
 
 
 
where PREFERED_USER is the user of your choice.
 
 
 
Instead of <code>startx</code>, you can of course have any program or self-written script you wish to execute. Myself, I have <code>startx -- -nolisten tcp -br -deferglyphs 16</code> instead of just <code>startx</code><br>
 
you can then choose window manager by editing <code>~/.xinitrc</code>.
 
----
 
Putting <code>startxfce4</code> (or <code>xinit</code>, and putting to <code>/.xinitrc</code> for example <code>icewm</code>, and copping <code>~/.icewm</code> to <code>/.icewm</code>) in <code>/etc/rc.local</code> is also an option, but note that both X and xfce (or the WM/DE of your choice) will start as super-user, which is generally not recommended. Of course you could use the same trick as above and execute your desktop with a <code>/bin/su</code>.
 
----
 

Latest revision as of 17:35, 29 November 2012