You are not logged in.

#1 2015-10-19 19:47:35

NeiHuem
Member
Registered: 2015-10-15
Posts: 5

lightdm / dm-tool user switch / nitrogen

As this is the awkward combination of both a suggestion and a bug report, I thought I put it here.

The suggestion part:

On my machine, I have set up two user accounts for me: one "strict" with all the important stuff and access to email etc., and one "loose" to try out things and surf in the wild. Switching accounts is a frequent thing for me.

A raw install of BL RC1 doesn't appear to support this: the options provided via "openbox menu > exit" are log out, suspend, reboot, power off.

Now lightdm comes with the dm-tool script. In the console,

dm-tool switch-to-greeter

will bring you to a greeter that allows you to log into whatever account is available. If there is already a session running for that user, you'll enter that session; otherwise, a new session is started.

After adding 12 lines of code to /usr/bin/bl-exit ...

    (...)
    
    def switch_action(self,btn):
        self.disable_buttons()
        self.status.set_label("Starting new session, please standby...")
        os.system("dm-tool switch-to-greeter")
        gtk.main_quit()

    (...)

        #Switch button
        self.switch = gtk.Button("_Switch user")
        self.switch.set_border_width(4)
        self.switch.connect("clicked", self.switch_action)
        self.button_box.pack_start(self.switch)
        self.switch.show()

    (...)

... I can now switch users via standard GUI.

I'd think this would be a good standard feature for BL.


The bug report part:

While dm-tool generally works like a charm (e.g., ecryptfs auto-unlocks as it should, menu.xml is applied, running apllications are still open), there is an unexpected behaviour which I lack knowledge to trace back to its cause.

It's immediately visible: the custom wallpaper is gone, it's BL default now.

[Edit: see explaniation in follow-up post. Only symptom description and guessing here.]

In ~/.config/nitrogen, the original bg-saved.cfg:

[:0.0]
file=/path/to/std-bg.png
mode=5
bgcolor=#000000

After starting the session via dm-tool switch-to-*, bg-saved.cfg still looks the same, the file is stll accessible, but no wallpaper is seen.

When setting a new background now, nitrogen adds a new entry to bg-saved.cfg:

[:0.0]
file=/path/to/std-bg.png
mode=5
bgcolor=#000000

[:1.0]
file=/path/to/new-bg.png
mode=5
bgcolor=#000000

Having set that, when logging in as first session on the machine, nitrogen will choose the [:0.0] entry; when logging in as first session on  the machine, nitrogen will choose the [:1.0] entry.

I never had to care about X server etc., so I can only guess that dm-tool changes something in the display/screen settings, so that the 2nd session is started on a new "virtual 2nd display" or something. I don't have the environment to check that out with two real monitors - I'm on a laptop here (HP 250G3).

Would be really nice if somebody could explain to me the [:0.0] / [:1.0] part of nitrogen's bg-saved.cfg, or even dig into the whole issue.

Which commands would I use to find out about screen IDs or the like? `dm-tool list-seats` always shows one seat with one resp. two sessions, no surprises here. To find the right X-server command is ... not intuitive; I gave up on that after digging through lots of man pages.

Last edited by NeiHuem (2015-10-20 00:23:21)

Offline

#2 2015-10-20 00:19:04

NeiHuem
Member
Registered: 2015-10-15
Posts: 5

Re: lightdm / dm-tool user switch / nitrogen

What happens is that when a new session is started via "dm-tool switch-to-*", the new session is assigned a new X screennumber. Nitrogen, when confronted with a new screennumber, adds a new entry to bg-saved.cfg for this screen and fills it with standard values.

One can just assign a new wallpaper for that screen and everything is fine again.

Just that it's not exactly elegant.

Btw, I checked with an Ubuntu/XFCE install: when switching users there, a new X displaynumber is assigned.

Offline

#3 2015-10-20 01:21:12

tknomanzr
BL Die Hard
From: Around the Bend
Registered: 2015-09-29
Posts: 1,057

Re: lightdm / dm-tool user switch / nitrogen

It would be easy enough to create a script to set the background to the previous seat's wallpaper. However, I would think it would be good to have a separate wallpaper per seat to remind you which user you are logged in too. It would be basically the same as keeping  a different gtk/ob theme set to remind me when I am working as root.

Offline

#4 2015-10-20 03:47:38

NeiHuem
Member
Registered: 2015-10-15
Posts: 5

Re: lightdm / dm-tool user switch / nitrogen

Sure,individual wallpapers per user is a good thing, I do that too.

But I seem to have failed in stating the problem.

Here is a usecase:

----------------------------
situation: 2 users on 1 laptop; user1 has set up a custom wallpaper

start machine

login as user1
--> you get user1's custom wallpaper
logout

login as user2
in terminal: dm-tool switch-to-greeter
login as user1
  (now both user2 and user1 are logged in)
  --> you get the BL standard wallpaper (*1)
in terminal: dm-tool switch-to-greeter
login as user2
logout
login as user1
  (now only user1 is logged in)
  --> you still get the BL standard wallpaper (*2)
logout

login as user1
  (now only user1 is logged in)
  --> you get user1's custom wallpaper again (*3)

(*1) because you're on a new display now, $DISPLAY is :1, and nitrogen has silently added an entry for that new display to saved-bg.cfg under "[0:1]"
(*2) because your session is kept on the same display, $DISPLAY is still :1, so nitrogen reads the entry it had silently added
(*3) because there is only one display around again, you're assigned the first free display, $DISPLAY is :0
------------------------------------

So it's about having, unexpectedly, two different wallpaper settings for one user, depending on how many other users are currently logged in.

Of course you can edit that new entry; but to do so, you first have to know what happened. In the first moment, it simply looks like the custom wallpaper disappeared.

I agree that it's fairly simple to automatically clone the user's custom nitrogen settings when a new display shows up. Could there be caveats with that approach?

Also, there was some unexpected behaviour of tint2 when I restarted it while logged in as second user ($DISPLAY=:1). But that may well be a misconfiguration on my side, as tint2 is new for me. I'll check that out.

Offline

#5 2015-10-20 04:32:51

tknomanzr
BL Die Hard
From: Around the Bend
Registered: 2015-09-29
Posts: 1,057

Re: lightdm / dm-tool user switch / nitrogen

I think the caveat might be, if I understand you correctly, is that Nitrogen is over-writing its config file when you log out. So your logout actions would also need a script to back the file up somehow or you would lose those settings.

In /etc/lightdm/lightdm.conf there are some settings which will run a script of your choosing upon login and logout.

Check it out here:

So my thoughts would be, upon logout, backup nitrogen's config file at ~/.config/nitrogen/bg-saved.cfg. You could simply use mv to rename it to something like bg-saved.cfg.bak.

Upon login, check to see it bg-saved.cfg.bak exists, and if so use mv to rename it to bg-saved.cfg then run nitrogen --restore, to restore the wallpaper. I haven't tried it to see if it would work but I think that would be the gist of it.

At least this approach would prevent Nitrogen from overwriting your configs when you logout (lose a seat). What I would expect to happen in that case is that Nitrogen will litter your .xsession-errors with messages about failing to set the background for the second login.

One last thing: Lightdm will run the scripts you specify as root. In order to properly restore a wallpaper, you would need to run the nitrogen restore command as the $USER you just logged in as. See the bottom of that post I listed for you to see an example of how to do that. I would actually run both scripts are your currently logged in $USER. Reason being, you don't want your scripts to change ownership of bg-saved.cfg to root.

Last edited by tknomanzr (2015-10-20 04:49:23)

Offline

#6 2015-10-20 05:22:46

tknomanzr
BL Die Hard
From: Around the Bend
Registered: 2015-09-29
Posts: 1,057

Re: lightdm / dm-tool user switch / nitrogen

Further testing leads me to wonder how you setup your second user. You would want to use adduser as such:

adduser bob

adduser should copy all of the BunsenLabs config files out of /etc/skel and populate your new user directory properly. Testing showed me that Nitrogen then correctly remembers which wallpapers go to which user as they each have unique configs, along with presumably anything else I would want to change per user. Further testing shows dm-tool switch-to-greeter also working. Final test shows it works as expected from the menu as well (I modified mine with your source.) Did you do something unusual when you set up your second user?

Offline

#7 2015-10-20 06:50:19

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 8,759
Website

Re: lightdm / dm-tool user switch / nitrogen

NeiHuem wrote:

Which commands would I use to find out about screen IDs

echo $DISPLAY

“Et ignotas animum dimittit in artes.” — Ovid, Metamorphoses, VIII., 18.

Forum Rules   •   How to report a problem   •   Software that rocks

Offline

#8 2015-10-20 08:13:47

nobody0
Disabled account
Registered: 2015-09-29
Posts: 664

Re: lightdm / dm-tool user switch / nitrogen

