35

My question is pretty much the title. I often use TTYs for handling different matters in parallel. This could be for instance:

  • something local on TTY1
  • per SSH on ServerA on TTY2
  • per SSH on ServerB on TTY3
  • network surveillance on TTY4
  • desktop GUI on TTY7

There are cases however, when it would be nice to have 1 desktop each on different TTYs. Like for example:

  • instance 1 with XFCE/Unity/Kde on TTY7
  • instance 2 with XFCE/Unity/Kde on TTY8

Is that possible?

5
  • If I understand your question, I think you may be asking something I wondered about several years ago when I first realized I had all these terminal windows (I still never use) behind ctrl-alt F1-F6. I wondered if that meant it was possible to essentially load the GUI multiple times or to shell directly to another operating system, rather like I currently do with my chromebook where I can directly swap between Chrome OS and Ubuntu/unity. I'll be following this question because I would honestly like to find out.
    – gyropyge
    Dec 18, 2014 at 7:12
  • @gyropyge Yet, as far as I understand, the different TTYs are non-other than just another view towards the terminal. But it would be nice to know, whether they could be used in a more flexible way, than just black and white terminal letters. Dec 18, 2014 at 7:16
  • Ordinarily when I need a terminal I hit ctrl-alt-T and bring up a terminal in a window. Most of the time it suits my meager needs and on those rare occasions I need a bigger one, make it bigger. I've always suspected the big six we are discussing have some advantage such as a higher cpu priority, but something that doesn't affect me for the odd need to install something I simply cannot install directly by means of the software center. The closest thing I've some so far to what you are talking about was when I set up VMware, which I only used to install windows, which I don't use anyway.
    – gyropyge
    Dec 18, 2014 at 7:24
  • @gyropyge in the old days it was possible but lightDM (what we use now) is -hardcoded- to tty7. You can change it to another tty but it is still ONE DE.
    – Rinzwind
    Dec 18, 2014 at 7:49
  • Although it's not exactly what you asked for, KDE has a feature called Activities. When you switch activities, you get a whole new set of desktops, possibly setup quite differently from your default. This sort of does the same thing as what you're asking for, but, AFAIK, does stay within one X session.
    – Joe
    Dec 25, 2014 at 1:23

2 Answers 2

30

Yes and no.

Setting aside TTY/PTS parts of the conversation...

Yes you can run more then one Xorg instance.

X :1
X :2
X :3

would start 3 new Xorg sessions on display ports 1,2, and 3

You can run damn near any command by setting the DISPLAY variable.

so DISPLAY=:1 xterm would start xterm on display port 1

Your "default" desktop is display port 0 (:0)

Now for the no part.

Unity is not a great desktop environment. As much as some people like it it really departs from a lot of things that make Linux awesome. One of those things, is that it assumes that it will be only running once. So starting Unity on many display ports usually produces tons of errors as both "environments" fight over settings and such.

KDE used to have the same problem (it still might). XFCE and other "more traditional" desktop environments usually work fine, or at the very least, work as one instance per user logged in.

So yes you can run several GUI sessions at once in different TTY/PTY and access them by pressing CTRL+ALT+F7-F12 (depending on kernel settings).

2
  • 3
    +1. As an additional data point, gnome has basically the same problem --- it's not designed so that you can start multiple sessions for the same user (a pity, especially when connecting remotely). Probably a basic limitation of DBus and Gsettings idea... But you can use some other more "oldish" window manager on the other graphical sessions, like in askubuntu.com/a/519164/16395, or simply using another user on the additional graphical sessions.
    – Rmano
    Dec 18, 2014 at 8:32
  • 1
    @coteyr I had no idea anything higher than ctrl-alt-F7 worked. Thank you for the other desktops! I will be checking out what else I can do as soon as things slow down.
    – gyropyge
    Dec 18, 2014 at 9:32
16

Yes you may start a new GUI in a different TTY. From the default Ubuntu TTY (number 7), switch to another TTY (number 3 in this example) by pressing:

Ctrl+Alt+F3

Provide your username and password and then start a new X session, using the same number of the present TTY:

startx -- :3
2
  • 11
    Be careful on starting a second Unity/Gnome/KDE session with the same user. Havoc can arise...
    – Rmano
    Dec 18, 2014 at 8:38
  • 3
    Yes, and in my experience things may also go wrong with KDE (it might not even start). But those are issues related to the DE themselves, in abstract this is basic X/Linux functionality that is also present in Ubuntu. Dec 18, 2014 at 9:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .