Douglas Su Douglas Su - 22 days ago 6
Linux Question

What is the differences between GLI and CLI in linux from the kernel's perspective

Can anyone tell me what is the differences between the GLI and CLI from a developer's perspective?

I also want to know how the linux system set up GLI and CLI after booting.

For CLI, when a new user login, after system booting, the process

init
dose a
fork
, in turn an
exec
of program
getty
is invoked for user login. After user entered username and password, the
getty
verifies the identity of current login user. If everything is OK,
getty
executes
execle
to load
login
program followed by invoking a shell.

But what does kernel do, when booting a graphic desktop.

Thanks a lot.

SzG SzG
Answer

It's not about the kernel at all. It's about how init is configured and which of its runlevels is started. The command pstree -u is your friend.

 ├─mdm───mdm─┬─Xorg
 │           ├─x-session-manag(szg)─┬─applet.py───{applet.py}
 │           │                      ├─gpg-agent
 │           │                      ├─marco───2*[{marco}]
 │           │                      ├─mate-bluetooth-───2*[{mate-bluetooth-}]
 │           │                      ├─mate-panel───2*[{mate-panel}]
 │           │                      ├─mate-power-mana───2*[{mate-power-mana}]
 │           │                      ├─mate-screensave───2*[{mate-screensave}]
 │           │                      ├─mate-settings-d───4*[{mate-settings-d}]
 │           │                      ├─mate-volume-con───{mate-volume-con}
 │           │                      ├─mintupdate-laun───sh───mintUpdate───2*[{mintUpdate}]
 │           │                      ├─nm-applet───2*[{nm-applet}]
 │           │                      ├─notgmail───sleep
 │           │                      ├─polkit-mate-aut───{polkit-mate-aut}
 │           │                      ├─sh───caja───3*[{caja}]
 │           │                      ├─ssh-agent
 │           │                      ├─tapeta───sleep
 │           │                      ├─zeitgeist-datah───3*[{zeitgeist-datah}]
 │           │                      └─3*[{x-session-manag}]
 │           └─{mdm}

You can see a MATE desktop session above. init starts mdm, the MATE Desktop Manager as root, which in turn starts the Xorg X-server to handle the hardware and a session-manager where you log in, then it drops privileges and starts your user-level desktop services.

This does not happen instead of the gettys, but besides them. You can still log in on the CLI, with ctrl-alt-F1 etc.