3

On my Ubuntu 14.04 virtual machine compiz freezes often. I usually swtich to tty1 and kill the process, then switch back to tty7 and, if I can see a terminal window, I run compiz --replace & in it. But there are times when I don't see any terminal window, and right clicking on the desktop doesn't give any menu so I can open one and I have to restart lightdm service. This is work blocking.

My question is: how can I run compiz --replace & or any other command from a different tty on tty7?

I read this thread, but I don't know how to make tmux connect to a different tty on my machine, and the second one involves using the homebrew program. I also read this, but it involves having a daemon run on tt7 expecting for my commands. Isn't there any easier way to do this?

Alex Burdusel
  • 563
  • 4
  • 8

1 Answers1

4

What matters is actually not what console you run the command from, but that you tell the program to connect to the still-existing X display. To do this, set the DISPLAY variable and restart Compiz from a standard terminal. Depending on your distribution and configuration, you may need to set XAUTHORITY as well. Switch to tty1 and type:

$ export DISPLAY=:0
$ compiz --replace &

The display may be different on your machine. Use who to find yours:

$ who
you     tty1    [time]             < This is you from tty1.
you     :0      [time] (:0)        < This is you from tty7.

        ^^              ^^
   This is your display on tty7

Note: you must be logged in as yourself on tty7 (graphically). Fortunately, when Compiz crashes, you are not disconnected from tty7 (even though you can't do much).

Gilles 'SO- stop being evil'
  • 807,993
  • 194
  • 1,674
  • 2,175
John WH Smith
  • 15,500
  • 6
  • 51
  • 62
  • this doesn't seem to work or there is some other problem: `$compiz (core) - Info: Loading plugin: core compiz (core) - Info: starting plugin: core` than it hangs. All this in the tty1 terminal – Alex Burdusel Nov 03 '14 at 14:25
  • 1
    @Burdu I wouldn't expect to see anything else in the terminal. The new instance of Compiz is now running. What is the effect on the GUI? Maybe you need to [set `DBUS_SESSION_BUS_ADDRESS`](https://unix.stackexchange.com/questions/28463/run-a-dbus-program-in-crontab-how-to-know-about-the-session-id/28496#28496) as well. – Gilles 'SO- stop being evil' Nov 03 '14 at 23:02
  • compiz does not get reloaded in tty7; nothing changes. – Alex Burdusel Nov 04 '14 at 09:09