Xfce 4.10 without display manager on trisquel 7

2 replies [Last post]
amrprznu
Offline
Joined: 08/12/2013

Fellows,

I only found this: https://trisquel.info/en/forum/trixquel-trisquel-con-xfce
which is in Spanish and is blocked. I want to share how I manged to do this, and I don't know if I should make a new manual for it. So, I will show it in the next post, just in case that I have to change something. Let me know if this is the right way to post this info, or I should create the manual.

amrprznu
Offline
Joined: 08/12/2013

Let me know if it worked or if you can improve it.

= 1. Remove any display manager =

sudo aptitude purge {{g,x,w,lx,light,k}dm,slim}
sudo mv /etc/{lightdm,gdm} /tmp

= 2. Install all of xfce4 that you like =

If you have problems installing xfce4-session due to trisquel-desktop-common-data, you can force installation like this:

 sudo aptitude install -o Dpkg::Options::="--force-all" xfce4-session

== Consider the following ==

http://wiki.gentoo.org/wiki/Xfce#Additional_applications

= 3. Install libpam-ck-connector=

sudo aptitude install libpam-ck-connector

[as per https://wiki.debian.org/Xfce]
This is required to mount and unmount drives from your session. The current version of Trisquel uses DBus, and this is needed to grant permissions through consolekit. "ConsoleKit is a D-Bus daemon and creates for each PAM session an
own session." [http://wiki.gentoo.org/wiki/ConsoleKit]. ConsoleKit will be dropped in favour of systemd later: "ConsoleKit is currently not actively maintained. The focus has shifted to the built-in seat/user/session management of Software/systemd called systemd-logind!" [http://www.freedesktop.org/wiki/Software/ConsoleKit/] [http://askubuntu.com/questions/362403/how-to-create-a-new-logind-session-while-running-xinit-from-the-console]. If you want to try without ConsoleKit, this may help: [https://wiki.archlinux.org/index.php/Systemd/User] [https://mail.gnome.org/archives/desktop-devel-list/2014-January/msg00079.html] [http://lists.freedesktop.org/archives/systemd-devel/2014-March/017552.html]

=4. Make sure the following is in /etc/pam.d/common-session before pam_ck_connector.so=

[https://wiki.debian.org/Xfce] (disregard the lines with ---):

session optional pam_loginuid.so

(you can run the following line to do so)

grep 'session[[:space:]]*optional[[:space:]]*pam_loginuid.so' /etc/pam.d/common-session || sudo sed -i 's/\(.*pam_ck_connector.so\)/session optional pam_loginuid.so\n\1/g' /etc/pam.d/common-session

=5. Make sure there is no $HOME/.xinitrc (or that it sources /etc/X11/Xsession) and remove ~/.bash_profile and ~/.bash_login. Then create a $HOME/.profile =

These are the contents of $HOME/.profile:

# ~/.profile: executed by the command interpreter for login shells.
# The login to a virtual terminal without a display manager is handled
# by upstart in Trisquel and Ubuntu by means of the /etc/init/ttyXX.conf
# files. These normally run getty (agetty) which "opens a tty port,
# prompts for a login name and invokes the /bin/login command"
# [man getty].
# This file is not read by bash(1), if ~/.bash_profile or
# ~/.bash_login exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.
#
# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022

# if running bash
if [ -n "$BASH_VERSION" ]; then
  # include .bashrc if it exists
  if [ -f "$HOME/.bashrc" ]; then
    . "$HOME/.bashrc"
  fi
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
  PATH="$HOME/bin:$PATH"
fi

# No display manager autologin with Xfce4
# Check that no display managers exist
if [ -f /usr/bin/startxfce4 ] &&\
  [ ! -f /etc/lxdm/lxdm.conf ] &&\
  [ ! -f /etc/xdg/lubuntu/lxdm/lxdm.conf ] &&\
  [ ! -f /etc/kde4/kdm/kdmrc ] &&\
  [ ! -d /etc/lightdm ] &&\
  [ ! -d /etc/gdm ]; then
    # Begin a graphical interface only in tty1 (CTRL + ALT + F1) and tty2
    [[ -z $DISPLAY  && $XDG_VTNR -le 2 ]] && exec startx -- vt$XDG_VTNR
fi

Explanation for -- vt$XDG_VTNR (vt1, for example):

 1. startx initialises an X server and sources ~/.xsession. Some
references suggest using ~/.xinitrc, but the Debian webpage for
Xfce https://wiki.debian.org/Xfce--Trisquel is based on Ubuntu,
and Ubuntu is based on Debian--suggests not to use ~/.xinitrc. If
~/.xinitrc exists, it doesn't read the default configuration
(/etc/X11/xinit/xinitrc [man startx], which basically sources
/etc/X11/Xsession [read the contents of the file]). However,
the session script can be contained in .xsession without a problem
 2. startx -- (from man pages):
Arguments immediately following the startx command are used to start a
  client in the same manner as xinit(1). The special argument '--' marks
  the end of client arguments and the beginning of server options.
 3. $XDG_VTNR: number of the current virtual terminal
 4. vtXX XX specifies the Virtual Terminal device number which Xorg will
  use. Without this option, Xorg will pick the first available
  Virtual Terminal that it can locate. This option applies only
  to platforms that have virtual terminal support, such as Linux,
  BSD, OpenSolaris, SVR3, and SVR4. [man Xorg]
 5. startx -- vt$XDG_VTNR: if the graphical environment is started in another terminal,
  dbus doesn't recognise it as the active session and permissions are lost.
  (see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=747882)
 6. exec startx: ensures that when the user logs out, the session is finished

6. Create $HOME/.xsession:

if [ -f /usr/bin/startxfce4 ] &&\
  [ ! -f /etc/lxdm/lxdm.conf ] &&\
  [ ! -f /etc/xdg/lubuntu/lxdm/lxdm.conf ] &&\
  [ ! -f /etc/kde4/kdm/kdmrc ] &&\
  [ ! -d /etc/lightdm ] &&\
  [ ! -d /etc/gdm ]; then
    ck-launch-session dbus-launch --exit-with-session startxfce4
fi;

What the last line does is create a session with
a cookie and run anything that it's in front of it within that
session, that is, within a PAM session, run the message bus for
startxfce4 and close it when logged out

More Explanations

THERE IS NO DOCUMENTATION ON ck-launch-session!, but the code can
be found here: http://cgit.freedesktop.org/ConsoleKit/tree/tools/ck-launch-session.c

- ConsoleKit integration for startx
[http://wiki.gentoo.org/wiki/ConsoleKit#ConsoleKit_integration_for_startx]

If you want to start the X-server manually with startx (instead of
using a display manager), you have to create the ConsoleKit session
yourself. Therefore create the following .xinitrc for your user:

exec ck-launch-session dbus-launch --sh-syntax --exit-with-session YOUR_COMMAND

"ConsoleKit is a D-Bus daemon and creates for each PAM session an
own session." http://wiki.gentoo.org/wiki/ConsoleKit

"ConsoleKit is currently not actively maintained. The focus has
shifted to the built-in seat/user/session management of
Software/systemd called systemd-logind!"
[http://www.freedesktop.org/wiki/Software/ConsoleKit/].
See also:
http://askubuntu.com/questions/362403/how-to-create-a-new-logind-session-while-running-xinit-from-the-console

- To do it without ConsoleKit (it's still being developed):
https://wiki.archlinux.org/index.php/Systemd/User
(read https://mail.gnome.org/archives/desktop-devel-list/2014-January/msg00079.html
http://lists.freedesktop.org/archives/systemd-devel/2014-March/017552.html)

May be (will check later) this to avoid permission issues

other than mounting, suspend, hibernate and power off in /etc/polkit-1/localauthority.conf.d/60-desktop-policy.conf [man pklocalauthority] (replace lisa or marge for your username, see manual of polkit):
[Configuration]
AdminIdentities=unix-user:lisa;unix-user:marge

*Update: this last part is not needed, it's included in /etc/polkit-1/localauthority.conf.d/51-ubuntu-admin.conf

And that's the penguin!

a_slacker_here
Offline
Joined: 06/29/2013

I would suggest you to make a new wiki page with this information.