Page 1 of 3 123 LastLast
Results 1 to 10 of 25

Thread: Start Lubuntu GUI from command line

Hybrid View

  1. #1
    Join Date
    Feb 2008
    Beans
    34

    Start Lubuntu GUI from command line

    I have a 14.04 server and a Lubuntu Desktop (core) on top of it and server boots into text mode. The idea is to be able to start the Lubuntu GUI when needed and to be able to turn back to the text mode when the GUI work is finished. May not be a widely used setup but sure it is something makes sense and that's what I need.

    Now, when I boot into the command line, "startx" does not work. It does not start the GUI but just goes into a blank/black screen. The "startlubuntu" script does not exist anymore. Copying over the script from an older version does not work. The command suggested to be used as a replacement of startlubuntu; "lxsession -e LXDE -s Lubuntu" also does not work.

    The only thing (somewhat) works is the command "service lightdm start", but of course with some caveats.

    First problem is; when I run that command I am already logged into my server but when I start the service and the GUI, I see the login screen and I have to re-login to a server which I am already logged in. Annoying for the least.

    Other problem is; when I finish my work on the GUI and log out, I go back to the graphical login screen. I do not go back to the command line which is expected. Now, this is more than annoying because there is a reason that I do not boot to the GUI directly but to the text mode. I wanna load the GUI when needed and unload it when not. This behaviour kills the whole idea.

    Can anyone think of a workaround to achieve what I am looking for?

    PS: There is a similar problem and a bug report here but that is related when trying to make a remote desktop connection via some NX software. In my case, I am trying to make this work on the local machine.

    Thanks....
    life is short, but sweet for certain...

  2. #2
    Join Date
    May 2014
    Beans
    4

    Re: Start Lubuntu GUI from command line

    Questions I have are;

    1. Is this at the terminal, ie the monitor, keyboard and mouse connected to the computer?
    2. how did you install Lubuntu?
    3. do you have any thing relevant /helpful in syslog?

  3. #3
    Join Date
    Feb 2008
    Beans
    34

    Re: Start Lubuntu GUI from command line

    1-
    Yes

    2-
    apt-get install lubuntu-core --no-install-recommends

    3-
    a) for trying the "startlubuntu" or "lxsession -e LXDE -s Lubuntu" nothing on the syslog but I got this error message on the screen.
    (lxsession:2186): Gtk-WARNING **: cannot open display:
    b) for trying "startx" there is nothing on the screen since it goes black and nothing on the syslog
    c) I didnt check for "service lightdm start" because it already works but in a weird way like I described.




    Quote Originally Posted by trevor_allett View Post
    Questions I have are;

    1. Is this at the terminal, ie the monitor, keyboard and mouse connected to the computer?
    2. how did you install Lubuntu?
    3. do you have any thing relevant /helpful in syslog?
    life is short, but sweet for certain...

  4. #4
    Join Date
    Apr 2014
    Location
    United States
    Beans
    65
    Distro
    Ubuntu

    Re: Start Lubuntu GUI from command line

    Have you tried using the init command?

    To invoke a GUI try running:

    Code:
    init 5
    To close a graphical session and return to CLI try running:

    Code:
    init 3
    I personally haven't tried manually manipulating the runlevel on Ubuntu server in some time, and I'm not sure what to tell you about having to log in again after you start lightdm.

  5. #5
    Join Date
    Feb 2008
    Beans
    34

    Re: Start Lubuntu GUI from command line

    No no, neither does work.


    Quote Originally Posted by matt_fussell2 View Post
    Have you tried using the init command?

    To invoke a GUI try running:

    Code:
    init 5
    To close a graphical session and return to CLI try running:

    Code:
    init 3
    I personally haven't tried manually manipulating the runlevel on Ubuntu server in some time, and I'm not sure what to tell you about having to log in again after you start lightdm.
    life is short, but sweet for certain...

  6. #6
    Join Date
    Apr 2014
    Location
    United States
    Beans
    65
    Distro
    Ubuntu

    Re: Start Lubuntu GUI from command line

    Dumb question - did you try using sudo? Also, you might try run level 2 as indicated here (since Ubuntu is derived from Debian).

  7. #7
    Join Date
    Feb 2008
    Beans
    34

    Re: Start Lubuntu GUI from command line

    No dump questions my friend.

    Sudo with a non-root user, or no sudo with a root user; it is like there is no command like "init 3" or "init 5". Nothing happens, no error messages. I was just thinking that you are giving me directions from decades ago since you said you haven't tried this for a long time (kidding) but then I tried "init 1" and it takes me to the single user mode. Weird huh?

    Back to the topic, I assure you "init 3" and "init 5" does not work.



    Quote Originally Posted by matt_fussell2 View Post
    Dumb question - did you try using sudo? Also, you might try run level 2 as indicated here (since Ubuntu is derived from Debian).
    life is short, but sweet for certain...

  8. #8
    Join Date
    Nov 2011
    Location
    /dev/root
    Beans
    Hidden!

    Re: Start Lubuntu GUI from command line

    Do you run
    Code:
    service lightdm start
    as root (superuser)?

    When running in graphics mode, you can start a text screen with one of the hot key combinations

    ctrl + alt +F1 ... ctrl + alt +F6
    and return to the graphics screen (while it is still running) with ctrl + alt +F7

    and from there you can stop lightdm with

    Code:
    service lightdm stop
    I am logged in as the regular user and use sudo for those commands, so

    Code:
    sudo service lightdm start
    Code:
    sudo service lightdm stop
    You can make a script or alias to toggle lightdm (on/off) in a convenient way. The following is a verbose script, that I store in the file ~/bin/x

    Code:
    #!/bin/bash
    
    ans="$(ps -A|grep \ lightdm$)"
    res=$?
    if [ "$res" == "0" ]
    then
     echo "x (lightdm) is already running"
    else
     echo "x will be started:"
     echo "sudo service lightdm start"
     sudo service lightdm start
    fi

  9. #9
    Join Date
    Feb 2008
    Beans
    34

    Re: Start Lubuntu GUI from command line

    So you say I start the service when I want the GUI and when I am finished; I switch to another display and stop the service from there. Is that right?

    How does your script works? I call the same script "lightdm" and if it is runnning, scripts stops the service. If the service is not running, then it starts it. Is this how it works?

    Not exactly I was hoping for but this is something.


    Quote Originally Posted by sudodus View Post
    Do you run
    Code:
    service lightdm start
    as root (superuser)?

    When running in graphics mode, you can start a text screen with one of the hot key combinations

    ctrl + alt +F1 ... ctrl + alt +F6
    and return to the graphics screen (while it is still running) with ctrl + alt +F7

    and from there you can stop lightdm with

    Code:
    service lightdm stop
    I am logged in as the regular user and use sudo for those commands, so

    Code:
    sudo service lightdm start
    Code:
    sudo service lightdm stop
    You can make a script or alias to toggle lightdm (on/off) in a convenient way. The following is a verbose script, that I store in the file ~/bin/x

    Code:
    #!/bin/bash
    
    ans="$(ps -A|grep \ lightdm$)"
    res=$?
    if [ "$res" == "0" ]
    then
     echo "x (lightdm) is already running"
    else
     echo "x will be started:"
     echo "sudo service lightdm start"
     sudo service lightdm start
    fi
    life is short, but sweet for certain...

  10. #10
    Join Date
    Apr 2012
    Beans
    7,256

    Re: Start Lubuntu GUI from command line

    AFAIK SysV-style runlevels are not relevant in Ubuntu

    I would focus on finding out why lxsession says it can't open the display - is lightdm perhaps still running? if so you will need to kill it first e.g. (after logging in at one of the CLI virtual terminals as your normal user)

    Code:
    sudo service lightdm stop
    
    lxsession -s LXDE -e LXDE

Page 1 of 3 123 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •