Systemd/ko

From Gentoo Wiki
Jump to:navigation Jump to:search
This page is a translated version of the page Systemd and the translation is 53% complete.
Outdated translations are marked like this.

systemd 는 최신 SysV 방식의 리눅스 시스템용 init, rc 후속작입니다. 젠투에선 대안 init 시스템으로 지원합니다.

Switching init systems is a non trivial operation that has implications for how the system is configured, and sometimes for what software can be installed or not. Generally, an init system will be chosen at installation time (i.e. by downloading either a systemd or an openrc stage3 tarball), and only changed if necessary. In true Gentoo style, in addition to systemd and OpenRC, several init systems are supported.

If systemd is being unwantedly pulled in as a dependency, see Gentoo without systemd.

설치

중요
<=sys-apps/systemd-203 버전에서 업데이트할 경우 업그레이드 하위 문서를 참고 하십시오.

이곳저곳에 빌드한 모든 배포판의 핵심은 리눅스 커널입니다. 사용자 프로그램과 시스템 하드웨어 사이의 계층입니다. 젠투에서는 가능한한 다양한 커널 소스를 제공합니다. 전체 설명은 커널 개요 페이지에 있습니다.

amd64 기반 시스템에서는 sys-kernel/gentoo-sources 꾸러미를 활용하시는게 좋습니다.

적당한 커널 소스를 선택하고 emerge로 설치하십시오:

root #emerge --ask sys-kernel/gentoo-sources

커널

systemd에서는 최신 리눅스 커널 기능의 대부분을 사용할 수 있습니다. 이제 최소 커널 지원 버전은 2.6.39입니다. sys-kernel/gentoo-sources 최근 버전에서는 systemd용 필수, 선택 커널 옵션을 선택하는 간편한 수단을 도입했습니다(자세한 내용은 Kernel/Configuration 참고):

커널 gentoo-sources의 간편 설정
Gentoo Linux --->
        Support for init systems, system and service managers --->
                [*] systemd

커널 옵션(sys-kernel/gentoo-sources를 사용하지 않는 경우)을 직접 설정하려면 다음 커널 옵션이 필요하거나 추천합니다:

커널 필수 옵션
General setup  --->
	[*] Control Group support --->
	[*] open by fhandle syscalls
	[ ] Enable deprecated sysfs features to support old userspace tools
	[*] Configure standard kernel features (expert users)  --->
		[*] Enable eventpoll support
		[*] Enable signalfd() system call
		[*] Enable timerfd() system call
[*] Networking support --->
Device Drivers  --->
	Generic Driver Options  --->
		[*] Maintain a devtmpfs filesystem to mount at /dev
File systems  --->
	[*] Inotify support for userspace
	Pseudo filesystems  --->
		[*] /proc file system support
		[*] sysfs file system support
커널 추천 옵션
General setup  --->
        [*] Checkpoint/restore support
	[*] Namespaces support  --->
		[*] Network namespace
[*] Enable the block layer  --->
	[*] Block layer SG support v4
Processor type and features  --->
	[*] Enable seccomp to safely compute untrusted bytecode
Networking support --->
	Networking options --->
		<*> The IPv6 protocol
Device Drivers  --->
	Generic Driver Options  --->
		()  path to uevent helper
		[ ] Fallback user-helper invocation for firmware loading
Firmware Drivers  --->
	[*] Export DMI identification via sysfs to userspace
File systems --->
	<*> Kernel automounter version 4 support (also supports v3)
	Pseudo filesystems --->
		[*] Tmpfs virtual memory file system support (former shm fs)
		[*]   Tmpfs POSIX Access Control Lists
		[*]   Tmpfs extended attributes

UEFI 시스템에서는 다음 옵션을 활성화하십시오:

커널 UEFI 지원
[*] Enable the block layer  --->
	Partition Types  --->
		[*] Advanced partition selection
		[*]   EFI GUID Partition support
Processor type and features  --->
	[*] EFI runtime service support
Firmware Drivers  --->
        EFI (Extensible Firmware Interface) Support -->
	        <*> EFI Variable Support via sysfs

시스템에서 BFQ 스케쥴러를 사용한다면 "Enable the block layer -> IO Schedulers"의 BFQ 업스트림에서 "BFQ hierarchical scheduling support" 활성화를 추천합니다.

커널 BFQ scheduler
IO Schedulers  --->
	<*> BFQ I/O scheduler
        [*]   BFQ hierarchical scheduling support

최신 목록은, 업스트림 README 파일에서 "REQUIREMENTS" 섹션을 참고하십시오.

부팅 시간에 /usr이 나타나는지 확인하기

/usr 설정을 나누려면 initramfs를 활용하여 systemd를 시작하기 전에 /usr를 마운트하십시오. 현재는 sys-kernel/genkernel 에서 /usr 마운트를 지원하기까지 sys-kernel/dracut 또는 sys-kernel/genkernel-next를 활용하라는 의미입니다. 설정을 옮겨갈 시간은 따로 확보해두십시오:

root #emerge --ask -c sys-kernel/genkernel
root #emerge --ask sys-kernel/dracut
root #emerge --ask sys-kernel/genkernel-next

dracut을 사용할 때, /usr를 자동으로 마운트하도록 자동으로 활성화하지 않는 경우 usrmount 모듈을 활성화하십시오.

파일 /etc/dracut.conf.d/usrmount.conf
# Dracut modules to add to the default
add_dracutmodules+="usrmount"

genkernel-next를 활용한다면, 커널을 다시 빌드하기 전에 genkernel의 설정 파일에서 UDEV 변수를 yes로 설정했는지 확인하십시오. 이 옵션을 설정하면 initramfs에 /usr 디렉터리를 끌어옵니다:

파일 /etc/genkernel.conf
# Use udev instead of mdev as the default device manager for the initramfs.
# If systemd and perhaps lvm is used, then this _must_ be turned on.
UDEV="yes"
root #genkernel --install all

더 많은 대안 설정은 Initramfs 안내서 를 참고하십시오.

LVM과 Initramfs 사용하기

sys-fs/lvm2를 사용하여 시스템을 initramfs로 부팅하려 할 때, sys-kernel/genkernel-next의 다음 명령을 사용하면 initramfs를 만듭니다:

root #genkernel --lvm <target>

<target>initramfs나 initramfs 생성 결과인 기타 genkernel 타겟 중 하나입니다. 자세한 내용은 genkernel --help 출력 내용을 살펴보십시오:

user $genkernel --help

USE 플래그

USE flags for sys-apps/systemd System and service manager for Linux

acl Add support for Access Control Lists
apparmor Enable support for the AppArmor application security system
audit Enable support for sys-process/audit
boot Enable EFI boot manager and stub loader
cgroup-hybrid Default to hybrid (legacy) cgroup hierarchy instead of unified (modern).
cryptsetup Enable cryptsetup tools (includes unit generator for crypttab)
curl Enable support for uploading journals
dns-over-tls Enable DNS-over-TLS support
elfutils Enable coredump stacktraces in the journal
fido2 Enable FIDO2 support
gcrypt Enable use of dev-libs/libgcrypt for various features
gnutls Prefer net-libs/gnutls as SSL/TLS provider (ineffective with USE=-ssl)
homed Enable portable home directories
http Enable embedded HTTP server in journald
idn Enable support for Internationalized Domain Names
importd Enable import daemon
iptables Use libiptc from net-firewall/iptables for NAT support in systemd-networkd; this is used only if the running kernel does not support nftables
kernel-install Enable kernel-install
kmod Enable kernel module loading via sys-apps/kmod
lz4 Enable lz4 compression for the journal
lzma Support for LZMA compression algorithm
openssl Enable use of dev-libs/openssl for various features
pam Add support for PAM (Pluggable Authentication Modules) - DANGEROUS to arbitrarily flip
pcre Add support for Perl Compatible Regular Expressions
pkcs11 Enable PKCS#11 support for cryptsetup and homed
policykit Enable PolicyKit (polkit) authentication support
pwquality Enable password quality checking in homed
qrcode Enable qrcode output support in journal
resolvconf Install resolvconf symlink for systemd-resolve
seccomp Enable seccomp (secure computing mode) to perform system call filtering at runtime to increase security of programs
secureboot Automatically sign efi executables using user specified key
selinux !!internal use only!! Security Enhanced Linux support, this must be set by the selinux profile or breakage will occur
split-usr Enable behavior to support maintaining /bin, /lib*, /sbin and /usr/sbin separately from /usr/bin and /usr/lib*
sysv-utils Install sysvinit compatibility symlinks and manpages for init, telinit, halt, poweroff, reboot, runlevel, and shutdown
test Enable dependencies and/or preparations necessary to run tests (usually controlled by FEATURES=test but can be toggled independently)
tpm Enable TPM support
ukify Enable systemd-ukify
vanilla Disable Gentoo-specific behavior and compatibility quirks
xkb Depend on x11-libs/libxkbcommon to allow logind to control the X11 keymap
zstd Enable support for ZSTD compression

프로파일

systemd USE 플래그를(make.conf에서) 전체적으로 활성화하십시오. systemd-logind 서비스와 충돌하는 현상을 막으려면 consolekit USE 플래그를 비활성해야합니다. 분명한 USE 플래그를 기본으로 사용하려 systemd 하위 프로파일로 전환할 수도 있는데, 이런 경우 make.conf의 설정을 바꿀 필요는 없습니다.

root #eselect profile list

마지막으로 새 프로파일을 적용하여 시스템을 업데이트하십시오:

root #emerge -avDN @world
참고
Once this command is complete, it is important follow the Configuration steps.

의존 문제

OpenRC를 systemd로 전환할 때 여러 의존 문제가 나타날 수 있습니다.

sys-apps/sysvinit 꾸러미가 sys-apps/systemd를 막는다면, sys-apps/systemd를 설치하기 전에 sysv-utils USE 플래그를 지워보십시오. 필요한 경우 다음에 USE 플래그를 설정(하고 sys-apps/systemd를 재설치)할 수 있습니다.

root #emerge --oneshot sys-apps/openrc
root #emerge --ask --depclean

If sys-apps/sysvinit is still blocking sys-apps/systemd, make sure it and sys-apps/openrc are not contained in the world file:

root #emerge --deselect sys-apps/openrc sys-apps/sysvinit

sys-fs/udevsys-apps/systemd를 막는다면, sys-fs/udev가 world 파일에 등록한 상태일수도 있습니다. 선택을 취소하여 이 문제를 해결해보십시오:

root #emerge --deselect sys-fs/udev

sys-apps/systemd에 udev가 있습니다. 일단 설치하면, virtual/udev의 프로바이더가 systemd가 되므로 sys-fs/udev 요구 항목을 제거할 수 있습니다.

시스템에 sys-fs/eudev를 설치했다면 virtual/udevvirtual/libudev에서 systemd 설치를 막을 수도 있습니다. portage에서 이 문제를 해결하려면 USE 플래그를 설정한 후 가상 꾸러미를 다시 설치해보십시오:

root #emerge --oneshot virtual/udev virtual/libudev

부트로더

중요
sysv-utils USE 플래그를 설정했다면 sys-apps/systemd에는 더이상 필요한 과정이 아닙니다. 젠투에서는 239번 버전부터 기본값입니다.

systemd를 실행하려면, 실행 커널(또는 initramfs)이 활용하는 init 을 전환해야합니다.

경고
이전 서비스 관리자용 설정 서비스는 자동으로 시작하지 않습니다. 시스템이 다른 서비스 관리자로 전환하기 때문입니다. 네트워크 또는 로그인 관리자와 같은 기능을 정상적인 기능을 하도록 되돌리려면, 이 서비스들 또한 활성화해야 합니다. 이에 대한 더 많은 정보는 이 글의 서비스 장에 있습니다.
참고
마이그레이션을 멈춘 상태로 두면, init 변경 과정의 실행을 취소하고 되돌려서 기본 서비스 관리자(OpenRC)로 돌아가서 언제든 부팅할 수 있습니다. 이 동작은 이 글의 마지막 문제 해결 장을 통해 어떤 문제를 해결할 수 있도록 합니다.

다음 하위 장에서는 부팅 관리자 또는 커널에서 init 설정을 바꾸는 방법을 언급합니다.

이전 GRUB 버전 (0.x)

init=/lib/systemd/systemd 매개 변수 값을 커널 명령줄에 추가하십시오. grub.conf에서 온 예제는 다음과 같습니다:

파일 /boot/grub/grub.confsystemd용 GRUB 설정 예제
title=Gentoo with systemd
root (hd0,0)
kernel /vmlinuz root=/dev/sda2 init=/lib/systemd/systemd

OpenRC로 시스템을 부팅할 경우 init 대신 real_init 를 사용하십시오.

GRUB 2

grub-mkconfig를 사용할 때, init 옵션을 GRUB_CMDLINE_LINUX 에 붙여넣으십시오:

참고
systemd에서 dracut이 만든 initramfs를 사용할 경우에는 initramfs 에서 이미 systemd를 시작했으므로 필요하지 않습니다.
파일 /etc/default/grubsystemd용 GRUB2 설정
# Append parameters to the linux kernel command line
GRUB_CMDLINE_LINUX="init=/lib/systemd/systemd"

GRUB2 설정 파일을 직접 작성할 경우(전문가에게만 해당), init= 매개 변수를 linux 또는 linux16 명령에 추가하십시오.

파일 /boot/grub/grub.cfgGRUB2 설정 일부 예제
linux /vmlinuz-3.10.9 root=UUID=508868e4-54c6-4e6b-84b0-b3b28b1656b6 init=/lib/systemd/systemd

YABOOT

Yaboot는 리눅스를 실행할 PowerPC 기반 하드웨어용 부트로더이며, 이 하드웨어는 뉴 월드 롬 매킨토시 시스템에 일부 해당합니다.

커널 명령줄 뒤에 init=/lib/systemd/systemd 인자 값을 직접 넣어야 합니다. yaboot.conf 예제는 다음과 같습니다:

파일 /etc/yaboot.confsystemd용 yaboot 설정 예제
image=/vmlinux 
   append="init=/lib/systemd/systemd" 
   label=Linux 
   read-only 
   initrd=/initramfs 
   initrd-size=8192

설정대로 동작하게 하려면 yaboot.conf를 수정할 때마다 ybin 명령을 매번 실행해야합니다.

커널 설정

init 설정은 커널 설정으로 하드코딩할 수 있습니다. "Processor type and features -> Built-in kernel command line" 부분을 참고하십시오. 이 기법은 GRUB 과 GRUB2에서 동작합니다.

업그레이드

systemd에서는 (재부팅을 하지 않고) 실행 중인 시스템을 업데이트하는 기능이 있습니다. systemd 업그레이드를 emerge 처리한 다음, 아래 명령을 실행하십시오:

root #systemctl daemon-reexec

설정

systemd에서는 대부분의 기본 시스템 세부 정보 설정할 몇가지 시스템 설정 파일을 지원합니다.

After installing systemd, run the following:

root #systemd-machine-id-setup
root #systemd-firstboot --prompt
root #systemctl preset-all
경고
If systemd-firstboot is not ran, it will automatically run on next boot. However, it interrupts the normal boot process, preventing access to the system from users who don't have access to the interactive console - like accessing a server via SSH.
참고
어떤 시스템 설정 매개 변수는 적당한 설정 파일을 수정해서 업데이트 할 수 있습니다만 대부분의 설정은 systemd 동작이 필요한 유틸리티로 관리합니다. 이 경우 systemd로 안전하게 다시 부팅한 후 필요한 대로 hostnamectl, localectl, timedatectl을 활용하십시오.

머신 ID

저널링 동작을 위해 머신 ID를 만듭니다. 다음 명령으로 진행할 수 있습니다:

root #systemd-machine-id-setup
참고
systemd-machine-id-setup 명령은 systemd-networkd 서비스에도 영향을 줍니다. 이 명령을 실행하지 않으면 네트워크 인터페이스를 구동할 수 없거나 네트워크 주소를 적용하지 못하는 이상한 동작이 일어날 수 있습니다.

호스트 이름

호스트 이름을 설정하려면 /etc/hostname를 만들거나 편집하여 원하는 호스트 이름을 넣으십시오.

systemd로 부팅할 때, /etc/hostname/etc/machine-info를 편집하는 hostnamectl 도구가 있습니다. 호스트 이름을 바꾼다면, 다음처럼 명령을 실행하십시오.

root #hostnamectl set-hostname <HOSTNAME>

더 많은 옵션은 man hostnamectl를 참고하십시오.

로캘

보통 로캘은 systemd를 설치할 때 OpenRC에서 적절하게 가져옵니다. 필요하다면 젠투 핸드북에 언급된 절차대로 /etc/locale.conf에서 설정할 수 있습니다.

파일 /etc/locale.confSystem locale configuration
LANG="en_US.utf8"

systemd로 부팅 했다면 localectl 도구로 로캘, 콘솔, X11 키 배치를 설정할 수 있습니다. 시스템 로캘을 바꾸려면, 다음 명령을 실행하십시오:

root #localectl set-locale LANG=<LOCALE>

가상 콘솔 키 배치를 바꾸려면:

root #localectl set-keymap <KEYMAP>

마지막으로 X11 배치를 설정하려면:

root #localectl set-x11-keymap <LAYOUT>

모델에서 필요하다면, 변수 및 옵션 값을 설정할 수 있습니다:

root #localectl set-x11-keymap <LAYOUT> <MODEL> <VARIANT> <OPTIONS>


위 동작 중 어느 하나를 실행한 다음, 환경을 업데이트하여 바뀐 설정대로 동작하게 하십시오:

root #env-update && source /etc/profile
root #env-update && source /etc/profile

날짜와 시간

날짜와 시간대는 timedatectl 유틸리티로 설정할 수 있습니다. 이 유틸리티에서는 net-misc/ntp 또는 systemd의 자체 구현체가 아닌 다른 구현체 없이 시간 동기화를 처리하도록 설정할 수 있습니다.

timedatectl 사용 방법을 알아보려면 간단하게 다음처럼 실행하십시오:

root #timedatectl --help

자동 모듈 불러오기

자동 모듈 불러오기는 파일의 디렉리가 아닌, 각자 다른 파일에 설정합니다. 설정 파일은 /etc/modules-load.d 에 있습니다. 부팅 과정에서 모듈 목록에 있는 파일을 불러옵니다. 파일 형식은 개행 문자로 구분한 모듈 목록이며, .conf를 붙여 파일 이름이 길어질 수 있습니다. 모듈 불러오기 동작은 프로그램, 서비스 또는 개인으 취향에 따른 방직으로 나눌 수 있습니다. 하단의 예제를 통해 virtualbox.conf를 보여드리겠습니다:

파일 /etc/modules-load.d/virtualbox.confvirtualbox 모듈용 예제 파일
vboxdrv
vboxnetflt
vboxnetadp
vboxpci

Automatic mounting of partitions at boot

Systemd is capable of automatically mounting various partitions to standardized location via systemd-gpt-auto-generator. This makes it possible to boot and automatically mount essential partitions without an fstab and without a root= paramter on the kernel command line. To use this capability, first systemd must be included in the initramfs, this is the case by default for initramfs images generated with Dracut on systems with systemd installed. And second, each partition must have the correct Partition Type GUID. A list of the most important GUIDs can be found in the systemd-gpt-auto-generator manual, the full list can be found on wikipedia.

To list the current Partition Type GUID of your partitions:

root #lsblk -o NAME,LABEL,PARTLABEL,PARTTYPE,PARTTYPENAME,MOUNTPOINT

systemd-gpt-auto-generator can auto-mount partitions at the following locations, note that the correct GUID depends on the systems CPU architecture:

  • / SD_GPT_ROOT_....
  • /boot/ SD_GPT_ESP if no /efi/ and no XBOOTLDR partition, otherwise SD_GPT_XBOOTLDR
  • /efi/ SD_GPT_ESP if /efi/ is present on the root, if not then ESP is at /boot/
  • /home/ SD_GPT_HOME
  • /srv/ SD_GPT_SRV
  • /usr/ SD_GPT_USR_....
  • /var/ SD_GPT_VAR
  • /var/tmp/ SD_GPT_TMP
  • Swap SD_GPT_SWAP

Below is an example of the most basic partition layout consisting of one EFI System Partition and one x86-64 root partition.

root #lsblk -o NAME,LABEL,PARTLABEL,PARTTYPE,PARTTYPENAME,MOUNTPOINT
NAME        LABEL    PARTLABEL            PARTTYPE                             PARTTYPENAME                 MOUNTPOINT
nvme1n1
├─nvme1n1p1 ESP      EFI System Partition c12a7328-f81f-11d2-ba4b-00a0c93ec93b EFI System                   /boot
└─nvme1n1p2 Gentoo   Gentoo               4f68bce3-e8cd-4db1-96e7-fbcaf984b709 Linux root (x86-64)          /

The PARTTYPE for an EFI System Partition is c12a7328-f81f-11d2-ba4b-00a0c93ec93b, it will be mounted at either /efi/ or /boot/ depending on which of these mount points is available and on if there is also an Extended Boot Loader Partition (PARTTYPE=bc13c2ff-59e6-4262-a352-b275fd6f7172) present on this disk. The PARTTYPE for an x86-64 root parition is 4f68bce3-e8cd-4db1-96e7-fbcaf984b709.

If the Partition Type GUID is not correct it can be changed without data loss using a partitioning tool such as fdisk. Note that the system must be offline to change the patition types! A system rescue image, or secondary operating system, must be used to complete the following steps.

Open the disk with the to be changed partition types in fdisk, in this exameple /dev/nvme1n1 is used:

root #fdisk /dev/nvme1n1
 
Welcome to fdisk (util-linux 2.39.3).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
 
 
Command (m for help):

List the current partition layout with the p command:

Command (m for help): p
 
Disk /dev/nvme1n1: 1.82 TiB, 2000398934016 bytes, 3907029168 sectors
Disk model: Samsung SSD 970 EVO Plus 2TB
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: B25D5B33-4A10-F940-826C-3CB24ADC7D86
 
Device           Start        End    Sectors  Size Type
/dev/nvme1n1p1    2048    1052671    1050624  513M EFI System
/dev/nvme1n1p2 1052672 3907028991 3905976320  1.8T Linux root (x86-64)

Change the Partition Type GUID of any partition with the t command, followed by the number of the partition to be changed, and finally the alias for the desired partition type:

Command (m for help): t
Partition number (1,2, default 2): 2
Partition type or alias (type L to list all): L
Partition type or alias (type L to list all): 23
 
Changed type of partition 'Linux root (x86-64)' to 'Linux root (x86-64)'.

Repeat the above steps for any additional partitions of which the Partition Type GUID should be changed. Once completed, save the changes with the w command:

Command (m for help): w
참고
systemd-gpt-auto-generator will only auto-mount partitions that reside on the same disk as the EFI System Partition that the system is being booted from.
요령
Some tools may become confused if there is no root= parameter on the kernel command line at all. To placate such tools add root=/dev/gpt-auto-root to the kernel command line. This trick is also usefull if a swapfile on the root partition is used instead of a swap partition for hibernation, i.e. one may specify the resume target on the kernel command line as resume=/dev/gpt-auto-root resume_offset=xxxxxxxxx.

네트워크

systemd is compatible with various network management tools.

systemd-networkd

See the systemd/systemd-networkd article for details on setting up a wired network on systemd systems.

systemd-resolved

See the systemd/systemd-resolved article for details on setting up address name resolution (DNS) on systemd systems.

NetworkManager

NetworkManager는 주로 네트워크를 설정할 때 사용합니다. 이 용도로, 그래픽 기반 데스크톱을 사용한다면 간단하게 다음 명령을 실행하십시오.

root #nm-connection-editor

이 경우가 아니라 콘솔에서 네트워크를 설정해야 한다면, nmcli를 사용해보시거나, nmtui를 통해 설정 안내 과정을 따라가십시오:

root #nmtui

nmtui은 콘솔에서 실행할 경우, 사용자에게 설정 과정을 안내하는 curses 프론트엔드입니다.

For more details see the dedicated article.

로그 파일 처리

systemd에는 (app-admin/syslog-ngapp-admin/rsyslog 같은) 외부 로그 시스템에 의존할 필요 없이 로그 파일을 자체적으로 처리하는 수단을 지니고 있습니다.

원한다면 sysklog나 syslog-ng 같은 외부 로깅 유틸리티로 로그 메시지를 전달하도록 로깅 서비스를 설정할 수 있습니다. 필요한 방식을 맞추기 위해 systemd-journald 서비스를 설정하는 방법을 알아보려면 man journald.conf를 참고하십시오.

systemd의 통합 로깅 서비스는 보안 상태의 이진 형식으로 로깅 메시지를 기록합니다. 로그는 journalctl 명령으로 "볼 수 있으며", systemd-journald 로깅 서비스와는 별개로 실행할 수 있습니다.

중요
systemd의 systemd-journald.service 를 로깅 목적으로 사용할 때 systemd를 실행하는 시스템에 보통 기본으로 동작합니다. journalctl 명령을 실행하는 일반 사용자에게는 "unable to view system logs" 메시지를 출력합니다. 시스템 로그를 비 루트 계정으로 보려면 systemd-journal, adm, wheel 그룹 중 하나에 속해야 합니다. 일반 사용자에게 로그 보기를 허용하는 가장 간단한 방식은 systemd-journal 그룹에 넣는 방식입니다. larry에게 로그를 볼 수 있게 하려면 다음 명령으로 추가합니다:

root #gpasswd --add larry systemd-journal
시스템 로그는 앞서 소개한 명령으로 일반 사용자 권한으로 journalctl --system 명령을 실행하여 볼 수 있습니다.

journalctl 옵션의 일부는 다음과 같습니다:

journalctl 명령줄 옵션 결과
journalctl 옵션 제외 모든 로그를 시작 순서대로 보여줍니다.
-b, --boot 부팅 과정의 모든 기록을 표시합니다.
-r, --reverse 나중에 뜬 항목 먼저.
-f, --follow 최근 일부 항목을 보여주고 새 기록 항목은 나타나는대로 바로 표시합니다.
-p, --priority= 메시지 표시 (최소) 우선순위를 다음 중 하나로 지정합니다: "emerg" (0), "alert" (1), "crit" (2), "err" (3), "warning" (4), "notice" (5), "info" (6), "debug" (7).
--since=, --until= 시간에 따라 항목을 제한합니다. "YYYY-MM-DD hh:mm:ss" 형식 또는 "yesterday", "today", "tomorrow" 문자열을 허용합니다.
-n, --lines= 항목 갯수 제한.
-k, --dmesg 커널 메시지만 표시.
-u, --unit= 지정 Systemd 유닛으로 제한.
--system 시스템 서비스와 커널 로그를 봅니다. 기본적으로 이 동작은 root 사용자만 실행할 수 있습니다. 일반 사용자에게 시스템 저널 읽기 권한을 주는 방법을 알아보려면 man journalctl을 참고하십시오.

| journalctl without options || Show all log entries, starting with earliest. |-

| -b, --boot || Show all log entries from the current boot. |-

| -r, --reverse || Show the newest log entries first (reverse chronological order). |-

| -f, --follow || Show the last few entries and display new log entries as they're being produced. This is similar to running tail -f in text logging utilities. |-

| -p, --priority= || Specify (minimum) priority to display messages, with a choice from: "emerg" (0), "alert" (1), "crit" (2), "err" (3), "warning" (4), "notice" (5), "info" (6), "debug" (7). |-

| -S, --since=, -U, --until= || Restrict entries by time. Accepts the format "YYYY-MM-DD hh:mm:ss" or the strings "yesterday", "today" and "tomorrow". |-

| -n, --lines= || Restrict to a number of entries. |-

| -k, --dmesg || Restrict to kernel messages. |-

| -u, --unit= || Restrict to a certain systemd unit. |-

| --system || View system service and kernel logs. By default, this is only possible as the root user. See man journalctl for how to grant standard users the ability to read the system journal. |-

|}

더 많은 옵션은 man journalctl을 살펴보십시오.

tmpfs에 있는 /tmp

/etc/fstab에서 /tmp에 어떤 다른 파일 시스템을 마운트하지 않으면 systemd에서는 /tmp를 tmpfs로 마운트합니다. 이는 매번 부팅할 때마다 비어있고 시스템에 장착한 RAM 용량의 50%로 제한된 상태임을 의미합니다. 왜 이런 동작이 타당한지, 이 설정을 어떻게 수정하는지 알아보려면 API File Systems를 살펴보십시오.

부팅 과정 세부 설정

systemd로 이전하는 과정에서 사용자 여러분은 보통 부팅 과정 출력 내용 규모가 다르다는걸 눈치챕니다:

  • quiet 커널 명령행 옵션은 커널 출력에만 영향을 줄 뿐만 아니라, systemd 자체에도 영향을 줍니다. 머신에 systemd를 설정한다면, 언제든 일어나는 오류를 쉽게 살펴보려면 이 옵션을 치워놓으십시오. 오류를 다 해결하고 다시 추가하면 잠잠한(그리고 빠른) 부팅 과정을 진행할 수 있습니다.
  • quiet 커널 명령행 옵션을 전달해도, 어차피 systemd 에서는 systemd.show_status=1 설정을 전달하여 상태를 표시하도록 설정할 수 있습니다.
  • quiet 커널 명령행 옵션을 설정하지 않으면, 일부 메시지를 콘솔에 겹쳐 출력할 수 있습니다. 이는 커널 설정에 기인합니다(man 5 proc/proc/sys/kernel/printk 참조). 이 설정을 조절하려면, loglevel=5 커널 명령행 매개 변수를 커널에 전달하십시오(그리고 설정에 따라 값을 업데이트 하십시오. 예를 들어, 가장 작은 값은 1입니다.).

Usage

Converting traditional home directories to systemd homed

See the systemd-homed subarticle.

서비스

시스템에서 어떨 때는 systemd를 (시스템 모드로) 동작하게 하려 다시 부팅할 필요가 있을 수도 있습니다. 다시 부팅하기 전에는, 가능한한 완벽하게 systemd를 설정했는지 확인하려는 목적으로 이 문서를 전반적으로 읽어내려가십시오. 참고로 journalctl은 systemd가 동작하지 않아도 동작하지만, systemctl은 systemd가 동작하지 않으면 무용지물입니다. systemd가 동작하는 시스템에 로그인 한 후 서비스 설정(서비스 활성화 및 시작)을 완료하십시오.

사전 설정 서비스

대부분은 systemd를 처음 설치했을 때 사용하지 않는 상태입니다. "preset" 파일을 제공하며 기본 설정 서비스로 활성화할 목적으로 씁니다.

root #systemctl preset-all

OpenRC 서비스

systemd가 근본적으로 이전 Init.d 스크립트 동작을 지원하도록 의도했지만, 지원 기능이 독립기반 OpenRC에 적합하지 않기 때문에 젠투에서는 완전히 먹통입니다. OpenRC는 OpenRC를 시스템 부팅 과정에서 사용하지 않았을 경우 init.d 스크립트를 실행할 수 없는지 확인(그렇지 않으면 결과를 예상할 수 없습니다)하는 추가 도구를 제공합니다.

존재 서비스 목록

존재하는 모든 서비스 유닛은 systemctllist-units 매개 변수를 붙여 목록을 확인할 수 있습니다:

root #systemctl list-units
UNIT                               LOAD   ACTIVE SUB       DESCRIPTION
boot.automount                     loaded active waiting   EFI System Partition Automount
proc-sys-fs-binfmt_misc.automount  loaded active waiting   Arbitrary Executable File Formats File System Automount Point
...

다음 파일 접미부 항목은 자주 사용하는 요소입니다:

접미부 설명
.service 일반 서비스 파일 (예. 데몬을 직접 실행),
.socket 소켓 감청자 (inetd와 유사),
.path 서비스용 파일 시스템 트리거(파일을 바꾸는 등의 동작이 일어날 때 실행하는 서비스).

| .service | Plain service files (e.g. ones just running a daemon directly). |-

| .socket | Socket listeners (much like inetd). |-

| .path | Filesystem triggers for services (running services when files change, etc.). |-

|}

대신 systemctl 도구로 (암묵적으로 동작하는) 모든 서비스 목록을 볼 때 사용할 수 있습니다:

root #systemctl --all --full

그리고 마지막으로 시작에 실패한 서비스를 점검하려면:

root #systemctl --failed

서비스 활성, 비활성, 시작, 중단

일반적인 서비스 활성화 방식은 다음 명령을 사용합니다:

root #systemctl enable foo.service

서비스는 다음과 같이 비활성화 할 수 있습니다:

root #systemctl disable foo.service

이 명령은 기본 대상의 기본 이름으로 서비스를 활성화합니다(각각의 내용은 서비스 파일의 "Install" 섹션에 설정했습니다). 그러나 가끔 서비스는 이런 정보 또는 사용자가 원하는 다른 이름/타겟을 제공하지 않기도 합니다.

이 명령은 다음에 시스템을 부팅할 때 서비스를 활성화, 비활성화 할 수 있습니다. 지금 서비스를 시작하려면 다음 명령을 사용하십시오:

root #systemctl start foo.service

다음과 같이 서비스를 멈출 수 있습니다:

root #systemctl stop foo.service

Services implementing ExecReload= can be commanded to reload their configuration without restarting itself:

root #systemctl reload foo.service

개별 유닛 설치

개별 유닛 파일은 systemctl daemon-reload를 실행한 후 systemd에서 인식할 /etc/systemd/system에 놓을 수 있습니다:

root #systemctl daemon-reload

/lib/systemd/system는 꾸러미 관리자에서 설치한 서비스 파일용으로 예약되어 있습니다.

유닛 파일 개별 설정

유닛의 중요하지 않은 설정을 바꿀 필요가 있다면, /etc/systemd/system에서 원래 유닛 파일의 완전한 사본을 만들 필요가 없습니다. 원본 유닛 이름 뒤에

  • .d가 붙은 디렉터리에서 해당 설정 파일을 넣으면 유닛에서 제공하는 꾸러미 관리 설정을 바꿀 수 있습니다.

Both the drop-in directory and config file can be created using the systemctl edit utility or manually.

The editing utility can be invoked as:

root #systemctl edit apache2.service
파일 /etc/systemd/system/apache2.d/mem-limit.conf서비스 파일에 설정 추가/덮어쓰기 예제
[Service]
MemoryLimit=1G

바뀐 내용을 systemd 에 알리려면 systemd를 다시 불러와야합니다:

root #systemctl daemon-reload

이제 바뀐 내용을 적용하려면 서비스를 다시 시작해야 합니다:

root #systemctl restart apache2

서비스에 바뀐 속성을 적용했는지 확인하십시오:

root #systemctl show --property=MemoryLimit apache2
MemoryLimit=1074000000
참고
{{{1}}}

개별 설정 이름으로 서비스 활성화

