geerlingguy/macos-virtualbox-vm

Is it possible to boot into "recovery mode"?

magicgoose opened this issue · 32 comments

…for example, to disable SIP.
I tried to use cmd(right)+R but it ignores it and boot as usual.

That... I'm not sure of. I've never tried it, but I'm not even sure if VirtualBox would pass keystrokes in the proper way during the OS boot process?

Maybe it won't. I don't know unfortunately.

Yes, it is possible, but you have to hit F12 to enter the EFI shell first, and then follow some instructions. I have tested it on Sierra.

http://anadoxin.org/blog/disabling-system-integrity-protection-from-guest-el-capitan-under-virtualbox-5.html

2.0 Shell> FS2:
2.0 FS2:>
2.0 FS2:\> cd com.apple.recovery.boot
2.0 FS2:\com.apple.recovery.boot\> boot.efi

Instructions with screenshots:
https://steemit.com/utopian-io/@kabooom/reset-mac-sierra-password-in-recovery-mode-running-inside-virtualbox

There is also a recovery mode disk image available:
https://techsviewer.com/how-to-boot-a-macos-mojave-virtual-machine-to-recovery-mode/
https://drive.google.com/file/d/1eh7Q0Xxky4diJig7KTbSW8OPAFlUGzt6/view

Yes, it is possible.
Restart your Mac from top left.
Click the same button such as Esc/F12/F8 whichever you use to go into the bios of your PC, it'll take you to Virtual Box Bios.
Go to 'Boot Manager'.
Choose 'EFI Internal Shell'.
Click Esc to to go to Shell.
Type FS2:
Type cd com.apple.recovery.boot
type boot.efi
You'll boot into Recovery OS

My shell says: cd: 'FS2:\com.apple.recovery.boot' is not a directory.
What should I do now?

My shell says: cd: 'FS2:\com.apple.recovery.boot' is not a directory.
What should I do now?

Same here. Fixed it with these steps:

  1. Download this file: https://drive.google.com/drive/folders/1YMc1HvamDnWg6wVLibX2RQw13kjCxbYu
    This is a macos recovery boot image.
  2. Select it as a separate drive in the settings of your virtual machine and remember its SATA port.
  3. Launch the machine and go into the boot menu, launch the recovery disk which is referenced by the same SATA port.
  4. From there recovery mode will launch, open the terminal from "Utilities" in the status bar.
  5. Type "csrutil disable" and then reboot via the apple logo in the top left corner.
  6. In your mac vm, you can check whether SIP is disabled in Terminal by typing "csrutil status".

Hope this helps!

Thank you @DerLasseHenrich, I‘ll try it later and comment if it works.

So, I'm using macOS Catalina and I can't use this one because it's for mojave :/

@redmlr You sure? I was also using Catalina, 10.15.4 I believe, and it worked perfectly.

I‘m booting in recovery disk, but when I‘m there I cannot use my mouse and keyboard to navigate..

This would help users get into recovery mode and back out. From my answer here.

In your VM's terminal:

sudo nvram recovery-boot-mode=unused && sudo shutdown -r now

Once in recovery mode you can run the commands you need in Utilities>Terminal.

Run the commands you want like:

$ csrutil disable
$ nvram -d recovery-boot-mode && shutdown -r now # this gets you out of recovery mode

And you'll get back into normal MacOS.

This would help users get into recovery mode and back out. From my answer here.

In your VM's terminal:

sudo nvram recovery-boot-mode=unused && sudo shutdown -r now

Once in recovery mode you can run the commands you need in Utilities>Terminal.

Run the commands you want like:

$ csrutils disable
$ nvram -d recovery-boot-mode && shutdown -r now # this gets you out of recovery mode

And you'll get back into normal OSX.

csrutil, not csrutils this gave me a mini heart attack. This works like a charm thanks.
host windows 10, guest catalina

Updated my answer :) Sorry!

See this, it fixes your issue and more. Makes the install very easy even if you are not a super user.

https://blog.victormendonca.com/2020/04/17/how-to-install-macos-catalina-in-virtual-box/

@vviikk Thanks for the commands. That + https://www.virtualbox.org/ticket/19047 allowed me to install virtual box additions on OSX.

@vviikk For me the second line omitting =unused to reinstate a non recovery operation of the Mac in the VM was not
necessary as a next boot process ended in normal mode anyways.

@matham The thread states this to be true but no functionality came back. Is this also your experience?

I was able to get copy and paste outside the vm working for a bit, but then it stopped working. But I couldn't get shared folders to work, nor the GPU, which was my primary interest so I didn't investigate in depth.

@matham Wow, impressive. Seems this is really going into the right direction.

At least on macOS Big Sur, it is also possible to boot into recovery mode using the EFI Internal Shell. This is useful if you are unable to boot into the OS to set the NVRAM flag via Terminal.

  1. restart the VM and repeatedly press ESC until the selection menu shows up

Screen Shot 2021-04-16 at 11 36 11 PM

  1. select Boot Manager and then select EFI Internal Shell

Screen Shot 2021-04-16 at 11 36 30 PM

  1. look for the recovery partition and run FSx:\System\Library\CoreServices\boot.efi

Screen Shot 2021-04-16 at 11 37 24 PM

You can look for the recovery partition by executing ls FSx:\, where x is an integer greater than 0, and checking if there is a folder Install macOS Big Sur.app. In my VM it was FS8.

The @t0rr3sp3dr0 solutions works. If you don't see the partition is because you haven't the recovery partition. A workaround to this is to use a pen drive with the installer.

I‘m booting in recovery disk, but when I‘m there I cannot use my mouse and keyboard to navigate..

Same thing was happening to me, I had to install this extension pack for virtualbox and set usb to 3.0 and it worked!

Steps over here: https://www.geekrar.com/fix-mouse-keyboard-stuck-macos-mojave-virtualbox/

My shell says: cd: 'FS2:\com.apple.recovery.boot' is not a directory.
What should I do now?

Same here. Fixed it with these steps:

  1. Download this file: https://drive.google.com/drive/folders/1YMc1HvamDnWg6wVLibX2RQw13kjCxbYu
    This is a macos recovery boot image.
  2. Select it as a separate drive in the settings of your virtual machine and remember its SATA port.
  3. Launch the machine and go into the boot menu, launch the recovery disk which is referenced by the same SATA port.
  4. From there recovery mode will launch, open the terminal from "Utilities" in the status bar.
  5. Type "csrutil disable" and then reboot via the apple logo in the top left corner.
  6. In your mac vm, you can check whether SIP is disabled in Terminal by typing "csrutil status".

Hope this helps!

Thanks to @DerLasseHenrich, it helped me to fix another error which is a circle with a line through it occurred in VMware. In recovery mode, do not need to re-install the Mojave version to Catalina System even it is recommended to re-install OS by Apple Documentation, I just restart the system and now everything works perfectly!

The @t0rr3sp3dr0 solutions works. If you don't see the partition is because you haven't the recovery partition. A workaround to this is to use a pen drive with the installer.

I see the partition, and I see the GUID directory, but there's no boot.efi there as there was in Catalina. So it seems the recovery partition does get installed by the Big Sur or Monterey installer ... it's just inaccessible via the Virtualbox BIOS. Or is the install somehow quietly failing? (Quietly because I don't see any errors during the upgrade process.)

I really don't want to download some mystery image from the web or have a separate USB just to boot recovery. I want the existing integral recovery partition to work. Will this require a fix from Oracle?

Kein commented

Anyone managed to enter recovery mode on Windows Host with Catalina as guest on Ryzen CPU?
I've tried:

sudo nvram recovery-boot-mode=unused
sudo nvram internet-recovery-mode=RecoveryModeNetwork
sudo nvram internet-recovery-mode=RecoveryModeDisk
Command (⌘)-R
Option-Command-R
Shift-Option-Command-R
F12/F8 during boot

None of these work.

My shell says: cd: 'FS2:\com.apple.recovery.boot' is not a directory.
What should I do now?

Same here. Fixed it with these steps:

  1. Download this file: https://drive.google.com/drive/folders/1YMc1HvamDnWg6wVLibX2RQw13kjCxbYu
    This is a macos recovery boot image.
  2. Select it as a separate drive in the settings of your virtual machine and remember its SATA port.
  3. Launch the machine and go into the boot menu, launch the recovery disk which is referenced by the same SATA port.
  4. From there recovery mode will launch, open the terminal from "Utilities" in the status bar.
  5. Type "csrutil disable" and then reboot via the apple logo in the top left corner.
  6. In your mac vm, you can check whether SIP is disabled in Terminal by typing "csrutil status".

Hope this helps!

Awesome - you saved my Saturday. Thanks

This would help users get into recovery mode and back out. From my answer here.

In your VM's terminal:

sudo nvram recovery-boot-mode=unused && sudo shutdown -r now

Once in recovery mode you can run the commands you need in Utilities>Terminal.

Run the commands you want like:

$ csrutil disable
$ nvram -d recovery-boot-mode && shutdown -r now # this gets you out of recovery mode

And you'll get back into normal MacOS.

Thank you very much. This worked for me :)

This didn't work for me on Monterey:

sudo nvram recovery-boot-mode=unused && sudo shutdown -r now
Error setting variable - 'recovery-boot-mode': (iokit/common) not permitted.

I'm told you can avoid this error by going into Recovery Mode and running a command. Catch 22.

A bit of web searching turned up this alternative command for Monterey, and it set the nvram data no problem, but afterwards, I just booted back into normal mode:

sudo nvram internet-recovery-mode=RecoveryModeDisk && sudo shutdown -r now

So, still stuck. Note that there's a bug logged against VMware for booting into Recovery Mode in Big Sur+ too, so obviously, some format or data structure changed in MacOS at a low level, affecting both VMware and VB.

For anyone who is still having issues with this, even after trying the solutions above, I tried the following and it works (on VirtualBox, for macOS 10.13):

  1. Restart macOS from the VM (for example with sudo reboot )
  2. Pres ESC to skip startup.sh in the first screen and enter the EFI Internal Shell (as @t0rr3sp3dr0 and others recommended)
  3. Now that you are in Shell, enter exit. This will open the selection menu
  4. Go to "Boot Maintenance Manager" -> "Boot from file"
  5. From there, select "Recovery"
  6. Select the option that looks like a UUID (a random string between { } )
  7. Select "boot.efi"
  8. After some time, you will be in Recovery Mode

Hope this helps somebody! 😄

For anyone who is still having issues with this, even after trying the solutions above, I tried the following and it works (on VirtualBox, for macOS 10.13):

1. Restart macOS from the VM (for example with `sudo reboot` )

2. Pres ESC to skip startup.sh in the first screen and enter the EFI Internal Shell (as @t0rr3sp3dr0 and others recommended)

3. Now that you are in Shell, enter `exit`. This will open the selection menu

4. Go to "Boot Maintenance Manager" -> "Boot from file"

5. From there, select "Recovery"

6. Select the option that looks like a UUID (a random string between { } )

7. Select "boot.efi"

8. After some time, you will be in Recovery Mode

Hope this helps somebody! smile

That's the standard way to boot into Recovery with VirtualBox, but it stopped working in Big Sur, because the boot.efi file isn't present.

I booted successfully into Recovery mode with Monterey following this thread https://superuser.com/questions/1235970/stuck-on-uefi-interactive-shell-with-mac-os-x-high-sierra-vm#:~:text=I%20found%20it%20in%20System%5CLibrary%5CCoreservices%5Cboot.efi%20for%2011.4%20Big%20Sur
The "boot.efi" can be found at "System\Library\Coreservices\boot.efi".

I booted successfully into Recovery mode with Monterey following this thread https://superuser.com/questions/1235970/stuck-on-uefi-interactive-shell-with-mac-os-x-high-sierra-vm#:~:text=I%20found%20it%20in%20System%5CLibrary%5CCoreservices%5Cboot.efi%20for%2011.4%20Big%20Sur The "boot.efi" can be found at "System\Library\Coreservices\boot.efi".

You must be mistaken. The superuser page you quote relates to High Sierra, a much older version of MacOS, and System\Library\CoreServices\boot.efi is a file that boots to normal MacOS, not Recovery Mode. In Catalina, where Recovery Mode was still accessible, you'll find boot.efi right underneath a GUID directory in the Recovery Partition.

As mentioned, the issue with Big Sur and later MacOS versions is that boot.efi is not present in the Recovery Partition. There are many slight variations of that name when you dig around in the UEFI Shell, but not boot.efi, and therefore it's not possible to use 'boot from file' in the VirtualBox BIOS to boot into recovery mode.

When you type sw_vers when booted normally, what is the output?

Hi,

I tried solutions here, but I can not obtain Recovery Mode.

Itried : FS3:\System\Library\Coreservices\boot.efi
Kernel Panic !

How could I do that with Monterey VM.

Thanks.

This would help users get into recovery mode and back out. From my answer here.

In your VM's terminal:

sudo nvram recovery-boot-mode=unused && sudo shutdown -r now

Once in recovery mode you can run the commands you need in Utilities>Terminal.

Run the commands you want like:

$ csrutil disable
$ nvram -d recovery-boot-mode && shutdown -r now # this gets you out of recovery mode

And you'll get back into normal MacOS.

Thank you kind human.