Sweets / hummingbird

Hummingbird init system for Linux based operating systems.
MIT License
247 stars 7 forks source link

Getting dropped to emergency shell post-boot #23

Closed undefinednpc closed 2 years ago

undefinednpc commented 2 years ago

Sometimes executing some command, (haven't found a pattern, sometimes it happens sometimes not), the init fails and drops me to emergency shell post-boot.

I'm not sure if this is KISS's init issue or hummingbird, but it's not happening with busybox init.

Sweets commented 2 years ago

If it's dropping you to the emergency shell then either tty fell through or something is killing your TTY(s).

Next time that it happens, if you could, let me know what the last command you did was that caused this. When you say post-boot, do you mean that the system has been fully booted and then it will eventually drop you to the shell? Or am I misunderstanding?

undefinednpc commented 2 years ago

Yes exactly, the system is fully booted, and then it eventually drops me in the shell. The two commands that killed it were sway and wpa_supplicant so far.

Sweets commented 2 years ago

Are you using the distribution files for KISS, or is this just vanilla hummingbird?

If it's not the dist files, what do your stage files look like? I'm particularly interested in tty, but it wouldn't hurt to include your fs and (if applicable) interlude stages

undefinednpc commented 2 years ago

Okay I checked the files, and they look exactly the same like the KISS specific ones in your repo. Nothing is different. I'm sending a link to pastebin to the tty file anyways. Sorry for that, I'm working on a very limited environment, so I can't find other way to attach the file.

https://pastebin.com/RxJcpjTz

I tried to use hummingbird for a while again, and I have encountered a random system reboot. Seems like the init just dies after a while, and reboots the computer?

Sweets commented 2 years ago

There's going to be something that causes it, and it's going to be external. The system reboots automatically if the emergency shell exits, or if SIGINT is sent to PID 1.

Since you're using the KISS dist files, I would say that it could be the tty script dying for some reason. tty is spawning 8 TTYs using getty, and forking them all into the background. Then it calls wait to block.

If tty stage ever stops blocking, exits, or what have you, then the init goes straight to dropping the user to the emergency shell. It isn't just randomly dying.

Out of curiosity, what's located at /bin/sh?

If ever tty exits, you will then get dropped into emergency shell. Given that you "encountered a random system reboot," though, either the emergency shell failed (/bin/sh is not linked or does not point to any file given that path) or PID 1 is receiving SIGINT. I'm inclined to think that the more likely occurrence is going to be that something is sending PID 1 SIGINT.

Your dist files look fine. Is there anything else you're doing at all in the init process? In the mean time, I'll review the source and do some testing to make sure it's not hummingbird that's actually causing this, just to double check.

undefinednpc commented 2 years ago

/bin/sh just executes /usr/bin/sh, and it's symlink to busybox, so I think that's fine. I guess something is sending PID 1 SIGINT then.

I guess not, I have just set up a runsvdir and I'm starting few services, namely mdev, dhcpcd, wpa_supplicant and acpid.

Sweets commented 2 years ago

acpid may be the culprit, since it can send events (SIGINT in particular). I had acpid send SIGINT to PID 1 on my last KISS install when pressing the power button.

If you disable acpid temporarily, what is the result? I am taking a shot in the dark, since I'm at work and can't review the source right now.

undefinednpc commented 2 years ago

I tried to disable acpid and the issue persists.

If it helps somehow though, the first time it happened, I was able to switch to tty2, and use the computer normally. Maybe the tty1 is falling through then.

Sweets commented 2 years ago

Were you able to switch back to tty1 after going to tty2?

undefinednpc commented 2 years ago

No, I wasn't.

Sweets commented 2 years ago

So it is the TTYs dying.

What about using the vanilla provided tty? It may be a problem with the dist files for KISS. If you could, try that and let me know.