myspaghetti / macos-virtualbox

Push-button installer of macOS Catalina, Mojave, and High Sierra guests in Virtualbox on x86 CPUs for Windows, Linux, and macOS
GNU General Public License v2.0
13.51k stars 1.12k forks source link

[Question] How to upgrade the VM using InstallESDmg.pkg ? #429

Closed philphirn closed 3 years ago

philphirn commented 3 years ago

I know this is a non-script question but I've seen people with good knowledge about macOS so just asking.

I'd first successfully installed High Sierra using this script on Virtual Box. Now I want it to upgrade to Catalina. I've downloaded all the files which are downloaded by this script. If I install using this script a fresh Installation is created. If I try to run BaseSystem.dmg it'll download the files again which I don't want to do as they're huge. And InstallESDmg.pkg will of course fail because it's unable to find the other required files which I've downloaded.

So my question is can I upgrade my VM using the downloaded files only ? If yes then how ?

myspaghetti commented 3 years ago

If you're patient you could study the script function populate_bootable_installer_virtual_disk() line-by-line and find out how it creates the macOS__bootinst.txt file, which is what you need. Here's what it does in a nutshell:

And then you have a bootable macOS installer.

However if you've already successfully downloaded the required files you can let the script perform these steps for you (simply abort after the bootable installer has been populated) or, if you don't mind re-downloading the files, you can download Catalina from the Apple App Store and run the installer from inside the VM.

philphirn commented 3 years ago

Ok thanks @myspaghetti .

Based on the above answer I've 2 more questions :

And if possible can you show me how to skip the download part of script ? Because my version of the Catalina install files is little bit old. So will new ones will be downloaded ?

myspaghetti commented 3 years ago
./macos-guest-virtualbox.sh prompt_delete_existing_vm create_vm configure_vm populate_basesystem_virtual_disk create_bootable_installer_virtual_disk populate_bootable_installer_virtual_disk

Make sure you edit the script variables at the top of the script so vm_name is different from the VM you want to keep so it doesn't delete it.

philphirn commented 3 years ago

@myspaghetti thank you so much.

One more thing the script is amazing. I'll try all the steps you mentioned tomorrow (I don't have access to the system right now) and update here.

Till then you can close this if you want.

philphirn commented 3 years ago

@myspaghetti got back from work. Tested the thing out.

At the first time I just copy pasted the command but this used to fail at the last stage saying that Failed to attach viso .

Then I realised you'd probably forgot to add the create_viso... (smth like that) argument which creates the viso file.

After running with the argument. The script fails at the population stage wherein it copies and reassembles InstallESD.dmg file. Then I realised (again 😅) that the part of the script which splits InstallESD did not ran at all . Now when I get back again I've to do this.

But one more thing , that splitting part is in the download part(function) which I don't want to run.

So should I run that manually or what should I do ?

Failure Image

myspaghetti commented 3 years ago

Sorry about the VISO and the file-splitting thing, I assumed all the files were already in place. You can split the InstallESD file with the following command:

split --verbose -a 2 -d -b 1000000000 "Catalina_InstallESDDmg.pkg" "Catalina_InstallESD.part"

Then generate the VISO (or manually edit it) and then the stages above can run. Sorry again.

philphirn commented 3 years ago

Ah thanks 👍. No need to be sorry.

I did whatever was required including what you said then the final result is the image below. Now the question is how can I use it to upgrade the VM ? And secondly the virtual disk on which high Sierra is installed is of smaller size which might not be enough for Catalina . So is there any fix for that ?

Final Result

myspaghetti commented 3 years ago

"Reinstall macOS" will install Catalina, but the command-line installer is more reliable. You can increase the virtual disk image size as described in the documentation section "Storage size":

The script by default assigns a target virtual disk storage size of 80GB, which is populated to about 25GB on the host on initial installation. After the installation is complete, the VDI storage size may be increased. First increase the virtual disk image size through VirtualBox Manager or VBoxManage, then in Terminal in the virtual machine execute the following command:

sudo diskutil repairDisk disk0

After it completes, open Disk Utility and delete the "Free space" partition so it allows the system APFS container to take up the available space, or if that fails, execute the following command:

sudo diskutil apfs resizeContainer disk1 0

Both Disk Utility and diskutil may fail and require successive resize attempts separated by virtual machine reboots.

philphirn commented 3 years ago

@myspaghetti successfully increased disk size.

Now only thing remaining is upgrade. One question : If I press reinstall macOS then won't be my previous data erased ??

And secondly what's the command line command for performing the upgrade ?

myspaghetti commented 3 years ago

And secondly what's the command line command for performing the upgrade ?

startosinstall (and the GUI) perform an upgrade by default unless erasing the target is specified. If you're unsure, make a copy of the .vdi before trying.

philphirn commented 3 years ago

@myspaghetti thanks it worked.

I used the GUI method to upgrade. It successfully upgraded my VM. The only problem I faced was that after shutting down my VM , VirtualBox showed that the VM is inaccessible as it's unable to attach bootable installer which is already attached. The Fix for this is to manually edit the .vbox file with any text editor and remove the lines containing the bootable installer under <AttachedDevices> and <DeviceRegistry> . Just writing this here so if anyone encounters such problem, they can refer this.

Also I've a suggestion for you, why don't you enable GitHub Discussions for this repo so that people can ask questions like this there and issues remains solely for addressing issues with the script ?

Success

myspaghetti commented 3 years ago

The answer is kind of rude - I don't want non-issue discussions. People are spreading misinformation (in particular about CPU Profile / CPUID settings) that they've read on other sites and the more it's repeated the more Google spreads it.

The odd general question is fine, but a discussion forum would largely be unmoderated and a breeding ground for misinformation. With technical issues, I feel it's better to have authoritative answers rather than a bunch of wrong answers and "Google it" and "have you tried turning it off and on again?"

philphirn commented 3 years ago

@myspaghetti ah I understand.

I've 2 more general questions :

myspaghetti commented 3 years ago
philphirn commented 3 years ago

@myspaghetti Thanks 👍 I read the documentation regarding NVRAM & EFI values and everything is clear save one which I want to ask.

My Real MacBook Air doesn't print Apple ROM Info for which you have written in docs that it's ok. But it prints the boot ROM Info in the format given below :

Boot ROM Version: XXXX.XX.XX.X.X (iBridge: XX.XX.XXXXX.X.X,X) where X represents any number between 0-9.

Now my questions :

1) Does iBridge mean Apple ROM ?

For my 2nd & 3rd question I want you to refer the snippet of your script below :

...
DmiBIOSVersion="string:MBP7.89"      # Boot ROM Version
DmiOEMVBoxVer="string:1"             # Apple ROM Info - left of the first dot
DmiOEMVBoxRev="string:.23.45.6"      # Apple ROM Info - first dot and onward
...

2) In these 3 parameters, you have used a string: thing. So should I remove that string: or not ?

3) If iBridge means Apple ROM Info than how should I assign the values ? If you could give an example. If iBridge doesn't mean Apple ROM Info than what should be done with those two variables ? Should we assign the default value ?

Thanks for the help

myspaghetti commented 3 years ago

Does iBridge mean Apple ROM ?

I don't know but it doesn't get checked when logging in to iCloud or iMessage etc. When registering an account, more NVRAM, EFI, and SMC values are queried, so registering requires a full Mac-like set of values that can be provided by OpenCore. The values provided by the script are only sufficient for logging in to an existing account.

should I remove that string: or not ?

Keep it, otherwise VirtualBox might interpret the string as an int or float or something crazy.

If iBridge means Apple ROM Info than how should I assign the values ?

Most likely it's not necessary and not checked when logging in to iCloud or iMessage etc. If you really want to assign each and every EFI and NVRAM and SMC value to mirror your genuine Mac you'll need OpenCore, but that's overkill if you just want to log in to an existing iCloud account.