tknomanzr wrote:

...adduser should copy all of the BunsenLabs config files out of /etc/skel and populate your new user directory properly.

That is, if you have anything in your /etc/skel, I suppose

Offline

#9 2015-10-20 09:34:27

damo
....moderator....
Registered: 2015-08-20
Posts: 6,566

Re: lightdm / dm-tool user switch / nitrogen

@OP Have you tried using feh instead of nitrogen?


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#10 2015-10-20 10:00:09

nobody0
Disabled account
Registered: 2015-09-29
Posts: 664

Re: lightdm / dm-tool user switch / nitrogen

When you install additional users, Bunsen configs don't work, but what is in /etc/xdg/user-dirs.defaults
This is a problem, which arises from placing skel in /usr/share/bunsen and not pointing at it for further user creation.

Last edited by nobody0 (2015-10-20 10:01:36)

Offline

#11 2015-10-20 10:23:48

damo
....moderator....
Registered: 2015-08-20
Posts: 6,566

Re: lightdm / dm-tool user switch / nitrogen

^ Have you posted this as a Bug Report?


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#12 2015-10-20 10:52:43

nobody0
Disabled account
Registered: 2015-09-29
Posts: 664

Re: lightdm / dm-tool user switch / nitrogen

damo wrote:

^ Have you posted this as a Bug Report?

No, I just looked in the /usr/lib/bunsen, /usr/share/bunsen, after reading OP's problem.

Offline

#13 2015-10-20 13:07:00

tknomanzr
BL Die Hard
From: Around the Bend
Registered: 2015-09-29
Posts: 1,057

Re: lightdm / dm-tool user switch / nitrogen

I got expected behavior when using adduser last night. I am thinking if I were to use useradd instead, then not specify /usr/share/bunsen/skel with the --skel flag, I might be able to create a HOME directory that was not Bunsenified. Here is the relevant info from man useradd and /etc/default/useradd:

-k, --skel SKEL_DIR
           The skeleton directory, which contains files and directories to be copied in the user's home directory, when the home directory is created by
           useradd.

           This option is only valid if the -m (or --create-home) option is specified.

           If this option is not set, the skeleton directory is defined by the SKEL variable in /etc/default/useradd or, by default, /etc/skel.

/etc/default/useradd

           
If possible, the ACLs and extended attributes are copied.

# The SKEL variable specifies the directory containing "skeletal" user
# files; in other words, files such as a sample .profile that will be
# copied to the new user's home directory when it is created.
# SKEL=/etc/skel
#

I am thinking /etc/default/useradd should have /usr/share/bunsen/etc set in the line that goes SKEL=/etc/skel in order to cover cases where people use useradd instead of adduser to create a new user. Of course, it might be wise to wait for OP to respond before we run off to raise an issue, however, I can already see that useradd is pointing to /etc/skel by default.

Offline

#14 2015-10-20 17:04:19

nobody0
Disabled account
Registered: 2015-09-29
Posts: 664

Re: lightdm / dm-tool user switch / nitrogen

The /etc/skel directory contains files and directories that are automatically copied over to a new user's home directory when such user is created by the useradd program. On some systems this program might be called adduser.

The /etc/skel allows a system administrator to create a default home directory for all new users on a computer or network and thus to make certain that all users begin with the same settings or environment.

The location of /etc/skel can be changed by editing the line that begins with SKEL= in the configuration file /etc/default/useradd. By default this line says SKEL=/etc/skel.

So, in BunsenLab's case, shouldn't it be SKEL=/usr/share/bunsen/skel?

Offline

#15 2015-10-20 17:39:21

damo
....moderator....
Registered: 2015-08-20
Posts: 6,566

Re: lightdm / dm-tool user switch / nitrogen

^ NB `useradd` is a low-level binary, `adduser` is a perl script which uses `useradd` as a backend. They are different programs.


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#16 2015-10-20 18:05:18

nobody0
Disabled account
Registered: 2015-09-29
Posts: 664

Re: lightdm / dm-tool user switch / nitrogen

^ Or take the skel off /usr/share/bunsen and place it in /etc/skel, then adding any amount of users with the same configurations and environment would not be a problem.   

I agree, normally we should use adduser as root, if we want to give the new user home folders and other settings.

Offline

#17 2015-10-20 18:13:11

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 8,759
Website

Re: lightdm / dm-tool user switch / nitrogen

ostrolek wrote:

normally we should use adduser as root, if we want to give the new user home folders and other settings.

Everything done with adduser(8) (configured in /etc/adduser.conf) can also be done with useradd(8) with a few added flags (as explained by tknomanzr).

useradd(8) is generally only used in scripts because it is non-interactive, unlike adduser(8)

The /etc/skel issues have already been discussed at length in the #! forums and the current path was decided by johnraff to maintain compatibility with the upstream Debian /etc/skel layout (AFAIUI).


“Et ignotas animum dimittit in artes.” — Ovid, Metamorphoses, VIII., 18.

Forum Rules   •   How to report a problem   •   Software that rocks

Offline

#18 2015-10-20 18:24:40

tknomanzr
BL Die Hard
From: Around the Bend
Registered: 2015-09-29
Posts: 1,057

Re: lightdm / dm-tool user switch / nitrogen

Yeah he had his reasons for setting it up that way. I was simply pointing out that if one were to choose to use useradd and didn't set their flags properly then they could come up with a HOME directory that did not have Bunsen configs at all. This could be avoided by placing SKEL=/usr/share/bunsen/skel into /etc/default/useradd.

I noticed that while attempting to help the OP. All of my tests indicate his user-switching implementation should work. Nitrogen behaves as expected, etc. I can only conclude that something is odd about the way he set his second user up, like maybe the second user doesn't have a HOME directory or something.

Offline

#19 2015-10-20 18:31:32

nobody0
Disabled account
Registered: 2015-09-29
Posts: 664

Re: lightdm / dm-tool user switch / nitrogen

^ /etc/adduser.conf also points to the /etc/skel

Offline

#20 2015-10-22 02:54:39

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 7,847
Website

Re: lightdm / dm-tool user switch / nitrogen

tknomanzr wrote:

if one were to choose to use useradd and didn't set their flags properly then they could come up with a HOME directory that did not have Bunsen configs at all.

Have you actually found this behaviour? If so please post it as a bug. Any newly created user should have no flags and the first time they login, lightdm's configured triggering of bl-setup should install all the bunsen config files from its custom location without adjusting basic system settings at all.

/etc/lightdm/lightdm.conf:

session-setup-script=/usr/lib/bunsen/bunsen-configs/bl-user-setup

It was set up this way to make it easier for sysadmins to create a user without the BL configs (just create ~/.config/bunsen/bl-setup), and to avoid filling /etc/skel with too much stuff.

Last edited by johnraff (2015-10-22 02:58:00)


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), idle Twitterings and GitStuff )

Introduction to the Bunsenlabs Lithium Desktop

Offline

#21 2015-10-22 02:59:31

tknomanzr
BL Die Hard
From: Around the Bend
Registered: 2015-09-29
Posts: 1,057

Re: lightdm / dm-tool user switch / nitrogen

I will test it to be sure for you. I know adduser worked properly for me. If lightdm is triggering the setup then it is likely a moot point. It was a guess based on what I saw of the source + man pages combined with the fact that I am unable to replicate the op's problem. FWIW, his user-switching works great for me  ops

Offline

#22 2015-10-22 03:59:53

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 7,847
Website

Re: lightdm / dm-tool user switch / nitrogen

FWIW I've just done a quick test with adduser and the new user got a complete BL setup, no problem.

IMHO anyone who needs to use useradd ought to be able to deal with any issues that come up.


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), idle Twitterings and GitStuff )

Introduction to the Bunsenlabs Lithium Desktop

Offline

#23 2015-10-22 04:57:22

tknomanzr
BL Die Hard
From: Around the Bend
Registered: 2015-09-29
Posts: 1,057

Re: lightdm / dm-tool user switch / nitrogen

Good deal.

Offline

#24 2015-10-22 06:00:41

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 7,847
Website

Re: lightdm / dm-tool user switch / nitrogen

BTW

ostrolek wrote:

When you install additional users, Bunsen configs don't work, but what is in /etc/xdg/user-dirs.defaults
This is a problem, which arises from placing skel in /usr/share/bunsen and not pointing at it for further user creation.

This is not true. Please check the facts before making statements like this.


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), idle Twitterings and GitStuff )

Introduction to the Bunsenlabs Lithium Desktop

Offline

#25 2015-10-22 07:15:42

nobody0
Disabled account
Registered: 2015-09-29
Posts: 664

Re: lightdm / dm-tool user switch / nitrogen

^ The question started with Nitrogen not working as it should be, when creating another user.  Yes, it should be checked out.

Offline

Board footer

Powered by FluxBB