Search code examples
python-3.xpycharmx11isolationschroot

start x11 session in schroot beside the standard x11 session


I recently started development with Python 3 and opencv. Since opencv has to compiled manually to get Python 3 support I created a separate development environment using schroot which is pretty helpful to try out building libs without messing up the host system along the process. As long as the build-tools stay inside the chroot'ed shell everything works as expected. But when I start an x11 application like Pycharm inside the chroot environment it gains access to everything (i guess because it's using the x11 session of the host system). How to keep my development environment completely isolated?

  • Can I start a second but isolated x11 session just for my IDE?
  • Did I miss some configuration options? (i use minimal schroot profile + pts mounted)

Solution

    1. You could use XNest or Xephyr a xserver in a window,

      First you have to create some authorization file:

      touch $HOME/.Xephyr_auth_1
      Xephyr -auth $HOME/.Xephyr_auth_1_1 :1 &
      xpid=$!
      xauth -f $HOME/.Xephyr_auth_1 generate :1 . trusted
      kill $xpid
      

      Then run your server with apropriated options...

      Xephyr -auth $HOME/.Xephyr_auth_1 -screen 1280x800 :1 &
      xpid=$!
      DISPLAY=:1 XAUTHORITY=$HOME/.Xephyr_auth_1 metacity &
      DISPLAY=:1 XAUTHORITY=$HOME/.Xephyr_auth_1 firefox -profileManager -fullscreen
      

      Once done:

      kill $! $xpid
      
    2. You could use chvt command to access another TTY and run another session

      1. From user's screen menu, go to change user and run another session

      2. By using Ctrl+Alt+Fn with Fn = F1 to F6, or use one of sudo chvt 1 to sudo chvt 6, to switch to another tty, then log:

        Login: user
        password: 
        startx -- :1