dnf-makecache disable

CentOS 8.x 에서는 주기적으로 dnf-makecache.service 가 실행되어 dnf 의 최신 메타데이터를 유지한다.

최신 메타테이터가 갱신될때 /var/log/message 에 아래와 같은 로그가 기록된다.

Aug 10 13:07:37 hostname systemd[1]: Starting dnf makecache...
Aug 10 13:07:39 hostname dnf[1222]: CentOS-8 - AppStream                            5.7 kB/s | 4.3 kB     00:00
Aug 10 13:07:39 hostname dnf[1222]: CentOS-8 - Base                                 7.3 kB/s | 3.9 kB     00:00
Aug 10 13:07:40 hostname dnf[1222]: CentOS-8 - Extras                               4.6 kB/s | 1.5 kB     00:00
Aug 10 13:07:41 hostname dnf[1222]: Extra Packages for Enterprise Linux Modular 8 -  10 kB/s | 9.1 kB     00:00
Aug 10 13:07:41 hostname dnf[1222]: Extra Packages for Enterprise Linux 8 - x86_64   14 kB/s | 9.0 kB     00:00
Aug 10 13:07:42 hostname dnf[1222]: Metadata cache created.
Aug 10 13:07:42 hostname systemd[1]: Started dnf makecache.

최신 메타데이터 유지를 중지하기 위해서는 systemd timer으로 등록되어 있는 dnf-makecache.timer를 중지하면된다.

systemctl disable --now dnf-makecache.timer

tmpfs /run/user/???


OS : CentOS 7.x

실제 메모리의 10%(기본값)가 사용자 tmpfs 으로 잡혀 있다.

>$ df -h | grep tmpfs
tmpfs           794M     0  794M   0% /run/user/501

문제는 없지만 사용하지도 않고 보기 싫으니 용량을 줄여보자.

>$ /etc/systemd/logind.conf
#RuntimeDirectorySize=10%
RuntimeDirectorySize=32M

아래 명령어를 시작 하였지만 적용이 되지 않았다.

>$ systemctl daemon-reexec
>$ systemctl daemon-reload

할수 없이 리부팅 해본다. 적용 되었다.

>$ df -h | grep tmpfs
tmpfs            32M     0   32M   0% /run/user/501

참고 : https://www.freedesktop.org/software/systemd/man/logind.conf.html

Created slice User Slice of root.

  • 환경
    CentOS 7 / RHEL 7
  • 내용
    /var/log/message 로그에 다음 메시지 생성.

     

    session_start_scope() 의 함수로 출력되는 로그으로 시스템 문제로 인한 로그는 아니라고 한다.

Nov  3 19:00:01 localhost systemd: Created slice User Slice of root.
Nov  3 19:00:01 localhost systemd: Starting User Slice of root.
Nov  3 19:00:01 localhost systemd: Started Session 711 of user root.
Nov  3 19:00:01 localhost systemd: Starting Session 711 of user root.
Nov  3 19:00:01 localhost systemd: Removed slice User Slice of root.
Nov  3 19:00:01 localhost systemd: Stopping User Slice of root.
Nov  3 19:01:01 localhost systemd: Created slice User Slice of root.
Nov  3 19:01:01 localhost systemd: Starting User Slice of root.
Nov  3 19:01:01 localhost systemd: Started Session 712 of user root.
Nov  3 19:01:01 localhost systemd: Starting Session 712 of user root.
Nov  3 19:01:01 localhost systemd: Removed slice User Slice of root.
Nov  3 19:01:01 localhost systemd: Stopping User Slice of root.
Nov  3 19:10:01 localhost systemd: Created slice User Slice of root.
  • 해결
    • rsyslog 삭제 필터 사용
      ] echo 'if $programname == "systemd" and ($msg contains "Starting Session" or $msg contains "Started Session" or $msg contains "Created slice" or $msg contains "Starting user-" or $msg contains "Starting User Slice of" or $msg contains "Removed session" or $msg contains "Removed slice User Slice of" or $msg contains "Stopping User Slice of") then stop' >/etc/rsyslog.d/ignore-systemd-session-slice.conf 
      ] systemctl restart rsyslog
    • systemd log level 조정
      • 명령을 통한 즉시 적용
        ] systemd-analyze set-log-level notice
      • systemd 설정 파일 수정 및 재 실행을 통한 영구 적용
        # 설정파일 수정
        ] vi /etc/systemd/system.conf
        ...
        [Manager]
        #LogLevel=info
        LogLevel=notice
        ...
        # Reexecute systemd manager
        ] systemctl daemon-reexec

        or

        # Reload systemd manager configuration
        ] systemctl daemon-reload

참고 : redhat customer portal , Doug’s Blog , RnDiT