New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Outreachy 2023] Improve user experience on early system boot failures #26586
Comments
implementation idea for "activation-by-journald":
(from the TODO file) |
Good evening @bluca. I'm extremely elated to have gotten this opportunity to be your protege over the next months. I know it can be quite demanding on your schedule, but please, I'll like to start my mentorship immediately. You mostly as well as the other team members here have made very huge impact on my tech journey this year sir. Please find the time in your schedule-no matter how little it is that I get- to start with me immediately sir. Thank you so so much. God bless you sir. |
First. That's because of an issue of '>' rather than '>=' I'll open a PR to fix that tonight or early tomorrow. I have just ordered for a new computer that I hope to pick up tomorrow morning. If I can't set up a vagrant box on my old PC again tonight, then I'll push the PR tomorrow. |
Second. I really do not understand PID1. I'm thinking src/core/main.c is what I should be studying sir. Is that right? |
Third. What other modules should I start with, in order to get the actual flow of the init process? Thank you sir. |
@bluca, It's a really cool feature. Thank you for choosing it sir, and thank you for this big opportunity of a mentorship. when I get excited about my learning again, I'll drop an update, that way I stay in touch, and you also monitor my progress. |
going through console_setup() function, I saw a comment that says we don't want to enforce text-mode on the console as initrd may have started a graphical process like plymouth. up until now, I thought the boot process flow was:
It looks like it's actually:
I thought initrd is only accessed at some point during PID 1, but it looks like it actually runs before PID1. So far, I've learnt that initrd is distribution dependent and isn't directly part of our project. |
@bluca @poettering, I'm confused about the "in initrd" part. My understanding is the bootloader loads the kernel and initrd/initramfs into the ram, the initrd mounts a temporary file system through which the kernel gets the drivers it needs for the machine's hardware, after the necessary hardware checks, the actual root file system is mounted and the kernel starts systemd as PID 1. So my confusion is initrd seems to be outside our project, how then do we detect battery level inside of it? Is it that we can somehow make initrd mount the temporary file system and thereafter run a script for detecting battery level? Or more in line with my understanding, is it that as soon as initrd completes and PID 1 starts, the first thing we do is check battery level to decide whether or not we should continue with the init process? I'm sorry for being verbose and naive. I often get good clarity after your guidance. Thank you sirs. |
I suggest reading this man page. It will possibly help with your confusion about the boot process. But here's a quick summary of the initrd:
Many distros choose to use systemd inside of the initrd as well as outside of it. This is the case that you should care about. This is what is meant by "in the initrd" in the context of systemd. Here's what that looks like
|
Wow, just like that, I mean you took out your precious time to explain this in such great details? How awesome, how exciting. Thank you so so so much @AdrianVovk. I'm so so glad to be part of this community. Thank you so so so much once again sir. I'm super Thankful. |
Thank you so much sir. |
There are various units that run only in the initrd, they generally are named "initrd-something", check the units/ directory. There's already a helper function to check whether battery is critically low, |
Yay!!!! Nice to hear from you sir. |
Awesome sir. Thank you so much, I'll get to work right away. Thank you sir. |
How has your day been sir? I look forward to a video meet with you soon. I hope my accent won't be terrible! |
I want to create a new tool "battery-check.c" should I place it in "src/battery-check/battery-check.c" or could it just stay in "src/ac-power/battery-check.c"? Also is the name choice good enough? or should I use something like "early-boot-battery-check.c" I appreciate the time you commit to guiding me very very much, knowing how busy your schedules can be. It's a super awesome blessing to have you. Thank you sir. Thank you everyone. |
Also, I'm not seeing any other use cases for this tool that may warrant adding the "--help", "--version" and "--verbose" flags as with the ac-power tool. should I leave those out sir? |
Here's what I've done sir: |
@bluca Should I answer no? Or as I would like, would you permit to schedule a video call sir? Thank you. |
We can continue using github PRs/issues for now, and re-evaluate if needed |
It's exciting though how much i'll get familiar with the codebase, given all these deep concepts Poettering has mentioned. With the knowledge, I'll be able to fix at least one issue/TODO per month going forward. |
I opened a PR to add a new call to Not quite ready for your reviews, but i'd rather just get started and push as i gain more knowledge. |
@poettering, @bluca , Good morning sirs. I've been trying to implement this, but I'm not quite clear on it. The implementation of this vl_subscribe_var() method is where I've gotten stuck. I understand this method should take a single argument which is the log level a service wants to subscribe to: emerg, warning, debug etc. But I'm not sure what it's prototype should be. I have considered:
I would appreciate some sort of break down on this sirs. |
@poettering The much I could implement is in this PR: Kindly take a look in your spare time sir.# |
I think we should change strategy a bit and simplify things. The idea of having journald send out notifications saves from having a running service that watches it, but puts a bit more burden in journald itself. It is also more complex. So instead, I suggest to simplify and change the bsod utility to get a new mode, where it waits for messages. This is very simple to do, you can see it from the example here: https://github.com/systemd/systemd/blob/main/man/journal-iterate-wait.c |
Okay sir. As a first approach at least. Then the Varlink API at some point in the future. |
Is the description above enough to get you started or do you need more details? |
😁😁😁 I haven't looked at the resource today, I'll probably do later in the night. But I don't want to miss the chance of getting more guidance especially as we head into the weekend. So yes sir I do need more details 😁😁 This is such an exciting question from you sir. |
@bluca It's awesome 😁😁😁 |
Two things sir: |
If I'm picturing this correctly, This approach does simplify things by a factor of 100!😂😂 I do hope though that @poettering still finds time to come guide on those complex approach. The knowledge from those four things he wants us to implement would be awesome to gain. |
Good morning sir. Kindly provide guidance on these sir: ->audit error level logs that are relevant for early boot failures, and bump log level up
I know your schedule may be very busy, But for as long as you can spare time to guide sir, I'll be available to refine these features(battery check and bsod) as much as possible. Thank you sir. |
It's easier to start from this - you can look around for |
Okay sir. I'm coming back to ask of the details. I saw @poettering is back, let me go express my excitement first!!! |
@bluca, I traced the calls like so: I didn't quite see any reference to the catalogue entry sir. What I picture is that each message we process with But, first, I'm not even sure if what I picture is accurate as per your guidance sir. If it is, or close, how do I find the message catalogue, how do I amend existing Sorry I'm verbose! |
Or could it be that you're not asking me to modify the existing calls to the logging functions,
Thank you sir. |
I just noticed there are some functions in the sd-journal API for the message catalogue. I'll look them up. |
I see this entry: The system journal process has started up, opened the journal
(a)Provide the administrator, user or developer with further information about the issue at hand, beyond the actual message text
|
This entry seems to be quite cool, it has everything but the native language explanations:
|
Don't worry about translations, that is done separately. Catalog entries are added to catalog/systemd.catalog.in, you need to look at the emergency level messages, and for each one generate a new uuid with |
Okay sir. I'll reach out whenever I'm stuck. |
Currently, I see 23 calls total to both None of the messages are currently in "catalog/systemd.catalog.in" This is the approach I'm considering: step 1: step 2: step 3:
(The last part will take lots of inputs during the PR review). Is that all I need do as far as adding catalog entries for the messages is concerned? |
You also need to change log_emergency*() so that it uses a message-id when logging, and takes it as a parameter, so that each call can specify the ID you are adding |
Okay sir. |
Component
systemd/journald
Project description
Improve the user experience when something goes wrong early at system boot. We want to ensure that users are able to debug early boot failures by providing QR-encoded URLs pointing to useful description of errors that the system just experienced.
We also want to ensure that the system meets a minimum baseline level before it is allowed to continue booting, which for this project consists in checking that the battery level is adequate and above a minimum configurable threshold.
Implementing this project will require working on low-level components such as the systemd system manager, the journald logging service, and adding new early boot services that handle virtual terminals, consoles and QR encoding.
Tasks
The text was updated successfully, but these errors were encountered: