VSIDO Community

VSIDO Support => General Support => Topic started by: VastOne on October 14, 2014, 05:09:21 AM

Title: (SOLVED) LightDM Default Session and x-session-manager setup
Post by: VastOne on October 14, 2014, 05:09:21 AM
LightDM is not behaving as it should ... on any new install it does not recognize FluxBox as the Default Session and spins in a loop until you select FluxBox from the LightDM menu

Yada yada yada...

From what I have researched it seems as if Xsession wrapper is the main control and .xsessionrc is the end goal to make anything see FluxBox as the Default Session

My question is confirmation and correction if I am wrong...

All I am looking for is the way to make sure anything sees fluxbox as the default session in X
Title: Re: LightDM Default Session and .xsessionrc setup
Post by: PackRat on October 14, 2014, 12:29:38 PM
QuoteFrom what I have researched it seems as if Xsession wrapper is the main control and .xsessionrc is the end goal to make anything see FluxBox as the Default Session

I think that is true if you are logging into X with startx or xinit; then the Xsession wrapper (by default) starts the search for files in /home or /etc/X11.

When you use a login manager, the login manager looks in /usr/share/xsessions for *.desktop files (notable exceptions were the early versions of slim which still relied on /home/.xinitrc etc ...).
The default for lightdm is the /usr/share/xsessions/lightdm-xsession.desktop file:

[Desktop Entry]
Version=1.0
Name=Default Xsession
Exec=default
Icon=
Type=Application


setting that "Exec=default" line to use fluxbox as default is the trick.

By design, the first time you select fluxbox from the pull-down menu, lightdm should remember it - use to write a /home/.dmrc file.

I don't know how lightdm interacts with the /etc/alternatives/ x-session-manager or /etc/alternatives/x-window-manager files - if at all. I have never been able to synlink either of those to fluxbox or startfluxbox and have fluxbox be the default.

I just re-installed lightdm on my laptop and it went with openbox as my default. When I logged out and selected fluxbox from the menu, it remembered. Different story when lightdm upgraded on my desktop - got caught in the loop you're talking about. I had to get more aggressive with it and edit the /etc/lightdm.conf file -

Quotechange -

#user-session=default

to

user-session=fluxbox

the fluxbox (or window manager of choice) is the name of /usr/share/<window manager>.desktop without the .desktop part.

One thing I have never been able to find is an accurate flow chart of the X startup procedure comparing startx, xinit, and login managers.
Title: Re: LightDM Default Session and .xsessionrc setup
Post by: VastOne on October 14, 2014, 03:19:05 PM
Quote from: PackRat on October 14, 2014, 12:29:38 PM

One thing I have never been able to find is an accurate flow chart of the X startup procedure comparing startx, xinit, and login managers.

That is precisely what is needed... in reading remarks from the lightdm dev (team?) he constantly references .xsessionsrc as the solution to default session questions but I have yet to find a parallel setup or config that makes it so.  It seems there have been many questions about why lightdm cannot see or use normal procedures (.xinitrc, .xsession etc) to validate what is the default session of the DE/DM.. seems like a straight forward approach to all other DM's but lightDM does not comply
Title: Re: LightDM Default Session and .xsessionrc setup
Post by: PackRat on October 14, 2014, 04:49:29 PM
@vastone -

this guide sort of does it -  http://www.linuxtopia.org/online_books/linux_system_administration/debian_linux_guides/debian_linux_reference_guide/ch-tune.en_027.html  (http://www.linuxtopia.org/online_books/linux_system_administration/debian_linux_guides/debian_linux_reference_guide/ch-tune.en_027.html)    - but reading through those files gets a bit confusing.

what is the output when you run


sudo update-alternatives --config x-session-manager          #openbox-session only for me

and / or

sudo update-alternatives --config x-window-manager         #openbox or i3 for me


in a terminal. My only choice is openbox - apparently provided by /usr/bin/openbox-session. At the very least I have i3 installed from a debian repo. I build my other window managers, including fluxbox, from source with the appropriate flags for my systems.

One file you may want to look at is /etc/X11/Xsession - pretty detailed script with a lot of session files defined. You may know more than I since you were a moderator over there, but I think #! makes heavy use of the /etc/X11 files to set up the user x-session.
Title: Re: LightDM Default Session and .xsessionrc setup
Post by: VastOne on October 14, 2014, 05:33:10 PM
I have nothing but fluxbox installed and this is the output of the requests:

vastone@vsido:~$ sudo update-alternatives --config x-session-manager

update-alternatives: error: no alternatives for x-session-manager


vastone@vsido:~$ sudo update-alternatives --config x-window-manager

There is only one alternative in link group x-window-manager (providing /usr/bin/x-window-manager): /usr/bin/startfluxbox
Nothing to configure.


Being a moderator at #! meant nothing as far as knowing the underlying code or any discussions with the dev, it never happened.  It also was a thankless job...  :-[
Title: Re: LightDM Default Session and .xsessionrc setup
Post by: PackRat on October 14, 2014, 05:43:19 PM
Being a moderator on a linux forum is a thankless job? Go figure  :D

From what I gleaned from any searching I've done in the past, getting fluxbox to be registered as a x-session-manager  with update-alternatives will go a long way to solving the lightdm issue. Reason being, when I first logged in with a clean install of lightdm, it started openbox, and openbox-session is linked to the /etc/alternatives/x-session-manager.

I don't know how to go about doing that.

Edit - false statement; lightdm was logging into openbox because it was reading a $HOME/.xsession file I didn't know existed (my bad for not knowing what dotfiles were installed). Situation resolved in later posts, this thread.
Title: Re: LightDM Default Session and .xsessionrc setup
Post by: VastOne on October 14, 2014, 06:23:00 PM
Also... and the reason for this thread.. it peaked my interest

I knew of this and had always used it in lightdm but through the changes had forgot to reset it...

user-session=fluxbox

BUT for a bit it was working without having that set and I do not know if it was because of having a .xsession or .xinitrc that made it work or if yet another update to lightdm changed the behavior (I personally think it is this)
Title: Re: LightDM Default Session and .xsessionrc setup
Post by: VastOne on October 14, 2014, 07:30:55 PM
I just confirmed that by installing the latest ISO it does not have

user-session=fluxbox

defined in /etc/lightdm/lightdm.conf but it does in fact have FluxBox as the default session on the very first LightDm login

This is a good sign (I think) ...  :P
Title: Re: LightDM Default Session and .xsessionrc setup
Post by: VastOne on October 14, 2014, 09:45:08 PM
The cleanest and sanest method I have found and now tested is to take what lightdm creates for the user in the ~/.dmrc file:


[Desktop]
Language=en_US.utf8
Session=fluxbox


and make it the default from /etc/skel making sure everyone gets it on first login

Problem solved outside of a lightdm upgrade that could change everything...

I just tested this on new builds where it was broken before... works as I want it to but still does not answer why fluxbox is not picked up by X11 as a default session
Title: Re: LightDM Default Session and .xsessionrc setup
Post by: PackRat on October 14, 2014, 10:03:35 PM
That's cool.

But now you have my curiosity piqued on how to make fluxbox the default x-session-manager that resides in /etc/alternatives.
Title: Re: LightDM Default Session and .xsessionrc setup
Post by: VastOne on October 14, 2014, 10:05:22 PM
(I told you Jed he would figure it out!)

That indeed was my motive Ratman...  8)

Jedi will confirm the basterd I am...  :-*
Title: Re: LightDM Default Session and .xsessionrc setup
Post by: PackRat on October 14, 2014, 10:09:48 PM
Quote from: VastOne on October 14, 2014, 10:05:22 PM
Jedi will confirm the basterd I am...  :-*

that's common knowledge; even saw it written on the men's room wall in the Phoenix airport the other day.  :P
Title: Re: LightDM Default Session and .xsessionrc setup
Post by: jedi on October 14, 2014, 10:11:16 PM
Alas PackRat, he tells the truth!  We discussed this last night, and he clearly stated he would "let ratman have a crack at it"! 

(http://en.zimagez.com/miniature/packrat0.png) (http://en.zimagez.com/zimage/packrat0.php)

What a wonderful group of people we have here!
Title: Re: LightDM Default Session and .xsessionrc setup
Post by: PackRat on October 14, 2014, 11:09:26 PM
Partially solved - the app needed should be installed by default.

update-alternatives   debian source:   http://www.debian-administration.org/article/91/Using_the_Debian_alternatives_system (http://www.debian-administration.org/article/91/Using_the_Debian_alternatives_system)

                                ubuntu example for java:  http://mranzorbey.wordpress.com/2013/10/09/ubuntudebian-update-alternatives-command-usage/ (http://mranzorbey.wordpress.com/2013/10/09/ubuntudebian-update-alternatives-command-usage/)

to create the default /etc/alternatives/x-session-manager, what needs to be done is apply update-alternatives and register window managers that do not do this by default - the registration and priority is part of the debian packaging, as near as I can figure.

so as root in a terminal for each window manager

sudo update-alternatives --install "/usr/bin/x-session-manager" "x-session-manager" "/usr/local/bin/fvwm" 1

sudo update-alternatives --install "/usr/bin/x-session-manager" "x-session-manager" "/usr/bin/i3" 1

sudo update-alternatives --install "/usr/bin/x-session-manager" "x-session-manager" "/usr/local/bin/startfluxbox" 2       <-- default for visido will be /usr/bin/startfluxbox


that 1, 2, (or 0) is the priority number for the window manager. I'm not quite sure how that really works, but using 2 makes the window manager default for auto mode (I think, further research needed here).

After those commands are run, I think all the window managers are now properly registered (I can find no direct reference for registering a program as an alternative). In a terminal, you can now run:

sudo update-alternatives --config x-session-manager


to bring up the list (my vsido desktop) -

(http://en.zimagez.com/miniature/wm9.png) (http://en.zimagez.com/zimage/wm9.php)

and make your selection.

Like I stated earlier, on my laptop, openbox-session was registered in /etc/alternatives and lightdm defaulted to that until I edited the /etc/lightdm.conf. So, I'm thinking that getting fluxbox registered in /etc/alternatives will cause lightdm to start it by default.

Much more to research in this area.
Title: Re: LightDM Default Session and .xsessionrc setup
Post by: VastOne on October 14, 2014, 11:58:40 PM
Awesome work RatMan...

I ran this

vastone@vsido:~$ sudo update-alternatives --install "/usr/bin/x-session-manager" "x-session-manager" "/usr/bin/startfluxbox" 2

update-alternatives: using /usr/bin/startfluxbox to provide /usr/bin/x-session-manager (x-session-manager) in auto mode



Then this


vastone@vsido:~$ sudo update-alternatives --config x-session-manager

There is only one alternative in link group x-session-manager (providing /usr/bin/x-session-manager): /usr/bin/startfluxbox
Nothing to configure.


Did I miss something or is there nothing to do on a single DM/DE system?

Quote from: jedi on October 14, 2014, 10:11:16 PM
Alas PackRat, he tells the truth!  We discussed this last night, and he clearly stated he would "let ratman have a crack at it"! 


I have been ratted out...
Title: Re: LightDM Default Session and .xsessionrc setup
Post by: VastOne on October 15, 2014, 12:18:03 AM
Crikey some of this stuff is dated that I am researching...

PackRat note my edit above
Title: Re: LightDM Default Session and .xsessionrc setup
Post by: PackRat on October 15, 2014, 12:31:01 AM
You only have fluxbox installed correct? If so that is right. There is only one so you don't see the list. You can try

sudo apt-get install twm

to add a second wm (no dependencies with twm) and then register it. Should produce a list with fluxbox and twm.

It looks like the priority number can be positive integer greater than 0, and the highest one gets to be default for automode (0 on the list). Openbox is priority 40, so I gave fluxbox 100 so it is now automode default. This is probably a way to keep fluxbox the default in case another WM/DE is installed. If the DE is packaged with a high priority it will overwrite the default; so assign a really high priority to what you want.

I reconfigured my laptop with -

1.  mv $HOME/.xsession  $HOME/.xsession_backup        < -- I didn't know I had this file openbox may have created it; lightdm will use it if it exists

2.  change lightdm.conf back to user-session=default

3. use sudo update-alternatives --config x-session-manager to select fluxbox.

Reboot and select Default from lightdm menu; Hello fluxbox!
Title: Re: LightDM Default Session and .xsessionrc setup
Post by: VastOne on October 15, 2014, 01:57:28 AM
^ Verified!  Nice one PackRat...

The solution was there, understanding it was the journey

Well done sir! I really appreciate you digging till the end...
Title: Re: (SOLVED) LightDM Default Session and x-session-manager setup
Post by: VastOne on October 15, 2014, 03:33:34 AM
For the record I am marking this solved with 3 different ways to get to what we were after and by renaming the subject... this will also assist anyone searching for what we were after in google fu

(PackRat, if you want to make this a How To by all means have at it.. it is your work)

The first method is to edit /etc/lightdm.conf and make sure this:

Quotechange -

#user-session=default

to

user-session=fluxbox

The second solution is to add .dmrc to /etc/skel which in turn gets installed to every user who ever logs in, or copy/create it in ~/home:

.dtrc


[Desktop]
Language=en_US.utf8
Session=fluxbox


And the final and real solution is to remove or rename any .xsession file in /home (and/or /etc/skel) and to run the following:


sudo update-alternatives --install "/usr/bin/x-session-manager" "x-session-manager" "/usr/bin/startfluxbox" 100


and then

sudo update-alternatives --config x-window-manager

Thank you again PackRat for showing once more that we do not run from challenges but demand them!
Title: Re: (SOLVED) LightDM Default Session and x-session-manager setup
Post by: PackRat on October 15, 2014, 12:23:01 PM
This thread can be the HowTo.

Do you have a $HOME/.xsession file? I did not know that file existed on my systems prior to researching the /etc/alternatives system of Debian. The default WM on both my systems was openbox-session so I'm assuming either lightdm or openbox creates this file at some point - kind of bad IMO because, as a configuration file for X, it can conflict with any existing versions of .xinitrc or .xsession that exist (typically in $HOME or /etc/X11)

If you do not have one, try this as a test -

create a $HOME/.xsession with (note that there is no leading #!/bin/sh):

xterm &
exec /usr/bin/startfluxbox


reboot (you can probably just logout if that's more convenient for you, I rebooted to flush any cache associated with an X-session)

Log in with lightdm after selecting default from the pull-down menu. You should end up in a fluxbox session with an xterm at your disposal, and since lightdm (systemd?) handles all the dbus and consolekit stuff, you should still be able to auto mount removable media.

A more generic way to set up fluxbox as default for VSIDO with lightdm as login manaager would be:

1. leave ligfhtdm installed with the defaults, mainly "user-session=default"  -- updates to lightdm tend to overwrite it's config files so this is an install and basically (hopefully) forget

2. Use update-alternatives to set up fluxbox as default

sudo update-alternatives --install "/usr/bin/x-session-manager" "x-session-manager" "/usr/bin/startfluxbox" 100   <-- give it a priority of 100 so it will be default in automode, openbox default is 40

# followed by

sudo update-alternatives --config x-window-manager     <-- if fluxbox is only window manager, you'll get a message that it's default, if you have openbox installed again, be sure to select fluxbox from the list (it will be 1 or 2) do not just go with 0; I don't know why, just seems to work better that way, auto versus manual mode, I suspect.


These two steps were enough to get fluxbox as default on my laptop, but my desktop was stuck in the loop where I was kicked out to the login screen until I selected fluxbox from the list.

3. To avoid that loop, create a $HOME/.xsession with one line:

exec /usr/bin/startfluxbox

put that in /etc/skel

Apparently lightdm looks for the $HOME/.xsession file first, and then moves on to the defaults set up in /etc/X11 and/or /etc/alternatives (really simplistic explanation). That loop where a user is kicked back to the login screen may be a bug in lightdm where it fails if the $HOME/.xsession file does not exist (or is blank?) rather than move on to the system defaults - also, lightdm didn't recognize my $HOME/.xinitrc and log into the default specified there.

The $HOME/.dmrc file is (should be) overwritten every time you log in with lightdm, it's there to remember your last login and sets the selection in the lightdm pull-down menu as far as I know. You can have it set to fluxbox in /etc/skel, but that won't be a permanent fix for a system with more than one WM.

Title: Re: (SOLVED) LightDM Default Session and x-session-manager setup
Post by: VastOne on October 15, 2014, 02:13:12 PM
The .xsession you were seeing with exec ck-launch-session openbox-session was an old remnant from days gone past that was stuck in /etc/skel and never again looked at

It has been removed
Title: Re: (SOLVED) LightDM Default Session and x-session-manager setup
Post by: PackRat on October 15, 2014, 03:25:47 PM
Cool.

What else is in /etc/skel? Perhaps an audit is in order before the next build.

And I confirmed, if $HOME/.xsession exists but is an empty file or has errors - like trying to start a WM that is not installed, lightdm will fail and take you back to the login screen - on my systems anyway. So either use it, or [re]move it.
Title: Re: (SOLVED) LightDM Default Session and x-session-manager setup
Post by: VastOne on October 15, 2014, 03:51:13 PM
/etc/skel is what defines each and every VSIDO desktop and is audited on every build. The remnants of old OpenBox files are leftovers from when we did have open box as a session.I left them for specific reasons that if a person installs open box it would give them a VSIDO desktop . These will all be removed now
Title: Re: (SOLVED) LightDM Default Session and x-session-manager setup
Post by: statmonkey on October 15, 2014, 11:09:54 PM
Just starting to read through this thread.  Excellent work as always and greatly appreciate the learning opportunity.  I feel a little better armed than I was and thank you PackRat for following through to the bitter end your effort is a big help.
Title: Re: LightDM Default Session and .xsessionrc setup
Post by: statmonkey on October 15, 2014, 11:33:30 PM
Quote from: VastOne on October 14, 2014, 05:33:10 PM
Being a moderator at #! meant nothing as far as knowing the underlying code or any discussions with the dev, it never happened.  It also was a thankless job...  :-[

I am sure it was meaningless but I promise it wasn't thankless.  ;)   I thanked you several times .... errr I think I did.  If I didn't then "THANK YOU!!!"  You did some pretty good stuff over there.
Title: Re: (SOLVED) LightDM Default Session and x-session-manager setup
Post by: VastOne on October 16, 2014, 12:36:02 AM
@PackRat
Quote
The $HOME/.dmrc file is (should be) overwritten every time you log in with lightdm, it's there to remember your last login and sets the selection in the lightdm pull-down menu as far as I know. You can have it set to fluxbox in /etc/skel, but that won't be a permanent fix for a system with more than one WM.

The goal and the very reason for this journey is to make sure FluxBox is the very first VSIDO experience on the first boot, then the vsido-welcome script ... 

After that, it is all on you!

@statmonkey

I appreciate that man.. seems a hundred years ago now   ;)
Title: Re: (SOLVED) LightDM Default Session and x-session-manager setup
Post by: airtime on October 16, 2014, 07:44:01 AM
i hate you geniuses hahaha -- I have been pulling my hair out all week trying to figure this out. I finally decided to come to the forum and found I wasnt the only one. lighdm was stuck in a loop and i had to log into the terminal and run startx.

wow  ???
Title: Re: (SOLVED) LightDM Default Session and x-session-manager setup
Post by: ozitraveller on December 22, 2014, 05:32:30 AM
Just wanted to say thanks here to everyone who contributed, this was the missing piece to bring my wheezy live-builds up to jessie.  ;D

I now have a fluxbox beta 2 version out here:
http://sourceforge.net/projects/linnix/files/?source=navbar (http://sourceforge.net/projects/linnix/files/?source=navbar)

Ozi