我在单板计算机上有一个ubuntu服务器(11.10),有时会意外关机。此后启动时,fsck提示用户点击'f'来检查驱动器。由于此服务器通常没有连接监视器和键盘,并且正常访问它的唯一方法是通过SSH,因此非常不方便。
有没有一种方法可以保证在启动时无需用户输入就可以执行任何必需的fsck检查?基本上,我希望它始终在引导时(检测到问题时)运行“fsck -y”,而不是提示用户输入。
谢谢!
最佳答案
因此,我找到了两个与问题相关的解决方案:
我不确定它们在任何地方都有效,但是它们可以在ubuntu服务器11.10上运行。
/etc/default/rcS看起来像这样:
#
# /etc/default/rcS
#
# Default settings for the scripts in /etc/rcS.d/
#
# For information about these variables see the rcS(5) manual page.
#
# This file belongs to the "initscripts" package.
# delete files in /tmp during boot older than x days.
# '0' means always, -1 or 'infinite' disables the feature
TMPTIME=0
# spawn sulogin during boot, continue normal boot if not used in 30 seconds
SULOGIN=no
# do not allow users to log in until the boot has completed
DELAYLOGIN=no
# assume that the BIOS clock is set to UTC time (recommended)
UTC=yes
# be more verbose during the boot process
VERBOSE=no
# automatically repair filesystems with inconsistencies during boot
FSCKFIX=no
确保最后一行显示为
# automatically repair filesystems with inconsistencies during boot
FSCKFIX=yes
我一直在不需用户干预的情况下始终引导的另一个障碍是grub引导加载程序屏幕,在引导失败/中断之后等待用户输入。
这需要在以下位置编辑grub设置文件
/etc/grub.d/00_header
/etc/grub.d$ grep -r -n -C3 timeout ./
./00_header-229- fi
./00_header-230-fi
./00_header-231-
./00_header:232:make_timeout ()
./00_header-233-{
./00_header-234- cat << EOF
./00_header-235-if [ "\${recordfail}" = 1 ]; then
./00_header:236: set timeout=-1
./00_header-237-else
./00_header:238: set timeout=${2}
./00_header-239-fi
./00_header-240-EOF
./00_header-241-}
只需将236行更改为
set timeout = 0
和238行到
set timeout = 0
这将导致系统在引导时永不暂停。编辑文件后,运行
sudo update-grub
以获得在/boot/grub/grub.cfg文件中实现的更改。关于ubuntu - 如何在启动时自动响应fsck提示,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/9932250/