I had a problem with my RasPi and it couldn't boot to lxde. So I tried fsck /dev/mmcblk0p2 and it works again. However, my Apache cannot start anymore so I can't open localhost and phpmyadmin. The error is "cannot load /usr/lib/apache2/modules/mod_auth_basic.so". Do you have any idea how to fix it?

  • It's not impossible for data to be lost after a fsck, even when done properly (with the fs unmounted) if the fs was in an inconsistent state to start with (which you imply it was). What fsck does is fix the filesystem so that whatever can be recovered is, and so that there are no inconsistencies which might snowball into further corruption. Usually this puts everything to rights, but if a file is truly mucked then it will remain that way. So don't get into a habit of thinking, eg, that you can yank the plug and if there is a problem fsck will fix it. Probably, but it is not guaranteed. – goldilocks Sep 12 '13 at 14:17

How did you do fsck? If you did it while system running (that means /dev/mmcblk0p2 mounted as /) you did it wrong. Linux filesystems should not be check/repair while mounted.

If you did check/repair filesystem while mounted maybe apache modules moved to /lost+found folder which is a linux special folder. You can search your file in /lost+found then move to original folder if you can find it. I suggest you backup your SD card, re-image with your system then restore your files.

From fsck manual :

Note that in general it is not safe to run e2fsck on mounted filesystems. The only exception is if the -n option is specified, and -c, -l, or -L options are not specified. However, even if it is safe to do so, the results printed by e2fsck are not valid if the filesystem is mounted. If e2fsck asks whether or not you should check a filesystem which is mounted, the only correct answer is ''no''. Only experts who really know what they are doing should consider answering this question in any other way.


  • My RasPi couldn't log in LXDE and stay at prompt. The reason was the root account was locked. So I did fsck /dev/mmcblk0p2, rebooted and it started working again exept apache. I tried to look at the lost+found folder but can't find any file there. – Hoang-Long Cao Sep 12 '13 at 12:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.