KillingSpark / rustysd

A service manager that is able to run "traditional" systemd services, written in rust
MIT License
506 stars 15 forks source link

Support interactive tty for example to spawn a foreground shell? #16

Closed pwFoo closed 4 years ago

pwFoo commented 4 years ago

Hi, it looks like ExecStart a shell by /bin/sh isn't supported yet? I think some not supported options would be needed to do that? Some of the following options?

#StandardInput=tty
#StandardOutput=tty
#TTYPath=/dev/tty8
#TTYReset=yes
#TTYVHangup=yes

With issue #15 I try to start a minimal rustysd environment with an interactive shell in the end of the boot process.

Is that possible with rustysd?

KillingSpark commented 4 years ago

I think that is not really what a service manager provides normally. It manages services you do not want to interact with directly. Getty is a somewhat special exception but it does all the work to get interactive itself. So just starting a shell in a service file isn't really supported. I think your goal should be to get getty running. I haven't done this my-self so I am afraid I can't be of too much help in that regard

pwFoo commented 4 years ago

Hi @KillingSpark , thanks for your help! I have created an working initrd which boots in qemu, but I can't change to the tty getty / login is running, because rustysd stays in foreground / active tty. Any hint how to get it work?

[...]
[2020-02-01][08:52:14][rustysd::services::fork_parent][TRACE] [FORK_PARENT] service getty.service doesnt notify
[getty.service][STDERR] EXECV: "/sbin/agetty" ["agetty", "--autologin", "root", "--skip-login", "--keep-baud", "tty1"]
[2020-02-01][08:52:14][rustysd::units::activate][TRACE] Activate id: 3
[2020-02-01][08:52:14][rustysd::units::activate][TRACE] Lock unit: 3
[2020-02-01][08:52:14][rustysd::units::activate][TRACE] Locked unit: 3
[2020-02-01][08:52:14][rustysd::units::activate][TRACE] Lock status for: getty.target
[2020-02-01][08:52:14][rustysd::units::activate][TRACE] Locked status for: getty.target
[2020-02-01][08:52:14][rustysd::units::units][TRACE] Reached target getty.target
[2020-02-01][08:52:14][rustysd::units::activate][TRACE] Activate id: 1
[2020-02-01][08:52:14][rustysd::units::activate][TRACE] Lock unit: 1
[2020-02-01][08:52:14][rustysd::units::activate][TRACE] Locked unit: 1
[2020-02-01][08:52:14][rustysd::units::activate][TRACE] Lock status for: default.target
[2020-02-01][08:52:14][rustysd::units::activate][TRACE] Locked status for: default.target
[2020-02-01][08:52:14][rustysd::units::units][TRACE] Reached target default.target
login[223]: root login on 'tty1'
pwFoo commented 4 years ago

@KillingSpark You're right! The important part isn't to start a shell directly, but boot should end in the started shell. Maybe change terminal by chvt? command after starting getty? I'll test it...

KillingSpark commented 4 years ago

How about starting agetty not on tty1 but on any other tty and switching to that with ctrl+alt+f3 for example?

KillingSpark commented 4 years ago

I have to admit that I am not very informed about how these issues are handled with other init systems

KillingSpark commented 4 years ago

If you do get this running that would be very cool to know thought! Please keep me updated if you make progress :)

pwFoo commented 4 years ago

I think it was a qemu / console (tty1, ttyS0, ttyAMA0) problem... Bootet on hardware tty1 works fine without chvt! :)

I'll try to build a minimal system with just systemd (-> rustysd) and podman (docker replacement, supports and generate systemd units!). Build system used will be linuxkit.

pwFoo commented 4 years ago

@KillingSpark Thanks for sharing your awesome project! I really like systemd alternatives for simple use cases 👍