unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
* [HOWTO] Start X server manually instead of using a login manager
@ 2018-07-19 20:33 Alex Kost
  2018-07-19 21:56 ` Divan Santana
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Alex Kost @ 2018-07-19 20:33 UTC (permalink / raw)
  To: help-guix

Hello,

People often ask how they can use startx/xinit on GuixSD.  It is
possible, although it is not as easy as on other distros.  Hopefully,
this tutorial will answer some questions on the subject.

At first, a couple of points:

- We will run X server with user privileges, so if something goes wrong,
  look at the X log, which is placed at "~/.local/share/xorg/Xorg.N.log"
  by default.

- We will run "xinit", not "startx": the latter is just a wrapper that
  does some preparations and runs "xinit".  (startx is a usual shell
  script with a usual script's behavior: it does not like that Guix
  violates Filesystem Hierarchy Standard, so it successfully fails to
  start).

Now the steps you need to do to use "xinit":

1. Install xinit, X server and required modules to some guix profile,
   for example:

     guix package -i xinit xorg-server xf86-input-libinput xf86-video-fbdev xf86-video-nouveau

2. Make "~/.xinitrc" file.  If you don't know what its content should
   be, just put "exec xterm" there, or even better read:

     https://wiki.archlinux.org/index.php/Xinit

3. Running "xinit" requires specifying multiple arguments, so you will
   probably make an auxiliary script to run it.  This script will look
   like this:

--8<---------------cut here---------------start------------->8---
#!/bin/sh

DIR=$HOME/.guix-profile

$DIR/bin/xinit -- $DIR/bin/Xorg :0 vt1 -keeptty \
               -configdir $DIR/share/X11/xorg.conf.d \
               -modulepath $DIR/lib/xorg/modules
--8<---------------cut here---------------end--------------->8---

  Note that using the current terminal ("vt1" in this case) and
  "-keeptty" is required, otherwise X server refuses to start without
  root privileges.

  For testing purposes, you may change the above arguments to ":1 vt2",
  switch to vt2 (Ctrl-Alt-F2) and run this script.

4. Finally (if the above script works), you can remove login manager
   from your os services (if you use %desktop-services):

--8<---------------cut here---------------start------------->8---
(use-modules
 ;; ...
 (srfi srfi-1)                  ; for 'remove'
 (gnu services desktop)
 (gnu services xorg))

(operating-system
  ;; ...
  (services
   (remove (lambda (service)
             (eq? (service-kind service) slim-service-type))
           %desktop-services)))
--8<---------------cut here---------------end--------------->8---

-- 
Alex

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [HOWTO] Start X server manually instead of using a login manager
  2018-07-19 20:33 [HOWTO] Start X server manually instead of using a login manager Alex Kost
@ 2018-07-19 21:56 ` Divan Santana
  2018-07-23  7:43 ` Divan Santana
  2018-07-26 15:34 ` Ludovic Courtès
  2 siblings, 0 replies; 7+ messages in thread
From: Divan Santana @ 2018-07-19 21:56 UTC (permalink / raw)
  To: Alex Kost; +Cc: help-guix

Hi Alex,

Alex Kost <alezost@gmail.com> writes:

> People often ask how they can use startx/xinit on GuixSD.  It is
> possible, although it is not as easy as on other distros.  Hopefully,
> this tutorial will answer some questions on the subject.

This is really great and appreciated.

Thank you very much.
--
Divan

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [HOWTO] Start X server manually instead of using a login manager
  2018-07-19 20:33 [HOWTO] Start X server manually instead of using a login manager Alex Kost
  2018-07-19 21:56 ` Divan Santana
@ 2018-07-23  7:43 ` Divan Santana
  2018-07-23  9:52   ` zloster
  2018-07-26 15:34 ` Ludovic Courtès
  2 siblings, 1 reply; 7+ messages in thread
From: Divan Santana @ 2018-07-23  7:43 UTC (permalink / raw)
  To: Alex Kost; +Cc: help-guix

Alex Kost <alezost@gmail.com> writes:

> Hello,
>
> People often ask how they can use startx/xinit on GuixSD.  It is
> possible, although it is not as easy as on other distros.  Hopefully,
> this tutorial will answer some questions on the subject.
>
> At first, a couple of points:
>
> - We will run X server with user privileges, so if something goes wrong,
>   look at the X log, which is placed at "~/.local/share/xorg/Xorg.N.log"
>   by default.
>
> - We will run "xinit", not "startx": the latter is just a wrapper that
>   does some preparations and runs "xinit".  (startx is a usual shell
>   script with a usual script's behavior: it does not like that Guix
>   violates Filesystem Hierarchy Standard, so it successfully fails to
>   start).
>
> Now the steps you need to do to use "xinit":
>
> 1. Install xinit, X server and required modules to some guix profile,
>    for example:
>
>      guix package -i xinit xorg-server xf86-input-libinput xf86-video-fbdev xf86-video-nouveau
>
> 2. Make "~/.xinitrc" file.  If you don't know what its content should
>    be, just put "exec xterm" there, or even better read:
>
>      https://wiki.archlinux.org/index.php/Xinit
>
> 3. Running "xinit" requires specifying multiple arguments, so you will
>    probably make an auxiliary script to run it.  This script will look
>    like this:
>
> --8<---------------cut here---------------start------------->8---
> #!/bin/sh
>
> DIR=$HOME/.guix-profile
>
> $DIR/bin/xinit -- $DIR/bin/Xorg :0 vt1 -keeptty \
>                -configdir $DIR/share/X11/xorg.conf.d \
>                -modulepath $DIR/lib/xorg/modules
> --8<---------------cut here---------------end--------------->8---
>
>   Note that using the current terminal ("vt1" in this case) and
>   "-keeptty" is required, otherwise X server refuses to start without
>   root privileges.
>
>   For testing purposes, you may change the above arguments to ":1 vt2",
>   switch to vt2 (Ctrl-Alt-F2) and run this script.
>
> 4. Finally (if the above script works), you can remove login manager
>    from your os services (if you use %desktop-services):
>
> --8<---------------cut here---------------start------------->8---
> (use-modules
>  ;; ...
>  (srfi srfi-1)                  ; for 'remove'
>  (gnu services desktop)
>  (gnu services xorg))
>
> (operating-system
>   ;; ...
>   (services
>    (remove (lambda (service)
>              (eq? (service-kind service) slim-service-type))
>            %desktop-services)))
> --8<---------------cut here---------------end--------------->8---

To help others, a few other notes.

To auto start x upon login one can do something like

--8<---------------cut here---------------start------------->8---
            (mingetty-service (mingetty-configuration
	    		       (tty "tty1")
	    		       (auto-login "ds")))
--8<---------------cut here---------------end--------------->8---

And this in you bashrc/zshrc.
--8<---------------cut here---------------start------------->8---
if [[ ! $DISPLAY && $XDG_VTNR -eq 1 ]]; then
  exec $HOME/bin/startx.sh
fi
--8<---------------cut here---------------end--------------->8---

Also I needed to set these in order for my icons to be detected
again. Failing to do so, the icons aren't found and some apps crash like
libreoffice.

--8<---------------cut here---------------start------------->8---
export XDG_DATA_DIRS="/run/current-system/profile/share:$HOME/.guix-profile/share:/run/current-system/profile/share"
export XDG_CONFIG_DIRS="$HOME/.guix-profile/etc/xdg:/run/current-system/profile/etc/xdg"
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_CACHE_HOME="$HOME/.cache"
export XDG_DATA_HOME="$HOME/.local/share"
--8<---------------cut here---------------end--------------->8---

I'm still strangely getting this error when my terminals (termite)
launch since switching to this method:

tput: unknown terminal "xterm-termite"

Not sure why that is yet.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [HOWTO] Start X server manually instead of using a login manager
  2018-07-23  7:43 ` Divan Santana
@ 2018-07-23  9:52   ` zloster
  0 siblings, 0 replies; 7+ messages in thread
From: zloster @ 2018-07-23  9:52 UTC (permalink / raw)
  To: Divan Santana, Alex Kost; +Cc: help-guix

On 23.07.2018 10:43, Divan Santana wrote:

> Alex Kost <alezost@gmail.com> writes:
>
>> Hello,
>>
>> People often ask how they can use startx/xinit on GuixSD.  It is
>> possible, although it is not as easy as on other distros.  Hopefully,
>> this tutorial will answer some questions on the subject.
>>
>> At first, a couple of points:
>>
>> - We will run X server with user privileges, so if something goes wrong,
>>    look at the X log, which is placed at "~/.local/share/xorg/Xorg.N.log"
>>    by default.
>>
>> - We will run "xinit", not "startx": the latter is just a wrapper that
>>    does some preparations and runs "xinit".  (startx is a usual shell
>>    script with a usual script's behavior: it does not like that Guix
>>    violates Filesystem Hierarchy Standard, so it successfully fails to
>>    start).
>>
>> Now the steps you need to do to use "xinit":
>>
>> 1. Install xinit, X server and required modules to some guix profile,
>>     for example:
>>
>>       guix package -i xinit xorg-server xf86-input-libinput xf86-video-fbdev xf86-video-nouveau
>>
>> 2. Make "~/.xinitrc" file.  If you don't know what its content should
>>     be, just put "exec xterm" there, or even better read:
>>
>>       https://wiki.archlinux.org/index.php/Xinit
>>
>> 3. Running "xinit" requires specifying multiple arguments, so you will
>>     probably make an auxiliary script to run it.  This script will look
>>     like this:
>>
>> --8<---------------cut here---------------start------------->8---
>> #!/bin/sh
>>
>> DIR=$HOME/.guix-profile
>>
>> $DIR/bin/xinit -- $DIR/bin/Xorg :0 vt1 -keeptty \
>>                 -configdir $DIR/share/X11/xorg.conf.d \
>>                 -modulepath $DIR/lib/xorg/modules
>> --8<---------------cut here---------------end--------------->8---
>>
>>    Note that using the current terminal ("vt1" in this case) and
>>    "-keeptty" is required, otherwise X server refuses to start without
>>    root privileges.
>>
>>    For testing purposes, you may change the above arguments to ":1 vt2",
>>    switch to vt2 (Ctrl-Alt-F2) and run this script.
>>
>> 4. Finally (if the above script works), you can remove login manager
>>     from your os services (if you use %desktop-services):
>>
>> --8<---------------cut here---------------start------------->8---
>> (use-modules
>>   ;; ...
>>   (srfi srfi-1)                  ; for 'remove'
>>   (gnu services desktop)
>>   (gnu services xorg))
>>
>> (operating-system
>>    ;; ...
>>    (services
>>     (remove (lambda (service)
>>               (eq? (service-kind service) slim-service-type))
>>             %desktop-services)))
>> --8<---------------cut here---------------end--------------->8---
> To help others, a few other notes.
>
> To auto start x upon login one can do something like
>
> --8<---------------cut here---------------start------------->8---
>              (mingetty-service (mingetty-configuration
> 	    		       (tty "tty1")
> 	    		       (auto-login "ds")))
> --8<---------------cut here---------------end--------------->8---
>
> And this in you bashrc/zshrc.
> --8<---------------cut here---------------start------------->8---
> if [[ ! $DISPLAY && $XDG_VTNR -eq 1 ]]; then
>    exec $HOME/bin/startx.sh
> fi
> --8<---------------cut here---------------end--------------->8---
>
> Also I needed to set these in order for my icons to be detected
> again. Failing to do so, the icons aren't found and some apps crash like
> libreoffice.
>
> --8<---------------cut here---------------start------------->8---
> export XDG_DATA_DIRS="/run/current-system/profile/share:$HOME/.guix-profile/share:/run/current-system/profile/share"
> export XDG_CONFIG_DIRS="$HOME/.guix-profile/etc/xdg:/run/current-system/profile/etc/xdg"
> export XDG_CONFIG_HOME="$HOME/.config"
> export XDG_CACHE_HOME="$HOME/.cache"
> export XDG_DATA_HOME="$HOME/.local/share"
> --8<---------------cut here---------------end--------------->8---
Hi, I have an idea about this problem. How ever my understanding is very 
limited so take care to do additional research:
> I'm still strangely getting this error when my terminals (termite)
> launch since switching to this method:
>
> tput: unknown terminal "xterm-termite"
>
> Not sure why that is yet.
There is a shell variable $TERM. Also there is a '/usr/share/terminfo/' 
directory with some definitions about the various terminals. If a 
description of terminal is missing from '/usr/share/terminfo/' it is 
possible to see this message from some command-line utilities.
Start with searching the man page of 'tset', 'reset' and 'terminfo' 
commands.

Best regards,
Radoslav Petrov

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [HOWTO] Start X server manually instead of using a login manager
  2018-07-19 20:33 [HOWTO] Start X server manually instead of using a login manager Alex Kost
  2018-07-19 21:56 ` Divan Santana
  2018-07-23  7:43 ` Divan Santana
@ 2018-07-26 15:34 ` Ludovic Courtès
  2024-02-26 14:47   ` Tomas Volf
  2 siblings, 1 reply; 7+ messages in thread
From: Ludovic Courtès @ 2018-07-26 15:34 UTC (permalink / raw)
  To: Alex Kost; +Cc: help-guix

Hi Alex,

Thank you for the tutorial!

Alex Kost <alezost@gmail.com> skribis:

> 3. Running "xinit" requires specifying multiple arguments, so you will
>    probably make an auxiliary script to run it.  This script will look
>    like this:
>
> #!/bin/sh
>
> DIR=$HOME/.guix-profile
>
> $DIR/bin/xinit -- $DIR/bin/Xorg :0 vt1 -keeptty \
>                -configdir $DIR/share/X11/xorg.conf.d \
>                -modulepath $DIR/lib/xorg/modules

I wonder: perhaps we should provide a ‘startx’ service that would
install in the system profile a script like this?

In fact the ‘xorg-wrapper’ procedure in (gnu services xorg) pretty much
produces this script.

Thoughts?

Ludo’.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [HOWTO] Start X server manually instead of using a login manager
  2018-07-26 15:34 ` Ludovic Courtès
@ 2024-02-26 14:47   ` Tomas Volf
  2024-02-26 17:28     ` Felix Lechner via
  0 siblings, 1 reply; 7+ messages in thread
From: Tomas Volf @ 2024-02-26 14:47 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: Alex Kost, help-guix

[-- Attachment #1: Type: text/plain, Size: 1068 bytes --]

On 2018-07-26 17:34:16 +0200, Ludovic Courtès wrote:
> Hi Alex,
>
> Thank you for the tutorial!
>
> Alex Kost <alezost@gmail.com> skribis:
>
> > 3. Running "xinit" requires specifying multiple arguments, so you will
> >    probably make an auxiliary script to run it.  This script will look
> >    like this:
> >
> > #!/bin/sh
> >
> > DIR=$HOME/.guix-profile
> >
> > $DIR/bin/xinit -- $DIR/bin/Xorg :0 vt1 -keeptty \
> >                -configdir $DIR/share/X11/xorg.conf.d \
> >                -modulepath $DIR/lib/xorg/modules
>
> I wonder: perhaps we should provide a ‘startx’ service that would
> install in the system profile a script like this?
>
> In fact the ‘xorg-wrapper’ procedure in (gnu services xorg) pretty much
> produces this script.
>
> Thoughts?

FYI: There is patch #68289 for some time now providing something like this
(without the service, just the script).

Have a nice day,
Tomas Volf

--
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [HOWTO] Start X server manually instead of using a login manager
  2024-02-26 14:47   ` Tomas Volf
@ 2024-02-26 17:28     ` Felix Lechner via
  0 siblings, 0 replies; 7+ messages in thread
From: Felix Lechner via @ 2024-02-26 17:28 UTC (permalink / raw)
  To: Tomas Volf, Ludovic Courtès; +Cc: Alex Kost, help-guix

Hi Tomas,

On Mon, Feb 26 2024, Tomas Volf wrote:

> There is patch #68289

Not sure where the message originated, but I use the script below.

Kind regards
Felix

* * *

#!/usr/bin/env -S guile --no-auto-compile -s
!#

(let* ((profile (string-append (getenv "HOME") "/.guix-profile"))
       (virtual-terminal (string-append "vt" (getenv "XDG_VTNR"))))
  (system* "xinit" "--"
           (string-append profile "/bin/Xorg")
           ":0"
           virtual-terminal "-keeptty"
           "-configdir" (string-append profile "/share/X11/xorg.conf.d")
           "-modulepath" (string-append profile "/lib/xorg/modules")))


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-02-26 17:29 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-19 20:33 [HOWTO] Start X server manually instead of using a login manager Alex Kost
2018-07-19 21:56 ` Divan Santana
2018-07-23  7:43 ` Divan Santana
2018-07-23  9:52   ` zloster
2018-07-26 15:34 ` Ludovic Courtès
2024-02-26 14:47   ` Tomas Volf
2024-02-26 17:28     ` Felix Lechner via

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).