谁在更改我的 grub.cfg?更改超时会导致 grub 不显示

谁在更改我的 grub.cfg?更改超时会导致 grub 不显示

这是我对 /boot/grub/grub.cfg 处的 grub 配置文件更改的审核。此更改使 timeout=10(我已将其设置为使 grub 菜单完全显示)变为 timeout=0,这意味着 grub 根本不显示。发生这种情况时我正在睡着。我很想将该文件设为只读,看看会发生什么。Ubuntu 19.04,ryzen 5 2500U,配备 vega radeon mobile gfx 2000mhz。默认 amd 驱动程序(昨天更新,但这对我来说不是一个新问题,每次更新 grub 都会发生)。有什么想法知道为什么会发生这种情况吗?(除了阴谋论)。文件上的更改时间戳也是早上 6 点 07 分,当时我正在熟睡。

  1. 2019-08-03 06:07:23 /boot/grub/unlinkat 没有 /usr/bin/rm 取消设置 303
  2. 2019-08-03 06:07:23 /boot/grub/grub.cfg.new openat 是 /usr/bin/dash 取消设置 304
  3. 2019-08-03 06:07:23 . openat 是 /usr/bin/dash 未设置 305
  4. 2019-08-03 06:07:23 . openat 是 /usr/bin/dash 未设置 306
  5. 2019-08-03 06:07:23 . openat 是 /usr/bin/dash 取消设置 307
  6. 2019-08-03 06:07:23 . openat 是 /usr/bin/dash 未设置 308
  7. 2019-08-03 06:07:23 . openat 是 /usr/bin/dash 未设置 309
  8. 2019-08-03 06:07:23 . openat 是 /usr/bin/dash 未设置 310
  9. 2019-08-03 06:07:23 . openat 是 /usr/bin/dash 未设置 311
  10. 2019-08-03 06:07:23 . openat 是 /usr/bin/dash 未设置 312
  11. 2019-08-03 06:07:27 /boot/grub/grub.cfg.new fchmodat 是 /usr/bin/chmod 未设置 314
  12. 2019-08-03 06:07:27 /boot/grub/grub.cfg.new openat 是 /usr/bin/grub-script-check 未设置 315
  13. 2019-08-03 06:07:27 /boot/grub/renameat2 否 /usr/bin/mv 未设置 316
  14. 2019-08-03 06:07:27 /boot/grub/grub.cfg 重命名 是 /usr/bin/mv 取消设置 317
  15. 2019-08-03 06:07:27 /boot/grub/grub.cfg.new openat 是 /usr/bin/grep 未设置 313
  16. 2019-08-03 07:38:06 . openat 是 /usr/bin/updatedb.mlocate 未设置 346
  17. 2019-08-03 12:48:37 /boot/grub sendto 是 /usr/sbin/auditctl 取消设置 54
  18. 2019-08-03 12:48:37 /boot/grub/grubenv openat 是 /usr/bin/grub-editenv 未设置 77
  19. 2019-08-03 12:48:37 /boot/grub/grubenv openat 是 /usr/bin/grub-editenv 未设置 78

grub.cfg 的相关部分是

terminal_output gfxterm
if [ "${recordfail}" = 1 ] ; then
  set timeout=30
else
  if [ x$feature_timeout_style = xy ] ; then
    set timeout_style=menu
    set timeout=10
  # Fallback normal timeout code in case the timeout_style feature is
  # unavailable.
  else
    set timeout=10
  fi
fi

问题是当我的 =10 更改为 =0 时

审计来自https://unix.stackexchange.com/questions/99074/find-which-process-is-modifying-a-file

sudo apt auditd

然后设置

sudo  auditctl  -w /boot/grub -k grubchanges -p rwxa

并报告

sudo ausearch -k grubchanges | aureport -f -i

答案1

答案很明显:它被 改变了grub-mkconfig。如果你grub.cfg手动更改,所有更改将在下一个 上被覆盖update-grub

每次内核升级以及其他情况下,Grub 都会更新。

而不是改变grub.cfg编辑/etc/default/grub和运行sudo update-grub

您可以在 的开头读到此内容grub.cfg

#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

相关内容