Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-5899

Missing dependency on home dir for user@.service unit

Details

    • Major
    • sst_cs_plumbers
    • ssg_core_services
    • False
    • Hide

      None

      Show
      None
    • If docs needed, set a value

    Description

      Description of problem:

      When having users with home dire on NFS and enabling lingering for such users, systemd fails to start the user@ service instance for the lingering user because the home dir is not present yet. This ends up not having the user services started.

      IMHO user@.service should have the following property added, so that it gets delayed until home dir is available:
      -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
      RequiresMountsFor=%h
      -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

      Unfortunately due to BZ #2056527 "%h" cannot be used for now.

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

      systemd-239

      How reproducible:

      Always

      Steps to Reproduce:
      1. Create a user with home dir on NFS

      2. Enable lingering for that user
      3. Create a user service (/home/rmetrich/.config/systemd/user/test.service) and enable it

      -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
      [Service]
      ExecStart=/bin/sleep 3600

      [Install]
      WantedBy=default.target
      -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

      4. Reboot

      Actual results:

      "systemd --user" loads but "test.service" unit is not known / didn't execute because "systemd --user" instance has a "null" configuration:
      -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
      $ systemctl --user status test
      Unit test.service could not be found.
      -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

      Expected results:

      "test.service" executes.

      Additional info:

      With the added dependency on home dir (hardcoded because "%h" fails), this works fine:
      -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

      1. systemctl cat user@$(id -u rmetrich)
        [...]
      2. /etc/systemd/system/user@.service.d/home.conf
        [Unit]
        RequiresMountsFor=/home/rmetrich

      $ systemctl --user status test
      ● test.service
      Loaded: loaded (/home/rmetrich/.config/systemd/user/test.service; enabled; vendor preset: enabled)
      Active: active (running) since Mon 2022-02-21 14:24:54 CET; 24s ago
      Main PID: 1265 (sleep)
      CGroup: /user.slice/user-101166.slice/user@101166.service/test.service
      └─1265 /bin/sleep 3600
      -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

      Attachments

        Activity

          People

            jmigacz@redhat.com Jacek Migacz
            rhn-support-rmetrich Renaud Metrich
            Jacek Migacz Jacek Migacz
            Frantisek Sumsal Frantisek Sumsal
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated: