linux - Starting and stopping X11 and LXDE from command line

18
2014-04
  • radian

    I have a Raspberry Pi with Debian Wheezy (Raspbian) and so far I've managed to learn quite a lot about Linux just playing around, but I have a few questions for all you seasoned Linux pros out there.

    1) From command line, if I execute startx, X11 will launch followed by LXDE. If I had a monitor connected, I'm imagining I would see a transition from command line to the desktop environment. Can I launch X11 first with x, then start LXDE on top of X11 afterwards with /etc/init.d/lxdm start (is this correct?) and get to the same result as startx?

    2) Instead, let's say I executed /etc/init.d/lxdm start alone, would X11 start automatically (since LXDE relies on X11)?

    3) From desktop, if I CTRL+ALT+F1 to get back to command line, then I should be able to shutdown LXDE using /etc/init.d/lxdm stop. Does X11 automatically close with the termination of LXDE?

    4) What is the proper/safe way to shutdown X11?

    Thanks

  • Answers
  • Lawrence

    1) If you launch X by itself, you'll likely find yourself sitting there with a blank grey screen with an X for the mouse cursor. The X window system provides the ability to put graphics onto the screen, but you need other components to actually put the things onto the screen. Starting LXDM starts X as it is a dependency for LXDM to actually run, so there is no real reason to start X first and then use /etc/init.d/lxdm start.

    2) Yes it would. You're starting the Desktop Manager which then starts the desktop environment to provide you with a GUI.

    3) Yes it does. The Desktop Manager (LXDM) is what provides X in the form of the LXDE (Desktop Environment)

    4) I use /etc/init.d/lxdm stop. Generally using the init.d scripts are the safest way to stop services to ensure that no stale files are left behind. With X though, I don't think there is any harm is just doing a killall -9 lxdm


  • Related Question

    osx - SSH from mac to linux -> start gnome-session -> X11 keyboard mapping all messed up
  • Justin

    I have 2 computers: echo.local is running Ubuntu 9.04. justin.local is running Mac OS 10.6.1. X11 version on the mac is 2.3.4.

    I open X11 on the mac, and open a new xterm window (Applications Menu -> Terminal), everything is fine. Keyboard works as expected.

    I do ssh -X echo.local from the mac (connecting to the linux box), and from the linux command prompt, start xterm - everything is fine. Keyboard works as expected.

    I do gnome-session from the linux command prompt (through SSH), gnome launches, but keyboard mapping is ALL types of screwed up. If I kill gnome-session and open an xterm via ssh, keyboard mapping is still screwed up. If I then kill the SSH session entirely, and do X11 -> Applications Menu -> Terminal, opening a brand new xterm window on the mac with no SSH session running at all ... keyboard mapping is still screwed up.

    Only after I quit X11 and relaunch, is the keyboard mapping back to normal.

    Keyboard layout under GNOME is Apple->MacBook/MacBook Pro.


  • Related Answers
  • Andrew

    Try creating a xmodmap first:

    sudo xmodmap -pke > .xmodmaprc

    After that, ssh -X gconf-editor

    Navigate to:

    Desktop > Gnome > Peripherals > Keyboard

    Select "layout" and then add "us".

    Restart X11

    ... This is half me fooling around, and the other half blatantly stolen from https://bugs.launchpad.net/ubuntu/feisty/+source/vino/+bug/112955/comments/31

    I'm not sure if the .xmodmaprc needs to be created, but hey.. the above steps worked for me!

    Andrew