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

Slow logins because spawning systemd-hostnamed takes 5 seconds due to having many mounts

Linking RHIVOS CVEs to...Migration: Automation ...SWIFT: POC ConversionSync from "Extern...XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Normal Normal
    • None
    • rhel-9.6
    • systemd
    • None
    • No
    • Low
    • rhel-systemd
    • 5
    • False
    • False
    • Hide

      None

      Show
      None
    • None
    • None
    • None
    • None
    • Unspecified
    • Unspecified
    • Unspecified
    • None

      What were you trying to do that didn't work?

      A customer is seeing a delay of 5 seconds when logging in through ssh. It appears that the delay is due to executing hostnamectl command from inside /etc/profile, which leads to having systemd spawn systemd-hostnamed, the latter taking 5 seconds to complete.
      The delay in the spawning is faced before executing systemd-hostnamed but while doing the remounts: processing of /proc/self/mountinfo is performed 104 times for the customer and the file contains 2832 lines.

      This issue looks very similar to RHEL8's one RHEL-106970 even though it's less critical here because there is no utab parsing anymore.

      What is the impact of this issue to you?

      Long delays spawning login shells

      Please provide the package NVR for which the bug is seen:

      systemd-252-46.el9_5.3
      systemd-252-51.el9_6.2

      How reproducible is this bug?:

      Always on customer system, it's sufficient to log in while having a large mount table.

      Reproducer

      With ~4000 mounts, it takes 4.6s to execute hostnamectl command:

      1. On my laptop I export /root and create 100 subdirectories /root/%d
      2. On the RHEL9 VM I mount these NFS exports
        # for i in $(seq 1 100); do mkdir -p /root/$i; mount NFSSERVER:/root/$i /root/$i; done
      3. On the RHEL9 VM I bind-mount these NFS exports 40 times each
        # for i in $(seq 1 40); do mkdir -p /mnt/binds/$i; for j in $(seq 1 100); do mkdir -p /mnt/binds/$i/$j; mount --bind /root/$i /mnt/binds/$i/$j; done; done
      4. I execute hostnamectl
        # systemctl is-active systemd-hostnamed
        inactive
        # time hostnamectl
        [...]
        real	0m4.667s
        user	0m0.005s
        sys	0m0.006s
        

              systemd-maint systemd maint mailing list
              rhn-support-rmetrich Renaud Métrich
              systemd maint mailing list systemd maint mailing list
              Frantisek Sumsal Frantisek Sumsal
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated: