[systemd-devel] Unable to login with /home marked as nofail (Issue #28890)

Kyle Evans kvans32 at gmail.com
Tue Aug 22 15:37:30 UTC 2023


Hello,

I have a mobile phone with /home on an encrypted sdcard.
I am trying to make sure that the phone will boot into a usable state 
regardless of whether /home is mounted or not.
Reasons that it might not be mounted include some type of sdcard 
failure/corruption, or the user removing the card while powered off.

The underlying / has a /home populated with a default user as a fallback 
in case /home is not mounted.

See https://github.com/systemd/systemd/issues/28890 for further.

In that issue it was stated
 > But of course, a user login session will still pull in the home dir 
of that user. Which is enforce programmatically in logind. But it's 
really the only thing that makes sense. Allowing the user to log in 
without their home dir is a very weird idea I'd argue. I cannot see how 
that would ever make sense?

If the answer to that is not obvious from the first paragraph, I shall 
expound.
This is not about having all of my files when I log in. It is about 
being able to use a thing that does not have a keyboard or mouse under 
as many circumstances as possible.
I enjoy troubleshooting, that is why I'm here, but out on the street 
with the sun shining down is not a circumstance where I look forward to 
doing that.
As it stands now, the device will not boot into a usable, or even 
troubleshootable, state if the sdcard is removed.
It is like not being able to use your car because your phone is not 
plugged in. Does that make any sense?

I considered creating a service to do some hackery at boot, but I was 
looking for a straight forward way to implement a fallback mechanism.
Certainly I am not the only person who will desire a robust phone.
This is not such a far out use case. I think the only reason that it has 
not come up yet is because systemd on phones is rather new and not many 
people have had to deal with a failed sdcard that puts their system into 
an unusable state. I mean unusable for no real reason. Sure many people 
have / on a failed sdcard, but that is a different story. It is also a 
different story when you don't have a keyboard available to log into a 
console for the simple task of commenting out a line in fstab, which 
should arguably not be necessary.

It seems probably a more acceptable solution would be to create another 
user and mount my home under /home/me and have /home/failsafe part of /.
What I have not worked out there is how to decide which user to login.
Is it possible to have deps on override files? For instance, If there is 
a phosh(phone shell) override to run under my uid. Can applying the 
override depend on some condition?

Something to consider is that the default user, me, is logged in 
automatically at boot. There is no display manager prompting for a user 
login, only a password protected lock screen. This is by necessity so 
that when a new call or message comes in there is a userspace app 
running to trigger a notification.

It also seems that removing the nofail option would be the preferable 
way to do this, as it would allow visibility of the missing mount.
But, that looks like a black hole as what is desired is something like a 
rescue target that has gui capability.
graphical.target both Requires=multi-user.target and Conflicts=rescue.target
multi-user.target Requires=basic.target, which Requires=`everything in 
fstab`

Is there a way around this? I don't have a lot of confidence in 
overrides at this point, and this all looks like a rabbit hole leading 
to a programmatically implicit dependency.

-Kyle Evans



More information about the systemd-devel mailing list