X11-app after su - leads to DISPLAY error

Dec 08, 2023 Last reply: 2 years ago 27 Replies

I may not be understanding correctly, but why not use a different terminal to access the test1 user? Ctrl-Alt-F[2345] to get a new terminal, log in as test1 and then run startx. This would seem, to me, to give you a completely separate, private, X session. I stand ready to be corrected.

Not everybody knows or cares to do that.

Not all Linux / X11 / WM / DE configurations support doing that.

Not all graphics hardware / X11 servers therefor will support that.

It is much more private.

But it's also more disruptive.

There is likely no way to directly share things like the clipboard between the multiple X11 sessions.

I'm sure there are ways to overcome many, if not most, of the problems. But this is an atypical / not out of the box solution that will probably only be acceptable for a few.

Could it work in the proper configuration, absolutely.

Is your average home system / college starter notebook going to support it out of the box? I doubt it.

That should work fine, but remember VT switching doesn't lock screens.

Linux supports terminal switching as standard (AFAIK) - Alt-F[123456] X11 suports Ctl-Alt-F[123456] I don't know about Wayland. If it doesn't that's yet another reason to keep X11.

Obviously this assumes (yes, I know) that your init system supports multiple terminals. LMDE and MX Linux (systemd) and Slackware (init/inittab) do out of the box.

Why would you want to? It's a separate session.

But do you have evidence of that?

>

Yes, Linux is capable of supporting this.

;-)

Support can be a few different things:

1) init system is capable of initializing / starting / managing such a configuration.

2) Vendor provides such a configuration

3) Such vendor provided configuration hasn't been disabled by local admin.

#1 and #2 are what I was thinking of with my previous reply.

#2 does not preclude #3. ;-)

I want to run my email client and my web browser in different environments /and/ I occasionally want to be able to copy and paste between them.

Maybe people will want the ability to copy & paste between them. Maybe they won't.

But copying and pasting is an inherent capability of GUI applications for decades. Thus I think it is prudent to call out when this basic capability likely won't be in place between them.

I have run into graphics cards / X11 display servers that wouldn't run multiple instances for one reason or another.

Be it something as simple as the X11 display server detecting another process running and refusing to start or as complex as the X11 display server maintaining some state in the video hardware and corrupting itself when trying to run multiple instances.

There is no guarantee that you will be able to run multiple X11 display servers on separate virtual terminals.

I mentioned average home system / college starter notebook as examples of lower end hardware which is often more limited and / or more problematic to make do fancier things.

Yes - however there is one important detail. Running startx does not start an X session on the terminal you run it from, it uses the first free virtual terminal - you can detach startx and logout on the terminal you start on. Also to run more than one X server you have to pass startx an argument to tell it what display it is if it isn't the default. It's been a long time since I did this and scripted it in a long lost shell function and I've a feeling there was another fiddly detail but it's all doable, or at least was several years ago. ISTR only one X server got access to DRM.

ACK

This ironically may be a case where the most basic / unaccelerated X server, VGA or frame buffer, would be advantageous.

"Displays" are EVIL - they can cause no end of problems, and the ways to find/deal with them are crude and annoying.

However, that's what we get with multi-user/task.

Best to remember that the first display usually belongs to root ... NOT your desired end-user. As such you can't do stuff THERE and expect it to smoothly carry-over to less-privileged users that pop up later. They each get their OWN displays.

For Linux, esp LXDE, there is the 'autostart' file at /home/pi/.config/lxsession/LXDE-pi and you can put valuable stuff in there and it will use the display for THAT user. If you are daft enough to use Wayland then that goes away and autostart is a FOLDER at /home/pi/.config you have to put ".desktop" files into (with BookWorm fer sure). Recently spent a LOT of time finding this out. It is NOT well documented.

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required