How to start lightdm services at startup

18,547

Solution 1

First run this command for a graphical environment

sudo systemctl set-default graphical.target

Because you have used sudo systemctl set-default multi-user.target before.


Then repair the entries in /etc/default/grub

This statement is completely wrong:

GRUB_DEFAULT="quiet splash"

Open the configuration:

sudo nano /etc/default/grub

and replace the entry

GRUB_DEFAULT="quiet splash"

with

GRUB_DEFAULT=0

add the entry

GRUB_CMDLINE_LINUX="quiet splash"

After that run

sudo update-grub

  • GRUB_DEFAULT

    The default menu entry. This may be a number, in which case it identifies the Nth entry in the generated menu counted from zero, or the title of a menu entry, or the special string ‘saved’. Using the title may be useful if you want to set a menu entry as the default even though there may be a variable number of entries before it.

  • GRUB_CMDLINE_LINUX

    Command-line arguments to add to menu entries for the Linux kernel.

  • GRUB_CMDLINE_LINUX_DEFAULT

    Unless ‘GRUB_DISABLE_RECOVERY’ is set to ‘true’, two menu entries will be generated for each Linux kernel: one default entry and one entry for recovery mode. This option lists command-line arguments to add only to the default menu entry, after those listed in ‘GRUB_CMDLINE_LINUX’.

Source

Solution 2

It depends on why it doesn't start as a default option. I accidentally purge systemd, so when I reinstall and boot I just have the TTY prompt.

First, you haver to start the service so you can do it graphical:

sudo start lightdm

Once you are in gui mode type in the terminal to reconfigure lightdm:

sudo dpkg-reconfigure lightdm

sudo systemctl set-default graphical.target

Now we need to update the grub so lightdm start a default service

init=/lib/systemd/systemd

To boot under systemd by default, edit /etc/default/grub and change the following line:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash init=/lib/systemd/systemd"

After modifying any grub related configuration files like /etc/default/grub the following command is needed to bring the changes into effect.

update-grub

You can see all the instructions in the official ubuntu wiki here, systemd is a services administrator so you will find quite functional

Share:
18,547

Related videos on Youtube

Mudit Kapil
Author by

Mudit Kapil

Updated on September 18, 2022

Comments

  • Mudit Kapil
    Mudit Kapil over 1 year

    My system is running Ubuntu 15.04 and I've changed default boot to "text" instead of "quiet splash" by going through answer by @Bruno Pereira How do I disable X at boot time so that the system boots in text mode?.However again I've changed default boot to quiet splash and update-grub but as Ubuntu 15.04 uses systemd my system does not boot to graphical login and stuck at Ubuntu Logo screen.I've to go to the tty1 terminal by CTRL+ALT+F1 and manullay starts Lightdm services as sudo service lightdm start on every login.

    How should I change my boot to Graphical login i.e "quiet splash"? content of sudo gedit /etc/default/grub

    # If you change this file, run 'update-grub' afterwards to update
    # /boot/grub/grub.cfg.
    # For full documentation of the options in this file, see:
    #   info -f grub -n 'Simple configuration'
    
    GRUB_DEFAULT="quiet splash"
    #GRUB_HIDDEN_TIMEOUT=0
    GRUB_HIDDEN_TIMEOUT_QUIET=true
    GRUB_TIMEOUT=0
    GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
    GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
    GRUB_CMDLINE_LINUX="quiet splash"
    
    # Uncomment to enable BadRAM filtering, modify to suit your needs
    # This works with Linux (no patch required) and with any kernel that obtains
    # the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
    #GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"
    
    # Uncomment to disable graphical terminal (grub-pc only)
    #GRUB_TERMINAL=console
    
    # The resolution used on graphical terminal
    # note that you can use only modes which your graphic card supports via VBE
    # you can see them in real GRUB with the command `vbeinfo'
    #GRUB_GFXMODE=1920x1080
    
    # Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
    #GRUB_DISABLE_LINUX_UUID=true
    
    # Uncomment to disable generation of recovery mode menu entries
    #GRUB_DISABLE_RECOVERY="true"
    
    # Uncomment to get a beep at grub start
    #GRUB_INIT_TUNE="480 440 1"
    
    • sugab
      sugab almost 9 years
      have you tried update-grub2 ? I think it should back to default conf when you update it, no need to define lightdm on startup, also check your ubuntu-session.
    • A.B.
      A.B. almost 9 years
      Post the output of sudo systemctl get-default
    • A.B.
      A.B. almost 9 years
      And run sudo systemctl set-default graphical.target
  • Mudit Kapil
    Mudit Kapil almost 9 years
    It is not working
  • Mudit Kapil
    Mudit Kapil almost 9 years
    without quiet splash it is booting in to command-line
  • A.B.
    A.B. almost 9 years
    That seems to be an other problem.
  • A.B.
    A.B. almost 9 years
    Try a sudo apt-get install --reinstall
  • user.dz
    user.dz almost 9 years
    @A.B. I think the problem with sudo systemctl enable multi-user.target --force; sudo systemctl set-default multi-user.target see Bruno's answer. OP has 15.04 with systemd. There should be a command to reverse that.
  • A.B.
    A.B. almost 9 years
    @Sneetsher this is a good point.
  • Mudit Kapil
    Mudit Kapil almost 9 years
    @A.B. after running sudo systemctl set-default graphical.target and grub changes and update-grub i am able to boot in to GUI but not able to drop any terminal tty1to tty6 and boot process is not default Ubuntu logo boot but from texttologin-screen
  • Mudit Kapil
    Mudit Kapil almost 9 years
    @A.B. yes when i set GRUB_CMDLINE_LINUX="quiet splash" it is booting normally instead of replacing
  • Mudit Kapil
    Mudit Kapil almost 9 years
    @A.B. after some failed kernel module it boots normally
  • Mudit Kapil
    Mudit Kapil almost 9 years
    @A.B. however it is some workaround and not a solution so upvoted it but not accepted thanks for your effort
  • A.B.
    A.B. almost 9 years
    Try a sudo systemctl enable [email protected]
  • Mudit Kapil
    Mudit Kapil almost 9 years
    @A.B. Tried sudo systemctl enable [email protected]