OK, I have a clearer idea of what's happening. I can resolve this problem by adding a sleep 5 in checkroot.sh
if [ -d /proc/acpi ]; then modprobe ac >/dev/null 2>&1 fi on_ac_power >/dev/null 2>&1 sleep 5 #log_success_msg "Result from on_ac_power is $?" if [ "$?" -eq 1 ] then log_warning_msg "On battery power, so skipping file system check." rootcheck=no fi If I don't add the sleep , then $? is equal to 1 even if I'm not on battery while, after adding the sleep, $? is correctly 0 when I'm on AC. So, in my opinion, during my boot, something in the modprobe command takes too much time and the value of $? is checked too early. If this is the problem, I think there should be a pause in the script until the module is inserted and works correctly. This solves the problem only partially, because e2fsck still detects the laptop as running on batteries, and doubles the max mount count parameter. -- No AC detection before running e2fsck https://bugs.launchpad.net/bugs/252682 You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs