SlideShare a Scribd company logo
Enterprise Linkx 7 New Feature
RHEL , OEL , CentOS , Fedora
Suk Kim , Oracle ACE Director
Nobreak Senior managed Consultant
Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
저작권
저작권 동의 및 이용에 관하여
본 문서의 저작권은 모두 저작자에게 있습니다.
본 문서의 상업적 이용을 금합니다.
 (무단 복제, 전제, 임의 수정 및 저작권 정보 수정 등의 행위 일체 금지)
본 문서의 이용은 개인 학습용으로만 가능합니다.
• Contacts : ostoneo@gmail.com
목차
서비스 관리 및 부트 장애 처리
systemd 소개 및 개념
systemd 와 전통적인 런레벨 비교
systemd 와 전통적인 init 비교
전원 관리
서비스 관리
부팅 프로세스의 이해 (systemd vs. init)
로그 관리
리소스 관리
호스트이름 , 로케일 , 로그인 , 날짜/시간 정보 변경
부팅 트러블슈팅
systemd-analyze를 이용한 분석 및 추적
Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
발표자 소개
김석 ( nick : 김재벌 )
현) 오라클 에이스 디렉터 ( Oracle ACE Director )
현) 주식회사 노브레이크 수석컨설던트 / 대표이사
현) 안산대학교 IT응용보안과 겸임교수
현) 한양사이버대학교 해킹보안과 교수
현) 솔라리스 테크넷 운영자
현) 솔라리스 스쿨 운영자
현) 블로그 “김재벌의 IT 이야기”
Service Management AND
Boot Troubleshooting
Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
introduce to systemd
전통적인 시스템은 init 프로세스 사용
전통적인 init 은 한계에 봉착
새로운 pid 1  systemd
systemd 사용시 장점
 병렬처리를 통한 시스템의 부팅 속도 향상
 의존적인 서비스의 시작 없이 요청시 데몬 즉시 시작
 자동화된 서비스 관리
예) 네트워크 불가시 네트워크 서비스 시작
 Linux control groups을 이용한 관련 프로세스의 트랙킹
 노트
/etc/system 기반이 아닌 일부 레거시 서비스는 여전히 쉘 스크립트로 제공
/etc/sysconfig
Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
사용 가능한 systemd 유닛 종류
[root@el7 /]# systemctl -t help
Available unit types:
service
socket
target
device
mount
automount
snapshot
timer
swap
path
slice
scope
사용 가능한 유닛 목록
Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
사용 가능한 systemd 유닛 종류
유닛 종류 파일 확장자 설명
Service unit .service 시스템 서비스
Target unit .target systemd 유닛 그룹
Automount unit .automount 파일 시스템의 자동 마운트 지점
Device unit .device 커널에 의해 재인식된 장치 파일
Mount unit .mount 파일 시스템의 마운트 지점
Path unit .path 파일 시스템 내의 파일 또는 디렉토리
Scope unit .scope 외부에서 만들어진 프로세스
Slice unit .slice 시스템 프로세스 관리를 위한 계층적으로
조직화된 유닛들의 그룹
Snapshot unit .snapshot systemd 매니저의 보존 상태
Socket unit .socket 프로세스 간 통신 소켓
Swap unit .swap 스왑 장치 또는 스왑 파일
Timer unit .timer systemd 타이머
Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
systemd unit 파일 목록
모든 유닛 상태 점검
[root@el7 ~]# systemctl
서비스 유닛 상태만 확인
[root@el7 ~]# systemctl --type=service
서비스 상태가 failed , maintenance 인 유닛만 출력 ( -l : full output)
[root@el7 ~]# systemctl status avahi-daemon.service -l
Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
systemd unit 파일 목록
서비스 활성화 확인
[root@el7 ~]# systemctl is-active sshd
active
[root@el7 ~]# systemctl is-enabled sshd
enabled
모든 로드된 유닛 목록 출력 ( --all : inactive unit 도 함께 출력)
[root@el7 ~]# systemctl list-units --type=service
[root@el7 ~]# systemctl list-units --type=service –all
모든 유닛의 활성화/비활성화 상태 출력
[root@el7 ~]# systemctl list-unit-files
[root@el7 ~]# systemctl list-unit-files --type=service
실패한 서비스 확인
# systemctl --failed --type=service
Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
런레벨의 이해 및 변경
Systemd 는 기존의 init을 통한 런레벨을 더 이상 제공하지 않음
각 런레벨에 대한 설정 셋을 통해 런레벨과 동일한 환경 제공
Single User Mode ( 기존 런레벨 기준 : 1 )
[root@el7 ~]# systemctl rescue
Multi User Mode ( 기존 런레벨 기준 : 3)
[root@el7 ~]# systemctl isolate multi-user.target
[root@el7 ~]# systemctl isolate runlevel3.target
 노트
초기에 graphical.target 에서 다른 레벨로 이동하는 경우 multi-user.target 으
로 이동해도 graphical.target 으로 이동됌.
Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
런레벨의 이해 및 변경
Multi User Mode ( 기존 런레벨 기준 : 5)
[root@el7 ~]# systemctl isolate graphical.target
[root@el7 ~]# systemctl isolate runlevel5.target
기본 런레벨의 확인 및 변경
[root@el7 ~]# systemctl get-default
graphical.target
[root@el7 ~]# systemctl set-default multi-user.target
[root@el7 ~]# systemctl get-default
multi-user.target
Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
Systemd target vs. SysV Runlevels
런레벨 대상 유닛 설명
0 runlevel0.target , poweroff.target 시스템을 종료하고 전원을 끕니다.
1 runlevel1.target , rescue.target 구조 쉘을 설정합니다.
2 runlevel2.target , multi-user.target
다중 사용자 시스템을 설정합니다.
(non-graphical)
3 runlevel3.target , multi-user.target
다중 사용자 시스템을 설정합니다.
(non-graphical)
4 runlevel4.target , multi-user.target
다중 사용자 시스템을 설정합니다.
(non-graphical)
5 runlevel5.target , graphical.target 그래픽 다중 사용자 시스템을 설정합니다.
6 runlevel6.target , reboot.target 시스템을 종료하고 다시 시작합니다.
Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
Systemd vs. init command
이전 명령 새로운 명령 설명
runlevel systemctl list-units --type target 현재로드 된 대상 장치를 표시합니다.
telinit runlevel systemctl isolate name .target 현재 대상을 변경합니다.
전통적인 runlevel 과 systemd의 런레벨 확인
 노트
isolate target은 그 대상 및 그 종속에 필요한 모든 서비스를 중지하고 아직
시작되지 않은 모든 필요한 서비스를 시작.
AllowIsolate=yes 으로 설정된 경우 ( ex : graphical.target )
crtyptsetup.target 의 경우는 isolate 아님.
Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
시스템 전원 관리
시스템 power-off
[root@el7 ~]# systemctl poweroff
시스템 emergency (rescue와 유사 , root 파일시스템만 읽기 전용)
[root@el7 ~]# systemctl emergency
시스템 halt ( 종료 , 전원은 안꺼짐 )
[root@el7 ~]# systemctl halt
시스템 reboot (재부팅)
[root@el7 ~]# systemctl reboot
시스템 suspend (시스템 정지)
[root@el7 ~]# systemctl suspend
시스템 hibernate (하이버네이션 상태)
[root@el7 ~]# systemctl hibernate
Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
시스템 전원 관리 명령
이전 명령 새로운 명령 설명
halt systemctl halt 시스템 중지
poweroff systemctl poweroff 시스템 전원 끔.
reboot systemctl reboot 시스템 재시작
pm-suspend systemctl suspend 일시 중단
pm-hibernate systemctl hibernate 최대 절전 모드
pm-suspend-hybrid systemctl hybrid-sleep 정지 상태로 일시 중단
Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
시스템 서비스 목록 관리
시스템 서비스 목록
[root@el7 ~]# systemctl list-unit-files
시스템 소켓 목록
[root@el7 ~]# systemctl list-sockets
Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
시스템 서비스 목록 관리
시스템 실패 목록
[root@el7 ~]# systemctl --failed
서비스 의존성 서비스/타겟 목록 확인
[root@el7 ~]# systemctl list-dependencies swap.target
서비스 의존성 서비스/타겟 목록 확인 ( --reverse )
[root@el7 ~]# systemctl list-dependencies sshd.service –reverse
Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
서비스 관리
시스템 서비스 활성화
[root@el7 ~]# systemctl enable sshd
시스템 서비스 비활성화
[root@el7 ~]# systemctl disable sshd
시스템 서비스 시작
[root@el7 ~]# systemctl start sshd
시스템 서비스 중지
[root@el7 ~]# systemctl stop sshd
시스템 서비스 재시작
[root@el7 ~]# systemctl restart sshd
시스템 서비스 갱신
[root@el7 ~]# systemctl reload sshd
Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
서비스 관리
시스템 서비스 활성화 여부 확인 (is-enabled)
[root@el7 ~]# systemctl is-enabled sshd
시스템 서비스 활성화 여부 확인 (is-active)
[root@el7 ~]# systemctl is-active sshd
시스템 서비스 재활성화
[root@el7 ~]# systemctl reenable sshd
변경 서비스 데몬 반영
[root@el7 ~]# systemctl daemon-reload
시스템 관리자 재시작
[root@el7 ~]# systemctl daemon-reexcute
시스템 서비스 kill 시그널링
[root@el7 ~]# systemctl kill httpd
Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
서비스 관리
시스템 서비스 마스킹
[root@el7 ~]# systemctl mask network
시스템 서비스 언마스킹
[root@el7 ~]# systemctl unmask network
 노트
