SlideShare a Scribd company logo
1 of 34
Download to read offline
systemd, 무엇이 바뀌었나?
RHEL 7
(주)오뉴이노베이션
Solutions Architect팀
2018년 3월 7일
systemd, 무엇이 바뀌었나? 1/34 (주)오뉴이노베이션
08381. 서울특별시 구로구 디지털로 273 702 호 ( 구로동 , 에이스트윈타워 2 차 )
702, ACE Twin Tower 2Cha, 273, Digital-ro Guro-gu, Seoul, Korea 08381
Tel. 02-866-2179 Fax. 02-866-2189
Table of Contents
1. systemd의 이해.........................................................................................3
1.1. systemd는 무엇인가?..............................................................................3
1.2. init은 무엇인가?.................................................................................3
1.3. 왜 System V init는 대체 되었는가?................................................................3
1.4. /etc/init.d/httpd 스크립트.......................................................................3
1.5. systemd: httpd.service...........................................................................5
1.6. So long and thanks for all the fish..............................................................6
1.7. init 사용 종료 시점..............................................................................7
2. systemd – System & Service Manager.....................................................................8
2.1. systemd Overview.................................................................................8
2.2. systemd Units....................................................................................8
2.3. systemd Unit Files...............................................................................8
2.4. Unit 파일의 일반적인 옵션........................................................................8
2.5. 서비스 활성화....................................................................................9
2.6. 개선 된 자원 관리................................................................................9
2.7. Kill/Restart Cleanly.............................................................................9
2.8. Auto-Restarting..................................................................................9
2.9. systemd : Managing Services......................................................................9
2.10. systemctl vs services..........................................................................10
2.10.1 서비스의 시작, 상태 종료...................................................................10
2.10.2. List services.............................................................................10
2.11. Managing Services: Enable / Disable............................................................12
2.12. systemctl vs chkconfig.........................................................................12
2.13. systemctl 명령의 옵션..........................................................................13
2.14. systemd-* 명령들...............................................................................14
2.15. systemd 의존성.................................................................................14
2.16. Parallel, Not Serial...........................................................................15
2.17. Boot Process...................................................................................15
2.17.1. boot Process – Services / Units...........................................................17
2.17.2. target의 모든 서비스 목록.................................................................17
2.17.3. Analyzing Boot............................................................................20
2.18. Targets are the new Runlevels..................................................................22
2.18.1. Common Targets............................................................................22
2.18.2. Working with Targets......................................................................22
2.18.3. Shutting Down, Suspending, Etc............................................................24
2.19. root 암호 리셋하기.............................................................................24
2.20. systemd-cgtop..................................................................................26
2.21. 컨트롤 그룹의 컨텐츠 보기......................................................................26
3. systemd Logging : journalctl..........................................................................31
3.1. 개선 된 Logging.................................................................................31
3.2. journalctl......................................................................................31
3.3. Journal의 사용..................................................................................31
3.3.1. journalctl.................................................................................32
3.3.2. journalctl 사용하기........................................................................33
systemd, 무엇이 바뀌었나? 2/34 (주)오뉴이노베이션
08381. 서울특별시 구로구 디지털로 273 702 호 ( 구로동 , 에이스트윈타워 2 차 )
702, ACE Twin Tower 2Cha, 273, Digital-ro Guro-gu, Seoul, Korea 08381
Tel. 02-866-2179 Fax. 02-866-2189
1. systemd의 이해
1.1. systemd는 무엇인가?
systemd는 initd를 대체 한다.
# ls -al /sbin/init
lrwxrwxrwx. 1 root root 22 2월 1 23:04 /sbin/init -> ../lib/systemd/systemd
• 시작하기 위한 첫 번째 프로세스이고, 종료하기 위한 마지막 프로세스
• 모든 다른 프로세스의 parent 프로세스
• 서비스와 기타 리소스를 관리
1.2. init은 무엇인가?
• Init – System V UNIX origin in 1970s
• 시스템을 시작하기 위한 프로세스 :
◦ BIOS/UEFI → Bootloader → Kernel → init
• init은 모든 프로세스의 parent 프로세스
• /etc/inittab에 저장 되어 있는 스크립트로부터 프로세스를 생성
• /etc/init.d에 저장 된 스크립트
1.3. 왜 System V init는 대체 되었는가?
• Init Scripts!
◦ 오래 됨
◦ 표준화의 부족
◦ 사람이나 컴퓨터가 이해하기 어렵고, 분석하기가 불가능하다.
• Single threaded
• 복잡한 관계를 표헌하기 어렵다.
1.4. /etc/init.d/httpd 스크립트
# pwd
/etc/init.d
# cat httpd
#!/bin/bash
#
# httpd Startup script for the Apache HTTP Server
#
# chkconfig: - 85 15
# description: The Apache HTTP Server is an efficient and extensible 
# server implementing the current HTTP standards.
systemd, 무엇이 바뀌었나? 3/34 (주)오뉴이노베이션
08381. 서울특별시 구로구 디지털로 273 702 호 ( 구로동 , 에이스트윈타워 2 차 )
702, ACE Twin Tower 2Cha, 273, Digital-ro Guro-gu, Seoul, Korea 08381
Tel. 02-866-2179 Fax. 02-866-2189
# processname: httpd
# config: /etc/httpd/conf/httpd.conf
# config: /etc/sysconfig/httpd
# pidfile: /var/run/httpd/httpd.pid
#
### BEGIN INIT INFO
# Provides: httpd
# Required-Start: $local_fs $remote_fs $network $named
# Required-Stop: $local_fs $remote_fs $network
# Should-Start: distcache
# Short-Description: start and stop Apache HTTP Server
# Description: The Apache HTTP Server is an extensible server
# implementing the current HTTP standards.
### END INIT INFO
# Source function library.
. /etc/rc.d/init.d/functions
if [ -f /etc/sysconfig/httpd ]; then
. /etc/sysconfig/httpd
fi
# Start httpd in the C locale by default.
HTTPD_LANG=${HTTPD_LANG-"C"}
# This will prevent initlog from swallowing up a pass-phrase prompt if
# mod_ssl needs a pass-phrase from the user.
INITLOG_ARGS=""
# Set HTTPD=/usr/sbin/httpd.worker in /etc/sysconfig/httpd to use a server
# with the thread-based "worker" MPM; BE WARNED that some modules may not
# work correctly with a thread-based MPM; notably PHP will refuse to start.
# Path to the apachectl script, server binary, and short-form for messages.
apachectl=/usr/sbin/apachectl
httpd=${HTTPD-/usr/sbin/httpd}
prog=httpd
pidfile=${PIDFILE-/var/run/httpd/httpd.pid}
lockfile=${LOCKFILE-/var/lock/subsys/httpd}
RETVAL=0
STOP_TIMEOUT=${STOP_TIMEOUT-10}
# The semantics of these two functions differ from the way apachectl does
# things -- attempting to start while running is a failure, and shutdown
# when not running is also a failure. So we just do it the way init scripts
# are expected to behave here.
start() {
echo -n $"Starting $prog: "
LANG=$HTTPD_LANG daemon --pidfile=${pidfile} $httpd $OPTIONS
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch ${lockfile}
return $RETVAL
}
# When stopping httpd, a delay (of default 10 second) is required
# before SIGKILLing the httpd parent; this gives enough time for the
# httpd parent to SIGKILL any errant children.
stop() {
echo -n $"Stopping $prog: "
killproc -p ${pidfile} -d ${STOP_TIMEOUT} $httpd
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}
systemd, 무엇이 바뀌었나? 4/34 (주)오뉴이노베이션
08381. 서울특별시 구로구 디지털로 273 702 호 ( 구로동 , 에이스트윈타워 2 차 )
702, ACE Twin Tower 2Cha, 273, Digital-ro Guro-gu, Seoul, Korea 08381
Tel. 02-866-2179 Fax. 02-866-2189
}
reload() {
echo -n $"Reloading $prog: "
if ! LANG=$HTTPD_LANG $httpd $OPTIONS -t >&/dev/null; then
RETVAL=6
echo $"not reloading due to configuration syntax error"
failure $"not reloading $httpd due to configuration syntax error"
else
# Force LSB behaviour from killproc
LSB=1 killproc -p ${pidfile} $httpd -HUP
RETVAL=$?
if [ $RETVAL -eq 7 ]; then
failure $"httpd shutdown"
fi
fi
echo
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status -p ${pidfile} $httpd
RETVAL=$?
;;
restart)
stop
start
;;
condrestart|try-restart)
if status -p ${pidfile} $httpd >&/dev/null; then
stop
start
fi
;;
force-reload|reload)
reload
;;
graceful|help|configtest|fullstatus)
$apachectl $@
RETVAL=$?
;;
*)
echo $"Usage: $prog {start|stop|restart|condrestart|try-restart|force-reload|reload|status|
fullstatus|graceful|help|configtest}"
RETVAL=2
esac
exit $RETVAL
1.5. systemd: httpd.service
# pwd
/usr/lib/systemd/system
# cat httpd.service
# It's not recommended to modify this file in-place, because it will be
# overwritten during package upgrades. If you want to customize, the best
systemd, 무엇이 바뀌었나? 5/34 (주)오뉴이노베이션
08381. 서울특별시 구로구 디지털로 273 702 호 ( 구로동 , 에이스트윈타워 2 차 )
702, ACE Twin Tower 2Cha, 273, Digital-ro Guro-gu, Seoul, Korea 08381
Tel. 02-866-2179 Fax. 02-866-2189
# way is to create a file "/etc/systemd/system/httpd.service",
# containing
# .include /lib/systemd/system/httpd.service
# ...make your changes here...
# For more info about custom unit files, see
# http://fedoraproject.org/wiki/Systemd#How_do_I_customize_a_unit_file.2F_add_a_custom_unit_file.3F
# For example, to pass additional options (for instance, -D definitions) to the
# httpd binary at startup, you need to create a file named
# "/etc/systemd/system/httpd.service" containing:
# .include /lib/systemd/system/httpd.service
# [Service]
# Environment=OPTIONS=-DMY_DEFINE
[Unit]
Description=The Apache HTTP Server
After=network.target remote-fs.target nss-lookup.target
[Service]
Type=notify
Environment=LANG=C
ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND
ExecReload=/usr/sbin/httpd $OPTIONS -k graceful
# Send SIGWINCH for graceful stop
KillSignal=SIGWINCH
KillMode=mixed
PrivateTmp=true
[Install]
WantedBy=multi-user.target
1.6. So long and thanks for all the fish
영화 “The hichiker's guide to the galaxy”에서 지구가 멸망할 것을 할고 돌고래가 지구를 떠날 때 다른 물고기
들에게 남긴 인사말.
systemd, 무엇이 바뀌었나? 6/34 (주)오뉴이노베이션
08381. 서울특별시 구로구 디지털로 273 702 호 ( 구로동 , 에이스트윈타워 2 차 )
702, ACE Twin Tower 2Cha, 273, Digital-ro Guro-gu, Seoul, Korea 08381
Tel. 02-866-2179 Fax. 02-866-2189
1.7. init 사용 종료 시점
Fedora 15 - 2011년 5월
Arch - 2012년 10월
Red Hat - 2014년 6월
SUSE - 2014년 10월
Ubunto & debian – 2015월 4월
systemd, 무엇이 바뀌었나? 7/34 (주)오뉴이노베이션
08381. 서울특별시 구로구 디지털로 273 702 호 ( 구로동 , 에이스트윈타워 2 차 )
702, ACE Twin Tower 2Cha, 273, Digital-ro Guro-gu, Seoul, Korea 08381
Tel. 02-866-2179 Fax. 02-866-2189
2. systemd – System & Service Manager
2.1. systemd Overview
• 더 많은 서비스를 제어
• 종속적 제어
• 서비스 활성화
• 빠른 시작 및 종료
• 개선 된 자원 관리
• 더 좋은 로깅, 디버깅 프로파일링
• 역 호환
• 배우기 쉽다
2.2. systemd Units
더 많은 서비스를 제어하고, 시스템이 가지고 있는 모든 자원은 제어한다.
• 제어 할 수 있는 Unit의 종류
◦ Services
◦ Sockets
◦ Mounts
◦ Targets
◦ Swap
◦ and more…
Unit는 Unit 파일이 사용되고 정의 된다.
Unit의 이름 규칙은 name.unit_type로 정해 진다.
2.3. systemd Unit Files
• Maintainer files : /usr/lib/systemd/system
• Administrator files : /etc/systemd/system
• Non-persistent, runtime data : /run/systemd
• Drop-ins : /etc/systemd/system/[name.type].d/*.conf
Note :
/etc 아래에 있는 Unit 파일은 /usr 아래에 있는 Unit 파일보다 우선 적용됨.
만약 unit가 수정 되면 '# systemctl daemon-reload' 를 잊지 마세요!
2.4. Unit 파일의 일반적인 옵션
• Description=Unit의 설명
• Documentation=문서 링크
• Requires=추가적으로 요구 되는 Unit
• Before/After=Unit이 시작하기 전/후의 Unit
• Wants=Weaker Requires
• Conflicts=Units cannot co-e4xist
• WantedBy/RquiredBy=Set other units requirement
systemd, 무엇이 바뀌었나? 8/34 (주)오뉴이노베이션
08381. 서울특별시 구로구 디지털로 273 702 호 ( 구로동 , 에이스트윈타워 2 차 )
702, ACE Twin Tower 2Cha, 273, Digital-ro Guro-gu, Seoul, Korea 08381
Tel. 02-866-2179 Fax. 02-866-2189
2.5. 서비스 활성화
• Start up services when needed
◦ 자원의 저장
◦ 신뢰성 향상
◦ 클라이언트에 투명
• Socket, Device, Path bus 그리고 Timer에 의해 활성화
• xinetd 서비스를 unit로 변환하는 것을 추천
2.6. 개선 된 자원 관리
Services labeled and isolated with Cgroups
More control than nice alone
Can properly kill/restart entire service chain
Can configure multiple instances for a single services
하나의 서비스에 여러개의 인스턴스를 구성 할 수 있음.
Can balance by shares or by hard limits
2.7. Kill/Restart Cleanly
Tracked in the kernel
Knows all children
Don't need to rely on a potentially misbehaving process to hopefully kill its children
2.8. Auto-Restarting
It's paying attention!
Auto-Restarting는 주의 해야함.
Reality : software does crash occasionally
실제로 소프트웨어는 때때로 크래시가 발생.
Reduces need for manual intervention
Auto-Restarting는 수동적인 개입 필요성을 감소
Socket stays open, only lose that single transaction
오픈되어 있는 소켓은 그 단일 트랜잭션을 잃을 수 있음.
2.9. systemd : Managing Services
Init:
# service unit {start, stop, restart, reload}
systemd:
# systemctl {start, stop, restart, reload} unit1 [unit2 …]
• 여러개의 서비스를 동시에 실행 할 수 있음.
• .service Unit 타입
• systemctl은 Tab 키로 완성 될 수 있음.
◦ bash-completion 패키지 설치 필요
systemd, 무엇이 바뀌었나? 9/34 (주)오뉴이노베이션
08381. 서울특별시 구로구 디지털로 273 702 호 ( 구로동 , 에이스트윈타워 2 차 )
702, ACE Twin Tower 2Cha, 273, Digital-ro Guro-gu, Seoul, Korea 08381
Tel. 02-866-2179 Fax. 02-866-2189
2.10. systemctl vs services
2.10.1 서비스의 시작, 상태 종료
2.10.2. List services
systemd, 무엇이 바뀌었나? 10/34 (주)오뉴이노베이션
08381. 서울특별시 구로구 디지털로 273 702 호 ( 구로동 , 에이스트윈타워 2 차 )
702, ACE Twin Tower 2Cha, 273, Digital-ro Guro-gu, Seoul, Korea 08381
Tel. 02-866-2179 Fax. 02-866-2189
systemd, 무엇이 바뀌었나? 11/34 (주)오뉴이노베이션
08381. 서울특별시 구로구 디지털로 273 702 호 ( 구로동 , 에이스트윈타워 2 차 )
702, ACE Twin Tower 2Cha, 273, Digital-ro Guro-gu, Seoul, Korea 08381
Tel. 02-866-2179 Fax. 02-866-2189
2.11. Managing Services: Enable / Disable
Init:
# chkconfig unit {on, off}
systemctl:
# systemctl {enable, disable, mask, unmask} unit [unit ...]
mask:
mask는 서비스를 disable하는 것 보다 더 강력하다. 서비스를 /dev/null로 링크 걸고, 그 링크를 인식함으로 서비
스를 시작하지 않는다.
2.12. systemctl vs chkconfig
systemd, 무엇이 바뀌었나? 12/34 (주)오뉴이노베이션
08381. 서울특별시 구로구 디지털로 273 702 호 ( 구로동 , 에이스트윈타워 2 차 )
702, ACE Twin Tower 2Cha, 273, Digital-ro Guro-gu, Seoul, Korea 08381
Tel. 02-866-2179 Fax. 02-866-2189
2.13. systemctl 명령의 옵션
systemd, 무엇이 바뀌었나? 13/34 (주)오뉴이노베이션
08381. 서울특별시 구로구 디지털로 273 702 호 ( 구로동 , 에이스트윈타워 2 차 )
702, ACE Twin Tower 2Cha, 273, Digital-ro Guro-gu, Seoul, Korea 08381
Tel. 02-866-2179 Fax. 02-866-2189
2.14. systemd-* 명령들
2.15. systemd 의존성
• 각 unit에 명령과 조건이 정의 되어 있음.
• Nfs-lock.service로 예를 들면
# cat nfs-lock.service
[Unit]
Description=NFS status monitor for NFSv2/3 locking.
DefaultDependencies=no
Conflicts=umount.target
Requires=nss-lookup.target rpcbind.target
After=network.target nss-lookup.target rpcbind.service
PartOf=nfs-utils.service
Wants=nfs-config.service
After=nfs-config.service
systemd, 무엇이 바뀌었나? 14/34 (주)오뉴이노베이션
08381. 서울특별시 구로구 디지털로 273 702 호 ( 구로동 , 에이스트윈타워 2 차 )
702, ACE Twin Tower 2Cha, 273, Digital-ro Guro-gu, Seoul, Korea 08381
Tel. 02-866-2179 Fax. 02-866-2189
[Service]
EnvironmentFile=-/run/sysconfig/nfs-utils
Type=forking
PIDFile=/var/run/rpc.statd.pid
ExecStart=/usr/sbin/rpc.statd --no-notify $STATDARGS
2.16. Parallel, Not Serial
• 빠른 시작과 종료를 위해 허용
• 효율적인 자원 관리
2.17. Boot Process
• 부팅 경로를 default.target이 결정
systemd, 무엇이 바뀌었나? 15/34 (주)오뉴이노베이션
08381. 서울특별시 구로구 디지털로 273 702 호 ( 구로동 , 에이스트윈타워 2 차 )
702, ACE Twin Tower 2Cha, 273, Digital-ro Guro-gu, Seoul, Korea 08381
Tel. 02-866-2179 Fax. 02-866-2189
systemd, 무엇이 바뀌었나? 16/34 (주)오뉴이노베이션
08381. 서울특별시 구로구 디지털로 273 702 호 ( 구로동 , 에이스트윈타워 2 차 )
702, ACE Twin Tower 2Cha, 273, Digital-ro Guro-gu, Seoul, Korea 08381
Tel. 02-866-2179 Fax. 02-866-2189
2.17.1. boot Process – Services / Units
• Target “Wants” Directories:
◦ /usr/lib/systemd/system/<name>.target.wants/
◦ /etc/systemd/system/<name>.target.wants/
• Files are symiinks to actual unit files
• Empty target wants directories are placeholders
multi-user.target.wants의 예시
2.17.2. target의 모든 서비스 목록
systemd, 무엇이 바뀌었나? 17/34 (주)오뉴이노베이션
08381. 서울특별시 구로구 디지털로 273 702 호 ( 구로동 , 에이스트윈타워 2 차 )
702, ACE Twin Tower 2Cha, 273, Digital-ro Guro-gu, Seoul, Korea 08381
Tel. 02-866-2179 Fax. 02-866-2189
# systemctl list-dependencies multi-user.target --no-pager
multi-user.target
● ├─abrt-ccpp.service
● ├─abrt-oops.service
● ├─abrt-vmcore.service
● ├─abrt-xorg.service
● ├─abrtd.service
● ├─atd.service
● ├─auditd.service
● ├─avahi-daemon.service
● ├─chronyd.service
● ├─crond.service
● ├─cups.path
● ├─dbus.service
● ├─libvirtd.service
● ├─livesys-late.service
● ├─livesys.service
● ├─mcelog.service
● ├─mdmonitor.service
● ├─ModemManager.service
● ├─netcf-transaction.service
● ├─NetworkManager.service
● ├─plymouth-quit-wait.service
● ├─plymouth-quit.service
● ├─rngd.service
● ├─smb.service
● ├─sysstat.service
● ├─systemd-ask-password-wall.path
● ├─systemd-logind.service
● ├─systemd-update-utmp-runlevel.service
● ├─systemd-user-sessions.service
● ├─vmtoolsd.service
● ├─basic.target
● │ ├─-.mount
● │ ├─alsa-restore.service
systemd, 무엇이 바뀌었나? 18/34 (주)오뉴이노베이션
08381. 서울특별시 구로구 디지털로 273 702 호 ( 구로동 , 에이스트윈타워 2 차 )
702, ACE Twin Tower 2Cha, 273, Digital-ro Guro-gu, Seoul, Korea 08381
Tel. 02-866-2179 Fax. 02-866-2189
● │ ├─alsa-state.service
● │ ├─dnf-makecache.timer
● │ ├─fedora-autorelabel-mark.service
● │ ├─fedora-autorelabel.service
● │ ├─fedora-loadmodules.service
● │ ├─firewalld.service
● │ ├─tmp.mount
● │ ├─paths.target
● │ ├─slices.target
● │ │ ├─-.slice
● │ │ └─system.slice
● │ ├─sockets.target
● │ │ ├─avahi-daemon.socket
● │ │ ├─cups.socket
● │ │ ├─dbus.socket
● │ │ ├─dm-event.socket
● │ │ ├─iscsid.socket
● │ │ ├─iscsiuio.socket
● │ │ ├─rpcbind.socket
● │ │ ├─systemd-initctl.socket
● │ │ ├─systemd-journald-audit.socket
● │ │ ├─systemd-journald-dev-log.socket
● │ │ ├─systemd-journald.socket
● │ │ ├─systemd-udevd-control.socket
● │ │ └─systemd-udevd-kernel.socket
● │ ├─sysinit.target
● │ │ ├─dev-hugepages.mount
● │ │ ├─dev-mqueue.mount
● │ │ ├─dmraid-activation.service
● │ │ ├─dracut-shutdown.service
● │ │ ├─iscsi.service
● │ │ ├─kmod-static-nodes.service
● │ │ ├─ldconfig.service
● │ │ ├─lvm2-lvmetad.socket
● │ │ ├─lvm2-lvmpolld.socket
● │ │ ├─lvm2-monitor.service
● │ │ ├─multipathd.service
● │ │ ├─plymouth-read-write.service
● │ │ ├─plymouth-start.service
● │ │ ├─proc-sys-fs-binfmt_misc.automount
● │ │ ├─sys-fs-fuse-connections.mount
● │ │ ├─sys-kernel-config.mount
● │ │ ├─sys-kernel-debug.mount
● │ │ ├─systemd-ask-password-console.path
● │ │ ├─systemd-binfmt.service
● │ │ ├─systemd-firstboot.service
● │ │ ├─systemd-hwdb-update.service
● │ │ ├─systemd-journal-catalog-update.service
● │ │ ├─systemd-journal-flush.service
● │ │ ├─systemd-journald.service
● │ │ ├─systemd-machine-id-commit.service
● │ │ ├─systemd-modules-load.service
● │ │ ├─systemd-random-seed.service
● │ │ ├─systemd-sysctl.service
● │ │ ├─systemd-sysusers.service
● │ │ ├─systemd-tmpfiles-setup-dev.service
● │ │ ├─systemd-tmpfiles-setup.service
● │ │ ├─systemd-udev-trigger.service
● │ │ ├─systemd-udevd.service
● │ │ ├─systemd-update-done.service
● │ │ ├─systemd-update-utmp.service
● │ │ ├─systemd-vconsole-setup.service
● │ │ ├─cryptsetup.target
● │ │ ├─local-fs.target
systemd, 무엇이 바뀌었나? 19/34 (주)오뉴이노베이션
08381. 서울특별시 구로구 디지털로 273 702 호 ( 구로동 , 에이스트윈타워 2 차 )
702, ACE Twin Tower 2Cha, 273, Digital-ro Guro-gu, Seoul, Korea 08381
Tel. 02-866-2179 Fax. 02-866-2189
● │ │ │ ├─-.mount
● │ │ │ ├─boot.mount
● │ │ │ ├─fedora-import-state.service
● │ │ │ ├─fedora-readonly.service
● │ │ │ ├─home.mount
● │ │ │ ├─systemd-fsck-root.service
● │ │ │ ├─systemd-remount-fs.service
● │ │ │ ├─tmp.mount
● │ │ │ └─var-lib-machines.mount
● │ │ └─swap.target
● │ │ └─dev-mapper-fedorax2dswap.swap
● │ └─timers.target
● │ ├─mlocate-updatedb.timer
● │ ├─systemd-tmpfiles-clean.timer
● │ └─unbound-anchor.timer
● ├─getty.target
● │ └─getty@tty1.service
● ├─nfs-client.target
● │ ├─auth-rpcgss-module.service
● │ ├─rpc-statd-notify.service
● │ └─remote-fs-pre.target
● └─remote-fs.target
● └─nfs-client.target
● ├─auth-rpcgss-module.service
● ├─rpc-statd-notify.service
● └─remote-fs-pre.target
2.17.3. Analyzing Boot
Each unit is tracked during start up
# systemd-analyze blame --no-pager
4.937s plymouth-quit-wait.service
systemd, 무엇이 바뀌었나? 20/34 (주)오뉴이노베이션
08381. 서울특별시 구로구 디지털로 273 702 호 ( 구로동 , 에이스트윈타워 2 차 )
702, ACE Twin Tower 2Cha, 273, Digital-ro Guro-gu, Seoul, Korea 08381
Tel. 02-866-2179 Fax. 02-866-2189
4.750s mlocate-updatedb.service
1.415s systemd-udev-settle.service
1.364s plymouth-start.service
689ms lvm2-pvscan@8:18.service
655ms firewalld.service
579ms dev-mapper-fedorax2droot.device
513ms dnf-makecache.service
272ms libvirtd.service
264ms lvm2-pvscan@8:2.service
229ms systemd-journal-flush.service
212ms smb.service
190ms accounts-daemon.service
173ms lvm2-monitor.service
161ms systemd-logind.service
144ms cups.service
117ms chronyd.service
104ms mcelog.service
104ms gssproxy.service
104ms ModemManager.service
104ms netcf-transaction.service
98ms rtkit-daemon.service
92ms avahi-daemon.service
92ms proc-fs-nfsd.mount
86ms packagekit.service
80ms polkit.service
78ms systemd-udev-trigger.service
76ms systemd-localed.service
75ms systemd-fsck-root.service
71ms home.mount
68ms systemd-udevd.service
59ms systemd-vconsole-setup.service
55ms systemd-hostnamed.service
52ms iio-sensor-proxy.service
52ms unbound-anchor.service
50ms bluetooth.service
48ms sysstat.service
44ms user@1000.service
41ms systemd-tmpfiles-setup-dev.service
37ms livesys.service
36ms systemd-fsck@dev-disk-byx2duuid-1ff364dbx2dfaadx2d491cx2db146x2d5b789c92e383.service
36ms systemd-tmpfiles-setup.service
36ms fedora-readonly.service
35ms user@42.service
34ms systemd-tmpfiles-clean.service
33ms livesys-late.service
33ms NetworkManager.service
28ms gdm.service
28ms colord.service
28ms systemd-journald.service
27ms systemd-remount-fs.service
25ms systemd-backlight@backlight:intel_backlight.service
24ms udisks2.service
24ms dmraid-activation.service
22ms fedora-import-state.service
21ms abrt-ccpp.service
21ms sysstat-collect.service
20ms tmp.mount
20ms boot.mount
19ms systemd-sysctl.service
18ms blk-availability.service
18ms abrtd.service
16ms rpc-statd-notify.service
16ms dev-hugepages.mount
15ms upower.service
systemd, 무엇이 바뀌었나? 21/34 (주)오뉴이노베이션
08381. 서울특별시 구로구 디지털로 273 702 호 ( 구로동 , 에이스트윈타워 2 차 )
702, ACE Twin Tower 2Cha, 273, Digital-ro Guro-gu, Seoul, Korea 08381
Tel. 02-866-2179 Fax. 02-866-2189
15ms kmod-static-nodes.service
15ms plymouth-read-write.service
14ms dev-mqueue.mount
14ms systemd-user-sessions.service
13ms wpa_supplicant.service
12ms nfs-config.service
12ms systemd-rfkill@rfkill1.service
9ms systemd-random-seed.service
9ms systemd-rfkill@rfkill0.service
9ms sys-fs-fuse-connections.mount
8ms dev-mapper-fedorax2dswap.swap
7ms sys-kernel-debug.mount
7ms systemd-update-utmp-runlevel.service
6ms systemd-update-utmp.service
6ms systemd-rfkill@rfkill2.service
6ms dracut-shutdown.service
5ms var-lib-nfs-rpc_pipefs.mount
5ms auditd.service
2ms sys-kernel-config.mount
2.18. Targets are the new Runlevels
Targets != Runlevels - 몇 몇은 같은 부분이 있다.
Traditional Runlevel Equivalent Target Symlink Target
Runlevel 0 poweroff.target Runlevel0.target
Runlevel 1 rescue.target Runlevel1.target
Runlevel 2 multi-user.target Runlevel2.target
Runlevel 3 multi-user.target Runlevel3.target
Runlevel 4 multi-user.target Runlevel4.target
Runlevel 5 graphical.target Runlevel5.target
Runlevel 6 Reboot.target Runlevel6.target
Target은 다른 target를 포함 할 수 있음.
2.18.1. Common Targets
Target Purpose
graphical.target 멀티 유저, 그래픽과 텍스트 로그인 지원
multi-user.target 멀티 유저, 텍스트 로그인만 지원
resuce.target 싱글 유저, 로컬 파일 시스템과 기본 시스템 초기화, 네트워크는 비활성
emergency.target
싱글 유저, root 파일 시스템이 ro로 마운트, 몇개의 기본적이 서비스만 실행, 네트워
크는 비활성
Rescue, Emergency target는 root 암호가 필요함!!
2.18.2. Working with Targets
기본 target 보기
[root@procyon ~]# systemctl get-default
graphical.target
systemd, 무엇이 바뀌었나? 22/34 (주)오뉴이노베이션
08381. 서울특별시 구로구 디지털로 273 702 호 ( 구로동 , 에이스트윈타워 2 차 )
702, ACE Twin Tower 2Cha, 273, Digital-ro Guro-gu, Seoul, Korea 08381
Tel. 02-866-2179 Fax. 02-866-2189
target 세팅 하기
[root@procyon ~]# systemctl set-default graphical.target
Removed symlink /etc/systemd/system/default.target.
Created symlink from /etc/systemd/system/default.target to /usr/lib/systemd/system/graphical.target.
기본 target는 symlink
[root@procyon ~]# ls -al /etc/systemd/system/default.target
lrwxrwxrwx. 1 root root 40 2월 17 13:52 /etc/systemd/system/default.target ->
/usr/lib/systemd/system/graphical.target
target 변경하기
[root@procyon ~]# systemctl isolate graphical.target
PolicyKit daemon disconnected from the bus.
We are no longer a registered authentication agent.
Rescue 모드로 변경하기
[root@procyon ~]# systemctl rescue
메시지를 보내지 않고 긴급 모드 변경하기
[root@procyon ~]# systemctl –no-wall emergency
현재 로드 된 target 보기
[root@procyon ~]# systemctl list-units --type target --no-pager
UNIT LOAD ACTIVE SUB DESCRIPTION
basic.target loaded active active Basic System
cryptsetup.target loaded active active Encrypted Volumes
getty.target loaded active active Login Prompts
graphical.target loaded active active Graphical Interface
local-fs-pre.target loaded active active Local File Systems (Pre)
local-fs.target loaded active active Local File Systems
systemd, 무엇이 바뀌었나? 23/34 (주)오뉴이노베이션
08381. 서울특별시 구로구 디지털로 273 702 호 ( 구로동 , 에이스트윈타워 2 차 )
702, ACE Twin Tower 2Cha, 273, Digital-ro Guro-gu, Seoul, Korea 08381
Tel. 02-866-2179 Fax. 02-866-2189
multi-user.target loaded active active Multi-User System
network.target loaded active active Network
nfs-client.target loaded active active NFS client services
nss-user-lookup.target loaded active active User and Group Name Lookups
paths.target loaded active active Paths
remote-fs-pre.target loaded active active Remote File Systems (Pre)
remote-fs.target loaded active active Remote File Systems
slices.target loaded active active Slices
sockets.target loaded active active Sockets
swap.target loaded active active Swap
sysinit.target loaded active active System Initialization
timers.target loaded active active Timers
LOAD = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB = The low-level unit activation state, values depend on unit type.
18 loaded units listed. Pass --all to see loaded but inactive units, too.
To show all installed unit files use 'systemctl list-unit-files'.
2.18.3. Shutting Down, Suspending, Etc
Old Command New Command Description
halt systemctl halt Halts the system
poweroff systemctl poweroff Powers off the system
reboot systemctl reboot Restarts the system
pm-suspend systemctl suspend Suspends the system
pm-hibernate systemctl hibernate Hibernates the system
pm-suspend-hybrid systemctl hybrid-sleep Hibernates and suspends the system
2.19. root 암호 리셋하기
Step 1 : Reboot your system
Step 2 : GRUB 부트로더가 보이면, any key로 인터럽트 그리고 'e' 선택
systemd, 무엇이 바뀌었나? 24/34 (주)오뉴이노베이션
08381. 서울특별시 구로구 디지털로 273 702 호 ( 구로동 , 에이스트윈타워 2 차 )
702, ACE Twin Tower 2Cha, 273, Digital-ro Guro-gu, Seoul, Korea 08381
Tel. 02-866-2179 Fax. 02-866-2189
Step 3 : 커서키로 linux16으로 시작하는 라인의 긑으로 이동
Step 4 : 라인의 끝에서 'rd.break' 입력하고, Ctrl + X로 변경된 설정으로 부팅
linux16 /vmlinuz-4.3.5-300.fc23.x86_64 root=/dev/mapper/fedora-root ro rd.lvm.lv=fedora/root
rd.lvm.lv=fedora/swap rhgb quiet LANG=en_US.UTF-8 rd.break
initrd16 /initramfs-4.3.5-300.fc23.x86_64.img
Step 5 : root 프롬프트로 스위치 되면, /sysroot 파일 시스템을 rw로 remount, 그리고 나서 chroot를 사용해서
jail로 들어감.
Step 6 : passwd로 root password 변경
systemd, 무엇이 바뀌었나? 25/34 (주)오뉴이노베이션
08381. 서울특별시 구로구 디지털로 273 702 호 ( 구로동 , 에이스트윈타워 2 차 )
702, ACE Twin Tower 2Cha, 273, Digital-ro Guro-gu, Seoul, Korea 08381
Tel. 02-866-2179 Fax. 02-866-2189
Step 7 : 리부팅시 모든 파일의 레이블을 다시 지정하기 위해 SELinux를 지시
• 만약 생략했다면 시스템은 아마도 부팅 되지 않을 수 있음.
Step 8 : relabel과 reboot하기 위해 두 번의 exit 명령
# touch /.autorelabel
# exit
exit
switch_root:/# exit
logout
2.20. systemd-cgtop
Top 컨트롤 그룹은 자원의 사용량을 보여준다.
[root@procyon ~]# systemd-cgtop
2.21. 컨트롤 그룹의 컨텐츠 보기
# systemd-cgls –no-pager
systemd, 무엇이 바뀌었나? 26/34 (주)오뉴이노베이션
08381. 서울특별시 구로구 디지털로 273 702 호 ( 구로동 , 에이스트윈타워 2 차 )
702, ACE Twin Tower 2Cha, 273, Digital-ro Guro-gu, Seoul, Korea 08381
Tel. 02-866-2179 Fax. 02-866-2189
# systemd-cgls --no-pager
├─1 /usr/lib/systemd/systemd --switched-root --system --deserialize 21
├─system.slice
│ ├─avahi-daemon.service
│ │ ├─848 avahi-daemon: running [procyon.local]
│ │ └─865 avahi-daemon: chroot helper
│ ├─dbus.service
│ │ └─828 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfi...
│ ├─firewalld.service
│ │ └─845 /usr/bin/python3 -Es /usr/sbin/firewalld --nofork --nopid
│ ├─ModemManager.service
│ │ └─844 /usr/sbin/ModemManager
│ ├─abrtd.service
│ │ └─3809 /usr/sbin/abrtd -d -s
│ ├─plymouth-start.service
│ │ └─14692 @usr/sbin/plymouthd --mode=boot --pid-file=/var/run/plymouth/pid ...
│ ├─crond.service
│ │ └─1011 /usr/sbin/crond -n
│ ├─alsa-state.service
│ │ └─819 /usr/sbin/alsactl -s -n 19 -c -E ALSA_CONFIG_PATH=/etc/alsa/alsactl...
│ ├─accounts-daemon.service
│ │ └─846 /usr/libexec/accounts-daemon
│ ├─colord.service
│ │ └─15094 /usr/libexec/colord
│ ├─atd.service
│ │ └─1013 /usr/sbin/atd -f
│ ├─systemd-journald.service
│ │ └─582 /usr/lib/systemd/systemd-journald
│ ├─chronyd.service
│ │ └─827 /usr/sbin/chronyd
│ ├─auditd.service
│ │ ├─804 /sbin/auditd -n
│ │ ├─813 /sbin/audispd
│ │ └─816 /usr/sbin/sedispatch
│ ├─plymouth-quit-wait.service
systemd, 무엇이 바뀌었나? 27/34 (주)오뉴이노베이션
08381. 서울특별시 구로구 디지털로 273 702 호 ( 구로동 , 에이스트윈타워 2 차 )
702, ACE Twin Tower 2Cha, 273, Digital-ro Guro-gu, Seoul, Korea 08381
Tel. 02-866-2179 Fax. 02-866-2189
│ │ └─14733 /usr/bin/plymouth --wait
│ ├─gssproxy.service
│ │ └─834 /usr/sbin/gssproxy -D
│ ├─cups.service
│ │ └─15093 /usr/sbin/cupsd -l
│ ├─systemd-logind.service
│ │ └─823 /usr/lib/systemd/systemd-logind
│ ├─libvirtd.service
│ │ ├─1002 /usr/sbin/libvirtd
│ │ ├─1519 /sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --...
│ │ └─1520 /sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --...
│ ├─smb.service
│ │ ├─1059 /usr/sbin/smbd
│ │ ├─1061 /usr/sbin/smbd
│ │ └─1066 /usr/sbin/smbd
│ ├─systemd-udevd.service
│ │ └─621 /usr/lib/systemd/systemd-udevd
│ ├─mcelog.service
│ │ └─874 /usr/sbin/mcelog --ignorenodev --daemon --foreground
│ ├─abrt-oops.service
│ │ └─3841 /usr/bin/abrt-dump-journal-oops -fxtD
│ ├─rngd.service
│ │ └─851 /sbin/rngd -f
│ ├─polkit.service
│ │ └─14724 /usr/lib/polkit-1/polkitd --no-debug
│ ├─abrt-xorg.service
│ │ └─3885 /usr/bin/abrt-dump-journal-xorg -fxtD
│ ├─NetworkManager.service
│ │ ├─ 979 /usr/sbin/NetworkManager --no-daemon
│ │ └─2892 /sbin/dhclient -d -q -sf /usr/libexec/nm-dhcp-helper -pf /var/run/...
│ ├─gdm.service
│ │ └─1009 /usr/sbin/gdm
│ └─rtkit-daemon.service
│ └─843 /usr/libexec/rtkit-daemon
└─user.slice
├─user-1000.slice
│ └─session-1.scope
│ ├─ 1905 gdm-session-worker [pam/gdm-password]
│ ├─ 1934 /usr/bin/gnome-keyring-daemon --daemonize --login
│ ├─ 2011 /usr/libexec/gdm-x-session --run-script gnome-session
│ ├─ 2019 /usr/libexec/Xorg vt2 -displayfd 3 -auth /run/user/1000/gdm/Xau...
│ ├─ 2033 /usr/libexec/xf86-video-intel-backlight-helper intel_backlight
│ ├─ 2051 dbus-daemon --print-address 4 --session
│ ├─ 2054 /usr/libexec/gnome-session-binary
│ ├─ 2128 /usr/libexec/at-spi-bus-launcher
│ ├─ 2133 /bin/dbus-daemon --config-file=/etc/at-spi2/accessibility.conf ...
│ ├─ 2136 /usr/libexec/at-spi2-registryd --use-gnome-session
│ ├─ 2149 /usr/libexec/gvfsd
│ ├─ 2154 /usr/libexec/gvfsd-fuse /run/user/1000/gvfs -f -o big_writes
│ ├─ 2162 /usr/libexec/gnome-settings-daemon
│ ├─ 2180 /usr/bin/pulseaudio --start --log-target=syslog
│ ├─ 2212 /usr/bin/gnome-shell
│ ├─ 2219 /usr/libexec/gsd-printer
│ ├─ 2286 /usr/libexec/gnome-shell-calendar-server
│ ├─ 2291 /usr/libexec/evolution-source-registry
│ ├─ 2295 ibus-daemon --xim --panel disable
│ ├─ 2300 /usr/libexec/ibus-dconf
│ ├─ 2302 /usr/libexec/ibus-x11 --kill-daemon
│ ├─ 2310 /usr/libexec/goa-daemon
│ ├─ 2319 /usr/libexec/goa-identity-service
│ ├─ 2322 /usr/libexec/mission-control-5
│ ├─ 2332 /usr/libexec/dconf-service
│ ├─ 2343 /usr/libexec/gvfs-udisks2-volume-monitor
│ ├─ 2354 /usr/libexec/gvfs-goa-volume-monitor
systemd, 무엇이 바뀌었나? 28/34 (주)오뉴이노베이션
08381. 서울특별시 구로구 디지털로 273 702 호 ( 구로동 , 에이스트윈타워 2 차 )
702, ACE Twin Tower 2Cha, 273, Digital-ro Guro-gu, Seoul, Korea 08381
Tel. 02-866-2179 Fax. 02-866-2189
│ ├─ 2361 /usr/libexec/gvfs-mtp-volume-monitor
│ ├─ 2370 /usr/libexec/gvfs-afc-volume-monitor
│ ├─ 2380 /usr/libexec/gvfs-gphoto2-volume-monitor
│ ├─ 2459 /usr/libexec/evolution/evolution-alarm-notify
│ ├─ 2461 /usr/bin/gnome-software --gapplication-service
│ ├─ 2462 abrt-applet
│ ├─ 2467 /usr/bin/seapplet
│ ├─ 2468 /usr/libexec/tracker-miner-fs
│ ├─ 2475 nautilus -n
│ ├─ 2479 /usr/libexec/tracker-miner-user-guides
│ ├─ 2483 /usr/libexec/tracker-store
│ ├─ 2494 /usr/libexec/tracker-extract
│ ├─ 2497 /usr/libexec/tracker-miner-apps
│ ├─ 2559 /usr/libexec/gconfd-2
│ ├─ 2561 /home/procyon/.dropbox-dist/dropbox-lnx.x86_64-3.12.6/dropbox
│ ├─ 2570 /usr/libexec/evolution-calendar-factory
│ ├─ 2572 /usr/libexec/gvfsd-trash --spawner :1.14 /org/gtk/gvfs/exec_spa...
│ ├─ 2585 /usr/libexec/evolution-calendar-factory-subprocess --factory co...
│ ├─ 2607 /usr/libexec/evolution-addressbook-factory
│ ├─ 2610 /usr/libexec/evolution-calendar-factory-subprocess --factory lo...
│ ├─ 2632 /usr/libexec/evolution-addressbook-factory-subprocess --factory...
│ ├─ 2633 /usr/libexec/ibus-engine-hangul --ibus
│ ├─ 2719 /usr/libexec/gvfsd-metadata
│ ├─ 2933 /usr/lib64/thunderbird/thunderbird
│ ├─ 2963 /usr/lib64/firefox/firefox
│ ├─ 3103 /usr/libexec/gnome-terminal-server
│ ├─ 3110 bash
│ ├─ 3157 sudo su -
│ ├─ 3161 su -
│ ├─ 3164 -bash
│ ├─ 3257 bash
│ ├─ 3705 sudo su -
│ ├─ 3921 su -
│ ├─ 3924 -bash
│ ├─ 3966 /usr/libexec/gvfsd-network --spawner :1.14 /org/gtk/gvfs/exec_s...
│ ├─ 3988 /usr/libexec/ibus-engine-simple
│ ├─ 3993 /usr/libexec/gvfsd-dnssd --spawner :1.14 /org/gtk/gvfs/exec_spa...
│ ├─ 4432 /usr/bin/gnome-boxes --gapplication-service
│ ├─ 4445 /usr/sbin/libvirtd --timeout=30
│ ├─ 5019 evince /run/media/procyon/476f3b1e-2ece-4640-88f2-80bd02bb35c2/...
│ ├─ 5025 /usr/libexec/evinced
│ ├─ 5379 /usr/lib64/libreoffice/program/oosplash --writer file:///run/me...
│ ├─ 5394 /usr/lib64/libreoffice/program/soffice.bin --writer file:///run...
│ ├─ 5596 /usr/libexec/bluetooth/obexd
│ ├─ 5617 /usr/bin/perl /usr/bin/shutter
│ ├─ 5853 /usr/lib64/firefox/plugin-container /usr/lib64/flash-plugin/lib...
│ ├─ 6497 evince /run/media/procyon/476f3b1e-2ece-4640-88f2-80bd02bb35c2/...
│ ├─12057 ssh -Y -l root 192.168.0.187
│ ├─13768 bash
│ ├─13803 sudo su -
│ ├─13811 su -
│ ├─13814 -bash
│ ├─15568 top
│ └─17276 systemd-cgls --no-pager
└─user-42.slice
└─session-c1.scope
├─1142 gdm-session-worker [pam/gdm-launch-environment]
├─1152 /usr/libexec/gdm-wayland-session /usr/bin/gnome-session --autost...
├─1154 dbus-daemon --print-address 3 --session
├─1155 /usr/libexec/gnome-session-binary --autostart /usr/share/gdm/gre...
├─1164 gnome-shell --mode=gdm --wayland --display-server
├─1190 /usr/libexec/gvfsd
├─1196 /usr/bin/Xwayland :1024 -rootless -noreset -listen 4 -listen 5 -...
├─1289 /usr/libexec/at-spi-bus-launcher
systemd, 무엇이 바뀌었나? 29/34 (주)오뉴이노베이션
08381. 서울특별시 구로구 디지털로 273 702 호 ( 구로동 , 에이스트윈타워 2 차 )
702, ACE Twin Tower 2Cha, 273, Digital-ro Guro-gu, Seoul, Korea 08381
Tel. 02-866-2179 Fax. 02-866-2189
├─1296 /bin/dbus-daemon --config-file=/etc/at-spi2/accessibility.conf -...
├─1301 /usr/libexec/at-spi2-registryd --use-gnome-session
├─1330 /usr/bin/pulseaudio --start --log-target=syslog
├─1546 ibus-daemon --xim --panel disable
├─1563 /usr/libexec/ibus-dconf
├─1567 /usr/libexec/ibus-x11 --kill-daemon
├─1590 /usr/libexec/gnome-settings-daemon
├─1595 /usr/libexec/gvfs-udisks2-volume-monitor
├─1606 /usr/libexec/gvfs-goa-volume-monitor
├─1610 /usr/libexec/goa-daemon
├─1617 /usr/libexec/goa-identity-service
├─1619 /usr/libexec/mission-control-5
├─1622 /usr/libexec/gvfs-mtp-volume-monitor
├─1631 /usr/libexec/gvfs-afc-volume-monitor
├─1640 /usr/libexec/gvfs-gphoto2-volume-monitor
└─1680 /usr/libexec/ibus-engine-simple
systemd, 무엇이 바뀌었나? 30/34 (주)오뉴이노베이션
08381. 서울특별시 구로구 디지털로 273 702 호 ( 구로동 , 에이스트윈타워 2 차 )
702, ACE Twin Tower 2Cha, 273, Digital-ro Guro-gu, Seoul, Korea 08381
Tel. 02-866-2179 Fax. 02-866-2189
3. systemd Logging : journalctl
3.1. 개선 된 Logging
• syslog가 시작되기를 기다릴 필요가 없음.
• STDERR와 STDOUT를 더 이상 유실 되지 않음.
• syslog보다 더 디데일 함
• logging도 metadata가 있음.
• 디버깅과 프로파일링이 개선됨.
3.2. journalctl
• RHEL7에서 rsyslog가 대체 된것이 아님.
◦ rsyslog는 디폴트로 enable됨
• journal은 기본적으로 저장(persistent) 되지 않음.
◦ persistence하기 위해서는 'mkdir /var/log/journal'
• key-value 쌍으로 저장 됨.
◦ Journalctl [tab] [tab]
◦ man 7 systemd.journal-fields
• 메시지와 함께 이벤트 메타데이터를 수집
• 간단한 필터
◦ units, binaries 등을 배치
3.3. Journal의 사용
• Tail the journal : 'journalctl -f'
• Show X number of lines : 'jounralctl -n 50'
• View from boot : 'journalctl -b'
• Filter by priority : 'journalctl -p [level]'
0 emerg
1 alert
2 crit
3 err
4 warning
5 notice
6 debug
systemd, 무엇이 바뀌었나? 31/34 (주)오뉴이노베이션
08381. 서울특별시 구로구 디지털로 273 702 호 ( 구로동 , 에이스트윈타워 2 차 )
702, ACE Twin Tower 2Cha, 273, Digital-ro Guro-gu, Seoul, Korea 08381
Tel. 02-866-2179 Fax. 02-866-2189
3.3.1. journalctl
[root@procyon ~]# journalctl –no-pager
• time stamps는 시스템 로컬 타임 존으로 변환 됨.
• 모든 로그 데이터는 rotated logs가 포함된 것이 보여짐.
• 기본적으로 영구 보존 되지 않음, 그러나 보존 할 수 있음.
최근의 로그를 보려면 -f 옵션을 사용
[root@procyon ~]# journalctl -f
원한다면 stdout/stderr는 systemd-cat으로 journal로 write 할 수 있다.
priority로 필터하기
systemd, 무엇이 바뀌었나? 32/34 (주)오뉴이노베이션
08381. 서울특별시 구로구 디지털로 273 702 호 ( 구로동 , 에이스트윈타워 2 차 )
702, ACE Twin Tower 2Cha, 273, Digital-ro Guro-gu, Seoul, Korea 08381
Tel. 02-866-2179 Fax. 02-866-2189
시간과 priority로 필터하기
[root@procyon ~]# journalctl -p err --since "2016-2-1 00:00:00" --until "2016-2-10 23:59:59"
field, UID, unit 등으로 확장 필터 할 수 있음.
3.3.2. journalctl 사용하기
• 유용한 filter
◦ -r reverse order
◦ -u [unit]
◦ bynary e.g. /usr/sbin/dnsmasq [additional binaries]
◦ --since=yesterday or YYYY-MM-DD (HH:MM:SS)
◦ --until=YYYY-MM-DD
• 전체 journal 보기
◦ journalctl -o verbose (useful for grep)
유용한 사이트
systemd, 무엇이 바뀌었나? 33/34 (주)오뉴이노베이션
08381. 서울특별시 구로구 디지털로 273 702 호 ( 구로동 , 에이스트윈타워 2 차 )
702, ACE Twin Tower 2Cha, 273, Digital-ro Guro-gu, Seoul, Korea 08381
Tel. 02-866-2179 Fax. 02-866-2189
• How to enable persistent logging for the systemd journalctl
◦ https://access.redhat.com/solutions/696893
• System Administrator's Guide
◦ https://access.redhat.com/documentation/en-
US/Red_Hat_Enterprise_Linux/7/html/System_Administrators_Guide/s1-Using_the_Journal.html
• Lennart Poettering – The systemd Journalctl
◦ https://www.youtube.com/watch?v=i4CACB7paLc
systemd, 무엇이 바뀌었나? 34/34 (주)오뉴이노베이션
08381. 서울특별시 구로구 디지털로 273 702 호 ( 구로동 , 에이스트윈타워 2 차 )
702, ACE Twin Tower 2Cha, 273, Digital-ro Guro-gu, Seoul, Korea 08381
Tel. 02-866-2179 Fax. 02-866-2189

More Related Content

What's hot

Linux Kernel Boot Process , SOSCON 2015, By Mario Cho
Linux Kernel Boot Process , SOSCON 2015, By Mario ChoLinux Kernel Boot Process , SOSCON 2015, By Mario Cho
Linux Kernel Boot Process , SOSCON 2015, By Mario ChoMario Cho
 
망고100 보드로 놀아보자 14
망고100 보드로 놀아보자 14망고100 보드로 놀아보자 14
망고100 보드로 놀아보자 14종인 전
 
도커없이컨테이너 만들기 8편 - pid namespace
도커없이컨테이너 만들기 8편 - pid namespace도커없이컨테이너 만들기 8편 - pid namespace
도커없이컨테이너 만들기 8편 - pid namespaceSam Kim
 
Zookeeper 활용 nifi clustering
Zookeeper 활용 nifi clusteringZookeeper 활용 nifi clustering
Zookeeper 활용 nifi clusteringNoahKIM36
 
IoT with Raspberry Pi + Node JS - Chapter 2
IoT with Raspberry Pi + Node JS - Chapter 2IoT with Raspberry Pi + Node JS - Chapter 2
IoT with Raspberry Pi + Node JS - Chapter 2Park Jonggun
 
(참고) Elk stack 설치 및 kafka
(참고) Elk stack 설치 및 kafka(참고) Elk stack 설치 및 kafka
(참고) Elk stack 설치 및 kafkaNoahKIM36
 
도커없이 컨테이너 만들기 1편
도커없이 컨테이너 만들기 1편도커없이 컨테이너 만들기 1편
도커없이 컨테이너 만들기 1편Sam Kim
 
Rhel7 beta information
Rhel7 beta informationRhel7 beta information
Rhel7 beta information현익 박
 
Enterprise Linux 7 new feature_systemd_booting
Enterprise Linux 7 new feature_systemd_bootingEnterprise Linux 7 new feature_systemd_booting
Enterprise Linux 7 new feature_systemd_bootingsuk kim
 
[오픈소스컨설팅]레드햇계열리눅스7 운영자가이드 - 기초편
[오픈소스컨설팅]레드햇계열리눅스7 운영자가이드 - 기초편[오픈소스컨설팅]레드햇계열리눅스7 운영자가이드 - 기초편
[오픈소스컨설팅]레드햇계열리눅스7 운영자가이드 - 기초편Ji-Woong Choi
 
도커 없이 컨테이너 만들기 3편
도커 없이 컨테이너 만들기 3편도커 없이 컨테이너 만들기 3편
도커 없이 컨테이너 만들기 3편Sam Kim
 
Start io t_with_raspberrypi
Start io t_with_raspberrypiStart io t_with_raspberrypi
Start io t_with_raspberrypiYeonah Ki
 
Hadoopcluster install in_centos_virtualbox
Hadoopcluster install in_centos_virtualboxHadoopcluster install in_centos_virtualbox
Hadoopcluster install in_centos_virtualbox은봉 이
 
Near field communication
Near field communicationNear field communication
Near field communicationDH Y.
 
리눅스 드라이버 실습 #1
리눅스 드라이버 실습 #1리눅스 드라이버 실습 #1
리눅스 드라이버 실습 #1Sangho Park
 
2nd ROS Tutorial Seminar Section 2
2nd ROS Tutorial Seminar Section 22nd ROS Tutorial Seminar Section 2
2nd ROS Tutorial Seminar Section 2Yoonseok Pyo
 

What's hot (16)

Linux Kernel Boot Process , SOSCON 2015, By Mario Cho
Linux Kernel Boot Process , SOSCON 2015, By Mario ChoLinux Kernel Boot Process , SOSCON 2015, By Mario Cho
Linux Kernel Boot Process , SOSCON 2015, By Mario Cho
 
망고100 보드로 놀아보자 14
망고100 보드로 놀아보자 14망고100 보드로 놀아보자 14
망고100 보드로 놀아보자 14
 
도커없이컨테이너 만들기 8편 - pid namespace
도커없이컨테이너 만들기 8편 - pid namespace도커없이컨테이너 만들기 8편 - pid namespace
도커없이컨테이너 만들기 8편 - pid namespace
 
Zookeeper 활용 nifi clustering
Zookeeper 활용 nifi clusteringZookeeper 활용 nifi clustering
Zookeeper 활용 nifi clustering
 
IoT with Raspberry Pi + Node JS - Chapter 2
IoT with Raspberry Pi + Node JS - Chapter 2IoT with Raspberry Pi + Node JS - Chapter 2
IoT with Raspberry Pi + Node JS - Chapter 2
 
(참고) Elk stack 설치 및 kafka
(참고) Elk stack 설치 및 kafka(참고) Elk stack 설치 및 kafka
(참고) Elk stack 설치 및 kafka
 
도커없이 컨테이너 만들기 1편
도커없이 컨테이너 만들기 1편도커없이 컨테이너 만들기 1편
도커없이 컨테이너 만들기 1편
 
Rhel7 beta information
Rhel7 beta informationRhel7 beta information
Rhel7 beta information
 
Enterprise Linux 7 new feature_systemd_booting
Enterprise Linux 7 new feature_systemd_bootingEnterprise Linux 7 new feature_systemd_booting
Enterprise Linux 7 new feature_systemd_booting
 
[오픈소스컨설팅]레드햇계열리눅스7 운영자가이드 - 기초편
[오픈소스컨설팅]레드햇계열리눅스7 운영자가이드 - 기초편[오픈소스컨설팅]레드햇계열리눅스7 운영자가이드 - 기초편
[오픈소스컨설팅]레드햇계열리눅스7 운영자가이드 - 기초편
 
도커 없이 컨테이너 만들기 3편
도커 없이 컨테이너 만들기 3편도커 없이 컨테이너 만들기 3편
도커 없이 컨테이너 만들기 3편
 
Start io t_with_raspberrypi
Start io t_with_raspberrypiStart io t_with_raspberrypi
Start io t_with_raspberrypi
 
Hadoopcluster install in_centos_virtualbox
Hadoopcluster install in_centos_virtualboxHadoopcluster install in_centos_virtualbox
Hadoopcluster install in_centos_virtualbox
 
Near field communication
Near field communicationNear field communication
Near field communication
 
리눅스 드라이버 실습 #1
리눅스 드라이버 실습 #1리눅스 드라이버 실습 #1
리눅스 드라이버 실습 #1
 
2nd ROS Tutorial Seminar Section 2
2nd ROS Tutorial Seminar Section 22nd ROS Tutorial Seminar Section 2
2nd ROS Tutorial Seminar Section 2
 

Similar to Init to systemd

Fluentd with MySQL
Fluentd with MySQLFluentd with MySQL
Fluentd with MySQLI Goo Lee
 
Python으로 채팅 구현하기
Python으로 채팅 구현하기Python으로 채팅 구현하기
Python으로 채팅 구현하기Tae Young Lee
 
Nginx basic configurations
Nginx basic configurationsNginx basic configurations
Nginx basic configurationsJohn Kim
 
NODE.JS 글로벌 기업 적용 사례 그리고, real-time 어플리케이션 개발하기
NODE.JS 글로벌 기업 적용 사례  그리고, real-time 어플리케이션 개발하기NODE.JS 글로벌 기업 적용 사례  그리고, real-time 어플리케이션 개발하기
NODE.JS 글로벌 기업 적용 사례 그리고, real-time 어플리케이션 개발하기John Kim
 
[2D4]Python에서의 동시성_병렬성
[2D4]Python에서의 동시성_병렬성[2D4]Python에서의 동시성_병렬성
[2D4]Python에서의 동시성_병렬성NAVER D2
 
242 naver-2
242 naver-2242 naver-2
242 naver-2NAVER D2
 
20170713 tech day_7th_pxe 부팅-김주한
20170713 tech day_7th_pxe 부팅-김주한20170713 tech day_7th_pxe 부팅-김주한
20170713 tech day_7th_pxe 부팅-김주한ymtech
 
Android+init+process
Android+init+processAndroid+init+process
Android+init+processHong Jae Kwon
 
Python socket programming
Python socket programmingPython socket programming
Python socket programmingTae Young Lee
 
(2013 DEVIEW) 멀티쓰레드 프로그래밍이 왜이리 힘드나요?
(2013 DEVIEW) 멀티쓰레드 프로그래밍이  왜이리 힘드나요? (2013 DEVIEW) 멀티쓰레드 프로그래밍이  왜이리 힘드나요?
(2013 DEVIEW) 멀티쓰레드 프로그래밍이 왜이리 힘드나요? 내훈 정
 
Linux Performan tuning Part I
Linux Performan tuning Part ILinux Performan tuning Part I
Linux Performan tuning Part Isprdd
 
Hadoop security DeView 2014
Hadoop security DeView 2014Hadoop security DeView 2014
Hadoop security DeView 2014Gruter
 
Overlapped IO와 IOCP 조사 발표
Overlapped IO와 IOCP 조사 발표Overlapped IO와 IOCP 조사 발표
Overlapped IO와 IOCP 조사 발표Kwen Won Lee
 
JBoss Web Server ( JBoss 웹서버 ) 설치 가이드
JBoss Web Server ( JBoss 웹서버 ) 설치 가이드JBoss Web Server ( JBoss 웹서버 ) 설치 가이드
JBoss Web Server ( JBoss 웹서버 ) 설치 가이드Opennaru, inc.
 
박진호 - 우분투 부팅 과정에 대한 이야기 (2012Y07M28D)
박진호 - 우분투 부팅 과정에 대한 이야기 (2012Y07M28D)박진호 - 우분투 부팅 과정에 대한 이야기 (2012Y07M28D)
박진호 - 우분투 부팅 과정에 대한 이야기 (2012Y07M28D)Ubuntu Korea Community
 
Apache Tomcat ( 아파치 톰캣 ) 설치 가이드
Apache Tomcat ( 아파치 톰캣 ) 설치 가이드Apache Tomcat ( 아파치 톰캣 ) 설치 가이드
Apache Tomcat ( 아파치 톰캣 ) 설치 가이드Opennaru, inc.
 

Similar to Init to systemd (20)

Fluentd with MySQL
Fluentd with MySQLFluentd with MySQL
Fluentd with MySQL
 
Python으로 채팅 구현하기
Python으로 채팅 구현하기Python으로 채팅 구현하기
Python으로 채팅 구현하기
 
Nginx basic configurations
Nginx basic configurationsNginx basic configurations
Nginx basic configurations
 
NODE.JS 글로벌 기업 적용 사례 그리고, real-time 어플리케이션 개발하기
NODE.JS 글로벌 기업 적용 사례  그리고, real-time 어플리케이션 개발하기NODE.JS 글로벌 기업 적용 사례  그리고, real-time 어플리케이션 개발하기
NODE.JS 글로벌 기업 적용 사례 그리고, real-time 어플리케이션 개발하기
 
[2D4]Python에서의 동시성_병렬성
[2D4]Python에서의 동시성_병렬성[2D4]Python에서의 동시성_병렬성
[2D4]Python에서의 동시성_병렬성
 
242 naver-2
242 naver-2242 naver-2
242 naver-2
 
20170713 tech day_7th_pxe 부팅-김주한
20170713 tech day_7th_pxe 부팅-김주한20170713 tech day_7th_pxe 부팅-김주한
20170713 tech day_7th_pxe 부팅-김주한
 
Android+init+process
Android+init+processAndroid+init+process
Android+init+process
 
Python socket programming
Python socket programmingPython socket programming
Python socket programming
 
OpenStack Swift Debugging
OpenStack Swift DebuggingOpenStack Swift Debugging
OpenStack Swift Debugging
 
(2013 DEVIEW) 멀티쓰레드 프로그래밍이 왜이리 힘드나요?
(2013 DEVIEW) 멀티쓰레드 프로그래밍이  왜이리 힘드나요? (2013 DEVIEW) 멀티쓰레드 프로그래밍이  왜이리 힘드나요?
(2013 DEVIEW) 멀티쓰레드 프로그래밍이 왜이리 힘드나요?
 
Linux Performan tuning Part I
Linux Performan tuning Part ILinux Performan tuning Part I
Linux Performan tuning Part I
 
Hadoop security DeView 2014
Hadoop security DeView 2014Hadoop security DeView 2014
Hadoop security DeView 2014
 
Overlapped IO와 IOCP 조사 발표
Overlapped IO와 IOCP 조사 발표Overlapped IO와 IOCP 조사 발표
Overlapped IO와 IOCP 조사 발표
 
Redis
RedisRedis
Redis
 
JBoss Web Server ( JBoss 웹서버 ) 설치 가이드
JBoss Web Server ( JBoss 웹서버 ) 설치 가이드JBoss Web Server ( JBoss 웹서버 ) 설치 가이드
JBoss Web Server ( JBoss 웹서버 ) 설치 가이드
 
박진호 - 우분투 부팅 과정에 대한 이야기 (2012Y07M28D)
박진호 - 우분투 부팅 과정에 대한 이야기 (2012Y07M28D)박진호 - 우분투 부팅 과정에 대한 이야기 (2012Y07M28D)
박진호 - 우분투 부팅 과정에 대한 이야기 (2012Y07M28D)
 
Apache Tomcat ( 아파치 톰캣 ) 설치 가이드
Apache Tomcat ( 아파치 톰캣 ) 설치 가이드Apache Tomcat ( 아파치 톰캣 ) 설치 가이드
Apache Tomcat ( 아파치 톰캣 ) 설치 가이드
 
Meteor IoT
Meteor IoTMeteor IoT
Meteor IoT
 
Device driver
Device driverDevice driver
Device driver
 

Init to systemd

  • 1. systemd, 무엇이 바뀌었나? RHEL 7 (주)오뉴이노베이션 Solutions Architect팀 2018년 3월 7일 systemd, 무엇이 바뀌었나? 1/34 (주)오뉴이노베이션 08381. 서울특별시 구로구 디지털로 273 702 호 ( 구로동 , 에이스트윈타워 2 차 ) 702, ACE Twin Tower 2Cha, 273, Digital-ro Guro-gu, Seoul, Korea 08381 Tel. 02-866-2179 Fax. 02-866-2189
  • 2. Table of Contents 1. systemd의 이해.........................................................................................3 1.1. systemd는 무엇인가?..............................................................................3 1.2. init은 무엇인가?.................................................................................3 1.3. 왜 System V init는 대체 되었는가?................................................................3 1.4. /etc/init.d/httpd 스크립트.......................................................................3 1.5. systemd: httpd.service...........................................................................5 1.6. So long and thanks for all the fish..............................................................6 1.7. init 사용 종료 시점..............................................................................7 2. systemd – System & Service Manager.....................................................................8 2.1. systemd Overview.................................................................................8 2.2. systemd Units....................................................................................8 2.3. systemd Unit Files...............................................................................8 2.4. Unit 파일의 일반적인 옵션........................................................................8 2.5. 서비스 활성화....................................................................................9 2.6. 개선 된 자원 관리................................................................................9 2.7. Kill/Restart Cleanly.............................................................................9 2.8. Auto-Restarting..................................................................................9 2.9. systemd : Managing Services......................................................................9 2.10. systemctl vs services..........................................................................10 2.10.1 서비스의 시작, 상태 종료...................................................................10 2.10.2. List services.............................................................................10 2.11. Managing Services: Enable / Disable............................................................12 2.12. systemctl vs chkconfig.........................................................................12 2.13. systemctl 명령의 옵션..........................................................................13 2.14. systemd-* 명령들...............................................................................14 2.15. systemd 의존성.................................................................................14 2.16. Parallel, Not Serial...........................................................................15 2.17. Boot Process...................................................................................15 2.17.1. boot Process – Services / Units...........................................................17 2.17.2. target의 모든 서비스 목록.................................................................17 2.17.3. Analyzing Boot............................................................................20 2.18. Targets are the new Runlevels..................................................................22 2.18.1. Common Targets............................................................................22 2.18.2. Working with Targets......................................................................22 2.18.3. Shutting Down, Suspending, Etc............................................................24 2.19. root 암호 리셋하기.............................................................................24 2.20. systemd-cgtop..................................................................................26 2.21. 컨트롤 그룹의 컨텐츠 보기......................................................................26 3. systemd Logging : journalctl..........................................................................31 3.1. 개선 된 Logging.................................................................................31 3.2. journalctl......................................................................................31 3.3. Journal의 사용..................................................................................31 3.3.1. journalctl.................................................................................32 3.3.2. journalctl 사용하기........................................................................33 systemd, 무엇이 바뀌었나? 2/34 (주)오뉴이노베이션 08381. 서울특별시 구로구 디지털로 273 702 호 ( 구로동 , 에이스트윈타워 2 차 ) 702, ACE Twin Tower 2Cha, 273, Digital-ro Guro-gu, Seoul, Korea 08381 Tel. 02-866-2179 Fax. 02-866-2189
  • 3. 1. systemd의 이해 1.1. systemd는 무엇인가? systemd는 initd를 대체 한다. # ls -al /sbin/init lrwxrwxrwx. 1 root root 22 2월 1 23:04 /sbin/init -> ../lib/systemd/systemd • 시작하기 위한 첫 번째 프로세스이고, 종료하기 위한 마지막 프로세스 • 모든 다른 프로세스의 parent 프로세스 • 서비스와 기타 리소스를 관리 1.2. init은 무엇인가? • Init – System V UNIX origin in 1970s • 시스템을 시작하기 위한 프로세스 : ◦ BIOS/UEFI → Bootloader → Kernel → init • init은 모든 프로세스의 parent 프로세스 • /etc/inittab에 저장 되어 있는 스크립트로부터 프로세스를 생성 • /etc/init.d에 저장 된 스크립트 1.3. 왜 System V init는 대체 되었는가? • Init Scripts! ◦ 오래 됨 ◦ 표준화의 부족 ◦ 사람이나 컴퓨터가 이해하기 어렵고, 분석하기가 불가능하다. • Single threaded • 복잡한 관계를 표헌하기 어렵다. 1.4. /etc/init.d/httpd 스크립트 # pwd /etc/init.d # cat httpd #!/bin/bash # # httpd Startup script for the Apache HTTP Server # # chkconfig: - 85 15 # description: The Apache HTTP Server is an efficient and extensible # server implementing the current HTTP standards. systemd, 무엇이 바뀌었나? 3/34 (주)오뉴이노베이션 08381. 서울특별시 구로구 디지털로 273 702 호 ( 구로동 , 에이스트윈타워 2 차 ) 702, ACE Twin Tower 2Cha, 273, Digital-ro Guro-gu, Seoul, Korea 08381 Tel. 02-866-2179 Fax. 02-866-2189
  • 4. # processname: httpd # config: /etc/httpd/conf/httpd.conf # config: /etc/sysconfig/httpd # pidfile: /var/run/httpd/httpd.pid # ### BEGIN INIT INFO # Provides: httpd # Required-Start: $local_fs $remote_fs $network $named # Required-Stop: $local_fs $remote_fs $network # Should-Start: distcache # Short-Description: start and stop Apache HTTP Server # Description: The Apache HTTP Server is an extensible server # implementing the current HTTP standards. ### END INIT INFO # Source function library. . /etc/rc.d/init.d/functions if [ -f /etc/sysconfig/httpd ]; then . /etc/sysconfig/httpd fi # Start httpd in the C locale by default. HTTPD_LANG=${HTTPD_LANG-"C"} # This will prevent initlog from swallowing up a pass-phrase prompt if # mod_ssl needs a pass-phrase from the user. INITLOG_ARGS="" # Set HTTPD=/usr/sbin/httpd.worker in /etc/sysconfig/httpd to use a server # with the thread-based "worker" MPM; BE WARNED that some modules may not # work correctly with a thread-based MPM; notably PHP will refuse to start. # Path to the apachectl script, server binary, and short-form for messages. apachectl=/usr/sbin/apachectl httpd=${HTTPD-/usr/sbin/httpd} prog=httpd pidfile=${PIDFILE-/var/run/httpd/httpd.pid} lockfile=${LOCKFILE-/var/lock/subsys/httpd} RETVAL=0 STOP_TIMEOUT=${STOP_TIMEOUT-10} # The semantics of these two functions differ from the way apachectl does # things -- attempting to start while running is a failure, and shutdown # when not running is also a failure. So we just do it the way init scripts # are expected to behave here. start() { echo -n $"Starting $prog: " LANG=$HTTPD_LANG daemon --pidfile=${pidfile} $httpd $OPTIONS RETVAL=$? echo [ $RETVAL = 0 ] && touch ${lockfile} return $RETVAL } # When stopping httpd, a delay (of default 10 second) is required # before SIGKILLing the httpd parent; this gives enough time for the # httpd parent to SIGKILL any errant children. stop() { echo -n $"Stopping $prog: " killproc -p ${pidfile} -d ${STOP_TIMEOUT} $httpd RETVAL=$? echo [ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile} systemd, 무엇이 바뀌었나? 4/34 (주)오뉴이노베이션 08381. 서울특별시 구로구 디지털로 273 702 호 ( 구로동 , 에이스트윈타워 2 차 ) 702, ACE Twin Tower 2Cha, 273, Digital-ro Guro-gu, Seoul, Korea 08381 Tel. 02-866-2179 Fax. 02-866-2189
  • 5. } reload() { echo -n $"Reloading $prog: " if ! LANG=$HTTPD_LANG $httpd $OPTIONS -t >&/dev/null; then RETVAL=6 echo $"not reloading due to configuration syntax error" failure $"not reloading $httpd due to configuration syntax error" else # Force LSB behaviour from killproc LSB=1 killproc -p ${pidfile} $httpd -HUP RETVAL=$? if [ $RETVAL -eq 7 ]; then failure $"httpd shutdown" fi fi echo } # See how we were called. case "$1" in start) start ;; stop) stop ;; status) status -p ${pidfile} $httpd RETVAL=$? ;; restart) stop start ;; condrestart|try-restart) if status -p ${pidfile} $httpd >&/dev/null; then stop start fi ;; force-reload|reload) reload ;; graceful|help|configtest|fullstatus) $apachectl $@ RETVAL=$? ;; *) echo $"Usage: $prog {start|stop|restart|condrestart|try-restart|force-reload|reload|status| fullstatus|graceful|help|configtest}" RETVAL=2 esac exit $RETVAL 1.5. systemd: httpd.service # pwd /usr/lib/systemd/system # cat httpd.service # It's not recommended to modify this file in-place, because it will be # overwritten during package upgrades. If you want to customize, the best systemd, 무엇이 바뀌었나? 5/34 (주)오뉴이노베이션 08381. 서울특별시 구로구 디지털로 273 702 호 ( 구로동 , 에이스트윈타워 2 차 ) 702, ACE Twin Tower 2Cha, 273, Digital-ro Guro-gu, Seoul, Korea 08381 Tel. 02-866-2179 Fax. 02-866-2189
  • 6. # way is to create a file "/etc/systemd/system/httpd.service", # containing # .include /lib/systemd/system/httpd.service # ...make your changes here... # For more info about custom unit files, see # http://fedoraproject.org/wiki/Systemd#How_do_I_customize_a_unit_file.2F_add_a_custom_unit_file.3F # For example, to pass additional options (for instance, -D definitions) to the # httpd binary at startup, you need to create a file named # "/etc/systemd/system/httpd.service" containing: # .include /lib/systemd/system/httpd.service # [Service] # Environment=OPTIONS=-DMY_DEFINE [Unit] Description=The Apache HTTP Server After=network.target remote-fs.target nss-lookup.target [Service] Type=notify Environment=LANG=C ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND ExecReload=/usr/sbin/httpd $OPTIONS -k graceful # Send SIGWINCH for graceful stop KillSignal=SIGWINCH KillMode=mixed PrivateTmp=true [Install] WantedBy=multi-user.target 1.6. So long and thanks for all the fish 영화 “The hichiker's guide to the galaxy”에서 지구가 멸망할 것을 할고 돌고래가 지구를 떠날 때 다른 물고기 들에게 남긴 인사말. systemd, 무엇이 바뀌었나? 6/34 (주)오뉴이노베이션 08381. 서울특별시 구로구 디지털로 273 702 호 ( 구로동 , 에이스트윈타워 2 차 ) 702, ACE Twin Tower 2Cha, 273, Digital-ro Guro-gu, Seoul, Korea 08381 Tel. 02-866-2179 Fax. 02-866-2189
  • 7. 1.7. init 사용 종료 시점 Fedora 15 - 2011년 5월 Arch - 2012년 10월 Red Hat - 2014년 6월 SUSE - 2014년 10월 Ubunto & debian – 2015월 4월 systemd, 무엇이 바뀌었나? 7/34 (주)오뉴이노베이션 08381. 서울특별시 구로구 디지털로 273 702 호 ( 구로동 , 에이스트윈타워 2 차 ) 702, ACE Twin Tower 2Cha, 273, Digital-ro Guro-gu, Seoul, Korea 08381 Tel. 02-866-2179 Fax. 02-866-2189
  • 8. 2. systemd – System & Service Manager 2.1. systemd Overview • 더 많은 서비스를 제어 • 종속적 제어 • 서비스 활성화 • 빠른 시작 및 종료 • 개선 된 자원 관리 • 더 좋은 로깅, 디버깅 프로파일링 • 역 호환 • 배우기 쉽다 2.2. systemd Units 더 많은 서비스를 제어하고, 시스템이 가지고 있는 모든 자원은 제어한다. • 제어 할 수 있는 Unit의 종류 ◦ Services ◦ Sockets ◦ Mounts ◦ Targets ◦ Swap ◦ and more… Unit는 Unit 파일이 사용되고 정의 된다. Unit의 이름 규칙은 name.unit_type로 정해 진다. 2.3. systemd Unit Files • Maintainer files : /usr/lib/systemd/system • Administrator files : /etc/systemd/system • Non-persistent, runtime data : /run/systemd • Drop-ins : /etc/systemd/system/[name.type].d/*.conf Note : /etc 아래에 있는 Unit 파일은 /usr 아래에 있는 Unit 파일보다 우선 적용됨. 만약 unit가 수정 되면 '# systemctl daemon-reload' 를 잊지 마세요! 2.4. Unit 파일의 일반적인 옵션 • Description=Unit의 설명 • Documentation=문서 링크 • Requires=추가적으로 요구 되는 Unit • Before/After=Unit이 시작하기 전/후의 Unit • Wants=Weaker Requires • Conflicts=Units cannot co-e4xist • WantedBy/RquiredBy=Set other units requirement systemd, 무엇이 바뀌었나? 8/34 (주)오뉴이노베이션 08381. 서울특별시 구로구 디지털로 273 702 호 ( 구로동 , 에이스트윈타워 2 차 ) 702, ACE Twin Tower 2Cha, 273, Digital-ro Guro-gu, Seoul, Korea 08381 Tel. 02-866-2179 Fax. 02-866-2189
  • 9. 2.5. 서비스 활성화 • Start up services when needed ◦ 자원의 저장 ◦ 신뢰성 향상 ◦ 클라이언트에 투명 • Socket, Device, Path bus 그리고 Timer에 의해 활성화 • xinetd 서비스를 unit로 변환하는 것을 추천 2.6. 개선 된 자원 관리 Services labeled and isolated with Cgroups More control than nice alone Can properly kill/restart entire service chain Can configure multiple instances for a single services 하나의 서비스에 여러개의 인스턴스를 구성 할 수 있음. Can balance by shares or by hard limits 2.7. Kill/Restart Cleanly Tracked in the kernel Knows all children Don't need to rely on a potentially misbehaving process to hopefully kill its children 2.8. Auto-Restarting It's paying attention! Auto-Restarting는 주의 해야함. Reality : software does crash occasionally 실제로 소프트웨어는 때때로 크래시가 발생. Reduces need for manual intervention Auto-Restarting는 수동적인 개입 필요성을 감소 Socket stays open, only lose that single transaction 오픈되어 있는 소켓은 그 단일 트랜잭션을 잃을 수 있음. 2.9. systemd : Managing Services Init: # service unit {start, stop, restart, reload} systemd: # systemctl {start, stop, restart, reload} unit1 [unit2 …] • 여러개의 서비스를 동시에 실행 할 수 있음. • .service Unit 타입 • systemctl은 Tab 키로 완성 될 수 있음. ◦ bash-completion 패키지 설치 필요 systemd, 무엇이 바뀌었나? 9/34 (주)오뉴이노베이션 08381. 서울특별시 구로구 디지털로 273 702 호 ( 구로동 , 에이스트윈타워 2 차 ) 702, ACE Twin Tower 2Cha, 273, Digital-ro Guro-gu, Seoul, Korea 08381 Tel. 02-866-2179 Fax. 02-866-2189
  • 10. 2.10. systemctl vs services 2.10.1 서비스의 시작, 상태 종료 2.10.2. List services systemd, 무엇이 바뀌었나? 10/34 (주)오뉴이노베이션 08381. 서울특별시 구로구 디지털로 273 702 호 ( 구로동 , 에이스트윈타워 2 차 ) 702, ACE Twin Tower 2Cha, 273, Digital-ro Guro-gu, Seoul, Korea 08381 Tel. 02-866-2179 Fax. 02-866-2189
  • 11. systemd, 무엇이 바뀌었나? 11/34 (주)오뉴이노베이션 08381. 서울특별시 구로구 디지털로 273 702 호 ( 구로동 , 에이스트윈타워 2 차 ) 702, ACE Twin Tower 2Cha, 273, Digital-ro Guro-gu, Seoul, Korea 08381 Tel. 02-866-2179 Fax. 02-866-2189
  • 12. 2.11. Managing Services: Enable / Disable Init: # chkconfig unit {on, off} systemctl: # systemctl {enable, disable, mask, unmask} unit [unit ...] mask: mask는 서비스를 disable하는 것 보다 더 강력하다. 서비스를 /dev/null로 링크 걸고, 그 링크를 인식함으로 서비 스를 시작하지 않는다. 2.12. systemctl vs chkconfig systemd, 무엇이 바뀌었나? 12/34 (주)오뉴이노베이션 08381. 서울특별시 구로구 디지털로 273 702 호 ( 구로동 , 에이스트윈타워 2 차 ) 702, ACE Twin Tower 2Cha, 273, Digital-ro Guro-gu, Seoul, Korea 08381 Tel. 02-866-2179 Fax. 02-866-2189
  • 13. 2.13. systemctl 명령의 옵션 systemd, 무엇이 바뀌었나? 13/34 (주)오뉴이노베이션 08381. 서울특별시 구로구 디지털로 273 702 호 ( 구로동 , 에이스트윈타워 2 차 ) 702, ACE Twin Tower 2Cha, 273, Digital-ro Guro-gu, Seoul, Korea 08381 Tel. 02-866-2179 Fax. 02-866-2189
  • 14. 2.14. systemd-* 명령들 2.15. systemd 의존성 • 각 unit에 명령과 조건이 정의 되어 있음. • Nfs-lock.service로 예를 들면 # cat nfs-lock.service [Unit] Description=NFS status monitor for NFSv2/3 locking. DefaultDependencies=no Conflicts=umount.target Requires=nss-lookup.target rpcbind.target After=network.target nss-lookup.target rpcbind.service PartOf=nfs-utils.service Wants=nfs-config.service After=nfs-config.service systemd, 무엇이 바뀌었나? 14/34 (주)오뉴이노베이션 08381. 서울특별시 구로구 디지털로 273 702 호 ( 구로동 , 에이스트윈타워 2 차 ) 702, ACE Twin Tower 2Cha, 273, Digital-ro Guro-gu, Seoul, Korea 08381 Tel. 02-866-2179 Fax. 02-866-2189
  • 15. [Service] EnvironmentFile=-/run/sysconfig/nfs-utils Type=forking PIDFile=/var/run/rpc.statd.pid ExecStart=/usr/sbin/rpc.statd --no-notify $STATDARGS 2.16. Parallel, Not Serial • 빠른 시작과 종료를 위해 허용 • 효율적인 자원 관리 2.17. Boot Process • 부팅 경로를 default.target이 결정 systemd, 무엇이 바뀌었나? 15/34 (주)오뉴이노베이션 08381. 서울특별시 구로구 디지털로 273 702 호 ( 구로동 , 에이스트윈타워 2 차 ) 702, ACE Twin Tower 2Cha, 273, Digital-ro Guro-gu, Seoul, Korea 08381 Tel. 02-866-2179 Fax. 02-866-2189
  • 16. systemd, 무엇이 바뀌었나? 16/34 (주)오뉴이노베이션 08381. 서울특별시 구로구 디지털로 273 702 호 ( 구로동 , 에이스트윈타워 2 차 ) 702, ACE Twin Tower 2Cha, 273, Digital-ro Guro-gu, Seoul, Korea 08381 Tel. 02-866-2179 Fax. 02-866-2189
  • 17. 2.17.1. boot Process – Services / Units • Target “Wants” Directories: ◦ /usr/lib/systemd/system/<name>.target.wants/ ◦ /etc/systemd/system/<name>.target.wants/ • Files are symiinks to actual unit files • Empty target wants directories are placeholders multi-user.target.wants의 예시 2.17.2. target의 모든 서비스 목록 systemd, 무엇이 바뀌었나? 17/34 (주)오뉴이노베이션 08381. 서울특별시 구로구 디지털로 273 702 호 ( 구로동 , 에이스트윈타워 2 차 ) 702, ACE Twin Tower 2Cha, 273, Digital-ro Guro-gu, Seoul, Korea 08381 Tel. 02-866-2179 Fax. 02-866-2189
  • 18. # systemctl list-dependencies multi-user.target --no-pager multi-user.target ● ├─abrt-ccpp.service ● ├─abrt-oops.service ● ├─abrt-vmcore.service ● ├─abrt-xorg.service ● ├─abrtd.service ● ├─atd.service ● ├─auditd.service ● ├─avahi-daemon.service ● ├─chronyd.service ● ├─crond.service ● ├─cups.path ● ├─dbus.service ● ├─libvirtd.service ● ├─livesys-late.service ● ├─livesys.service ● ├─mcelog.service ● ├─mdmonitor.service ● ├─ModemManager.service ● ├─netcf-transaction.service ● ├─NetworkManager.service ● ├─plymouth-quit-wait.service ● ├─plymouth-quit.service ● ├─rngd.service ● ├─smb.service ● ├─sysstat.service ● ├─systemd-ask-password-wall.path ● ├─systemd-logind.service ● ├─systemd-update-utmp-runlevel.service ● ├─systemd-user-sessions.service ● ├─vmtoolsd.service ● ├─basic.target ● │ ├─-.mount ● │ ├─alsa-restore.service systemd, 무엇이 바뀌었나? 18/34 (주)오뉴이노베이션 08381. 서울특별시 구로구 디지털로 273 702 호 ( 구로동 , 에이스트윈타워 2 차 ) 702, ACE Twin Tower 2Cha, 273, Digital-ro Guro-gu, Seoul, Korea 08381 Tel. 02-866-2179 Fax. 02-866-2189
  • 19. ● │ ├─alsa-state.service ● │ ├─dnf-makecache.timer ● │ ├─fedora-autorelabel-mark.service ● │ ├─fedora-autorelabel.service ● │ ├─fedora-loadmodules.service ● │ ├─firewalld.service ● │ ├─tmp.mount ● │ ├─paths.target ● │ ├─slices.target ● │ │ ├─-.slice ● │ │ └─system.slice ● │ ├─sockets.target ● │ │ ├─avahi-daemon.socket ● │ │ ├─cups.socket ● │ │ ├─dbus.socket ● │ │ ├─dm-event.socket ● │ │ ├─iscsid.socket ● │ │ ├─iscsiuio.socket ● │ │ ├─rpcbind.socket ● │ │ ├─systemd-initctl.socket ● │ │ ├─systemd-journald-audit.socket ● │ │ ├─systemd-journald-dev-log.socket ● │ │ ├─systemd-journald.socket ● │ │ ├─systemd-udevd-control.socket ● │ │ └─systemd-udevd-kernel.socket ● │ ├─sysinit.target ● │ │ ├─dev-hugepages.mount ● │ │ ├─dev-mqueue.mount ● │ │ ├─dmraid-activation.service ● │ │ ├─dracut-shutdown.service ● │ │ ├─iscsi.service ● │ │ ├─kmod-static-nodes.service ● │ │ ├─ldconfig.service ● │ │ ├─lvm2-lvmetad.socket ● │ │ ├─lvm2-lvmpolld.socket ● │ │ ├─lvm2-monitor.service ● │ │ ├─multipathd.service ● │ │ ├─plymouth-read-write.service ● │ │ ├─plymouth-start.service ● │ │ ├─proc-sys-fs-binfmt_misc.automount ● │ │ ├─sys-fs-fuse-connections.mount ● │ │ ├─sys-kernel-config.mount ● │ │ ├─sys-kernel-debug.mount ● │ │ ├─systemd-ask-password-console.path ● │ │ ├─systemd-binfmt.service ● │ │ ├─systemd-firstboot.service ● │ │ ├─systemd-hwdb-update.service ● │ │ ├─systemd-journal-catalog-update.service ● │ │ ├─systemd-journal-flush.service ● │ │ ├─systemd-journald.service ● │ │ ├─systemd-machine-id-commit.service ● │ │ ├─systemd-modules-load.service ● │ │ ├─systemd-random-seed.service ● │ │ ├─systemd-sysctl.service ● │ │ ├─systemd-sysusers.service ● │ │ ├─systemd-tmpfiles-setup-dev.service ● │ │ ├─systemd-tmpfiles-setup.service ● │ │ ├─systemd-udev-trigger.service ● │ │ ├─systemd-udevd.service ● │ │ ├─systemd-update-done.service ● │ │ ├─systemd-update-utmp.service ● │ │ ├─systemd-vconsole-setup.service ● │ │ ├─cryptsetup.target ● │ │ ├─local-fs.target systemd, 무엇이 바뀌었나? 19/34 (주)오뉴이노베이션 08381. 서울특별시 구로구 디지털로 273 702 호 ( 구로동 , 에이스트윈타워 2 차 ) 702, ACE Twin Tower 2Cha, 273, Digital-ro Guro-gu, Seoul, Korea 08381 Tel. 02-866-2179 Fax. 02-866-2189
  • 20. ● │ │ │ ├─-.mount ● │ │ │ ├─boot.mount ● │ │ │ ├─fedora-import-state.service ● │ │ │ ├─fedora-readonly.service ● │ │ │ ├─home.mount ● │ │ │ ├─systemd-fsck-root.service ● │ │ │ ├─systemd-remount-fs.service ● │ │ │ ├─tmp.mount ● │ │ │ └─var-lib-machines.mount ● │ │ └─swap.target ● │ │ └─dev-mapper-fedorax2dswap.swap ● │ └─timers.target ● │ ├─mlocate-updatedb.timer ● │ ├─systemd-tmpfiles-clean.timer ● │ └─unbound-anchor.timer ● ├─getty.target ● │ └─getty@tty1.service ● ├─nfs-client.target ● │ ├─auth-rpcgss-module.service ● │ ├─rpc-statd-notify.service ● │ └─remote-fs-pre.target ● └─remote-fs.target ● └─nfs-client.target ● ├─auth-rpcgss-module.service ● ├─rpc-statd-notify.service ● └─remote-fs-pre.target 2.17.3. Analyzing Boot Each unit is tracked during start up # systemd-analyze blame --no-pager 4.937s plymouth-quit-wait.service systemd, 무엇이 바뀌었나? 20/34 (주)오뉴이노베이션 08381. 서울특별시 구로구 디지털로 273 702 호 ( 구로동 , 에이스트윈타워 2 차 ) 702, ACE Twin Tower 2Cha, 273, Digital-ro Guro-gu, Seoul, Korea 08381 Tel. 02-866-2179 Fax. 02-866-2189
  • 21. 4.750s mlocate-updatedb.service 1.415s systemd-udev-settle.service 1.364s plymouth-start.service 689ms lvm2-pvscan@8:18.service 655ms firewalld.service 579ms dev-mapper-fedorax2droot.device 513ms dnf-makecache.service 272ms libvirtd.service 264ms lvm2-pvscan@8:2.service 229ms systemd-journal-flush.service 212ms smb.service 190ms accounts-daemon.service 173ms lvm2-monitor.service 161ms systemd-logind.service 144ms cups.service 117ms chronyd.service 104ms mcelog.service 104ms gssproxy.service 104ms ModemManager.service 104ms netcf-transaction.service 98ms rtkit-daemon.service 92ms avahi-daemon.service 92ms proc-fs-nfsd.mount 86ms packagekit.service 80ms polkit.service 78ms systemd-udev-trigger.service 76ms systemd-localed.service 75ms systemd-fsck-root.service 71ms home.mount 68ms systemd-udevd.service 59ms systemd-vconsole-setup.service 55ms systemd-hostnamed.service 52ms iio-sensor-proxy.service 52ms unbound-anchor.service 50ms bluetooth.service 48ms sysstat.service 44ms user@1000.service 41ms systemd-tmpfiles-setup-dev.service 37ms livesys.service 36ms systemd-fsck@dev-disk-byx2duuid-1ff364dbx2dfaadx2d491cx2db146x2d5b789c92e383.service 36ms systemd-tmpfiles-setup.service 36ms fedora-readonly.service 35ms user@42.service 34ms systemd-tmpfiles-clean.service 33ms livesys-late.service 33ms NetworkManager.service 28ms gdm.service 28ms colord.service 28ms systemd-journald.service 27ms systemd-remount-fs.service 25ms systemd-backlight@backlight:intel_backlight.service 24ms udisks2.service 24ms dmraid-activation.service 22ms fedora-import-state.service 21ms abrt-ccpp.service 21ms sysstat-collect.service 20ms tmp.mount 20ms boot.mount 19ms systemd-sysctl.service 18ms blk-availability.service 18ms abrtd.service 16ms rpc-statd-notify.service 16ms dev-hugepages.mount 15ms upower.service systemd, 무엇이 바뀌었나? 21/34 (주)오뉴이노베이션 08381. 서울특별시 구로구 디지털로 273 702 호 ( 구로동 , 에이스트윈타워 2 차 ) 702, ACE Twin Tower 2Cha, 273, Digital-ro Guro-gu, Seoul, Korea 08381 Tel. 02-866-2179 Fax. 02-866-2189
  • 22. 15ms kmod-static-nodes.service 15ms plymouth-read-write.service 14ms dev-mqueue.mount 14ms systemd-user-sessions.service 13ms wpa_supplicant.service 12ms nfs-config.service 12ms systemd-rfkill@rfkill1.service 9ms systemd-random-seed.service 9ms systemd-rfkill@rfkill0.service 9ms sys-fs-fuse-connections.mount 8ms dev-mapper-fedorax2dswap.swap 7ms sys-kernel-debug.mount 7ms systemd-update-utmp-runlevel.service 6ms systemd-update-utmp.service 6ms systemd-rfkill@rfkill2.service 6ms dracut-shutdown.service 5ms var-lib-nfs-rpc_pipefs.mount 5ms auditd.service 2ms sys-kernel-config.mount 2.18. Targets are the new Runlevels Targets != Runlevels - 몇 몇은 같은 부분이 있다. Traditional Runlevel Equivalent Target Symlink Target Runlevel 0 poweroff.target Runlevel0.target Runlevel 1 rescue.target Runlevel1.target Runlevel 2 multi-user.target Runlevel2.target Runlevel 3 multi-user.target Runlevel3.target Runlevel 4 multi-user.target Runlevel4.target Runlevel 5 graphical.target Runlevel5.target Runlevel 6 Reboot.target Runlevel6.target Target은 다른 target를 포함 할 수 있음. 2.18.1. Common Targets Target Purpose graphical.target 멀티 유저, 그래픽과 텍스트 로그인 지원 multi-user.target 멀티 유저, 텍스트 로그인만 지원 resuce.target 싱글 유저, 로컬 파일 시스템과 기본 시스템 초기화, 네트워크는 비활성 emergency.target 싱글 유저, root 파일 시스템이 ro로 마운트, 몇개의 기본적이 서비스만 실행, 네트워 크는 비활성 Rescue, Emergency target는 root 암호가 필요함!! 2.18.2. Working with Targets 기본 target 보기 [root@procyon ~]# systemctl get-default graphical.target systemd, 무엇이 바뀌었나? 22/34 (주)오뉴이노베이션 08381. 서울특별시 구로구 디지털로 273 702 호 ( 구로동 , 에이스트윈타워 2 차 ) 702, ACE Twin Tower 2Cha, 273, Digital-ro Guro-gu, Seoul, Korea 08381 Tel. 02-866-2179 Fax. 02-866-2189
  • 23. target 세팅 하기 [root@procyon ~]# systemctl set-default graphical.target Removed symlink /etc/systemd/system/default.target. Created symlink from /etc/systemd/system/default.target to /usr/lib/systemd/system/graphical.target. 기본 target는 symlink [root@procyon ~]# ls -al /etc/systemd/system/default.target lrwxrwxrwx. 1 root root 40 2월 17 13:52 /etc/systemd/system/default.target -> /usr/lib/systemd/system/graphical.target target 변경하기 [root@procyon ~]# systemctl isolate graphical.target PolicyKit daemon disconnected from the bus. We are no longer a registered authentication agent. Rescue 모드로 변경하기 [root@procyon ~]# systemctl rescue 메시지를 보내지 않고 긴급 모드 변경하기 [root@procyon ~]# systemctl –no-wall emergency 현재 로드 된 target 보기 [root@procyon ~]# systemctl list-units --type target --no-pager UNIT LOAD ACTIVE SUB DESCRIPTION basic.target loaded active active Basic System cryptsetup.target loaded active active Encrypted Volumes getty.target loaded active active Login Prompts graphical.target loaded active active Graphical Interface local-fs-pre.target loaded active active Local File Systems (Pre) local-fs.target loaded active active Local File Systems systemd, 무엇이 바뀌었나? 23/34 (주)오뉴이노베이션 08381. 서울특별시 구로구 디지털로 273 702 호 ( 구로동 , 에이스트윈타워 2 차 ) 702, ACE Twin Tower 2Cha, 273, Digital-ro Guro-gu, Seoul, Korea 08381 Tel. 02-866-2179 Fax. 02-866-2189
  • 24. multi-user.target loaded active active Multi-User System network.target loaded active active Network nfs-client.target loaded active active NFS client services nss-user-lookup.target loaded active active User and Group Name Lookups paths.target loaded active active Paths remote-fs-pre.target loaded active active Remote File Systems (Pre) remote-fs.target loaded active active Remote File Systems slices.target loaded active active Slices sockets.target loaded active active Sockets swap.target loaded active active Swap sysinit.target loaded active active System Initialization timers.target loaded active active Timers LOAD = Reflects whether the unit definition was properly loaded. ACTIVE = The high-level unit activation state, i.e. generalization of SUB. SUB = The low-level unit activation state, values depend on unit type. 18 loaded units listed. Pass --all to see loaded but inactive units, too. To show all installed unit files use 'systemctl list-unit-files'. 2.18.3. Shutting Down, Suspending, Etc Old Command New Command Description halt systemctl halt Halts the system poweroff systemctl poweroff Powers off the system reboot systemctl reboot Restarts the system pm-suspend systemctl suspend Suspends the system pm-hibernate systemctl hibernate Hibernates the system pm-suspend-hybrid systemctl hybrid-sleep Hibernates and suspends the system 2.19. root 암호 리셋하기 Step 1 : Reboot your system Step 2 : GRUB 부트로더가 보이면, any key로 인터럽트 그리고 'e' 선택 systemd, 무엇이 바뀌었나? 24/34 (주)오뉴이노베이션 08381. 서울특별시 구로구 디지털로 273 702 호 ( 구로동 , 에이스트윈타워 2 차 ) 702, ACE Twin Tower 2Cha, 273, Digital-ro Guro-gu, Seoul, Korea 08381 Tel. 02-866-2179 Fax. 02-866-2189
  • 25. Step 3 : 커서키로 linux16으로 시작하는 라인의 긑으로 이동 Step 4 : 라인의 끝에서 'rd.break' 입력하고, Ctrl + X로 변경된 설정으로 부팅 linux16 /vmlinuz-4.3.5-300.fc23.x86_64 root=/dev/mapper/fedora-root ro rd.lvm.lv=fedora/root rd.lvm.lv=fedora/swap rhgb quiet LANG=en_US.UTF-8 rd.break initrd16 /initramfs-4.3.5-300.fc23.x86_64.img Step 5 : root 프롬프트로 스위치 되면, /sysroot 파일 시스템을 rw로 remount, 그리고 나서 chroot를 사용해서 jail로 들어감. Step 6 : passwd로 root password 변경 systemd, 무엇이 바뀌었나? 25/34 (주)오뉴이노베이션 08381. 서울특별시 구로구 디지털로 273 702 호 ( 구로동 , 에이스트윈타워 2 차 ) 702, ACE Twin Tower 2Cha, 273, Digital-ro Guro-gu, Seoul, Korea 08381 Tel. 02-866-2179 Fax. 02-866-2189
  • 26. Step 7 : 리부팅시 모든 파일의 레이블을 다시 지정하기 위해 SELinux를 지시 • 만약 생략했다면 시스템은 아마도 부팅 되지 않을 수 있음. Step 8 : relabel과 reboot하기 위해 두 번의 exit 명령 # touch /.autorelabel # exit exit switch_root:/# exit logout 2.20. systemd-cgtop Top 컨트롤 그룹은 자원의 사용량을 보여준다. [root@procyon ~]# systemd-cgtop 2.21. 컨트롤 그룹의 컨텐츠 보기 # systemd-cgls –no-pager systemd, 무엇이 바뀌었나? 26/34 (주)오뉴이노베이션 08381. 서울특별시 구로구 디지털로 273 702 호 ( 구로동 , 에이스트윈타워 2 차 ) 702, ACE Twin Tower 2Cha, 273, Digital-ro Guro-gu, Seoul, Korea 08381 Tel. 02-866-2179 Fax. 02-866-2189
  • 27. # systemd-cgls --no-pager ├─1 /usr/lib/systemd/systemd --switched-root --system --deserialize 21 ├─system.slice │ ├─avahi-daemon.service │ │ ├─848 avahi-daemon: running [procyon.local] │ │ └─865 avahi-daemon: chroot helper │ ├─dbus.service │ │ └─828 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfi... │ ├─firewalld.service │ │ └─845 /usr/bin/python3 -Es /usr/sbin/firewalld --nofork --nopid │ ├─ModemManager.service │ │ └─844 /usr/sbin/ModemManager │ ├─abrtd.service │ │ └─3809 /usr/sbin/abrtd -d -s │ ├─plymouth-start.service │ │ └─14692 @usr/sbin/plymouthd --mode=boot --pid-file=/var/run/plymouth/pid ... │ ├─crond.service │ │ └─1011 /usr/sbin/crond -n │ ├─alsa-state.service │ │ └─819 /usr/sbin/alsactl -s -n 19 -c -E ALSA_CONFIG_PATH=/etc/alsa/alsactl... │ ├─accounts-daemon.service │ │ └─846 /usr/libexec/accounts-daemon │ ├─colord.service │ │ └─15094 /usr/libexec/colord │ ├─atd.service │ │ └─1013 /usr/sbin/atd -f │ ├─systemd-journald.service │ │ └─582 /usr/lib/systemd/systemd-journald │ ├─chronyd.service │ │ └─827 /usr/sbin/chronyd │ ├─auditd.service │ │ ├─804 /sbin/auditd -n │ │ ├─813 /sbin/audispd │ │ └─816 /usr/sbin/sedispatch │ ├─plymouth-quit-wait.service systemd, 무엇이 바뀌었나? 27/34 (주)오뉴이노베이션 08381. 서울특별시 구로구 디지털로 273 702 호 ( 구로동 , 에이스트윈타워 2 차 ) 702, ACE Twin Tower 2Cha, 273, Digital-ro Guro-gu, Seoul, Korea 08381 Tel. 02-866-2179 Fax. 02-866-2189
  • 28. │ │ └─14733 /usr/bin/plymouth --wait │ ├─gssproxy.service │ │ └─834 /usr/sbin/gssproxy -D │ ├─cups.service │ │ └─15093 /usr/sbin/cupsd -l │ ├─systemd-logind.service │ │ └─823 /usr/lib/systemd/systemd-logind │ ├─libvirtd.service │ │ ├─1002 /usr/sbin/libvirtd │ │ ├─1519 /sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --... │ │ └─1520 /sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --... │ ├─smb.service │ │ ├─1059 /usr/sbin/smbd │ │ ├─1061 /usr/sbin/smbd │ │ └─1066 /usr/sbin/smbd │ ├─systemd-udevd.service │ │ └─621 /usr/lib/systemd/systemd-udevd │ ├─mcelog.service │ │ └─874 /usr/sbin/mcelog --ignorenodev --daemon --foreground │ ├─abrt-oops.service │ │ └─3841 /usr/bin/abrt-dump-journal-oops -fxtD │ ├─rngd.service │ │ └─851 /sbin/rngd -f │ ├─polkit.service │ │ └─14724 /usr/lib/polkit-1/polkitd --no-debug │ ├─abrt-xorg.service │ │ └─3885 /usr/bin/abrt-dump-journal-xorg -fxtD │ ├─NetworkManager.service │ │ ├─ 979 /usr/sbin/NetworkManager --no-daemon │ │ └─2892 /sbin/dhclient -d -q -sf /usr/libexec/nm-dhcp-helper -pf /var/run/... │ ├─gdm.service │ │ └─1009 /usr/sbin/gdm │ └─rtkit-daemon.service │ └─843 /usr/libexec/rtkit-daemon └─user.slice ├─user-1000.slice │ └─session-1.scope │ ├─ 1905 gdm-session-worker [pam/gdm-password] │ ├─ 1934 /usr/bin/gnome-keyring-daemon --daemonize --login │ ├─ 2011 /usr/libexec/gdm-x-session --run-script gnome-session │ ├─ 2019 /usr/libexec/Xorg vt2 -displayfd 3 -auth /run/user/1000/gdm/Xau... │ ├─ 2033 /usr/libexec/xf86-video-intel-backlight-helper intel_backlight │ ├─ 2051 dbus-daemon --print-address 4 --session │ ├─ 2054 /usr/libexec/gnome-session-binary │ ├─ 2128 /usr/libexec/at-spi-bus-launcher │ ├─ 2133 /bin/dbus-daemon --config-file=/etc/at-spi2/accessibility.conf ... │ ├─ 2136 /usr/libexec/at-spi2-registryd --use-gnome-session │ ├─ 2149 /usr/libexec/gvfsd │ ├─ 2154 /usr/libexec/gvfsd-fuse /run/user/1000/gvfs -f -o big_writes │ ├─ 2162 /usr/libexec/gnome-settings-daemon │ ├─ 2180 /usr/bin/pulseaudio --start --log-target=syslog │ ├─ 2212 /usr/bin/gnome-shell │ ├─ 2219 /usr/libexec/gsd-printer │ ├─ 2286 /usr/libexec/gnome-shell-calendar-server │ ├─ 2291 /usr/libexec/evolution-source-registry │ ├─ 2295 ibus-daemon --xim --panel disable │ ├─ 2300 /usr/libexec/ibus-dconf │ ├─ 2302 /usr/libexec/ibus-x11 --kill-daemon │ ├─ 2310 /usr/libexec/goa-daemon │ ├─ 2319 /usr/libexec/goa-identity-service │ ├─ 2322 /usr/libexec/mission-control-5 │ ├─ 2332 /usr/libexec/dconf-service │ ├─ 2343 /usr/libexec/gvfs-udisks2-volume-monitor │ ├─ 2354 /usr/libexec/gvfs-goa-volume-monitor systemd, 무엇이 바뀌었나? 28/34 (주)오뉴이노베이션 08381. 서울특별시 구로구 디지털로 273 702 호 ( 구로동 , 에이스트윈타워 2 차 ) 702, ACE Twin Tower 2Cha, 273, Digital-ro Guro-gu, Seoul, Korea 08381 Tel. 02-866-2179 Fax. 02-866-2189
  • 29. │ ├─ 2361 /usr/libexec/gvfs-mtp-volume-monitor │ ├─ 2370 /usr/libexec/gvfs-afc-volume-monitor │ ├─ 2380 /usr/libexec/gvfs-gphoto2-volume-monitor │ ├─ 2459 /usr/libexec/evolution/evolution-alarm-notify │ ├─ 2461 /usr/bin/gnome-software --gapplication-service │ ├─ 2462 abrt-applet │ ├─ 2467 /usr/bin/seapplet │ ├─ 2468 /usr/libexec/tracker-miner-fs │ ├─ 2475 nautilus -n │ ├─ 2479 /usr/libexec/tracker-miner-user-guides │ ├─ 2483 /usr/libexec/tracker-store │ ├─ 2494 /usr/libexec/tracker-extract │ ├─ 2497 /usr/libexec/tracker-miner-apps │ ├─ 2559 /usr/libexec/gconfd-2 │ ├─ 2561 /home/procyon/.dropbox-dist/dropbox-lnx.x86_64-3.12.6/dropbox │ ├─ 2570 /usr/libexec/evolution-calendar-factory │ ├─ 2572 /usr/libexec/gvfsd-trash --spawner :1.14 /org/gtk/gvfs/exec_spa... │ ├─ 2585 /usr/libexec/evolution-calendar-factory-subprocess --factory co... │ ├─ 2607 /usr/libexec/evolution-addressbook-factory │ ├─ 2610 /usr/libexec/evolution-calendar-factory-subprocess --factory lo... │ ├─ 2632 /usr/libexec/evolution-addressbook-factory-subprocess --factory... │ ├─ 2633 /usr/libexec/ibus-engine-hangul --ibus │ ├─ 2719 /usr/libexec/gvfsd-metadata │ ├─ 2933 /usr/lib64/thunderbird/thunderbird │ ├─ 2963 /usr/lib64/firefox/firefox │ ├─ 3103 /usr/libexec/gnome-terminal-server │ ├─ 3110 bash │ ├─ 3157 sudo su - │ ├─ 3161 su - │ ├─ 3164 -bash │ ├─ 3257 bash │ ├─ 3705 sudo su - │ ├─ 3921 su - │ ├─ 3924 -bash │ ├─ 3966 /usr/libexec/gvfsd-network --spawner :1.14 /org/gtk/gvfs/exec_s... │ ├─ 3988 /usr/libexec/ibus-engine-simple │ ├─ 3993 /usr/libexec/gvfsd-dnssd --spawner :1.14 /org/gtk/gvfs/exec_spa... │ ├─ 4432 /usr/bin/gnome-boxes --gapplication-service │ ├─ 4445 /usr/sbin/libvirtd --timeout=30 │ ├─ 5019 evince /run/media/procyon/476f3b1e-2ece-4640-88f2-80bd02bb35c2/... │ ├─ 5025 /usr/libexec/evinced │ ├─ 5379 /usr/lib64/libreoffice/program/oosplash --writer file:///run/me... │ ├─ 5394 /usr/lib64/libreoffice/program/soffice.bin --writer file:///run... │ ├─ 5596 /usr/libexec/bluetooth/obexd │ ├─ 5617 /usr/bin/perl /usr/bin/shutter │ ├─ 5853 /usr/lib64/firefox/plugin-container /usr/lib64/flash-plugin/lib... │ ├─ 6497 evince /run/media/procyon/476f3b1e-2ece-4640-88f2-80bd02bb35c2/... │ ├─12057 ssh -Y -l root 192.168.0.187 │ ├─13768 bash │ ├─13803 sudo su - │ ├─13811 su - │ ├─13814 -bash │ ├─15568 top │ └─17276 systemd-cgls --no-pager └─user-42.slice └─session-c1.scope ├─1142 gdm-session-worker [pam/gdm-launch-environment] ├─1152 /usr/libexec/gdm-wayland-session /usr/bin/gnome-session --autost... ├─1154 dbus-daemon --print-address 3 --session ├─1155 /usr/libexec/gnome-session-binary --autostart /usr/share/gdm/gre... ├─1164 gnome-shell --mode=gdm --wayland --display-server ├─1190 /usr/libexec/gvfsd ├─1196 /usr/bin/Xwayland :1024 -rootless -noreset -listen 4 -listen 5 -... ├─1289 /usr/libexec/at-spi-bus-launcher systemd, 무엇이 바뀌었나? 29/34 (주)오뉴이노베이션 08381. 서울특별시 구로구 디지털로 273 702 호 ( 구로동 , 에이스트윈타워 2 차 ) 702, ACE Twin Tower 2Cha, 273, Digital-ro Guro-gu, Seoul, Korea 08381 Tel. 02-866-2179 Fax. 02-866-2189
  • 30. ├─1296 /bin/dbus-daemon --config-file=/etc/at-spi2/accessibility.conf -... ├─1301 /usr/libexec/at-spi2-registryd --use-gnome-session ├─1330 /usr/bin/pulseaudio --start --log-target=syslog ├─1546 ibus-daemon --xim --panel disable ├─1563 /usr/libexec/ibus-dconf ├─1567 /usr/libexec/ibus-x11 --kill-daemon ├─1590 /usr/libexec/gnome-settings-daemon ├─1595 /usr/libexec/gvfs-udisks2-volume-monitor ├─1606 /usr/libexec/gvfs-goa-volume-monitor ├─1610 /usr/libexec/goa-daemon ├─1617 /usr/libexec/goa-identity-service ├─1619 /usr/libexec/mission-control-5 ├─1622 /usr/libexec/gvfs-mtp-volume-monitor ├─1631 /usr/libexec/gvfs-afc-volume-monitor ├─1640 /usr/libexec/gvfs-gphoto2-volume-monitor └─1680 /usr/libexec/ibus-engine-simple systemd, 무엇이 바뀌었나? 30/34 (주)오뉴이노베이션 08381. 서울특별시 구로구 디지털로 273 702 호 ( 구로동 , 에이스트윈타워 2 차 ) 702, ACE Twin Tower 2Cha, 273, Digital-ro Guro-gu, Seoul, Korea 08381 Tel. 02-866-2179 Fax. 02-866-2189
  • 31. 3. systemd Logging : journalctl 3.1. 개선 된 Logging • syslog가 시작되기를 기다릴 필요가 없음. • STDERR와 STDOUT를 더 이상 유실 되지 않음. • syslog보다 더 디데일 함 • logging도 metadata가 있음. • 디버깅과 프로파일링이 개선됨. 3.2. journalctl • RHEL7에서 rsyslog가 대체 된것이 아님. ◦ rsyslog는 디폴트로 enable됨 • journal은 기본적으로 저장(persistent) 되지 않음. ◦ persistence하기 위해서는 'mkdir /var/log/journal' • key-value 쌍으로 저장 됨. ◦ Journalctl [tab] [tab] ◦ man 7 systemd.journal-fields • 메시지와 함께 이벤트 메타데이터를 수집 • 간단한 필터 ◦ units, binaries 등을 배치 3.3. Journal의 사용 • Tail the journal : 'journalctl -f' • Show X number of lines : 'jounralctl -n 50' • View from boot : 'journalctl -b' • Filter by priority : 'journalctl -p [level]' 0 emerg 1 alert 2 crit 3 err 4 warning 5 notice 6 debug systemd, 무엇이 바뀌었나? 31/34 (주)오뉴이노베이션 08381. 서울특별시 구로구 디지털로 273 702 호 ( 구로동 , 에이스트윈타워 2 차 ) 702, ACE Twin Tower 2Cha, 273, Digital-ro Guro-gu, Seoul, Korea 08381 Tel. 02-866-2179 Fax. 02-866-2189
  • 32. 3.3.1. journalctl [root@procyon ~]# journalctl –no-pager • time stamps는 시스템 로컬 타임 존으로 변환 됨. • 모든 로그 데이터는 rotated logs가 포함된 것이 보여짐. • 기본적으로 영구 보존 되지 않음, 그러나 보존 할 수 있음. 최근의 로그를 보려면 -f 옵션을 사용 [root@procyon ~]# journalctl -f 원한다면 stdout/stderr는 systemd-cat으로 journal로 write 할 수 있다. priority로 필터하기 systemd, 무엇이 바뀌었나? 32/34 (주)오뉴이노베이션 08381. 서울특별시 구로구 디지털로 273 702 호 ( 구로동 , 에이스트윈타워 2 차 ) 702, ACE Twin Tower 2Cha, 273, Digital-ro Guro-gu, Seoul, Korea 08381 Tel. 02-866-2179 Fax. 02-866-2189
  • 33. 시간과 priority로 필터하기 [root@procyon ~]# journalctl -p err --since "2016-2-1 00:00:00" --until "2016-2-10 23:59:59" field, UID, unit 등으로 확장 필터 할 수 있음. 3.3.2. journalctl 사용하기 • 유용한 filter ◦ -r reverse order ◦ -u [unit] ◦ bynary e.g. /usr/sbin/dnsmasq [additional binaries] ◦ --since=yesterday or YYYY-MM-DD (HH:MM:SS) ◦ --until=YYYY-MM-DD • 전체 journal 보기 ◦ journalctl -o verbose (useful for grep) 유용한 사이트 systemd, 무엇이 바뀌었나? 33/34 (주)오뉴이노베이션 08381. 서울특별시 구로구 디지털로 273 702 호 ( 구로동 , 에이스트윈타워 2 차 ) 702, ACE Twin Tower 2Cha, 273, Digital-ro Guro-gu, Seoul, Korea 08381 Tel. 02-866-2179 Fax. 02-866-2189
  • 34. • How to enable persistent logging for the systemd journalctl ◦ https://access.redhat.com/solutions/696893 • System Administrator's Guide ◦ https://access.redhat.com/documentation/en- US/Red_Hat_Enterprise_Linux/7/html/System_Administrators_Guide/s1-Using_the_Journal.html • Lennart Poettering – The systemd Journalctl ◦ https://www.youtube.com/watch?v=i4CACB7paLc systemd, 무엇이 바뀌었나? 34/34 (주)오뉴이노베이션 08381. 서울특별시 구로구 디지털로 273 702 호 ( 구로동 , 에이스트윈타워 2 차 ) 702, ACE Twin Tower 2Cha, 273, Digital-ro Guro-gu, Seoul, Korea 08381 Tel. 02-866-2179 Fax. 02-866-2189