systemd-logind.service的RemoveIPC引數影響
阿新 • • 發佈:2021-11-08
systemd-logind.service的RemoveIPC引數影響
systemd-logind.service的RemoveIPC引數影響
背景
在centos7.2,RHEL7.2或Kylin-Server-20200711版本系統核心上遇到一個奇怪的問題,使用者登入後建立的檔案,在使用者logout後會被自動刪除。
原因
在RHEL7.2及之後,systemd-logind 服務引入了一個新特性——當一個user 完全退出os之後,remove掉所有的IPC objects。
該特性由/etc/systemd/logind.conf引數檔案中RemoveIPC選項來控制。詳細請看man logind.conf(5)。當使用預設值(即 RemoveIPC=yes)的情況,當用戶退出時,作業系統會remove掉該使用者的shared memory segments and semaphores。
影響範圍
在設定了RemoveIPC=yes 的RHEL7.2或Kylin-Server-20200711版本系統中會crash掉使用了Shared Memory Segment (SHM) or Semaphores (SEM)的應用程式
目前遇到過的資料庫應用
- 在RHEL7.2上安裝的Oracle Database應用程式異常crash
- 在Kylin-Server-10-SP1-Release-Build04-20200711-x86_64部署的DM DSC應用也出現異常crash
解決方案
關閉RemoveIPC特性
# 修改配置檔案 sed -i 's/.*RemoveIPC.*/RemoveIPC=no/' /etc/systemd/logind.conf # 檢查確認配置 grep RemoveIPC /etc/systemd/logind.conf RemoveIPC=no # 重啟服務或重啟作業系統 systemctl daemon-reload systemctl restart systemd-logind.service # 結果驗證確認 loginctl show-session | grep RemoveIPC systemctl show systemd-logind | grep RemoveIPC