Skip to content

delay providing shell prompt until some signal or condition is met #11078

Open

Description

@razamatan

Is your feature request related to a problem? Please describe.
i'm using an encrypted home directory that i mount using https://gist.github.com/razamatan/dcdc7188b0bd643401adeeccbc8164c8. everything works nice using gentoo's openrc as wsl's boot.command.

now, when i want to set my starting user to someone who's homedir is under /home, things break as the proper /home isn't available while openrc's various init scripts that i use to "start up" finish. b/c the prompt is given so fast, all the dotfiles for login is tried to be read from the empty /home directory which is the state it's in prior to being properly mounted.

i then can exit and go back in, and it works fine.

this gets old really quick as this happens every time wsl shuts down.

Describe the solution you'd like

the ideal solution is to have wsl2 be aware of the state of completion in openrc to completing running all the init scripts for default. if you tell me that systemd integration just works here, then i would consider moving to that.

a weaker solution would be to provide some command whose return value determines if the shell can be loaded. in my case, my /home is an ext4 partition, so it has a /home/lost+found directory. i could just have a test for that directory's presence.

Describe alternatives you've considered
i thought about trying systemd given that it's better supported, but i don't really like it. i would strongly consider trying if wsl2 is fully aware of the systemd startup state and delays providing the shell until it's complete.

i also thought about only allowing root to be the wsl2 startup user and having root's bashrc change from root's login to my user (su) after evaluating the shell condition to ensure /home was properly mounted.

Additional context
n/a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions