Linux는 부팅 프로세스 중에 언제/어떻게 시스템 사용자를 생성합니까?

Linux는 부팅 프로세스 중에 언제/어떻게 시스템 사용자를 생성합니까?

NFS 마운트 루트 파일 시스템(Debian 10)에서 보드를 가져오려고 합니다. 시작하는 동안 직렬 포트를 통해 오류가 보고됩니다.

[FAILED] Failed to start Create System Users.
See 'systemctl status systemd-sysusers.service' for details.

이것은 인쇄된 유일한 오류 메시지입니다. (아직 사용자가 생성되지 않았기 때문에) 로그인할 수 없어서 세부 정보를 확인하는 명령을 실행할 수 없습니다.

루트 파일 시스템은 SD 카드에 있을 때 마더보드가 부팅할 수 있기 때문에 문제가 없습니다.

그렇다면 Linux가 시작될 때 "시스템 사용자 생성" 프로세스는 어떻게 수행됩니까? 이 오류의 원인은 무엇입니까?

답변1

시작 프로세스 중에 systemd는 구성되고 활성화된 모든 서비스를 초기화합니다. 명확하게 명시된 요구사항과 기타 측정항목을 기준으로 순위를 매깁니다.

귀하의 경우 데비안에는 파일에 정의된 systemd-sysusers 서비스와 함께 systemd가 포함되어 있습니다./usr/lib/systemd/system/systemd-users.service.

서비스의 기본 콘텐츠는 다음과 같습니다.

#  SPDX-License-Identifier: LGPL-2.1-or-later                                                                                                                                         #                                                                                                                                                                                     #  This file is part of systemd.                                                                                                                                                      #                                                                                                                                                                                     #  systemd is free software; you can redistribute it and/or modify it                                                                                                                 #  under the terms of the GNU Lesser General Public License as published by                                                                                                           #  the Free Software Foundation; either version 2.1 of the License, or                                                                                                                #  (at your option) any later version.

[Unit]
Description=Create System Users
Documentation=man:sysusers.d(5) man:systemd-sysusers.service(8)
DefaultDependencies=no
Conflicts=shutdown.target
After=systemd-remount-fs.service
Before=sysinit.target shutdown.target systemd-update-done.service
ConditionNeedsUpdate=/etc

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=systemd-sysusers
TimeoutSec=90s

# Optionally, pick up a root password and shell for the root user from a
# credential passed to the service manager. This is useful for importing this
# data from nspawn's --set-credential= switch.
LoadCredential=passwd.hashed-password.root
LoadCredential=passwd.plaintext-password.root
LoadCredential=passwd.shell.root

ExecStart줄은 이 서비스에 대해 실행할 항목을 systemd에 알려줍니다. 이 경우 실행됩니다./usr/bin/systemd-sysusers매개변수가 없습니다. 이 유틸리티의 일부 출력은 다음에서 찾을 수 있습니다./var/log/메시지. 제 경우(CentOS 9 Stream)의 성공적인 실행 결과는 다음과 같습니다.

Aug 15 10:11:26 MY-VM systemd-sysusers[257]: Suggested group ID 65534 for nobody already used.
Aug 15 10:11:26 MY-VM systemd-sysusers[257]: Creating group 'nobody' with GID 999.
Aug 15 10:11:26 MY-VM systemd-sysusers[257]: Creating group 'users' with GID 100.
Aug 15 10:11:26 MY-VM systemd-sysusers[257]: Creating group 'dbus' with GID 996.
Aug 15 10:11:26 MY-VM systemd-sysusers[257]: Creating user 'dbus' (System Message Bus) with UID 996 and GID 996.
Aug 15 10:11:28 MY-VM systemd[1]: systemd-sysusers.service: Deactivated successfully.

발생한 오류를 검색했을 때 나열된 가장 가능성 있는 원인은 다음과 같습니다. 루트 드라이브/파티션에 쓸 수 없음(디스크 가득 참, 권한, 읽기 전용 마운트 등) 및 하나 이상의 구성 오류 다음 또는 문법 오류:/etc/passwd, /etc/shadow, /etc/gshadow, /etc/group.

systemd 서비스 단위 파일에는 읽을 수 있는 문서에 대한 매뉴얼 페이지도 나열되어 있습니다.

관련 정보