View previous topic :: View next topic |
Author |
Message |
mortonP Tux's lil' helper
Joined: 22 Dec 2015 Posts: 84
|
Posted: Wed Jan 18, 2023 10:26 pm Post subject: force specific terminal device for login |
|
|
I guess my question fits best into this groups....
On a good old still "init" installation, inittab defines the terminal device that's used for login as:
c1:12345:respawn:/sbin/agetty 38400 tty1 linux
ok, but sometimes for debugging purposes I want to boot the kernel with "console=foo" parameter,
so on this boot I want instead
c1:12345:respawn:/sbin/agetty 38400 foo linux
Q: How to do this selection automatically on boot, without editing inittab?
Add another line to inittab?
Name the line something else than c1, but how to tell init to use this line instead?
...
Thank you for pointers.... |
|
Back to top |
|
|
GDH-gentoo Veteran
Joined: 20 Jul 2019 Posts: 1549 Location: South America
|
Posted: Thu Jan 19, 2023 12:09 am Post subject: |
|
|
¿Would repurposing a sysvinit runlevel (say, 4 or 5) so that the agetty process using /dev/foo only launches when entering that specific runlevel work for you? With such a configuration, you would specify that runlevel in the kernel command line when you want the process. _________________
NeddySeagoon wrote: | I'm not a witch, I'm a retired electronics engineer |
Ionen wrote: | As a packager I just don't want things to get messier with weird build systems and multiple toolchains requirements though |
|
|
Back to top |
|
|
Hu Administrator
Joined: 06 Mar 2007 Posts: 21724
|
Posted: Thu Jan 19, 2023 1:26 am Post subject: |
|
|
Could you explain why you need this to be dynamically switched? It is possible to run more than one agetty, so you could permanently enable an agetty on tty1 and another on your foo console, assuming that the foo device always exists. |
|
Back to top |
|
|
mortonP Tux's lil' helper
Joined: 22 Dec 2015 Posts: 84
|
Posted: Mon Jan 23, 2023 6:43 pm Post subject: |
|
|
Thank you for your suggestions!
Tried again.
I want to boot the identical rootfs
1) either local, so sitting in front of a PC or
2) via serial console
and see all output, for debugging purposes.
That works with modifying inittab to:
1) c1:12345:respawn:/sbin/agetty -J 38400 tty1 linux
or
2) c1:12345:respawn:/sbin/agetty -J 115200 hvc0 linux
and booting with kernel options: earlyprintk=hvc0 console=hvc0
However, using the same inittab that makes 1 and 2 work, does not:
Either:
c1:12345:respawn:/sbin/agetty -J 115200 hvc0 linux
c2:12345:respawn:/sbin/agetty 38400 tty2 linux
serial console: works ok
local: nothing shows, need ALT-F2 to get to login tty2
and error: local INIT: id "c1" respawning too fast: disabled for 5 minutes
...because there is no hvc0?
Or:
c1:12345:respawn:/sbin/agetty -J 38400 tty1 linux
c2:12345:respawn:/sbin/agetty -J 115200 hvc0 linux
local login: works ok
serial console: login shows, but middle of screen and some keys are somehow messed up
and error: local INIT: id "c2" respawning too fast: disabled for 5 minutes
...because there is no tty1?
...is it possible to boot either in 1 or 2, without always modifying /etc/inittab first?
(havn't figured out runlevels yet...)
Hmm... hope that makes sense somehow... |
|
Back to top |
|
|
GDH-gentoo Veteran
Joined: 20 Jul 2019 Posts: 1549 Location: South America
|
Posted: Tue Jan 31, 2023 11:15 pm Post subject: |
|
|
(I didn't see the reply)
mortonP wrote: | ...is it possible to boot either in 1 or 2, without always modifying /etc/inittab first?
(havn't figured out runlevels yet...) |
In theory yes. You could try this:
/etc/inittab
Code: | # Dont use /dev/tty1 in runlevel 4
c1:1235:respawn:/sbin/agetty 38400 tty1 linux
# Only use /dev/hvc0 in runlevel 4
hvc:4:respawn:/sbin/agetty -J 115200 hvc0 linux | And then use earlyprintk=hvc0 console=hvc0 4 in the kernel command line. "4" gets passed as an argument to init, specifying that it should enter runlevel 4 instead of the default one (3 in Gentoo's unmodified inittab).
Although I don't understand why the serial console doesn't work well if you have agetty processes for all /dev/tty1, /dev/tty2 and /dev/hvc0... _________________
NeddySeagoon wrote: | I'm not a witch, I'm a retired electronics engineer |
Ionen wrote: | As a packager I just don't want things to get messier with weird build systems and multiple toolchains requirements though |
|
|
Back to top |
|
|
|