雲主機重啓後,core_pattern
,即/proc/sys/kernel/core_pattern
和/etc/sysctl*
配置失效,被系統自動修改。
配置後,重啓後core_pattern
被重寫
cat /etc/sysctl.conf
定位過程
定位到的原因是系統的apport服務導致的問題。
apport服務啓動配置文件中/etc/init/apport.conf
apport將其自身註冊爲系統的核心轉儲處理程序, 它強制覆蓋用戶在/etc/sysctl.conf中指定的設置,並且不使用/etc/sysctl.d。
因此,它將覆蓋啓動和關閉時在其他位置配置的設置。
apport的功能是上報內部錯誤, 關閉後並不影響作爲純server使用的ubuntu系統的正常工作。
所以,爲了解決這個問題,需要手動關閉apport服務。
ubuntu12.04 14.04
ucloud, tencent雲主機已測試通過
service apport stop #臨時關閉
sudo update-rc.d -f apport remove
sed -i 's@enabled=1@enabled=0@g' /etc/default/apport #永久關閉
sysctl -p
ubuntu18.04
sudo systemctl stop apt-daily.timer
sudo systemctl stop apt-daily.service
sudo systemctl stop apt-daily-upgrade.timer
sudo systemctl stop apt-daily-upgrade.service
sudo systemctl disable apt-daily.service
sudo systemctl disable apt-daily.timer
sudo systemctl disable apt-daily-upgrade.timer
sudo systemctl disable apt-daily-upgrade.service
systemctl stop apport.service
systemctl disable apport.service
sed -i 's@enabled=1@enabled=0@g' /etc/default/apport
sysctl -p
參考:
https://bugs.launchpad.net/ubuntu/+source/apport/+bug/1080978