You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We don't add more TTYs by default because it would spawn more processes, even if we use `askfirst` instead of `respawn`.
3403
3447
3404
-
Also tried to add some extra lines to `/etc/inittab` of type:
3448
+
On the GUI, switch TTYs with:
3405
3449
3450
+
* `Alt-Left` or `Alt-Right:` go to previous / next populated TTY. Skips over empty TTYs.
3451
+
* `Alt-Fn`: go to the nth TTY. If it is not populated, don't go there.
3452
+
* `chvt <n>`: go to the n-th virtual TTY, even if it is empty: https://superuser.com/questions/33065/console-commands-to-change-virtual-ttys-in-linux-and-openbsd
3453
+
3454
+
You can also test this on most hosts such as Ubuntu 18.04, except that when in the GUI, you must use `Ctrl-Alt-Fx` to switch to another terminal.
3455
+
3456
+
Then, go to the text shells we opened previously, and press enter, and you will see that we have:
3457
+
3458
+
* one shell on the shell that was used to run QEMU
3459
+
* one shell on the second shell running `telnet`
3460
+
3461
+
although we cannot change between terminals from there.
3462
+
3463
+
Each populated TTY contains a "shell":
3464
+
3465
+
* `-/bin/sh`: goes directly into an `sh` without a login prompt. Don't forget the dash `-`: https://askubuntu.com/questions/902998/how-to-check-which-tty-am-i-using
3466
+
+
3467
+
TODO: does not work for the `ttyS*` terminals. Why?
3468
+
* `/sbin/getty` asks for password, and then gives you an `sh`
3469
+
+
3470
+
We can overcome the password prompt with the `-l /loginroot.sh` technique explained at: https://askubuntu.com/questions/902998/how-to-check-which-tty-am-i-using but I don't see any advantage over `-/bin/sh` currently.
* `/dev/console` for the initial GUI terminal. But I think it is the same as `/dev/tty1`, because if I try to do
3486
+
+
3487
+
....
3488
+
tty1::respawn:-/bin/sh
3489
+
....
3490
+
+
3491
+
it makes the terminal go crazy, as if multiple processes are randomly eating up the characters.
3492
+
* `/dev/ttyN` for the other graphic TTYs. Note that there are only 63 available ones, from `/dev/tty1` to `/dev/tty63` (`/dev/tty0` is the current one): link:https://superuser.com/questions/449781/why-is-there-so-many-linux-dev-tty[]. I think this is determined by:
These are Serial ports, see this to understand what those represent physically: https://unix.stackexchange.com/questions/307390/what-is-the-difference-between-ttys0-ttyusb0-and-ttyama0-in-linux/367882#367882
3502
+
+
3503
+
There are only 4 serial ports, I think this is determined by QEMU. TODO check.
3504
+
+
3505
+
See also: https://stackoverflow.com/questions/16706423/two-instances-of-busybox-on-separate-serial-lines-ttysn
3506
+
3507
+
Next try:
3508
+
3509
+
....
3510
+
insmod /kthread.ko
3408
3511
....
3409
3512
3410
-
but nothing changed.
3513
+
and switch between virtual terminals, to understand that the dmesg goes to whatever current virtual terminal you are on, but not the others, and not to the serial terminals.
3411
3514
3412
-
Note that on Ubuntu 17.10, to get to the text terminal from the GUI we first need `Ctrl-Alt-Fx`, and once in the text terminals, `Alt-Fn` works without `Ctrl`.
Take the command described at <<tty>> and try adding the following:
3524
+
3525
+
* `-e 'console=tty7'`: boot messages still show on `/dev/tty1` (TODO how to change that?), but we don't get a shell at the end of boot there.
3526
+
+
3527
+
Instead, the shell appears on `/dev/tty7`.
3528
+
* `-e 'console=tty2'` like `/dev/tty7`, but `/dev/tty2` is broken, because we have two shells there:
3529
+
** one due to the `::respawn:-/bin/sh` entry which uses whatever `console` points to
3530
+
** another one due to the `tty2::respawn:/sbin/getty` entry we added
3531
+
* `-e 'console=ttyS0'` much like `tty2`, but messages show only on serial, and the terminal is broken due to having multiple shells on it
3532
+
* `-e 'console=tty1 console=ttyS0'`: boot messages show on both `tty1` and `ttyS0`, but only `S0` gets a shell because it came last
3413
3533
3414
3534
==== CONFIG_LOGO
3415
3535
@@ -5262,7 +5382,7 @@ Then copy and paste the diff additions to link:br2[] to make them permanent.
5262
5382
5263
5383
=== Change user
5264
5384
5265
-
At startup, we login automatically as the `root` user as explained at: https://unix.stackexchange.com/questions/299408/how-to-login-automatically-without-typing-root-in-buildroot-x86-64-qemu/300152#300152
5385
+
At startup, we login automatically as the `root` user.
5266
5386
5267
5387
If you want to switch to another user to test some permissions, we have already created an `user0` user through the link:user_table[] file, and you can just login as that user with:
0 commit comments