geerlingguy / macos-virtualbox-vm

Instructions and script to help you create a VirtualBox VM running macOS.
MIT License
2.55k stars 313 forks source link

Is it possible to boot into "recovery mode"? #46

Open magicgoose opened 6 years ago

magicgoose commented 6 years ago

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

geerlingguy commented 6 years ago

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?

magicgoose commented 6 years ago

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

unqueued commented 5 years ago

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

the-vishal-kumar commented 4 years ago

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

pietmlr commented 4 years ago

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

LasseHenrich commented 4 years ago

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!

pietmlr commented 4 years ago

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 :/

LasseHenrich commented 4 years ago

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

pietmlr commented 4 years ago

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

vviikk commented 4 years ago

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.

ilampirai commented 4 years ago

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

vviikk commented 4 years ago

Updated my answer :) Sorry!

david-turnell commented 4 years ago

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/

matham commented 4 years ago

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

nobruinfo commented 4 years ago

@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?

matham commented 4 years ago

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.

nobruinfo commented 4 years ago

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

t0rr3sp3dr0 commented 3 years ago

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
  2. select Boot Manager and then select EFI Internal Shell

    Screen Shot 2021-04-16 at 11 36 30 PM
  3. 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.

jkutianski commented 3 years ago

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.

spookyuser commented 3 years ago

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/

oguzhnatly commented 3 years ago

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!

CalculonPrime commented 2 years ago

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 2 years ago

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.

akaydev-coder commented 2 years ago

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

jpapa1896 commented 2 years ago

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 :)

CalculonPrime commented 2 years ago

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.

NadgobKhan commented 1 year ago

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! 😄

CalculonPrime commented 1 year ago

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.

shb3014 commented 1 year ago

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".

CalculonPrime commented 1 year ago

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_verswhen booted normally, what is the output?

BenLaKnet commented 1 year ago

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.

haidar47x commented 3 weeks ago

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.