Using fsck in bootloader
————————————————————
来源:Debian 8.1 with Uboot bootloader cannot run FSCK on reboot
原文:
I stumbled across this recently on the BananaPi myself. It’s likely your booting with Systemd so setting FSCKFIX=yes
inside /etc/defaults/rcS
Won’t help you. Also /proc
is a virtual filesytem, so changes will disappear between reboots.
Setting those kernel options are correct for systemd, but you need to append them to the boot args.
In /boot/boot.cmd
I appended fsck.repair=yes
to the end of the setenv bootargs
:
setenv bootargs "console=tty1 root=/dev/mmcblk0p1 rootwait rootfstype=ext4 cgroup_enable=memory swapaccount=1 sunxi_ve_mem_reserve=0 sunxi_g2d_mem_reserve=0 sunxi_no_mali_mem_reserve sunxi_fb_mem_reserve=16 hdmi.audio=EDID:0 disp.screen0_output_mode=1920x1080p60 panic=10 consoleblank=0 enforcing=0 loglevel=${verbosity} fsck.repair=yes"
It’s important to note you need to re-generate the /boot/boot.cmd
before they’ll appear using the following command (it’s at printed at the end of /boot/boot.cmd
)
mkimage -C none -A arm -T script -d /boot/boot.cmd /boot/boot.scr
You can can confirm it applied after rebooting with cat:
~# cat /proc/cmdline
console=tty1 root=/dev/mmcblk0p1 rootwait rootfstype=ext4 cgroup_enable=memory swapaccount=1 sunxi_ve_mem_reserve=0 sunxi_g2d_mem_reserve=0 sunxi_no_mali_mem_reserve sunxi_fb_mem_reserve=16 hdmi.audio=EDID:0 disp.screen0_output_mode=1920x1080p60 panic=10 consoleblank=0 enforcing=0 loglevel=1 fsck.repair=yes
mhansen, edited Apr 14, 2019 at 4:58
Leon Wright, answered Jul 2, 2016 at 8:45