You are not logged in.

#1 2018-06-14 20:23:06

diwangs
Member
From: Bandung, Indonesia
Registered: 2018-06-14
Posts: 3

[SOLVED] Can I boot without getty / text interfaces?

I'm trying to optimize my Arch boot process.

The usual Arch install comes with getty@tty1.service enabled that is started by the init process. This service launches agetty, which launches login, and finally launches bash. My current config is that I have a .bash_login file in my home that starts an X server (through exec startx). So, as far as I know, the overall boot process (from init) goes like this:

init -> getty -> bash -> X -> DE

Now, my question is already written on the title, but just to elaborate: is it possible to boot straight into X, without getty and bash? To be clear, I'm not talking about "automating" the process i.e. autologin and then launching X through .bash_login, as I've successfully done that, but to actually trim the process, i.e.

init (-> login?) -> X -> DE

What I've tried so far is that I've edited the getty@tty1.service so that it launches startx instead of agetty, but this results in a blank screen after boot. And from what I've read online is that /bin/login cannot be invoked explicitly so that it can't authenticate any user launching a program, but I'm not sure about this since there are very few places online talking about this (or, at least the one that I found).

So, is it possible? If so, how do I do that and what are the consequences? Or I'm missing something here?

Thank you.

Last edited by diwangs (2018-06-16 05:14:54)


Nothing here.

Offline

#2 2018-06-14 22:01:38

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 19,335
Website

Re: [SOLVED] Can I boot without getty / text interfaces?

It's possible:
https://wiki.archlinux.org/index.php/Sy … nd_systemd

But why?  What do you think you would gain by doing this?

EDIT: it may be possible.  I've never run X as a system user service, and in looking at that wiki page, it seems to suggest you still first need to log in to a tty.

Last edited by Trilby (2018-06-14 22:03:14)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Online

#3 2018-06-14 22:09:15

progandy
Member
Registered: 2012-05-17
Posts: 2,885

Re: [SOLVED] Can I boot without getty / text interfaces?

The gentoo wiki describes using "su" without getty to set up the environment variables. This still uses a shell, but if you use dash and then "exec startx", this should be of no consequence.
https://wiki.gentoo.org/wiki/X_without_ … r#Method_2

Last edited by progandy (2018-06-14 22:11:38)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#4 2018-06-14 22:12:14

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 19,335
Website

Re: [SOLVED] Can I boot without getty / text interfaces?

I'm pretty sure that will fail, given that logging in as root, su'ing to a user, and attempting to run xinit/startx will fail.

X - as build in the arch repos - needs an active logind session.  Gentoo user's can build with different options.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Online

#5 2018-06-14 22:24:41

progandy
Member
Registered: 2012-05-17
Posts: 2,885

Re: [SOLVED] Can I boot without getty / text interfaces?

I guess you could modify pam for su-l to start a logind session, but I don't really see the use.

Edit: A systemd unit can create a pam session with PAMName=..., so I guess with enough persistence you can start x directly from a service.

Last edited by progandy (2018-06-14 22:47:18)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#6 2018-06-15 21:06:15

diwangs
Member
From: Bandung, Indonesia
Registered: 2018-06-14
Posts: 3

Re: [SOLVED] Can I boot without getty / text interfaces?

Trilby wrote:

What do you think you would gain by doing this?

As I said before, I'm trying to simplify my boot process, or at least learn something about it big_smile

What I have in mind is starting a graphical environment directly and that also logs me in automatically, without using a command-line shell or desktop manager. I've tried both methods on the systemd/User Archwiki and apparently both require /bin/login to authenticate. Seems that it is an intended security feature that can't be bothered.

I have a feeling that I have a wrong understanding about getty and virtual console in general. Is a text interface a must-have for a tty device (i.e. tied to the protocol itself) or is it just an interface that can be changed for a graphical one? Can I start a graphical session in a tty directly without starting any text interfaces (without printing /etc/issue, etc)?


Nothing here.

Offline

#7 2018-06-15 21:39:15

progandy
Member
Registered: 2012-05-17
Posts: 2,885

Re: [SOLVED] Can I boot without getty / text interfaces?

You can directly start a graphical environment, but you need some way to start a pam session. A display manager accomplishes that, but it does even more. getty/login does it as well without a GUI. You can probably hack something together with systemd. Otherwise you'd have to write your own minimal setup program.

Edit: nodm should do what you want.

Last edited by progandy (2018-06-15 21:40:11)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#8 2018-06-15 21:41:50

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 19,335
Website

Re: [SOLVED] Can I boot without getty / text interfaces?

diwangs wrote:

Can I start a graphical session in a tty directly without starting any text interfaces (without printing /etc/issue, etc)?

Yes.  But you'd have to first create that graphical interface as you seem to have ruled out all the ones that currently exist.

There are many alternatives to agetty.  Some are just other getty programs (mingetty, mgetty, fbgetty).  There are also framebuffer programs, many of these just give a terminal though with higher resolution and more colors (e.g., kmscon).  Display managers are yet another program that can run on a tty.  In principle you could have any kind of program you want run in place of getty.  But many programs are simply not written to be used in that way.

Most of what a basic getty program does would have to be done anyways.  So, sure, in principle you could rewrite xinit to run in place of agetty (it would be a substantial rewrite).  But why, at best you'd just duplicate getty code - more likely you'd end up with something that tried to duplicate getty code, but missed some important parts and did most of the steps poorly.

What does getty do that you'd want to trim out?


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Online

#9 2018-06-16 05:14:02

diwangs
Member
From: Bandung, Indonesia
Registered: 2018-06-14
Posts: 3

Re: [SOLVED] Can I boot without getty / text interfaces?

Trilby wrote:

What does getty do that you'd want to trim out?

I thought that getty is the one responsible for starting the text interfaces, but after learning about what you guys said, turns out it does more than that. Now I'm starting to understand why you guys think that this is pretty pointless.

progandy wrote:

nodm should do what you want.

I think this is the closest one to what I need, sorry for the poor description.

I think I'll mark this thread as solved now. Thanks for the direction!


Nothing here.

Offline

#10 2018-06-16 11:25:20

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 19,335
Website

Re: [SOLVED] Can I boot without getty / text interfaces?

diwangs wrote:

Now I'm starting to understand why you guys think that this is pretty pointless.

Pretty much yes.  But that is not at all to discourage your mode of thinking.  Keep learning about the tools you are using - and keep seeking the simplest or most minimal approach to acheive your ends.  If for no other reason, the more people there are doing that, the more likely developers will write tools for such people - and I'd like to use such tools.

But in this case I do think you're just barking up the wrong tree.  Getty programs are pretty minimal already and do important things for you.

I would only suggest that you use `exec` where ever appropriate in the start up process.  You mentioned all the steps from login through agetty, bash, and startx.  These whould all run, but they should not all continue running.  If you see these in a chain in your pstree output, then you are not using `exec` properly to have each new process replace it's parent.  The relevant part of my pstree:

|-login---xi-+-Xorg---2*[{disk_cache:0}]
|            `-tmuxwm

login starts agetty which is replaced by a shell under which I (automatically) run `exec xi tmuxwm` (xi is my version of xinit, tmuxwm is my window manager) , so xi replaces the shell.  The shell and agetty are no longer running.

You can also use lighter shells than bash if you don't have any use for all of it's bells and whistles during the start up process.  And while I think this would be easier and more fruitful than trying to get rid of agetty, even this would have benefits only in principle (in practice it's so trivial you'd never notice).


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Online

Board footer

Powered by FluxBB