(SOLVED) LightDM Default Session and x-session-manager setup

VastOne

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
VSIDO      VSIDO Change Blog    

    I dev VSIDO

PackRat

#1
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.
I am tired of talk that comes to nothing.
-- Chief Joseph

...the sun, the darkness, the winds are all listening to what we have to say.
-- Geronimo

VastOne

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
VSIDO      VSIDO Change Blog    

    I dev VSIDO

PackRat

#3
@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     - 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.
I am tired of talk that comes to nothing.
-- Chief Joseph

...the sun, the darkness, the winds are all listening to what we have to say.
-- Geronimo

VastOne

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...  :-[
VSIDO      VSIDO Change Blog    

    I dev VSIDO

PackRat

#5
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.
I am tired of talk that comes to nothing.
-- Chief Joseph

...the sun, the darkness, the winds are all listening to what we have to say.
-- Geronimo

VastOne

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)
VSIDO      VSIDO Change Blog    

    I dev VSIDO

VastOne

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
VSIDO      VSIDO Change Blog    

    I dev VSIDO

VastOne

#8
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
VSIDO      VSIDO Change Blog    

    I dev VSIDO

PackRat

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.
I am tired of talk that comes to nothing.
-- Chief Joseph

...the sun, the darkness, the winds are all listening to what we have to say.
-- Geronimo

VastOne

(I told you Jed he would figure it out!)

That indeed was my motive Ratman...  8)

Jedi will confirm the basterd I am...  :-*
VSIDO      VSIDO Change Blog    

    I dev VSIDO

PackRat

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
I am tired of talk that comes to nothing.
-- Chief Joseph

...the sun, the darkness, the winds are all listening to what we have to say.
-- Geronimo

jedi

#12
Alas PackRat, he tells the truth!  We discussed this last night, and he clearly stated he would "let ratman have a crack at it"! 



What a wonderful group of people we have here!
Forum Netiquette

"No matter how smart you are you can never convince someone stupid that they are stupid."  Anonymous

PackRat

#13
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

                                ubuntu example for java:  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) -



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.
I am tired of talk that comes to nothing.
-- Chief Joseph

...the sun, the darkness, the winds are all listening to what we have to say.
-- Geronimo

VastOne

#14
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...
VSIDO      VSIDO Change Blog    

    I dev VSIDO