유닛의 "[Install]" 섹션에 "Alias"에서 제공하는 이름이 없어 기대한 조건에 일치하지 않고 개별 설정을 통해 이 이름을 완전한 새 값으로 제공하고 싶지 않다면, /etc/systemd/system/*.wants/에 직접 심볼릭 링크로 만들 수 있습니다.

  • .wants 디렉터리의 이름은 타겟 또는 사로운 요소에 의존할 다른 서비스를 지정할 수 있습니다.

예를 들어 mysqld.servicemulti-user.targetdb.service로 설치하려면:

root #ln -s /lib/systemd/system/mysqld.service /etc/systemd/system/multi-user.target.wants/db.service

서비스를 비활성화하려면, 심볼릭 링크를 제거하기만 하시면 됩니다:

root #unlink /etc/systemd/system/multi-user.target.wants/db.service

자체 서비스

일부 젠투 꾸러미는 이미 systemd 유닛 파일을 설치합니다. 이 서비스들은 충분히 활성화 할 요건을 갖추었습니다. 꾸러미 설치 유닛 파일의 간단한 요약 정보는 systemd eclass users list에서 살펴볼 수 있습니다.

OpenRC의 서비스와 일치하는 systemd 서비스는 다음 테이블 목록과 같습니다:

서비스 이전 열람표
젠투 꾸러미 OpenRC 서비스 systemd 유닛 참고
sys-apps/openrc bootmisc systemd-tmpfiles-setup.service 항상 활성화 상태이며, tmpfiles.d 활용
consolefont systemd-vconsole-setup.service 항상 활성화 상태이며, vconsole.conf 활용
devfs
dmesg
fsck fsck*.service 마운트 프로그램에서 암묵적으로 끌어옴(실행함)
functions.sh 참고 확인 bug #373219
hostname (내장) /etc/hostname
hwclock 참고 확인 systemd의 일부로 항상 활성화(구워져 나온 상태이며 유닛이 아님).
(역자 주: '구워져 나온 상태'라는건 빌드할 때 포함했다는 의미)
keymaps systemd-vconsole-setup.service 항상 활성화 상태이며, vconsole.conf 활용
killprocs
local
localmount local-fs.target 실제 유닛은 /etc/fstab에서 만듬
modules systemd-modules-load.service 항상 활성화 상태이며, /etc/modules-load.d/*.conf 활용
mount-ro
mtab
netmount remote-fs.target
numlock
procfs (내장)
root remount-rootfs.service
savecache 없음 OpenRC 내부 전용 스크립트
staticroute
swap swap.target 실제 유닛은 /etc/fstab에서 만듬
swclock
sysctl systemd-sysctl.service sysctl.conf, sysctl.d/
sysfs (내장)
termencoding systemd-vconsole-setup.service 항상 활성화 상태이며 vconsole.conf 활용
urandom systemd-random-seed-load.service
systemd-random-seed-save.service
app-admin/rsyslog rsyslog rsyslog.service
app-admin/syslog-ng syslog-ng syslog-ng.service
media-sound/alsa-utils alsasound alsa-store.service (기본으로 활성화)
alsa-restore.socket (기본으로 활성화)
net-misc/dhcpcd dhcpcd dhcpcd.service
net-misc/netifrc net.* net@.service net.* 스크립트용 systemd 래퍼 (net-misc/netifrc 에서 딸려옴)
netctl@.service net-misc/netctl는 원래 아치 리눅스 도구입니다.
NetworkManager.service networkmanager-0.9.8.4 미만 버전에서는 dispatcher.d 스크립트가 동작하려면 NetworkManager-dispatcher.service 를 활성화 하십시오.
NetworkManager-wait-online.service를 활성화하면
시스템이 활성 인터넷에 연결한 상태인지 확인합니다.
기타 네트워크 관리자(e.g., wicd, dhcpcd)와 wpa_supplicant는 비활성화 하십시오.
dhcpcd.service net-misc/dhcpcd에서 제공
systemd.networkd.service systemd의 일부
net-misc/openntpd ntpd ntpd.service
net-misc/openssh sshd sshd.service sshd 를 데몬으로 실행
sshd.socket inetd 유사 기반으로 sshd 실행 (들어오는 연결 별로)
net-wireless/wpa_supplicant wpa-supplicant wpa_supplicant.service D-Bus 에서 제어하는 데몬 (NetworkManager용)
wpa_supplicant@.service 인터페이스별 wpa_supplicant (wpa_supplicant@wlan0.service 처럼 사용)
net-print/cups cupsd cups.service 기존 방식의 부팅 시작 서비스
cups.socket 소켓, 경로 활성화(요청 기반으로만 cups 시작)
cups.path
net-wireless/bluez bluetooth bluetooth.service
sys-apps/dbus dbus dbus.service
dbus.socket
sys-apps/irqbalance irqbalance irqbalance.service 데몬 모드만 지원
sys-apps/microcode-ctl microcode_ctl microcodemodule로 설정하여 마이크로 코드 자체를 불러오도록 합니다. 잊지 마시고 "Processor type and features" -> "CPU microcode loading support" 로 이동하여 Intel 또는 AMD 프로세서를 가진 시스템에 따라 올바른 옵션을 설정하십시오.
sys-fs/udev udev udev.service
udev-mount (내장) /dev 를 tmpfs 로 마운트
udev-postmount udev-trigger.service
udev-settle.service
sys-power/acpid acpid acpid.service 대부분의 기능은 systemd 자체에서 구현이 완료됐으니 이 항목의 비활성화를 고려하십시오
x11-apps/xdm (xdm) xdm.service OpenRC 는 x11-base/xorg-server에서 설치한 xdm 를 사용합니다. systemd 에서는 각각의 디스플레이 관리자에서 제공하는 관련 파일(gdm.service, kdm.service...)을 활성화해야합니다
net-firewall/iptables iptables iptables-store.service
iptables-restore.service

! scope="col" | Gentoo package ! scope="col" | OpenRC service ! scope="col" | systemd unit ! scope="col" | Notes |-

! scope="row" rowspan="28" | sys-apps/openrc | bootmisc || systemd-tmpfiles-setup.service || always enabled, uses tmpfiles.d |-

| consolefont || systemd-vconsole-setup.service || always enabled, uses vconsole.conf |-

| devfs || || |-

| dmesg || || |-

| fsck || fsck*.service || pulled in implicitly by mounts |-

| functions.sh || See note || bug #373219 |-

| hostname || (builtin) || /etc/hostname |-

| hwclock || See note || always enabled as part of systemd (i.e. it is baked in and it is not a unit) |-

| keymaps || systemd-vconsole-setup.service || always enabled, uses vconsole.conf |-

| killprocs || || |-

| local || || |-

| localmount || local-fs.target || actual units are created implicitly from /etc/fstab |-

| modules || systemd-modules-load.service || always enabled, uses /etc/modules-load.d/*.conf |-

| mount-ro || || |-

| mtab || || |-

| netmount || remote-fs.target || |-

| numlock || || |-

| procfs || (builtin) || |-

| root || remount-rootfs.service || |-

| savecache || n/a || OpenRC internals |-

| staticroute || || |-

| swap || swap.target || actual units are created implicitly from /etc/fstab |-

| swclock || || |-

| sysctl || systemd-sysctl.service || sysctl.conf and sysctl.d/ |-

| sysfs || (builtin) || |-

| termencoding || systemd-vconsole-setup.service || always enabled, uses vconsole.conf |-

| scope="row" rowspan="2" | urandom | systemd-random-seed-load.service || |-

| systemd-random-seed-save.service || |-

! scope="row" | app-admin/rsyslog | rsyslog || rsyslog.service || |-

! scope="row" | app-admin/syslog-ng | syslog-ng || syslog-ng.service || |-

! scope="row" rowspan="2" | media-sound/alsa-utils | scope="row" rowspan="2" | alsasound | alsa-store.service || (enabled by default) |-

| alsa-restore.socket || (enabled by default) |-

! scope="row" | net-misc/dhcpcd | dhcpcd || dhcpcd.service || |-

! scope="row" rowspan="5" | net-misc/netifrc | scope="row" rowspan="5" | net.* | net@.service || systemd wrapper for net.* scripts (comes with net-misc/netifrc) |-

| netctl@.service || net-misc/netctl is originally an Arch Linux tool. |-

| NetworkManager.service || For <networkmanager-0.9.8.4 : enable NetworkManager-dispatcher.service for dispatcher.d scripts to work.
Enable NetworkManager-wait-online.service to detect that the system has a working internet connection.
Disable all other managers (e.g., wicd, dhcpcd) and wpa_supplicant. |-

| dhcpcd.service || Provided by net-misc/dhcpcd |-

| systemd.networkd.service || Part of systemd |-

! scope="row" | net-misc/openntpd | ntpd || ntpd.service || |-

! scope="row" rowspan="2" | net-misc/openssh | scope="row" rowspan="2" | sshd | sshd.service || runs sshd as a daemon |-

| sshd.socket || runs sshd on a inetd-like basis (for each incoming connection) |-

! scope="row" rowspan="2" | net-wireless/wpa_supplicant | scope="row" rowspan="2" | wpa-supplicant | wpa_supplicant.service || D-Bus controlled daemon (e.g. for NetworkManager) |-

| wpa_supplicant@.service || interface-specific wpa_supplicant (used like wpa_supplicant@wlan0.service) |-

! scope="row" rowspan="3" | net-print/cups | scope="row" rowspan="3" | cupsd | cups.service || classic on-boot start up service |-

| cups.socket | scope="row" rowspan="2" | socket and path activation (cups only started on-demand) |-

| cups.path |-

! scope="row" | net-wireless/bluez | bluetooth || bluetooth.service || |-

! scope="row" rowspan="2" | sys-apps/dbus | scope="row" rowspan="2" | dbus | dbus.service || |-

| dbus.socket || |-

! scope="row" | sys-apps/irqbalance | irqbalance || irqbalance.service || supports daemon mode only |-

! scope="row" | sys-apps/microcode-ctl | microcode_ctl || || Configure microcode as a module to let it load the microcode itself. Go to "Processor type and features" -> "CPU microcode loading support" and remember to add the right option based on the system having an Intel or AMD processor. |-

! scope="row" rowspan="4" | sys-fs/udev | udev || udev.service || |-

| udev-mount || (builtin) || /dev is mounted as tmpfs |-

| udev-postmount || udev-trigger.service || |-

| || udev-settle.service || |-

! scope="row" | sys-power/acpid | acpid || acpid.service || Most of its functionality is done by systemd itself, so consider disabling this |-

! scope="row" | x11-apps/xdm | (xdm) || xdm.service || OpenRC uses common xdm init.d installed by x11-base/xorg-server. With systemd the corresponding unit file for each DM (gdm.service, kdm.service...) needs to be enabled. |-

! scope="row" rowspan="2" | net-firewall/iptables | scope="row" rowspan="2" | iptables | iptables-store.service || |-

| iptables-restore.service || |-

|}

사용자 서비스

사용자 별 systemd 인스턴스로 서비스를 만들어 관리할 수 있습니다. 이렇게 하면 사용자의 개별 자체 서비스 내지는 타이머를 구성할 수 있습니다.

사용자 유닛은 여러 위치에 둘 수 있습니다. 사용자는 $XDG_CONFIG_HOME/systemd/user/ 위치에 둘 수 있습니다. 설치 꾸러미는 /usr/lib/systemd/user/ 위치에 둘 수 있습니다.

사용자 서비스는 --user systemctl 옵션을 활용합니다. 예를 들어 mpd 사용자 서비스를 시작하려면:

user $systemctl --user start mpd

타이머 서비스

197 버전 부터 systemd에서는 타이머를 지원하는데 systemd 시스템에서 크론을 필요없게 만듭니다. 212 버전 부터는 영속 서비스를 지원하며 anacron을 대체합니다. 영속 타이머는 시스템의 전원이 꺼진 상태에서 타이머 작업이 계획 상태일 경우 다음 기회에 실행합니다.

다음 예제는 사용자 관점에서 실행하는 간단한 타이머를 만드는 방법을 보여줍니다. 사용자가 로그인 상태가 아니어도 실행합니다. 모든 timed 서비스에서는 타이머가 필요하며 서비스 파일은 다음과 같이 타이머가 활성화합니다.

파일 ~/.local/share/systemd/user/backup-work.timer매일 동작하는 타이머 예제
[Unit]
Description=daily backup work
RefuseManualStart=no
RefuseManualStop=no
 
[Timer]
Persistent=false
OnCalendar=Mon-Fri *-*-* 11:30:00
Unit=backup-work.service
 
[Install]
WantedBy=default.target
파일 ~/.local/share/systemd/user/backup-work.service백업을 실행하는 서비스 예제
[Unit]
Description=daily backup work
RefuseManualStart=no
RefuseManualStop=yes
 
[Service]
Type=oneshot
ExecStart=/home/<user>/scripts/backup-work.sh

These unit files can be created either manually or using the systemctl edit utility:

user $systemctl edit --force --full --user backup-work.timer

When creating the unit files manually, the files are to be placed in the ~/.config/systemd/user directory. It may need to be created for the relevant user:

user $mkdir -p ~/.config/systemd/user

To have a timer run while the user is not logged in, be sure to enable lingering sessions:

user $loginctl enable-linger <username>

우선 systemd에 서비스 파일을 다시 검색하라고 요청하십시오:

user $systemctl --user daemon-reload

다음 명령을 통해 직접 백업을 실행할 수 있습니다:

user $systemctl --user start backup-work.service

다음과 같이 타이머를 직접 시작하고 멈춰보십시오.

user $systemctl --user start backup-work.timer
user $systemctl --user stop backup-work.timer

마지막으로, 매번 시스템을 시작할 때마다 타이머를 활성화하려면, 다음 명령을 실행하십시오:

user $systemctl --user enable backup-work.timer

서비스 실행 최종 결과를 확인하려 한다면:

user $systemctl --user list-timers

전자메일 처리 실패

timed 서비스가 동작중이면, 사용자 또는 관리자에게 시스템 정보를 보낼 수 있는 전자메일 처리에 실패합니다. 서비스 동작에 실패할 경우의 "OnFailure" 상태일 가능성이 있습니다. 이러한 실패 현상은 스크립트 실행 후 비-제로 반환 값으로 나타납니다.

문제를 해결하려면 다음과 같이 스크립트 내용을 바꾸십시오:

파일 ~/.local/share/systemd/user/backup-work.service백업 실행 서비스 예제
[Unit]
Description=daily backup work
RefuseManualStart=no
RefuseManualStop=yes
OnFailure=failure-email@%i.service
 
[Service]
Type=oneshot
ExecStart=/home/<user>/scripts/backup-work.sh

이 문제를 해결하려면 failure-email@.service 설치가 필요하며, kylemanna's systemd-utils repository에서 찾아볼 수 있습니다.

크론 바꾸기

상단의 타이머와 서비스 파일은 시스템 전체에서 사용할 수 있도록 /lib/systemd/system 에 추가할 수 있습니다. 시스템을 시작할 때 서비스를 활성화하려면 설치 섹션에 WantedBy=multi-user.target를 적어두어야 합니다.

그러나, 크론은 /etc/cron.daily 또는 기타 위치의 스크립트를 실행하기도 합니다. 다양한 꾸러미에서는 매일마다 실행하려는 여러가지 스크립트를 해당 위치에 놓습니다. 이 동작은 sys-process/systemd-cron을 설치해서 systemd에서 시험해 볼 수 있습니다. 그 다음 다음 명령을 통해 새 크론을 활성화합니다:

root #systemctl enable cron.target
root #systemctl start cron.target

문제 해결

Slow shutdowns or reboot times due to running services

Problem
Occasionally a systemd system or user service will cause the system to greatly delay poweroff/shutdown or reboot operation due to systemd default wait times for the operation blocking service to time out.
Solution
To greatly speed up this operation, the default timeout values can be reduced at the expense of the service (potentially) not cleanly finishing a task. In order to be effective, both of the following configuration changes must be put into effect to shorten the default timeout system and user services.
파일 /etc/systemd/system.conf.d/system.confReduce default timeout to 10s for hanging system services
[Manager]
DefaultTimeoutStopSec=10s
파일 ~/.config/systemd/user.confReduce default timeout to 10s for hanging user services
[Manager]
DefaultTimeoutStopSec=10s

/dev/kmsg buffer overrun, some messages lost

문제점
시스템을 부팅할 때, /dev/kmsg buffer overrun, some messages lost 메시지가 무한대로 나타납니다. 시스템 부팅 과정에서 이 시점 이후로 넘어가지 않으므로 콘솔에 로그인 화면이 뜨지 않습니다.
해결책
대부분 이 문제는 커널에서 CONFIG_POWER_SUPPLY_DEBUG 옵션을 활성화했을 때 나타납니다. 현재 해결책은 이 옵션을 커널에서 비활성화하고, 다시 컴파일한 다음 설치하고, 새 커널로 부팅하는 방법입니다. 방법은 젠투 포럼의 이 글타래 에서 찾아볼 수 있습니다. 포럼의 한 사용자에 따르면 임베디드 시스템의 I2C EEPROM을 활용할 때도 나타났다고 합니다[1]. 이 경우의 해결책은 CONFIG_I2C_DEBUG_CORE 커널 옵션을 비활성화하는 방법입니다.

임의의 위치에서 열리는 그래픽 세션

기본적으로 systemd는 사용하려는 getty 프로세스만 실행합니다. 때문에 일부 (GDM 같은) 디스플레이 관리자 프로그램에서 필요할 때마다 열려있는 그래픽 세션에 대한 기존의 tty를 사용하는데, 이 때문에 콘솔과 그래픽 세션이 사용 순서에 따라 임의대로 배치되는 결과가 나타날 수 있습니다.

좀 더 "기존의" 동작과 가깝게 (예: 콘솔은 tty1 부터 tty6까지의 프로세스에 위치하며 그래픽 세션은 남아있는 tty를 활용) 항상 getty를 실행하도록 강제하려면:

root #systemctl enable getty@tty{2,3,4,5,6}.service

LVM

OpenRC에서 systemd로 넘어오면서 시스템 볼륨을 올바르게 마운트하려 LVM이 필요한 경우 LVM 서비스를 활성화하십시오:

root #systemctl enable lvm2-monitor.service

(LVM이 initramfs에 들어갔다면) 루트 볼륨 활성화가 따로 필요한건 아니겠지만, 서비스를 시작하기 전에는 다른 LVM 볼륨이 동작하지 않을지도 모릅니다.

systemd-bootchart

CONFIG_DEBUG_KERNEL, CONFIG_SCHED_DEBUG,  CONFIG_SCHEDSTATS 설정을 활성화했는지 확인하십시오.
커널 systemd-bootchart 기능 지원 활성화
File systems  --->
	Pseudo filesystems --->
	[*] /proc file system support
Kernel hacking  --->
	[*] Kernel debugging
	[*] Collect scheduler debugging info
	[*] Collect scheduler statistics

이제, systemd-bootchart.service를 활성화하십시오:

root #systemctl enable systemd-bootchart

설정을 바꾸면 매번 부팅할 때마다 /run/log에 SVG 형식으로 bootchart 보고서를 만듭니다. 최신 웹 브라우저에서 볼 수 있습니다.

systemd-bootchart의 대안으로 서비스 시작 단계를 다음 명령으로 시각화할 수 있습니다:

root #systemd-analyze plot > plot.svg

systemd용 syslog-ng 소스

unix-dgram('/dev/log'); 설정을 /etc/syslog-ng/syslog-ng.conf 설정 파일에 넣을 필요가 없습니다. 이 설정으로 하여금 syslog-ng(최소한 syslog-ng-3.7.2에서)가 동작하지 못합니다. 다음과 같이 syslog-ng 게시글에서 언급한 대로 source src { ...; }; 줄을 새로 고치십시오:

파일 /etc/syslog-ng/syslog-ng.conf
# default config for openrc
#source src { system(); internal(); };
 
# systemd
source src { systemd-journal(); internal(); };

sys-fs/cryptsetup 설정

systemd에서 /etc/conf.d/dmcrypt를 고려하는 것 같지 않으므로(bug #429966 참고) /etc/crypttab 파일로 설정해야합니다:

파일 /etc/crypttab암호화 블록 장치 설정 파일
crypt-home UUID=c25dd0f3-ecdd-420e-99a8-0ff2eaf3f391 -

sys-apps/systemdcryptsetup USE 플래그를 활성화했는지 확인하십시오. 설정하면 매번 부팅할 때마다 서비스 각 항목(여기서는 cryptsetup@crypt-home.service)을 자동으로 만들어주는 /lib/systemd/system-generators/systemd-cryptsetup-generator를 설치합니다.

시작에 실패한 유닛 점검

시작에 실패한 유닛을 점검하려면 다음 명령을 실행하십시오:

root #systemctl --failed

디버깅 모드 활성

자세한 내용은 /etc/systemd/system.conf의 다음 부분을 참고하십시오:

파일 /etc/systemd/system.conf
LogLevel=debug

또는 tty9에서 터미널을 여는 debug-shell을 활성화하십시오. 부팅 과정을 진행하는 동안 디버깅 서비스 동작을 돕습니다.

root #systemctl enable debug-shell.service

e4rat 사용법

/etc/e4rat.conf를 편집하여 'init'를 /lib/systemd/systemd로 설정하는 것을 잊지 마십시오. 그렇지 않으면 OpenRC로 부팅합니다.

GRSecurity 강화

grsecurity를 활성화하면, systemd-networkd에서 다음 오류를 로그로 남깁니다:

코드 systemd-networkd 오류
could not find udev device: Permission denied

비 루트 사용자가 grsecurity를 사용하는 상황에서 각 사용자에게 /sys 파일 시스템 구조에 완전히 접근하려는 시도를 막기 때문에 systemd-networkd에서 오류가 발생합니다. 이 옵션을 비활성화하려면 CONFIG_GRKERNSEC_SYSFS_RESTRICT 커널 옵션을 비활성화하십시오.

logind에는 CONFIG_GRKERNSEC_PROC 변수를 활성화했을 때, 모호한 권한 문제가 있습니다. bug #472098 버그 참고.

shutdown -rF 명령이 fsck 명령을 강제로 실행하지 않음

필요할 경우 systemd-fsck 서비스에서 fsck를 실행합니다. shutdown -rF 옵션에 우선하지 않지만, 커널 부팅 매개변수에 따릅니다.

부팅 매개변수 제안 옵션 설명
fsck.mode auto
force
skip
동작 상태를 다룹니다. 기본 값은 auto 이며, 파일 시스템 검사기가 필요성을 인지하면 파일 시스템 검사를 수행합니다. force 는 전체 파일 시스템 검사를 무조건 하고 결과를 냅니다. skip 은 파일 시스템 검사를 건너 뜁니다.
fsck.repair preen
yes
no
동작 상태를 다룹니다. 기본 값은 preen이며, 안전하게 복구할 수 있는 문제를 자동으로 복구합니다. yes 는 fsck의 모든 질문에 yes라고 답하며 no는 모든 질문에 no 라고 답합니다.

! scope="col" width="15%" | Boot parameter ! scope="col" width="15%" | Supported options ! Description |-

| fsck.mode | auto
force
skip | Controls the mode of operation. The default is auto, and ensures that file system checks are done when the file system checker deems them necessary. force unconditionally results in full file system checks. skip skips any file system checks. |-

| fsck.repair | preen
yes
no | Controls the mode of operation. The default is preen, and will automatically repair problems that can be safely fixed. yes will answer yes to all questions by fsck and no will answer no to all questions. |-

|}

Optional systemd binaries

Many optional systemd binaries can be built by setting certain use flags. An incomplete mapping of USE flag to binary is below.

USE flag Additional binary built
curl /lib/systemd/systemd-journal-upload
http /lib/systemd/systemd-journal-gatewayd
/lib/systemd/systemd-journal-remote

추가 참조

외부 자료

참고 자료