Skip navigation

Will not boot into Safe Mode

52622 Views 199 Replies Latest reply: Apr 3, 2014 8:30 AM by Kikonda12 RSS
  • laughing_badger Calculating status...
    Currently Being Moderated
    Feb 26, 2013 1:53 PM (in response to kallisti)

    Sure. Someone had posted that he had done a verbose safe boot and had seen the hang happened while fsck was checking the disk. So I wanted to make safe boot skip this step to see if that allowed the safe boot to complete, and to see if that then cured the log message issue. I did this by replacing the fsck binary that is called as part of a safe boot with something else.

     

    cd /sbin

     

    Go to where the fsck_hfs binary is. I found this by doing 'which fsck' and then by knowing that fsck calls another binary specific to the type of filesystem that is being checked. OSX uses HFS, so I needed to disable fsck_hfs.

     

    sudo mv fsck_hfs fsck_hfs_orig

     

    Move it to a new filename so that we keep a copy.

     

    sudo cp ~/true fsck_hfs

     

    Put a new binary in it's place. This is a simple bit of code that just returns the value zero. This is what fsck does if the disk was OK. So here we are setting up a trick that makes the safe boot process think that the disk has been checked and it was OK.

     

    For reference, the program was:

     

    #include <stdlib.h>

     

    int main( int argc, char* argv[] ) { return 0; }

     

    Standard C code, compiled with gcc.

     

    sudo chmod ugo+rx fsck_hfs

     

    This changes the file permissions to match what they were set to for the real binary.

     

    nvram boot-args="-x -v"

     

    This sets some flags in non-volatile RAM that will cause the machine to always boot with a verbose safe boot until told to do otherwise.

     

    reboot, log in

     

    Reboot the machine to let the safe boot proceed with our trick binary and wait until everything has completed and we can log into the machine.

     

    sudo nvram boot-args=""

     

    Clear the flags that we set earlier so that we get a normal boot next time.

     

    reboot

     

    Get the machine back into the state that we normally have it in.

     

    cd /sbin

    sudo mv fsck_hfs_orig fsck_hfs

     

    Clean up after ourselves by putting the original (working) binary for fsck into place.

  • kallisti Level 1 Level 1 (0 points)
    Currently Being Moderated
    Feb 26, 2013 2:24 PM (in response to laughing_badger)

    Thanks Badger!

     

     

    you're awesome

  • Jan Wessel Calculating status...
    Currently Being Moderated
    Feb 26, 2013 2:24 PM (in response to laughing_badger)

    Thank you laughing_badger

    For me too this was very instructive

  • kallisti Level 1 Level 1 (0 points)
    Currently Being Moderated
    Feb 26, 2013 2:36 PM (in response to laughing_badger)

    alright, so if I understand, the following sequence should also work:

    cd /sbin

    sudo mv fsck_hfs fsck_hfs_orig

    sudo cp -p /usr/bin/true fsck_hfs

    nvram boot-args="-x -v"

     

    reboot, log in

     

    sudo nvram boot-args=""

     

    reboot

     

    cd /sbin

    sudo mv fsck_hfs_orig fsck_hfs

  • Olaf Barthel Level 1 Level 1 (0 points)
    Currently Being Moderated
    Feb 27, 2013 12:09 AM (in response to kallisti)

    Just in case: changing the boot-args is not strictly necessary to make your computer go through the safe boot process.

     

    You could omit the 'nvram boot-args="-x -v"' command, restart your Mac and hold down any shift key until the safe boot process starts.

     

    Note that with the 'fsck_hfs' command taken out of the picture, the safe boot process can finish very quickly, and you may not even see the grey progress bar which is normally a sign that a safe boot is underway.

  • Syth Level 1 Level 1 (45 points)
    Currently Being Moderated
    Feb 28, 2013 6:45 AM (in response to Olaf Barthel)

    Olaf Barthel wrote:

     

    Note that with the 'fsck_hfs' command taken out of the picture, the safe boot process can finish very quickly, and you may not even see the grey progress bar which is normally a sign that a safe boot is underway.

    This is useful to know because, yes, the boot process finishes very quickly and there is no really obvious way to know you're in safe mode.

  • David Losada Level 1 Level 1 (10 points)
    Currently Being Moderated
    Mar 1, 2013 1:34 AM (in response to Syth)

    I tried again with a new DIMM. If I have the 8 RAM slots in my MacPro 5.1 populated I can't start in safe mode because the boot process gets stuck at "checking extranded attributes file". If I remove on of the DIMM, I can safe boot without problems.

     

    I can't understand it.

  • Olaf Barthel Level 1 Level 1 (0 points)
    Currently Being Moderated
    Mar 1, 2013 2:07 AM (in response to Syth)

    If your Mac is set up to require that you enter a password before you can use it, there will be a message in the top right corner of the login screen (in red) to notify you that safe boot is in effect.

     

    I do not know if there is any similar hint message visible if your Mac is set up to log you in automatically.

     

    Truth be told, I triggered safe boot three times in a row before I noticed the message and realized that the first attempt was successful after all.

  • laughing_badger Level 1 Level 1 (0 points)
    Currently Being Moderated
    Mar 1, 2013 2:20 AM (in response to David Losada)

    My guess is that there is a bug in the code for fsck_hfs that is only triggered with large amounts of memory available, and in the specific memory layout that occurs in safe boot. The next step would be to get a debuggable version of the code and have the safe boot process drop into the debugger before it does the disk check. More work than I have the time to go into at present, sadly.

  • Jeff Biggus Calculating status...
    Currently Being Moderated
    Mar 4, 2013 5:29 PM (in response to laughing_badger)

    Many thanks badger on the great workaround for fsck. Works like a charm. You'd think a "safe" boot should be safer.

     

    (Sadly, it didn't end up curing my mdimport / lsboxd bug that I have been trying to cure by doing a safe boot to begin with, but it was good to know how to get it to work.)

     

    Fwiw, if it makes things easier for anyone, to make "true", all you need is this one line of code:

     

         int main(){}

     

    If you save that as true.c, compile it like this:

     

         clang -o true true.c

     

    (Clang knows to have the program return 0 by default. The import and the arguments to main aren't needed.)

  • Olaf Barthel Level 1 Level 1 (0 points)
    Currently Being Moderated
    Mar 5, 2013 2:17 AM (in response to Jeff Biggus)

    It is simple enough if you have the software development tools installed

     

    Simpler still is just copying the existing "true" command from "/usr/bin/true", like so:

     

         sudo cp -pn /usr/bin/true fsck_hfs

     

    The "-pn" options make sure that the access rights to the command are preserved and that no existing file is overwritten (you need to move the original "fsck_hfs" command out of the way before you can plug in the dummy replacement).

  • Graham Perrin Level 2 Level 2 (240 points)
    Currently Being Moderated
    Mar 14, 2013 3:02 PM (in response to Graham Perrin)

    In January I wrote:

     

    > I may have a workaround but it's too early to disclose.

     

    About the OS X Mountain Lion v10.8.3 Update does not mention safe boot, but safe boot began working for me whilst I tested a pre-release build of the update.

     

    To any user of OS X 10.8.2 who can not boot in safe mode, please:

     

    1) update to 10.8.3

     

    2) let us know whether 10.8.3 resolves the bug for you.

     

    If not resolved by 10.8.3, I'll offer my workaround.

  • Widber Level 1 Level 1 (0 points)
    Currently Being Moderated
    Mar 14, 2013 3:07 PM (in response to Graham Perrin)

    Hello Graham,

     

    unfortunately the released v.10.8.3 didn't solve this safe boot issue

  • Jeff Biggus Level 1 Level 1 (75 points)
    Currently Being Moderated
    Mar 14, 2013 3:29 PM (in response to Graham Perrin)

    Hi Graham, No progress for me either on 10.8.3. Stalls at the same step.

  • Jan Wessel Level 1 Level 1 (0 points)
    Currently Being Moderated
    Mar 14, 2013 5:00 PM (in response to Graham Perrin)

    Hi Graham,

     

    Seem here, installed 10.8.3, but safe boot still stalls.

1 ... 7 8 9 10 11 ... 14 Previous Next

Actions

More Like This

  • Retrieving data ...

Related Articles

Bookmarked By (16)

Legend

  • This solved my question - 10 points
  • This helped me - 5 points
This site contains user submitted content, comments and opinions and is for informational purposes only. Apple disclaims any and all liability for the acts, omissions and conduct of any third parties in connection with or related to your use of the site. All postings and use of the content on this site are subject to the Apple Support Communities Terms of Use.