[systemd-devel] No maintenance shell on local fs failure (/bin/sh: no such file or directory)
Jonathan de Boyne Pollard
J.deBoynePollard-newsgroups at NTLWorld.com
Sat Jan 16 01:52:16 PST 2016
Frank Steiner:
> [...] I see such messages:
>
>> About to execute: /bin/echo -e 'Welcome to emergency mode! After logging in, ...
>> Forked /bin/echo as 4290
>> Failed at step CHDIR spawning /bin/echo: No such file or directory
>
>
> [...] But |/usr/lib/systemd/system/emergency.service| contains:
>
>> [Service]
>> Environment=HOME=/root
>> WorkingDirectory=/root
>> ...
>> ExecStartPre=-/bin/echo -e 'Welcome to emergency mode! After logging in, ...
>> ExecStart=-/bin/sh -c "/sbin/sulogin; /usr/bin/systemctl --fail --no-block default"
>> ...
>
>
> [...] That was caused by |/root| being a symbolic link to
> |/local/home/root| [...]
>
Andrei Borzenkov:
> [...] So I would vote for changing it to |/| as well.
>
|
/bin/echo| certainly doesn't care what its working directory is.
When it comes to the later |ExecStart|, which hasn't yet been reached in
the scenario at hand, the convention is that the "userinit" part of the
procedure (i.e. the part that sets up the environment variables like
|HOME|||and changes working directory) is the responsibility of the
login program. The |@SULOGIN@| that is Miquel van Smoorenburg's
|sulogin| (as exemplified above) is no exception to this.
It /itself/ reads the home directory out of the password database, and
changes directory to it and sets the |HOME| environment variable to it;
without need for the invoking systemd unit to do so, and with less
drastic failure modes in the absence of root's home directory or when
the system administrator has decided that it isn't |/root|. Witness:
> if (chdir(pwd->pw_dir) < 0) {
> if (chdir("/") < 0)
> fprintf(stderr, "sulogin: change of working directory failed: %m\n\r");
> }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20160116/d8c87f67/attachment.html>
More information about the systemd-devel
mailing list