Bug 1444223

Summary: systemd ProtectHome=yes does not follow symlink'd /home dir
Product: [Fedora] Fedora Reporter: Tyler <teaton>
Component: systemdAssignee: systemd-maint
Status: CLOSED EOL QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 25CC: johannbg, lnykryn, msekleta, muadda, rhbugs, ssahani, s, systemd-maint, zbyszek
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-12-12 10:14:35 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Tyler 2017-04-20 21:59:49 UTC
Description of problem:
When using ProtectHome=yes in a service unit file, the service will fail to start if the /home directory is a symlink.

Version-Release number of selected component (if applicable):
systemd 231

How reproducible:
This is easily reproduced by creating a symlink to another directory as /home.  Default services like systemd-hostnamed and systemd-localed will fail to start with error 226/NAMESPACE.

Steps to Reproduce:
1. mv /home /foo
2. ln -s /foo /home
3. systemctl restart systemd-hostnamed.service

Actual results:
The service fails to start with error:

"Failed at step NAMESPACE spawning /usr/lib/systemd/systemd-hostnamed: Too many levels of symbolic links"

Expected results:
Service starts normally, chasing the symlink to the true location.

Additional info:
This is fixed in systemd 232 by Poettering himself under issue #3867:
https://github.com/systemd/systemd/issues/3867

I have not tested, but I suspect the read-only option will also be affected.

Comment 1 Tyler 2017-06-22 18:42:22 UTC
To clarify, this bug breaks autofs-based network home folders.

This bug could be worked around with a null or network mount of the home directory, but systemd-tmpfiles-setup requires access to this folder pre-network, so adding it to fstab as an NFS or null mount to an autofs mount causes a chicken-and-egg problem, and the entire operating system will not boot, dropping to dracut shell.

I have found no reasonable workaround without modifying the service files to disable ProtectHome, modifying the systemd-tmpfiles-setup service to occur after the home folder is mounted (causing several other issues in the boot process), or changing user home folders to somewhere other than /home, which completely defeats the purpose of ProtectHome in the first place.

This is fixed in systemd 232, and I have verified by building and installing v232 from systemd on github.  After installing, the system boots normally and all systemd-* services function with ProtectHome=yes set in their service file.

Please pull systemd 232 or above into Fedora 25.

Comment 2 Fedora End Of Life 2017-11-16 19:05:06 UTC
This message is a reminder that Fedora 25 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 25. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '25'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 25 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

Comment 3 Fedora End Of Life 2017-12-12 10:14:35 UTC
Fedora 25 changed to end-of-life (EOL) status on 2017-12-12. Fedora 25 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.