archlinux / archinstall

Arch Linux installer - guided, templates etc.
GNU General Public License v3.0
6.36k stars 545 forks source link

Add Teaching Mode as a CLI Flag #2799

Open jackdesert opened 2 weeks ago

jackdesert commented 2 weeks ago

PR Description:

Adds a flag through ArgParser for --teach, which does the following:

  1. Echo each subprocess command to the screen (but only after installation actually begins)
  2. Wait for a few seconds before actually running the command so the user has a chance to grok what's going on

Tests and Checks

jackdesert commented 2 weeks ago

Screenshots:

2024-11-11 16 52 16

2024-11-11 16 52 37

2024-11-11 16 52 54

2024-11-11 16 52 58

2024-11-11 16 57 21

svartkanin commented 2 weeks ago

We're already logging every command executed into a file https://github.com/archlinux/archinstall/blob/040a6aba27d20361f0c833a04b75fce09690bb51/docs/help/report_bug.rst isn't that sufficient?

jackdesert commented 2 weeks ago

I actually built this to educate myself about the arch install process, and to demonstrate to a fellow arch newb the patterns used by the guided installer.

For me the --teach option is about education in the moment. Seeing the play-by-play inline with the narration. The existing narration tells me in friendly words what the installer is about to do. Then seeing the actual commands right after that lets me know how those friendly words are enacted. This lends itself to realizations such as: "Oh look, it takes three commands to make those friendly words happen!" / "Oh look, that's the command where I always wondered how they got it to run without asking for human input!" / "Oh look, that command takes a looong time to run and generates a log of output!"

I also envision the --teach option to be super easy to point newcomers to. For example: "Boot up this .iso, run these three iwctl commands to connect to WiFi, and then run archinstall --teach for a guided install that also shows you what commands are running under the hood."

jackdesert commented 2 weeks ago

Here's one more plug for --teach mode:

@svartkanin Today I looked at the contents of /var/log/archinstall/cmd_history.txt to see if it could serve as a stand-in for the --teach mode that I have proposed in this PR. Here is what I observe:

  1. cmd_history.txt appears to contain the cumulative logs from all the times I've run archinstall during this boot. (This makes it hard to see which commands were used in just one invocation of archinstall)

  2. cmd_history.txt appears to include the commands that were run even before the menu was populated. (This makes it challenging to separate out which commands were run just to set up the menu vs which commands were run to actually install the system. I am most interested in learning the latter.)

  3. The timestamp format in cmd_history.txt is numerical. (Example: 1731611189.3625734) This makes it hard for my human eyes to determine how many minutes passed from one command to the next.

svartkanin commented 2 weeks ago

archinstall is essentially an automation tool for the arch wiki. It tends to implement commands and instructions as they are described in the wiki. It adds maintenance cost that doesn't necessarily translate into a larger benefit as I think most folks are looking for an automated installation rather than going through it manually step-by-step. And in the latter case the wiki should be the first point of entry for gathering knowledge.

Torxed commented 2 weeks ago

I agree. While it's a novel idea, I think it adds maintenance cost and some times generate a lot of noise (for instance when we probe devices for internal reasons, something users wouldn't have to do).

If anything, I think we could be better about informing the users that IF they want to learn what we did - there is a file they can look at to track the steps - and that these steps can be further read about in the wiki.

Because ultimately, these commands won't tell the user much unless they follow along the installation guide anyway.

I like the idea tho, but I think we can achieve the same result with guiding the user to /var/log/archinstall/cmd_history.txt at the end of an installation.

(we could probably improve this file too, if it's of use for others.. it's mainly for internal debugging and more advanced error debugging and can for sure contain sensitive information)