bevry / dorothy

πŸ§™πŸ»β€β™€οΈ Bring your dotfile commands and configuration to any shell. Sensible defaults and hundreds of commands preloaded. Supports Bash, Zsh, Fish, Nu, Xonsh, Elvish, Dash, KornShell, macOS, Linux, Windows.
Other
311 stars 22 forks source link

Improvement: smooth installation on non-root systems #233

Open edmcman opened 3 months ago

edmcman commented 3 months ago

I am installing dorothy on a machine that I don't have root on. It begins to install the required packages, and basically prompts me to enter a sudo password many times for bash, moreutils, llvm, openssl, and so on. This is pretty annoying. I can press Ctrl-D to make sudo bail and dorothy continues, but it's definitely not a great experience.

Since dorothy can't upgrade the bash package, it also downloads and installs a new version of bash from source, which I really didn't want it to do.

balupton commented 3 months ago

Hrmmm. Yeah, def could be improved.

Are you wishing for those utilities to be installed, but just via a method that doesn't require sudo? Such would still let all the Dorothy commands function as expected. Let's call this the non-root complete install option; this might be easy enough to do, such as updating setup-util to filter methods based on root/non-root with a flag.

Or do you wish to not have them installed at all, and use only a minimal set of Dorothy commands that do not need them? If so, is this use of Dorothy only for Dorothy's cross-shell configuration loading but not for Dorothy's own commands? Let's call this non-root minimal install; this will require some thinking on the best approach.

For bash, which bash version did you wish to keep it on? Or are you okay with Dorothy getting a newer bash, as long as Dorothy only has access to it? Bash is definitely a dependency in which older version support varies… here is a list of issues that I've encountered with older bash versions: https://github.com/bevry/dorothy/blob/master/docs/bash/versions.md the bash.bash file provides shims of various compromises: https://github.com/bevry/dorothy/blob/master/sources/bash.bash

What operating system and architecture was this? Does it have a docker container? If so, we can add CI testing.

edmcman commented 3 months ago

I think this issue is about the "non-root complete install". If I hadn't been prompted many times by sudo, the process would have been fine.

The complaint about bash was more of an afterthought. My thought as it was happening was basically "Do I really need a new version of bash?" and I felt a little out of control during the process. This machine is fairly old and outdated: RHEL 7.9 on x86-64. The built-in version of /bin/bash is 4.2.46. Maybe all that is needed here is a prompt or message saying that bash is being upgraded because it is older than a certain version, or making it an interactive decision.

It does look like there is a docker container for RHEL 7.9, but it's deprecated so it's probably not even worth your time to worry about that version specifically. (We are upgrading soon..... hopefully).

balupton commented 3 months ago

I think this issue is about the "non-root complete install". If I hadn't been prompted many times by sudo, the process would have been fine.

Interesting, so did the deps manage to install via an alternative method? Or did Dorothy, or that dep installation, end up failing in the end? Do you still have the output of this session and are able to share, if so, it'll be easier for me to know which methods to filter as non-root compatible.

The complaint about bash was more of an afterthought.

Good feedback. It does this check internally, but never communicates it externally if it can just do the upgrade:

https://github.com/bevry/dorothy/blob/a982b1dfe52968049df266d3e9e7cb3fff5fa983/sources/bash.bash#L60-L74

https://github.com/bevry/dorothy/blob/a982b1dfe52968049df266d3e9e7cb3fff5fa983/commands/is-bash-version-outdated#L86-L90

https://github.com/bevry/dorothy/blob/a982b1dfe52968049df266d3e9e7cb3fff5fa983/commands/setup-util-bash#L92-L99

Will update it accordingly so that it is mentioned why it is upgrading.

edmcman commented 3 months ago

Interesting, so did the deps manage to install via an alternative method? Or did Dorothy, or that dep installation, end up failing in the end?

Some of them, such as bash, managed to install via an alternate method. It seemed like some of the others, like openssl, failed but then the process moved on. It's a bit unclear what happened to the dorothy install as a whole. The install did seem to fail, but it wasn't completely clear why. (It might have been my fault -- I have a submodule on my dotfiles repo as an added layer of protection).

Do you still have the output of this session and are able to share, if so, it'll be easier for me to know which methods to filter as non-root compatible.

I didn't save it, but I will recreate it.

balupton commented 3 months ago

Some of them, such as bash, managed to install via an alternate method. It seemed like some of the others, like openssl, failed but then the process moved on. It's a bit unclear what happened to the dorothy install as a whole. The install did seem to fail, but it wasn't completely clear why. (It might have been my fault -- I have a submodule on my dotfiles repo as an added layer of protection).

Hrmm, will need to see then in the recreation.

I didn't save it, but I will recreate it.

Ok cool, thank you. Could you record as well if not too inconvenient?


I think the next step here is finding an up to date container that can reproduce the non-root experience. Then I can develop the adjustments against it, and add CI support for the adjustments. Would you be able to post back with such a container?

I will schedule any adjustments for after #229 lands, which is my current task. So have 2 weeks before I start on this.

edmcman commented 3 months ago

Here's a script log. dorothy.log

A couple notes:

I'll try in the container and see if the same thing happens.

edmcman commented 3 months ago

I replicated this in a Docker container here: https://github.com/edmcman/dorothy-issue233

I also created a video:

Video

balupton commented 2 months ago

Great, thank you.

So there's two approaches that I'm thinking of:

  1. we proceed the installation as normal, however if the root prompt fails, we ask the user if they want to (a) try again, (b) skip this invocation but still try for other invocations, or (c) skip root altogether. The latter will write a $DOROTHY/state/no-root file, which sudo-helper and setup-util will check in the future, to adapt their behaviour accordingly.

  2. same as the first option, but we prompt the user prior to trying sudo; I'm leaning away from this, as there are too many install pathways that could avoid a direct prompt.

for the actual dorothy installation:

  1. the login shell enablement will need to be skipped, as it requires root
  2. will need to document exactly which commands require which of those required deps
  3. explain why bash is being upgraded

I've scheduled this in my Dorothy batch of work and for completion it'll probably be sometime next month. If someone wants to beat me to it, that's good too.

depending on how it all goes, it may make sense to introduce a few different installation options:

  1. Clone the git repo and expose the dorothy command only via an alias
  2. Clone the git repo and add its bins to path
  3. Clone the git repo and load init.sh
  4. Clone the git repo, install deps, load init.sh, ask about user config, etc - current method

however alternative installation options will be significant increase in complexity and support burden, so should only be done if justified and sustainable

balupton commented 1 month ago

Besides the few fixes on the issue tracker, this is up next.

balupton commented 2 weeks ago

Okay, so finally got those fixes finished with #250. Will release this week. Then will finish #221, which may take next week. Then this. Then #195