Debian Codegraph @

doc/config/tty.md

raw symbols SCIP
1 TTYs and Consoles
2 =================
3
4 **Syntax:** `tty [LVLS] <COND> DEV [BAUD] [noclear] [nowait] [nologin] [TERM]`
5 `tty [LVLS] <COND> CMD <ARGS> [noclear] [nowait]`
6 `tty [LVLS] <COND> [notty] [rescue]`
7
8 The first variant of this option uses the built-in getty on the given
9 TTY device DEV, in the given runlevels. DEV may be the special keyword
10 `@console`, which is expanded from `/sys/class/tty/console/active`,
11 useful on embedded systems.
12
13 The default baud rate is 0, i.e., keep kernel default.
14
15 > The `tty` stanza inherits runlevel, condition (and other feature)
16 > parsing from the `service` stanza. So TTYs can run in one or many
17 > runlevels and depend on any condition supported by Finit. This is
18 > useful e.g. to depend on `<pid/elogind>` before starting a TTY.
19
20 **Example:**
21
22 tty [12345] /dev/ttyAMA0 115200 noclear vt220
23
24 The second `tty` syntax variant is for using an external getty, like
25 agetty or the BusyBox getty.
26
27 The third variant is for board bringup and the `rescue` boot mode. No
28 device node is required in this variant, the same output that the kernel
29 uses is reused for stdio. If the `rescue` option is omitted, a shell is
30 started (`nologin`, `noclear`, and `nowait` are implied), if the rescue
31 option is set the bundled `/libexec/finit/sulogin` is started to present
32 a bare-bones root login prompt. If the root (uid:0, gid:0) user does
33 not have a password set, no rescue is possible. For more information,
34 see the [Rescue Mode](rescue.md) section.
35
36 By default, the first two syntax variants *clear* the TTY and *wait* for
37 the user to press enter before starting getty.
38
39 **Example:**
40
41 tty [12345] /sbin/getty -L 115200 /dev/ttyAMA0 vt100
42 tty [12345] /sbin/agetty -L ttyAMA0 115200 vt100 nowait
43
44 The `noclear` option disables clearing the TTY after each session.
45 Clearing the TTY when a user logs out is usually preferable.
46
47 The `nowait` option disables the `press Enter to activate console`
48 message before actually starting the getty program. On small and
49 embedded systems running multiple unused getty wastes both memory
50 and CPU cycles, so `wait` is the preferred default.
51
52 The `nologin` option disables getty and `/bin/login`, and gives the
53 user a root (login) shell on the given TTY `<DEV>` immediately.
54 Needless to say, this is a rather insecure option, but can be very
55 useful for developer builds, during board bringup, or similar.
56
57 Notice the ordering, the `TERM` option to the built-in getty must be
58 the last argument.
59
60 Embedded systems may want to enable automatic `DEV` by supplying the
61 special `@console` device. This works regardless weather the system
62 uses `ttyS0`, `ttyAMA0`, `ttyMXC0`, or anything else. Finit figures
63 it out by querying sysfs: `/sys/class/tty/console/active`. The speed
64 can be omitted to keep the kernel default.
65
66 > Most systems get by fine by just using `console`, which will evaluate
67 > to `/dev/console`. If you have to use `@console` to get any output,
68 > you may have some issue with your kernel config.
69
70 **Example:**
71
72 tty [12345] @console noclear vt220
73
74 On really bare bones systems, or for board bringup, Finit can give you a
75 shell prompt as soon as bootstrap is done, without opening any device
76 node:
77
78 tty [12345789] notty
79
80 This should of course not be enabled on production systems. Because it
81 may give a user root access without having to log in. However, for
82 board bringup and system debugging it can come in handy.
83
84 One can also use the `service` stanza to start a stand-alone shell:
85
86 service [12345] /bin/sh -l