disable 된 서비스는 부트 때나 다른 유닛 파일 의해 자동 시작되지 않는다 .
수동 시작해야 한다.
마스크 서비스는 수동 또는 자동으로 시작할 수 없다.
서비스 충돌 방지 ( ex. network vs NetworkManager)
Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
서비스 관리
시스템 서비스 상태 확인 ( -l : 한줄 넘어가는 라인 축약 없이 출력)
[root@el7 ~]# systemctl status sshd
Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
가능한 서비스 유닛 정보
필드 설명
Loaded
서비스 유닛 로드 되어 있는지 여부.
유닛 파일의 절대 경로,
유닛이 유효한지 여부에 대한 설명.
Active 서비스 유닛이 타임 스탬프에 따라 실행 중인지 정보
Main PID 해당 시스템 서비스의 PID
Status 해당 시스템 서비스에 대한 추가 정보.
Process 관련 프로세스에 대한 추가 정보.
CGroup 관련 Control Group에 대한 추가 정보.
Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
systemctl summary vs. service utility
서비스 systemctl 설명
service name start systemctl start name .service 서비스 시작
service name stop systemctl stop name .service 서비스 중지
service name restart systemctl restart name .service 서비스 재시작
Service name condrestart systemctl try-restart name .service 서비스가 실행중인 경우에만 재시작
service name reload systemctl reload name .service 설정을 다시 로드
service name status systemctl status name .service
systemctl is-active name .service
서비스가 실행 중인지 여부 확인
service --status-all systemctl list-units --type service --all 모든 서비스의 상태 표시
chkconfig name on systemctl enable unit 부트 때 서비스 활성화
chkconfig name off systemctl disable unit 부트 때 서비스가 비활성화
systemctl mask unit 부트 때, 수동시작 모두 비활성화
systemctl unmask unit mask 서비스가 가능하도록 생성
systemctl list-dependencies unit 특정 유닛에 의해 요구되거나 , 필요한 유닛 목
록
Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
systemctl vs. chkconfig utility
chkconfig systemctl 설명
chkconfig name on systemctl enable name .service 서비스를 활성화합니다.
chkconfig name off systemctl disable name .service 서비스를 비활성화합니다.
chkconfig --list name
systemctl status name .service
systemctl is-enabled name .servi
ce
서비스가 활성화되어 있는지 여
부를 확인합니다.
chkconfig --list
systemctl list-unit-files --type ser
vice
서비스를 나열하고 그들이 사용
할 수 있는지 여부를 확인합니다.
Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
Systemd 유닛 위치
디렉토리 설명
/usr/lib/systemd/system/ RPM 패키지로 배포된 systemd 유닛
/run/systemd/system/
systemd 유닛은 런타임에 생성되며,
이 디렉토리는 설치된 서비스 유닛의 디렉토리에 우선함.
/etc/systemd/system/
시스템 관리자가 만들고 관리하는 systemd unit.
이 디렉토리는 런타임 unit의 디렉토리에 우선함.
Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
부팅 프로세스 ( System V Boot Process )
BIOS/UEFI
GRUB/LILO
KERNEL
init
Read inittab
rc.sysint
Run level 1
Run level 2
Run level 3
Run level 4
Run level 5
Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
symlink
symlink
부팅 프로세스 ( Systemd Boot Process )
BIOS/UEFI
GRUB/LILO
KERNEL
systemd
Default target
rescue target
unit
sysinit target
unit
basic target
unit
multi-user target
unit
Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
부팅 프로세스
① UEFI or BIOS
② MBR or UEFI boot firmware
③ System firmware reads -> boot loader ( grub2 )
#grub2-install
④ /etc/grub.d/ , /etc/default/grub , /boot/grub2/grub.cfg 로드
⑤ initramfs 와 구성된 kernel 메모리 적재
#/etc/dracut.conf
⑥ 부트로더는 메모리 내의 initramfs 의 위치 , 부트로더 내의 커널
명령을 지정하여 시스템을 제어
/etc/grub.d/ , /etc/default/grub , /boot/grub2/grub.cfg
dracut은 initramfs 생성을 위한 low-level 도구
#man dracut
Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
부팅 프로세스
⑦ 커널 초기화 (initramfs 내의 하드웨어 드라이버 이용)
PID 1 인 /sbin/init 을 구동 ( RHEL 7 기반에서는 udev daemon
과 마찬가지로 /sbin/init 대신 systemd 구동)
⑧ initramfs 내의 systemd 인스턴스는 initrd.target 을 위해서 모든
유닛을 실행 , /sysroot 상의 root file system을 실제 마운트
⑨ 커널 루트 파일시스템은 이전 /sysroot에 마운트 된 시스템 루프
파일 시스템을 다시 initramfs 루트 파일시스템으로 전환
systemd의 복사본을 사용해서 systemd 자신을 다시 실행
⑩ systemd -> default target 을 검색 , 커널 명령이나 구성된 시스
템에 구성에 따라 시작/정지 ( 유닛 사이의 의존성 문제 해결 )
그래픽 또는 텍스트 기반으로 시스템 상태 진행
/etc/system/system/default/target, /etc/system/system
Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
로그 관리
Systemd 는 단순한 init 대체가 아닌 시스템 전반적인 관리자
로그관리를 위해 systemd-journal 사용
Journalctl
로그 관리 명령어
Syslog 를 대체하거나 병렬처리 가능
구조화, 인덱스화 , 검색시간 단축
[root@el7 ~]# journalctl
-- Logs begin at 토 2015-02-14 01:33:52 KST, end at 일 2015-02-15 01:20:01 KST. --
2월 14 01:33:52 localhost systemd-journal[62]: Runtime journal is using 8.0M (max 184.5M, leaving 276.7M of free 1.7G, curre
2월 14 01:33:52 localhost systemd-journal[62]: Runtime journal is using 8.0M (max 184.5M, leaving 276.7M of free 1.7G, curre
2월 14 01:33:52 localhost kernel: Initializing cgroup subsys cpuset
2월 14 01:33:52 localhost kernel: Initializing cgroup subsys cpu
2월 14 01:33:52 localhost kernel: Linux version 3.8.13-35.3.1.el7uek.x86_64 (mockbuild@ca-build56.us.oracle.com) (gcc versio
2월 14 01:33:52 localhost kernel: e820: BIOS-provided physical RAM map:
2월 14 01:33:52 localhost kernel: BIOS-e820: [mem 0x0000000000000000-0x000000000009efff] usable
2월 14 01:33:52 localhost kernel: BIOS-e820: [mem 0x000000000009f000-0x000000000009ffff] reserved
2월 14 01:33:54 localhost kernel: sd 2:0:0:0: [sda] Assuming drive cache: write through
2월 14 01:33:54 localhost kernel: sd 2:0:0:0: [sda] Cache data unavailable
2월 14 01:33:54 localhost kernel: sd 2:0:0:0: [sda] Assuming drive cache: write through
Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
로그 관리
Journalctl
항목의 우선순위가 시각적으로 표기
 오류 순위와 그 보다 높은 행은 red color 적용
 주의 및 경고의 우선순위에 bold 적용
타임스탬프  시스템의 로컬시간대로 변환
순환된 로그를 포함하여 기록된 모든 데이터 표시
부팅 시작시 특별한 라인으로 태깅
기본적으로 root 가 아닌 사용자는 자신의 로그만 확인 가능
 특정 사용자가 모든 로그에 접근하려면 adm 그룹의 멤버여야 함.
 노트
접근제어는 Journal의 Persitent storage가 활성화된 경우만 사용 가능
Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
로그 관리
로그 개수 지정 ( -n : 라인 수 )
[root@el7 ~]# journalctl –n 10
상세 로그
[root@el7 ~]# journalctl –o verbose
로그 Liveview
[root@el7 ~]# journalctl –f
우선순위 필터링 (-p : 우선순위 : debug~emerg)
[root@el7 ~]# journalctl –p err
 노트
각 필드에 대한 설명은 system.journal-fields(7) 매뉴얼 페이지 참고
Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
로그 관리
시간 필터링 (-b : 부팅 이후 현재 로그 )
[root@el7 ~]# journalctl -b
시간 필터링 (--since , --until : 기간 조회 )
[root@el7 ~]# journalctl --since=2015-01-01 --until=2015-01-31
시간과 우선순위 조합 필터링
[root@el7 ~]# journalctl -p warning --since = "2013-3-16 23:59:59"
우선순위 필터링 (-p : 우선순위 : debug~emerg)
[root@el7 ~]# journalctl –p err
 노트
각 필드에 대한 설명은 system.journal-fields(7) 매뉴얼 페이지 참고
Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
로그 관리
특정 바이너리 이벤트 (실행 가능 특정 바이너리에 대한 이벤트)
[root@el7 ~]# journalctl /sbin/sshd
메타 데이터 필드별 필터링 (Logical AND 연산)
[root@el7 ~]# journalctl -F 필드명 -F 필드명
메타 데이터 필드별 필터링 (Logical OR 연산)
[root@el7 ~]# journalctl -F 필드명=값 + 필드명=값
고급 필터링 예제)
[root@el7 ~]# journalctl _UID = 70 _SYSTEMD_UNIT = avahi-
daemon.service _SYSTEMD_UNIT = crond.service
Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
로그 관리
Persistent Storage 활성화
로그 파일을 메모리 또는 /run/log/journal 디렉토리내 작은 링
버퍼에 저장
/run/log/journal은 휘발성이며 , 영구저장 하지 않음
 최근 로그기록 확인용으로 적합
영구적으로 로그를 기록하면 /var/log/journal에 저장되고 재부
팅 이후에도 유지
Persistent Storage 사용시 장점 / 단점
장점 :
장기적으로 문제 해결을 할 수 있는 로그를 기록, 보관
서버 콘솔 로그 파일이 아니라 journal 이용
단점:
더 많은 디스크 공간 필요
저장되는 데이터 량은 여유 메모리 양에 의존 , 특정 기간에 대한 보증은 불가
 노트
Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
로그 관리
Persistent 활성화 ( 로그 디렉토리 생성
[root@el7 ~]# mkdir -p /var/log/journal
서비스 재시작
[root@el7 ~]# systemctl restart system-jounald
[root@el7 ~]# mkdir -p -m 2775 /var/log/journal
[root@el7 ~]# chown :systemd-journal /var/log/journal/
[root@el7 ~]# killall -USR1 systemd-journald
 노트
Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
GUI 도구 활용
#설치 안되어 있는 경우 yum -y install gnome-system-log 명령으로 설치 후 실행
해당 명령은 반드시 root 권한으로 실행
Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
GUI 도구 활용 - 필터링
Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
Systemd Cgroup 관리
Systemd 를 이용하여 Cgroup ( Control Group ) 관리 가능
Cgroup 정보 출력
[root@el7 ~]# system-cgls
Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
Systemd Cgroup 관리
Systemd 를 이용하여 Cgroup ( Control Group ) 관리 가능
Cgroup에 대하여 top 명령 결과로 출력
[root@el7 ~]# system-cgtop
Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
리소스 관리
Systemctl 명령을 이용하여 리소스 제어 가능
http.service CPUShare 가중치 512 으로 설정
[root@el7 ~]# systemctl set-property sshd.service CPUShares=512
http.service 프로퍼티 확인
[root@el7 ~]# systemctl show httpd.service CPUShares
[root@el7 ~]# systemctl show sshd.service | grep CPU
CPUShares=1024
[root@el7 ~]# systemctl set-property sshd.service CPUShares=512
[root@el7 ~]# systemctl show sshd.service | grep CPU
CPUShares=512
[root@el7 ~]# cat /sys/fs/cgroup/cpu/system.slice/sshd.service/cpu.shares
512
[root@el7 ~]# man systemd.resource-control
Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
Systemd 를 이용한 기타 설정(호스트/로케일)
호스트명 확인
[root@el7 ~]# hostnamectl
호스트명 변경
[root@el7 ~]# hostnamectl set-hostname newlinux
로케일 확인
[root@el7 ~]# localectl
로케일 변경
[root@el7 ~]# localectl set-locale LANG=ko_KR.UTF-8
localectl 서브 명령어를 통해 제어
list-keymaps set-keymap set-x11-keymap list-locales set-locale status
 노트
Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
Systemd 를 이용한 기타 설정(로그인)
사용자 관리 (systemd 로그인 관리 )
[root@el7 ~]# loginctl
loginctl 서브 명령어를 통해 제어
 노트
사용자 관리 목록
[root@el7 ~]# loginctl list-users
terminate-user
unlock-session
user-status
activate
attach
disable-linger
enable-linger
flush-devices
kill-session
kill-user
list-seats
list-sessions
list-users
lock-session
seat-status
session-status
show-seat
show-session
show-user
terminate-seat
terminate-session
Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
Systemd 를 이용한 기타 설정 (시간)
시스템 시간에 대한 이해
실시간시간(RTC)
 현지시간 또는 협정세계시(UTC)
 UTC 사용시 혼잡시간에 시간차 적용되어 계산
 서머타임(DST) 적용
 대부분의 경우 UTC 권장
시스템클럭
 소프트웨어 클럭
 초기값은 실시간 클럭 기반이나 , 초기화 이후 독립적인 시간
Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
Systemd 를 이용한 기타 설정(시간)
시간 날짜 확인
[root@el7 ~]# timedatectl
날짜 설정
[root@el7 ~]# timedatectl set-time 2015-02-15
시간 설정 ( HH:MM:SS 형식)
[root@el7 ~]# timedatectl set-time 12:30:00
현지 시간으로 시계 유지 하도록 설정 ( RTC 활성화 : true(1) , false(0) )
[root@el7 ~]# localectl set-local-rtc true
타임존 확인
[root@el7 ~]# localectl list-timezone
현지 시간으로 시계 유지 하도록 설정 ( RTC 활성화 : true(1) , false(0) )
[root@el7 ~]# localectl set-timezone Asia/Seoul
Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
Systemd 를 이용한 기타 설정(원격 관리)
원격서버 정보 설정 변경
[root@el7 ~]#hostnamectl -H root@test.linux.com set-hostname newlinux
원격서버 정보 조회
[root@el7 ~]# hostnamectl -H root@test.linux.com
Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
트러블슈팅
boot taget 의 선택 (rescue.target 부팅 시)
1. 방향키를 이용하여 선택 후
e 를 누름.
2. linux16 으로 시작하는
줄을 찾아 해당 줄의 끝으로
이동
3. systemd.unit=rescue.target
을 추가
4. ctrl + x
Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
트러블슈팅
root password 복구
1. 방향키를 이용하여 선택 후
e 를 누름.
2. linux16 으로 시작하는
줄을 찾아 해당 줄의 끝으로
이동
3. rd.break 를 추가
4. ctrl + x
5. # mount -o remount,rw /sysroot
6. # chroot /sysroot
7. # passwd root
8. # touch /.autorelabel
Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
트러블슈팅
debug shell 의 활용
서비스 활성 후 재부팅 후 crtl + alt + F9 를 이용
Debug Shell 활성화
[root@el7 ~]# systemctl enable debug-shell.service
ln -s '/usr/lib/systemd/system/debug-shell.service'
'/etc/systemd/system/sysinit.target.wants/debug-shell.service'
 노트
debug shell 은 인증 없이 로컬에서 root 사용자로 접근이 가능하므로 일시적
으로 사용 후 반드시 비활성화 하여야 함.
Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
Systemd 분석 및 추적
systemd-analyze
시스템과 부팅 성능 통계와 상태 결정
시스템과 서비스 관리자로 부터 정보 추적
옵션 없이 사용시 time 이 암시적으로 적용
system-analyze time
사용자 영역에 도달하기 전에 커널에서 소요된 시간
일반 시스템에서는 사용자 영역에 도달 하기전에 초기
RAM(initrd)디스크에서 소요
(일반적인 시스템에서는 이를 사용자 영역 초기화라고 명명)
지점까지의 모든 시스템 서비스가 만들어진(spawned) 경우 측
정치는 단순히 통과된 지점까지 전달된 시간을 측정
이것이 디스크가 유휴하거나, 초기화가 완전 히 끝날때까지 필
요한 것은 아님.
Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
Systemd 분석 및 추적
systemd-analyze time
systemd-analyze time
[root@el7 ~]# systemd-analyze
Startup finished in 1.502s (kernel) + 3.274s (initrd) + 26.716s (userspace) =
31.493s
Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
Systemd 분석 및 추적
systemd-analyze blame
초기화 하는데 걸리는 시간에 따라 구동중인 모든 유닛의 목록
을 정렬해서 출력
이 정보는 부팅 시간을 최적화 하는데 사용될 수 있음.
다른 서비스가 완료될 때 까지 다른 서비스의 초기화를 기다리
고 있기 때문에 하나의 서비스는 느리게 보일 수도 있으며 , 출
력정보를 잘못 이해 하는 경우도 있다는 점에서 유의.
systemd-analyze blame
[root@el7 ~]# systemd-analyze blame
12.945s kdump.service
4.579s firewalld.service
3.748s network.service
2.920s tuned.service
2.829s postfix.service
1.957s iprupdate.service
Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
Systemd 분석 및 추적
systemd-analyze critical-chain
시간이 많이 소요된 서비스에 대한 실행과 대기에 대하여 체인
형태로 출력
유닛이 활성화 또는 시작된 후 시간은 @ 문자로 , 유닛이 시작
하는데 걸린 시간은 "+" 문자로 유닛들의 실행은 병렬적으로
실행되기 때문에 하나의 서비스 초기화에는 소켓 활성화에 의
존하는 경우가 있으므로 출력을 오해 할 수 있음.
systemd-analyze critical-chain
[[root@el7 ~]# systemd-analyze critical-chain
multi-user.target @26.690s
└─kdump.service @13.744s +12.945s
└─network.target @13.710s
└─network.service @9.960s +3.748s
└─NetworkManager.service @8.652s +1.303s
Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
Systemd 분석 및 추적
systemd-analyze plot
시스템 서비스 정보를 상세하게 SVG 그래픽으로 출력.
서비스 시작 시간을 강조 하고 , 초기화에 소요된 시간을 하이
라이팅.
systemd-analyze plot
[[root@el7 ~]# systemd-analyze plot > analyze.svg
Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
Systemd 분석 및 추적
systemd-analyze dot
GraphViz dot 도구를 이용하여 텍스트기반 그래프 출력
필요시 GraphViz 설치 ( #yum -y install GraphViz )
저장된 파일을 열기 위해 필요시 eyes of gnome 설치
(#yum -y install eog)
systemd-analyze dot
[[root@el7 ~]# systemd-analyze dot 'avahi-daemon.*' | dot -Tsvg >
avahi.svg
Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
Systemd 분석 및 추적
Color legend: black = Requires
dark blue = Requisite
dark grey = Wants
red = Conflicts
green = After
systemd-analyze dot 를 이용하여 avahi-daemon에 의존하는 모
든 서비스를 추적 및 시각화
Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED
Systemd 분석 및 추적
systemd-analyze dot
[[root@el7 ~]# systemd-analyze dot --to-pattern='*.target' --from-
pattern='*.target' | dot -Tsvg > targets.svg
systemd-analyze dot 를 이용하여 target unit 에 의존하는 모든
서비스를 추적 및 시각화

More Related Content

What's hot

Linux Performan tuning Part I
Linux Performan tuning Part ILinux Performan tuning Part I
Linux Performan tuning Part I
sprdd
 
Zinst 패키지 기반의-리눅스_중앙관리시스템_20140415
Zinst 패키지 기반의-리눅스_중앙관리시스템_20140415Zinst 패키지 기반의-리눅스_중앙관리시스템_20140415
Zinst 패키지 기반의-리눅스_중앙관리시스템_20140415
sprdd
 
오픈소스컨설팅 클러스터제안 V1.0
오픈소스컨설팅 클러스터제안 V1.0오픈소스컨설팅 클러스터제안 V1.0
오픈소스컨설팅 클러스터제안 V1.0
sprdd
 

What's hot (20)

Apache Tomcat ( 아파치 톰캣 ) 설치 가이드
Apache Tomcat ( 아파치 톰캣 ) 설치 가이드Apache Tomcat ( 아파치 톰캣 ) 설치 가이드
Apache Tomcat ( 아파치 톰캣 ) 설치 가이드
 
Linux Performan tuning Part I
Linux Performan tuning Part ILinux Performan tuning Part I
Linux Performan tuning Part I
 
[오픈소스컨설팅] Open stack kilo with DVR_CEPH_v1.1
[오픈소스컨설팅] Open stack kilo with DVR_CEPH_v1.1[오픈소스컨설팅] Open stack kilo with DVR_CEPH_v1.1
[오픈소스컨설팅] Open stack kilo with DVR_CEPH_v1.1
 
[오픈소스컨설팅]Zabbix Installation and Configuration Guide
[오픈소스컨설팅]Zabbix Installation and Configuration Guide[오픈소스컨설팅]Zabbix Installation and Configuration Guide
[오픈소스컨설팅]Zabbix Installation and Configuration Guide
 
[오픈소스컨설팅] Red Hat ReaR (relax and-recover) Quick Guide
[오픈소스컨설팅] Red Hat ReaR (relax and-recover) Quick Guide[오픈소스컨설팅] Red Hat ReaR (relax and-recover) Quick Guide
[오픈소스컨설팅] Red Hat ReaR (relax and-recover) Quick Guide
 
Scouter와 influx db – grafana 연동 가이드
Scouter와 influx db – grafana 연동 가이드Scouter와 influx db – grafana 연동 가이드
Scouter와 influx db – grafana 연동 가이드
 
[오픈소스컨설팅]Nginx 1.2.7 설치가이드__v1
[오픈소스컨설팅]Nginx 1.2.7 설치가이드__v1[오픈소스컨설팅]Nginx 1.2.7 설치가이드__v1
[오픈소스컨설팅]Nginx 1.2.7 설치가이드__v1
 
[오픈소스컨설팅]Docker on Cloud(Digital Ocean)
[오픈소스컨설팅]Docker on Cloud(Digital Ocean)[오픈소스컨설팅]Docker on Cloud(Digital Ocean)
[오픈소스컨설팅]Docker on Cloud(Digital Ocean)
 
Apache httpd ( 아파치 웹서버 ) 설치 가이드
Apache httpd ( 아파치 웹서버 ) 설치 가이드Apache httpd ( 아파치 웹서버 ) 설치 가이드
Apache httpd ( 아파치 웹서버 ) 설치 가이드
 
[오픈소스컨설팅] RPM 만들기
[오픈소스컨설팅] RPM 만들기[오픈소스컨설팅] RPM 만들기
[오픈소스컨설팅] RPM 만들기
 
[오픈소스컨설팅]Nginx jboss 연동가이드__v1
[오픈소스컨설팅]Nginx jboss 연동가이드__v1[오픈소스컨설팅]Nginx jboss 연동가이드__v1
[오픈소스컨설팅]Nginx jboss 연동가이드__v1
 
Zinst 패키지 기반의-리눅스_중앙관리시스템_20140415
Zinst 패키지 기반의-리눅스_중앙관리시스템_20140415Zinst 패키지 기반의-리눅스_중앙관리시스템_20140415
Zinst 패키지 기반의-리눅스_중앙관리시스템_20140415
 
오픈소스컨설팅 클러스터제안 V1.0
오픈소스컨설팅 클러스터제안 V1.0오픈소스컨설팅 클러스터제안 V1.0
오픈소스컨설팅 클러스터제안 V1.0
 
텔레그램을 이용한 양방향 모니터링 시스템 구축
텔레그램을 이용한 양방향 모니터링 시스템 구축텔레그램을 이용한 양방향 모니터링 시스템 구축
텔레그램을 이용한 양방향 모니터링 시스템 구축
 
김성윤 - 우분투로 슈퍼컴 만들기 (2011Y03M26D)
김성윤 - 우분투로 슈퍼컴 만들기 (2011Y03M26D)김성윤 - 우분투로 슈퍼컴 만들기 (2011Y03M26D)
김성윤 - 우분투로 슈퍼컴 만들기 (2011Y03M26D)
 
Hyperledger fabric practice(pdf)
Hyperledger fabric practice(pdf)Hyperledger fabric practice(pdf)
Hyperledger fabric practice(pdf)
 
Osc4.x installation v1-upload
Osc4.x installation v1-uploadOsc4.x installation v1-upload
Osc4.x installation v1-upload
 
Solaris11 기초 자료
Solaris11 기초 자료Solaris11 기초 자료
Solaris11 기초 자료
 
Solaris messages v0.2
Solaris messages v0.2Solaris messages v0.2
Solaris messages v0.2
 
리눅스서버세팅-김태호
리눅스서버세팅-김태호리눅스서버세팅-김태호
리눅스서버세팅-김태호
 

Similar to Enterprise Linux 7 new feature_systemd_booting

[231]나는서버를썰터이니너는개발만하여라 양지욱
[231]나는서버를썰터이니너는개발만하여라 양지욱[231]나는서버를썰터이니너는개발만하여라 양지욱
[231]나는서버를썰터이니너는개발만하여라 양지욱
NAVER D2
 

Similar to Enterprise Linux 7 new feature_systemd_booting (20)

Systemd
SystemdSystemd
Systemd
 
03.Ansible 소개
03.Ansible 소개03.Ansible 소개
03.Ansible 소개
 
Systemd explained
Systemd explainedSystemd explained
Systemd explained
 
Gpdb best practices v a01 20150313
Gpdb best practices v a01 20150313Gpdb best practices v a01 20150313
Gpdb best practices v a01 20150313
 
[Ansible] Solution Guide V0.4_20181204.pdf
[Ansible] Solution Guide V0.4_20181204.pdf[Ansible] Solution Guide V0.4_20181204.pdf
[Ansible] Solution Guide V0.4_20181204.pdf
 
엘라스틱서치 클러스터로 수십억 건의 데이터 운영하기
엘라스틱서치 클러스터로 수십억 건의 데이터 운영하기엘라스틱서치 클러스터로 수십억 건의 데이터 운영하기
엘라스틱서치 클러스터로 수십억 건의 데이터 운영하기
 
Oracle database 12 c on oracle linux 7.3
Oracle database 12 c on oracle linux 7.3Oracle database 12 c on oracle linux 7.3
Oracle database 12 c on oracle linux 7.3
 
02.실전! 시스템 관리자를 위한 Ansible
02.실전! 시스템 관리자를 위한 Ansible02.실전! 시스템 관리자를 위한 Ansible
02.실전! 시스템 관리자를 위한 Ansible
 
[오픈소스컨설팅]Fault Tolerance Architecture by Netflix
[오픈소스컨설팅]Fault Tolerance Architecture by Netflix[오픈소스컨설팅]Fault Tolerance Architecture by Netflix
[오픈소스컨설팅]Fault Tolerance Architecture by Netflix
 
박진호 - 우분투 부팅 과정에 대한 이야기 (2012Y07M28D)
박진호 - 우분투 부팅 과정에 대한 이야기 (2012Y07M28D)박진호 - 우분투 부팅 과정에 대한 이야기 (2012Y07M28D)
박진호 - 우분투 부팅 과정에 대한 이야기 (2012Y07M28D)
 
#2.SQL초보에서 Schema Objects까지_재직자/근로자환급/국비지원교육/IT실무교육/SQL기초교육/구로IT학원추천
#2.SQL초보에서 Schema Objects까지_재직자/근로자환급/국비지원교육/IT실무교육/SQL기초교육/구로IT학원추천#2.SQL초보에서 Schema Objects까지_재직자/근로자환급/국비지원교육/IT실무교육/SQL기초교육/구로IT학원추천
#2.SQL초보에서 Schema Objects까지_재직자/근로자환급/국비지원교육/IT실무교육/SQL기초교육/구로IT학원추천
 
오픈스택: 구석구석 파헤쳐보기
오픈스택: 구석구석 파헤쳐보기오픈스택: 구석구석 파헤쳐보기
오픈스택: 구석구석 파헤쳐보기
 
Exadata troubleshooting
Exadata troubleshootingExadata troubleshooting
Exadata troubleshooting
 
Confd, systemd, fleet을 이용한 어플리케이션 배포 in CoreOS
Confd, systemd, fleet을 이용한 어플리케이션 배포 in CoreOSConfd, systemd, fleet을 이용한 어플리케이션 배포 in CoreOS
Confd, systemd, fleet을 이용한 어플리케이션 배포 in CoreOS
 
Kafka slideshare
Kafka   slideshareKafka   slideshare
Kafka slideshare
 
[231]나는서버를썰터이니너는개발만하여라 양지욱
[231]나는서버를썰터이니너는개발만하여라 양지욱[231]나는서버를썰터이니너는개발만하여라 양지욱
[231]나는서버를썰터이니너는개발만하여라 양지욱
 
Free rtos seminar
Free rtos seminarFree rtos seminar
Free rtos seminar
 
제 9회 엑셈 수요 세미나 자료 연구컨텐츠팀
제 9회 엑셈 수요 세미나 자료 연구컨텐츠팀제 9회 엑셈 수요 세미나 자료 연구컨텐츠팀
제 9회 엑셈 수요 세미나 자료 연구컨텐츠팀
 
[오픈소스컨설팅] SELinux : Stop Disabling SELinux
[오픈소스컨설팅] SELinux : Stop Disabling SELinux[오픈소스컨설팅] SELinux : Stop Disabling SELinux
[오픈소스컨설팅] SELinux : Stop Disabling SELinux
 
Ansible - Introduction
Ansible - IntroductionAnsible - Introduction
Ansible - Introduction
 

More from suk kim (7)

cloud security-suk kim-2022-10-14-Busan.pdf
cloud security-suk kim-2022-10-14-Busan.pdfcloud security-suk kim-2022-10-14-Busan.pdf
cloud security-suk kim-2022-10-14-Busan.pdf
 
cloud security trend and case
cloud security trend and casecloud security trend and case
cloud security trend and case
 
Oracle linux8 solaris_new_features-suk kim
Oracle linux8 solaris_new_features-suk kimOracle linux8 solaris_new_features-suk kim
Oracle linux8 solaris_new_features-suk kim
 
Cloud security suk kim
Cloud security suk kimCloud security suk kim
Cloud security suk kim
 
How to Oracle Ravello Cloud 200% utilize and use case
How to Oracle Ravello Cloud 200% utilize and use case How to Oracle Ravello Cloud 200% utilize and use case
How to Oracle Ravello Cloud 200% utilize and use case
 
Oracle Developer Cloud for Developer 101
Oracle Developer Cloud for Developer 101Oracle Developer Cloud for Developer 101
Oracle Developer Cloud for Developer 101
 
Oracle solaris comstar introduce and configuration ppt sukkim
Oracle solaris comstar introduce and configuration ppt sukkimOracle solaris comstar introduce and configuration ppt sukkim
Oracle solaris comstar introduce and configuration ppt sukkim
 

Enterprise Linux 7 new feature_systemd_booting

  • 1. Enterprise Linkx 7 New Feature RHEL , OEL , CentOS , Fedora Suk Kim , Oracle ACE Director Nobreak Senior managed Consultant
  • 2. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED 저작권 저작권 동의 및 이용에 관하여 본 문서의 저작권은 모두 저작자에게 있습니다. 본 문서의 상업적 이용을 금합니다.  (무단 복제, 전제, 임의 수정 및 저작권 정보 수정 등의 행위 일체 금지) 본 문서의 이용은 개인 학습용으로만 가능합니다. • Contacts : ostoneo@gmail.com
  • 3. 목차 서비스 관리 및 부트 장애 처리 systemd 소개 및 개념 systemd 와 전통적인 런레벨 비교 systemd 와 전통적인 init 비교 전원 관리 서비스 관리 부팅 프로세스의 이해 (systemd vs. init) 로그 관리 리소스 관리 호스트이름 , 로케일 , 로그인 , 날짜/시간 정보 변경 부팅 트러블슈팅 systemd-analyze를 이용한 분석 및 추적
  • 4. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED 발표자 소개 김석 ( nick : 김재벌 ) 현) 오라클 에이스 디렉터 ( Oracle ACE Director ) 현) 주식회사 노브레이크 수석컨설던트 / 대표이사 현) 안산대학교 IT응용보안과 겸임교수 현) 한양사이버대학교 해킹보안과 교수 현) 솔라리스 테크넷 운영자 현) 솔라리스 스쿨 운영자 현) 블로그 “김재벌의 IT 이야기”
  • 5. Service Management AND Boot Troubleshooting
  • 6. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED introduce to systemd 전통적인 시스템은 init 프로세스 사용 전통적인 init 은 한계에 봉착 새로운 pid 1  systemd systemd 사용시 장점  병렬처리를 통한 시스템의 부팅 속도 향상  의존적인 서비스의 시작 없이 요청시 데몬 즉시 시작  자동화된 서비스 관리 예) 네트워크 불가시 네트워크 서비스 시작  Linux control groups을 이용한 관련 프로세스의 트랙킹  노트 /etc/system 기반이 아닌 일부 레거시 서비스는 여전히 쉘 스크립트로 제공 /etc/sysconfig
  • 7. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED 사용 가능한 systemd 유닛 종류 [root@el7 /]# systemctl -t help Available unit types: service socket target device mount automount snapshot timer swap path slice scope 사용 가능한 유닛 목록
  • 8. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED 사용 가능한 systemd 유닛 종류 유닛 종류 파일 확장자 설명 Service unit .service 시스템 서비스 Target unit .target systemd 유닛 그룹 Automount unit .automount 파일 시스템의 자동 마운트 지점 Device unit .device 커널에 의해 재인식된 장치 파일 Mount unit .mount 파일 시스템의 마운트 지점 Path unit .path 파일 시스템 내의 파일 또는 디렉토리 Scope unit .scope 외부에서 만들어진 프로세스 Slice unit .slice 시스템 프로세스 관리를 위한 계층적으로 조직화된 유닛들의 그룹 Snapshot unit .snapshot systemd 매니저의 보존 상태 Socket unit .socket 프로세스 간 통신 소켓 Swap unit .swap 스왑 장치 또는 스왑 파일 Timer unit .timer systemd 타이머
  • 9. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED systemd unit 파일 목록 모든 유닛 상태 점검 [root@el7 ~]# systemctl 서비스 유닛 상태만 확인 [root@el7 ~]# systemctl --type=service 서비스 상태가 failed , maintenance 인 유닛만 출력 ( -l : full output) [root@el7 ~]# systemctl status avahi-daemon.service -l
  • 10. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED systemd unit 파일 목록 서비스 활성화 확인 [root@el7 ~]# systemctl is-active sshd active [root@el7 ~]# systemctl is-enabled sshd enabled 모든 로드된 유닛 목록 출력 ( --all : inactive unit 도 함께 출력) [root@el7 ~]# systemctl list-units --type=service [root@el7 ~]# systemctl list-units --type=service –all 모든 유닛의 활성화/비활성화 상태 출력 [root@el7 ~]# systemctl list-unit-files [root@el7 ~]# systemctl list-unit-files --type=service 실패한 서비스 확인 # systemctl --failed --type=service
  • 11. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED 런레벨의 이해 및 변경 Systemd 는 기존의 init을 통한 런레벨을 더 이상 제공하지 않음 각 런레벨에 대한 설정 셋을 통해 런레벨과 동일한 환경 제공 Single User Mode ( 기존 런레벨 기준 : 1 ) [root@el7 ~]# systemctl rescue Multi User Mode ( 기존 런레벨 기준 : 3) [root@el7 ~]# systemctl isolate multi-user.target [root@el7 ~]# systemctl isolate runlevel3.target  노트 초기에 graphical.target 에서 다른 레벨로 이동하는 경우 multi-user.target 으 로 이동해도 graphical.target 으로 이동됌.
  • 12. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED 런레벨의 이해 및 변경 Multi User Mode ( 기존 런레벨 기준 : 5) [root@el7 ~]# systemctl isolate graphical.target [root@el7 ~]# systemctl isolate runlevel5.target 기본 런레벨의 확인 및 변경 [root@el7 ~]# systemctl get-default graphical.target [root@el7 ~]# systemctl set-default multi-user.target [root@el7 ~]# systemctl get-default multi-user.target
  • 13. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED Systemd target vs. SysV Runlevels 런레벨 대상 유닛 설명 0 runlevel0.target , poweroff.target 시스템을 종료하고 전원을 끕니다. 1 runlevel1.target , rescue.target 구조 쉘을 설정합니다. 2 runlevel2.target , multi-user.target 다중 사용자 시스템을 설정합니다. (non-graphical) 3 runlevel3.target , multi-user.target 다중 사용자 시스템을 설정합니다. (non-graphical) 4 runlevel4.target , multi-user.target 다중 사용자 시스템을 설정합니다. (non-graphical) 5 runlevel5.target , graphical.target 그래픽 다중 사용자 시스템을 설정합니다. 6 runlevel6.target , reboot.target 시스템을 종료하고 다시 시작합니다.
  • 14. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED Systemd vs. init command 이전 명령 새로운 명령 설명 runlevel systemctl list-units --type target 현재로드 된 대상 장치를 표시합니다. telinit runlevel systemctl isolate name .target 현재 대상을 변경합니다. 전통적인 runlevel 과 systemd의 런레벨 확인  노트 isolate target은 그 대상 및 그 종속에 필요한 모든 서비스를 중지하고 아직 시작되지 않은 모든 필요한 서비스를 시작. AllowIsolate=yes 으로 설정된 경우 ( ex : graphical.target ) crtyptsetup.target 의 경우는 isolate 아님.
  • 15. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED 시스템 전원 관리 시스템 power-off [root@el7 ~]# systemctl poweroff 시스템 emergency (rescue와 유사 , root 파일시스템만 읽기 전용) [root@el7 ~]# systemctl emergency 시스템 halt ( 종료 , 전원은 안꺼짐 ) [root@el7 ~]# systemctl halt 시스템 reboot (재부팅) [root@el7 ~]# systemctl reboot 시스템 suspend (시스템 정지) [root@el7 ~]# systemctl suspend 시스템 hibernate (하이버네이션 상태) [root@el7 ~]# systemctl hibernate
  • 16. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED 시스템 전원 관리 명령 이전 명령 새로운 명령 설명 halt systemctl halt 시스템 중지 poweroff systemctl poweroff 시스템 전원 끔. reboot systemctl reboot 시스템 재시작 pm-suspend systemctl suspend 일시 중단 pm-hibernate systemctl hibernate 최대 절전 모드 pm-suspend-hybrid systemctl hybrid-sleep 정지 상태로 일시 중단
  • 17. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED 시스템 서비스 목록 관리 시스템 서비스 목록 [root@el7 ~]# systemctl list-unit-files 시스템 소켓 목록 [root@el7 ~]# systemctl list-sockets
  • 18. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED 시스템 서비스 목록 관리 시스템 실패 목록 [root@el7 ~]# systemctl --failed 서비스 의존성 서비스/타겟 목록 확인 [root@el7 ~]# systemctl list-dependencies swap.target 서비스 의존성 서비스/타겟 목록 확인 ( --reverse ) [root@el7 ~]# systemctl list-dependencies sshd.service –reverse
  • 19. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED 서비스 관리 시스템 서비스 활성화 [root@el7 ~]# systemctl enable sshd 시스템 서비스 비활성화 [root@el7 ~]# systemctl disable sshd 시스템 서비스 시작 [root@el7 ~]# systemctl start sshd 시스템 서비스 중지 [root@el7 ~]# systemctl stop sshd 시스템 서비스 재시작 [root@el7 ~]# systemctl restart sshd 시스템 서비스 갱신 [root@el7 ~]# systemctl reload sshd
  • 20. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED 서비스 관리 시스템 서비스 활성화 여부 확인 (is-enabled) [root@el7 ~]# systemctl is-enabled sshd 시스템 서비스 활성화 여부 확인 (is-active) [root@el7 ~]# systemctl is-active sshd 시스템 서비스 재활성화 [root@el7 ~]# systemctl reenable sshd 변경 서비스 데몬 반영 [root@el7 ~]# systemctl daemon-reload 시스템 관리자 재시작 [root@el7 ~]# systemctl daemon-reexcute 시스템 서비스 kill 시그널링 [root@el7 ~]# systemctl kill httpd
  • 21. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED 서비스 관리 시스템 서비스 마스킹 [root@el7 ~]# systemctl mask network 시스템 서비스 언마스킹 [root@el7 ~]# systemctl unmask network  노트 disable 된 서비스는 부트 때나 다른 유닛 파일 의해 자동 시작되지 않는다 . 수동 시작해야 한다. 마스크 서비스는 수동 또는 자동으로 시작할 수 없다. 서비스 충돌 방지 ( ex. network vs NetworkManager)
  • 22. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED 서비스 관리 시스템 서비스 상태 확인 ( -l : 한줄 넘어가는 라인 축약 없이 출력) [root@el7 ~]# systemctl status sshd
  • 23. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED 가능한 서비스 유닛 정보 필드 설명 Loaded 서비스 유닛 로드 되어 있는지 여부. 유닛 파일의 절대 경로, 유닛이 유효한지 여부에 대한 설명. Active 서비스 유닛이 타임 스탬프에 따라 실행 중인지 정보 Main PID 해당 시스템 서비스의 PID Status 해당 시스템 서비스에 대한 추가 정보. Process 관련 프로세스에 대한 추가 정보. CGroup 관련 Control Group에 대한 추가 정보.
  • 24. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED systemctl summary vs. service utility 서비스 systemctl 설명 service name start systemctl start name .service 서비스 시작 service name stop systemctl stop name .service 서비스 중지 service name restart systemctl restart name .service 서비스 재시작 Service name condrestart systemctl try-restart name .service 서비스가 실행중인 경우에만 재시작 service name reload systemctl reload name .service 설정을 다시 로드 service name status systemctl status name .service systemctl is-active name .service 서비스가 실행 중인지 여부 확인 service --status-all systemctl list-units --type service --all 모든 서비스의 상태 표시 chkconfig name on systemctl enable unit 부트 때 서비스 활성화 chkconfig name off systemctl disable unit 부트 때 서비스가 비활성화 systemctl mask unit 부트 때, 수동시작 모두 비활성화 systemctl unmask unit mask 서비스가 가능하도록 생성 systemctl list-dependencies unit 특정 유닛에 의해 요구되거나 , 필요한 유닛 목 록
  • 25. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED systemctl vs. chkconfig utility chkconfig systemctl 설명 chkconfig name on systemctl enable name .service 서비스를 활성화합니다. chkconfig name off systemctl disable name .service 서비스를 비활성화합니다. chkconfig --list name systemctl status name .service systemctl is-enabled name .servi ce 서비스가 활성화되어 있는지 여 부를 확인합니다. chkconfig --list systemctl list-unit-files --type ser vice 서비스를 나열하고 그들이 사용 할 수 있는지 여부를 확인합니다.
  • 26. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED Systemd 유닛 위치 디렉토리 설명 /usr/lib/systemd/system/ RPM 패키지로 배포된 systemd 유닛 /run/systemd/system/ systemd 유닛은 런타임에 생성되며, 이 디렉토리는 설치된 서비스 유닛의 디렉토리에 우선함. /etc/systemd/system/ 시스템 관리자가 만들고 관리하는 systemd unit. 이 디렉토리는 런타임 unit의 디렉토리에 우선함.
  • 27. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED 부팅 프로세스 ( System V Boot Process ) BIOS/UEFI GRUB/LILO KERNEL init Read inittab rc.sysint Run level 1 Run level 2 Run level 3 Run level 4 Run level 5
  • 28. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED symlink symlink 부팅 프로세스 ( Systemd Boot Process ) BIOS/UEFI GRUB/LILO KERNEL systemd Default target rescue target unit sysinit target unit basic target unit multi-user target unit
  • 29. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED 부팅 프로세스 ① UEFI or BIOS ② MBR or UEFI boot firmware ③ System firmware reads -> boot loader ( grub2 ) #grub2-install ④ /etc/grub.d/ , /etc/default/grub , /boot/grub2/grub.cfg 로드 ⑤ initramfs 와 구성된 kernel 메모리 적재 #/etc/dracut.conf ⑥ 부트로더는 메모리 내의 initramfs 의 위치 , 부트로더 내의 커널 명령을 지정하여 시스템을 제어 /etc/grub.d/ , /etc/default/grub , /boot/grub2/grub.cfg dracut은 initramfs 생성을 위한 low-level 도구 #man dracut
  • 30. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED 부팅 프로세스 ⑦ 커널 초기화 (initramfs 내의 하드웨어 드라이버 이용) PID 1 인 /sbin/init 을 구동 ( RHEL 7 기반에서는 udev daemon 과 마찬가지로 /sbin/init 대신 systemd 구동) ⑧ initramfs 내의 systemd 인스턴스는 initrd.target 을 위해서 모든 유닛을 실행 , /sysroot 상의 root file system을 실제 마운트 ⑨ 커널 루트 파일시스템은 이전 /sysroot에 마운트 된 시스템 루프 파일 시스템을 다시 initramfs 루트 파일시스템으로 전환 systemd의 복사본을 사용해서 systemd 자신을 다시 실행 ⑩ systemd -> default target 을 검색 , 커널 명령이나 구성된 시스 템에 구성에 따라 시작/정지 ( 유닛 사이의 의존성 문제 해결 ) 그래픽 또는 텍스트 기반으로 시스템 상태 진행 /etc/system/system/default/target, /etc/system/system
  • 31. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED 로그 관리 Systemd 는 단순한 init 대체가 아닌 시스템 전반적인 관리자 로그관리를 위해 systemd-journal 사용 Journalctl 로그 관리 명령어 Syslog 를 대체하거나 병렬처리 가능 구조화, 인덱스화 , 검색시간 단축 [root@el7 ~]# journalctl -- Logs begin at 토 2015-02-14 01:33:52 KST, end at 일 2015-02-15 01:20:01 KST. -- 2월 14 01:33:52 localhost systemd-journal[62]: Runtime journal is using 8.0M (max 184.5M, leaving 276.7M of free 1.7G, curre 2월 14 01:33:52 localhost systemd-journal[62]: Runtime journal is using 8.0M (max 184.5M, leaving 276.7M of free 1.7G, curre 2월 14 01:33:52 localhost kernel: Initializing cgroup subsys cpuset 2월 14 01:33:52 localhost kernel: Initializing cgroup subsys cpu 2월 14 01:33:52 localhost kernel: Linux version 3.8.13-35.3.1.el7uek.x86_64 (mockbuild@ca-build56.us.oracle.com) (gcc versio 2월 14 01:33:52 localhost kernel: e820: BIOS-provided physical RAM map: 2월 14 01:33:52 localhost kernel: BIOS-e820: [mem 0x0000000000000000-0x000000000009efff] usable 2월 14 01:33:52 localhost kernel: BIOS-e820: [mem 0x000000000009f000-0x000000000009ffff] reserved 2월 14 01:33:54 localhost kernel: sd 2:0:0:0: [sda] Assuming drive cache: write through 2월 14 01:33:54 localhost kernel: sd 2:0:0:0: [sda] Cache data unavailable 2월 14 01:33:54 localhost kernel: sd 2:0:0:0: [sda] Assuming drive cache: write through
  • 32. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED 로그 관리 Journalctl 항목의 우선순위가 시각적으로 표기  오류 순위와 그 보다 높은 행은 red color 적용  주의 및 경고의 우선순위에 bold 적용 타임스탬프  시스템의 로컬시간대로 변환 순환된 로그를 포함하여 기록된 모든 데이터 표시 부팅 시작시 특별한 라인으로 태깅 기본적으로 root 가 아닌 사용자는 자신의 로그만 확인 가능  특정 사용자가 모든 로그에 접근하려면 adm 그룹의 멤버여야 함.  노트 접근제어는 Journal의 Persitent storage가 활성화된 경우만 사용 가능
  • 33. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED 로그 관리 로그 개수 지정 ( -n : 라인 수 ) [root@el7 ~]# journalctl –n 10 상세 로그 [root@el7 ~]# journalctl –o verbose 로그 Liveview [root@el7 ~]# journalctl –f 우선순위 필터링 (-p : 우선순위 : debug~emerg) [root@el7 ~]# journalctl –p err  노트 각 필드에 대한 설명은 system.journal-fields(7) 매뉴얼 페이지 참고
  • 34. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED 로그 관리 시간 필터링 (-b : 부팅 이후 현재 로그 ) [root@el7 ~]# journalctl -b 시간 필터링 (--since , --until : 기간 조회 ) [root@el7 ~]# journalctl --since=2015-01-01 --until=2015-01-31 시간과 우선순위 조합 필터링 [root@el7 ~]# journalctl -p warning --since = "2013-3-16 23:59:59" 우선순위 필터링 (-p : 우선순위 : debug~emerg) [root@el7 ~]# journalctl –p err  노트 각 필드에 대한 설명은 system.journal-fields(7) 매뉴얼 페이지 참고
  • 35. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED 로그 관리 특정 바이너리 이벤트 (실행 가능 특정 바이너리에 대한 이벤트) [root@el7 ~]# journalctl /sbin/sshd 메타 데이터 필드별 필터링 (Logical AND 연산) [root@el7 ~]# journalctl -F 필드명 -F 필드명 메타 데이터 필드별 필터링 (Logical OR 연산) [root@el7 ~]# journalctl -F 필드명=값 + 필드명=값 고급 필터링 예제) [root@el7 ~]# journalctl _UID = 70 _SYSTEMD_UNIT = avahi- daemon.service _SYSTEMD_UNIT = crond.service
  • 36. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED 로그 관리 Persistent Storage 활성화 로그 파일을 메모리 또는 /run/log/journal 디렉토리내 작은 링 버퍼에 저장 /run/log/journal은 휘발성이며 , 영구저장 하지 않음  최근 로그기록 확인용으로 적합 영구적으로 로그를 기록하면 /var/log/journal에 저장되고 재부 팅 이후에도 유지 Persistent Storage 사용시 장점 / 단점 장점 : 장기적으로 문제 해결을 할 수 있는 로그를 기록, 보관 서버 콘솔 로그 파일이 아니라 journal 이용 단점: 더 많은 디스크 공간 필요 저장되는 데이터 량은 여유 메모리 양에 의존 , 특정 기간에 대한 보증은 불가  노트
  • 37. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED 로그 관리 Persistent 활성화 ( 로그 디렉토리 생성 [root@el7 ~]# mkdir -p /var/log/journal 서비스 재시작 [root@el7 ~]# systemctl restart system-jounald [root@el7 ~]# mkdir -p -m 2775 /var/log/journal [root@el7 ~]# chown :systemd-journal /var/log/journal/ [root@el7 ~]# killall -USR1 systemd-journald  노트
  • 38. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED GUI 도구 활용 #설치 안되어 있는 경우 yum -y install gnome-system-log 명령으로 설치 후 실행 해당 명령은 반드시 root 권한으로 실행
  • 39. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED GUI 도구 활용 - 필터링
  • 40. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED Systemd Cgroup 관리 Systemd 를 이용하여 Cgroup ( Control Group ) 관리 가능 Cgroup 정보 출력 [root@el7 ~]# system-cgls
  • 41. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED Systemd Cgroup 관리 Systemd 를 이용하여 Cgroup ( Control Group ) 관리 가능 Cgroup에 대하여 top 명령 결과로 출력 [root@el7 ~]# system-cgtop
  • 42. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED 리소스 관리 Systemctl 명령을 이용하여 리소스 제어 가능 http.service CPUShare 가중치 512 으로 설정 [root@el7 ~]# systemctl set-property sshd.service CPUShares=512 http.service 프로퍼티 확인 [root@el7 ~]# systemctl show httpd.service CPUShares [root@el7 ~]# systemctl show sshd.service | grep CPU CPUShares=1024 [root@el7 ~]# systemctl set-property sshd.service CPUShares=512 [root@el7 ~]# systemctl show sshd.service | grep CPU CPUShares=512 [root@el7 ~]# cat /sys/fs/cgroup/cpu/system.slice/sshd.service/cpu.shares 512 [root@el7 ~]# man systemd.resource-control
  • 43. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED Systemd 를 이용한 기타 설정(호스트/로케일) 호스트명 확인 [root@el7 ~]# hostnamectl 호스트명 변경 [root@el7 ~]# hostnamectl set-hostname newlinux 로케일 확인 [root@el7 ~]# localectl 로케일 변경 [root@el7 ~]# localectl set-locale LANG=ko_KR.UTF-8 localectl 서브 명령어를 통해 제어 list-keymaps set-keymap set-x11-keymap list-locales set-locale status  노트
  • 44. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED Systemd 를 이용한 기타 설정(로그인) 사용자 관리 (systemd 로그인 관리 ) [root@el7 ~]# loginctl loginctl 서브 명령어를 통해 제어  노트 사용자 관리 목록 [root@el7 ~]# loginctl list-users terminate-user unlock-session user-status activate attach disable-linger enable-linger flush-devices kill-session kill-user list-seats list-sessions list-users lock-session seat-status session-status show-seat show-session show-user terminate-seat terminate-session
  • 45. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED Systemd 를 이용한 기타 설정 (시간) 시스템 시간에 대한 이해 실시간시간(RTC)  현지시간 또는 협정세계시(UTC)  UTC 사용시 혼잡시간에 시간차 적용되어 계산  서머타임(DST) 적용  대부분의 경우 UTC 권장 시스템클럭  소프트웨어 클럭  초기값은 실시간 클럭 기반이나 , 초기화 이후 독립적인 시간
  • 46. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED Systemd 를 이용한 기타 설정(시간) 시간 날짜 확인 [root@el7 ~]# timedatectl 날짜 설정 [root@el7 ~]# timedatectl set-time 2015-02-15 시간 설정 ( HH:MM:SS 형식) [root@el7 ~]# timedatectl set-time 12:30:00 현지 시간으로 시계 유지 하도록 설정 ( RTC 활성화 : true(1) , false(0) ) [root@el7 ~]# localectl set-local-rtc true 타임존 확인 [root@el7 ~]# localectl list-timezone 현지 시간으로 시계 유지 하도록 설정 ( RTC 활성화 : true(1) , false(0) ) [root@el7 ~]# localectl set-timezone Asia/Seoul
  • 47. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED Systemd 를 이용한 기타 설정(원격 관리) 원격서버 정보 설정 변경 [root@el7 ~]#hostnamectl -H root@test.linux.com set-hostname newlinux 원격서버 정보 조회 [root@el7 ~]# hostnamectl -H root@test.linux.com
  • 48. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED 트러블슈팅 boot taget 의 선택 (rescue.target 부팅 시) 1. 방향키를 이용하여 선택 후 e 를 누름. 2. linux16 으로 시작하는 줄을 찾아 해당 줄의 끝으로 이동 3. systemd.unit=rescue.target 을 추가 4. ctrl + x
  • 49. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED 트러블슈팅 root password 복구 1. 방향키를 이용하여 선택 후 e 를 누름. 2. linux16 으로 시작하는 줄을 찾아 해당 줄의 끝으로 이동 3. rd.break 를 추가 4. ctrl + x 5. # mount -o remount,rw /sysroot 6. # chroot /sysroot 7. # passwd root 8. # touch /.autorelabel
  • 50. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED 트러블슈팅 debug shell 의 활용 서비스 활성 후 재부팅 후 crtl + alt + F9 를 이용 Debug Shell 활성화 [root@el7 ~]# systemctl enable debug-shell.service ln -s '/usr/lib/systemd/system/debug-shell.service' '/etc/systemd/system/sysinit.target.wants/debug-shell.service'  노트 debug shell 은 인증 없이 로컬에서 root 사용자로 접근이 가능하므로 일시적 으로 사용 후 반드시 비활성화 하여야 함.
  • 51. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED Systemd 분석 및 추적 systemd-analyze 시스템과 부팅 성능 통계와 상태 결정 시스템과 서비스 관리자로 부터 정보 추적 옵션 없이 사용시 time 이 암시적으로 적용 system-analyze time 사용자 영역에 도달하기 전에 커널에서 소요된 시간 일반 시스템에서는 사용자 영역에 도달 하기전에 초기 RAM(initrd)디스크에서 소요 (일반적인 시스템에서는 이를 사용자 영역 초기화라고 명명) 지점까지의 모든 시스템 서비스가 만들어진(spawned) 경우 측 정치는 단순히 통과된 지점까지 전달된 시간을 측정 이것이 디스크가 유휴하거나, 초기화가 완전 히 끝날때까지 필 요한 것은 아님.
  • 52. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED Systemd 분석 및 추적 systemd-analyze time systemd-analyze time [root@el7 ~]# systemd-analyze Startup finished in 1.502s (kernel) + 3.274s (initrd) + 26.716s (userspace) = 31.493s
  • 53. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED Systemd 분석 및 추적 systemd-analyze blame 초기화 하는데 걸리는 시간에 따라 구동중인 모든 유닛의 목록 을 정렬해서 출력 이 정보는 부팅 시간을 최적화 하는데 사용될 수 있음. 다른 서비스가 완료될 때 까지 다른 서비스의 초기화를 기다리 고 있기 때문에 하나의 서비스는 느리게 보일 수도 있으며 , 출 력정보를 잘못 이해 하는 경우도 있다는 점에서 유의. systemd-analyze blame [root@el7 ~]# systemd-analyze blame 12.945s kdump.service 4.579s firewalld.service 3.748s network.service 2.920s tuned.service 2.829s postfix.service 1.957s iprupdate.service
  • 54. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED Systemd 분석 및 추적 systemd-analyze critical-chain 시간이 많이 소요된 서비스에 대한 실행과 대기에 대하여 체인 형태로 출력 유닛이 활성화 또는 시작된 후 시간은 @ 문자로 , 유닛이 시작 하는데 걸린 시간은 "+" 문자로 유닛들의 실행은 병렬적으로 실행되기 때문에 하나의 서비스 초기화에는 소켓 활성화에 의 존하는 경우가 있으므로 출력을 오해 할 수 있음. systemd-analyze critical-chain [[root@el7 ~]# systemd-analyze critical-chain multi-user.target @26.690s └─kdump.service @13.744s +12.945s └─network.target @13.710s └─network.service @9.960s +3.748s └─NetworkManager.service @8.652s +1.303s
  • 55. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED Systemd 분석 및 추적 systemd-analyze plot 시스템 서비스 정보를 상세하게 SVG 그래픽으로 출력. 서비스 시작 시간을 강조 하고 , 초기화에 소요된 시간을 하이 라이팅. systemd-analyze plot [[root@el7 ~]# systemd-analyze plot > analyze.svg
  • 56. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED Systemd 분석 및 추적 systemd-analyze dot GraphViz dot 도구를 이용하여 텍스트기반 그래프 출력 필요시 GraphViz 설치 ( #yum -y install GraphViz ) 저장된 파일을 열기 위해 필요시 eyes of gnome 설치 (#yum -y install eog) systemd-analyze dot [[root@el7 ~]# systemd-analyze dot 'avahi-daemon.*' | dot -Tsvg > avahi.svg
  • 57. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED Systemd 분석 및 추적 Color legend: black = Requires dark blue = Requisite dark grey = Wants red = Conflicts green = After systemd-analyze dot 를 이용하여 avahi-daemon에 의존하는 모 든 서비스를 추적 및 시각화
  • 58. Copyright © 2016 All Right Reversed Nobreak Co.,LTD. Reproduction is strictly PROHIBITED Systemd 분석 및 추적 systemd-analyze dot [[root@el7 ~]# systemd-analyze dot --to-pattern='*.target' --from- pattern='*.target' | dot -Tsvg > targets.svg systemd-analyze dot 를 이용하여 target unit 에 의존하는 모든 서비스를 추적 및 시각화