I am an old man in my 90s. My great grandkids used linux of some type on my iMac and I can no longer boot into BigSur. None of the various "key presses" work. Someone told me to download rEFIND and use it. I have downloaded it, read some of the guide on HTML and the readme.txt file but have no idea how to get the file onto a flash drive. I formatted the flash drive (I'm on an old MacBook (2014) and have unzipped the downloaded file but am not very familiar with the terminal. The flash drive appears in disk utility as "4s1". I have tried several times with various commands as seen in the docs but no success. Any help to get this done and hopefully get to a screen on the iMac where I can do a restore from my backup will be greatly appreciated.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
First, I'm not a mac user, but I've tinkered with it, and since it's been a few hours since you posted and no one else has responded, I'll try to help.
I'm not sure what "key presses" you've tried, but if you've tried Command + R while restarting the iMac and that hasn't worked, then creating a bootable USB stick with rEFInd probably won't help. That's because Command + R is the mechanism you need to boot that USB stick. Command + R should also allow you to boot from your backup, too. So, if you aren't sure what I mean by Command + R, maybe this link will help: https://support.apple.com/en-us/HT201255
If you still need to create a bootable USB stick with rEFInd, I think you may be stuck at this point in the README-flashdrive.txt file:
"To use this disk image, you must copy it to a USB flash drive or similar
medium. Under Linux or Mac OS X, you can do this with dd as root, as in:
There's a lot to unpack for someone who isn't familiar with the terminal. First you need to become the root user in a terminal. Hopefully this link will help you do that on your MacBook: https://support.apple.com/en-us/HT204012
Once you've logged in as the root user, you need to use the terminal to "cd" (change directory) to the location where you have unzipped the download from sourceforge.net. You also need to know the correct device name for the USD stick to use as the of= parameter. It isn't /dev/sdx and I don't know enough about macOS to help with that detail.
Let us know if this helps you get further or if you're still stuck.
You could also ask your great-grandkids for help, too! They created this mess. Maybe there's something simple they forgot to do to restore the iMac to the way you like it.
Hope this helps
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Many, many thanks for your kindness. One can hardly believe that I used to be the "go to" guru at the community where I live ... but memory is something that just slips away. I didn't think I'd ever forget how to get around in a terminal session but it is all gone from my memory now.
The kids have no idea what they did except that one said "I have a USB stick that will do anything" and when they left here I discovered my dilemna.
I have tried the Apple commands "Command R"'; "Option"; "D"; all the others that I could find on the Apple site. All I get is a message on screen that begins "GNU GRUB version 2.04" and continues about using "TAB" in the BASH shell.
I don't know if a rEFIND flash drive will work but I feel I must try it before lugging this 27" iMac to a repair facility. I can use my MacBook to try that and you are correct that I am stuck at the point in the readme text file that mentions using the terminal.
I did use the terminal, without success. As root (sudo) I used the command as indicated but now realize the error I kept getting "unknown (something) may have been because I was using the identity of the flash drive as "4s1". I have no idea what that identity should be.
If I get no further help today that enables me to make a bootable rEFIND flash drive, I'll try to do the repair facility tomorrow. In the meantime I'll rely on this 9 year old MacBook.
Again, my thanks for your effort.
I should add: I did not use the (version) - 0.13.3.1 - in the command I tried in Terminal. So there are 2 items in the command I SHOULD USE that are probably causing my failure to get the result desired.
Last edit: Don MacDonald 2022-05-22
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If your iMac is newish, it might be what the first link I sent: https://support.apple.com/en-us/HT204012
refers to as a Mac with Apple silicon. In that case, you want to follow the "On a Mac with Apple silicon" directions. I.e. hold down (don't release) the power button when you turn it on.
Since you see "GNU GRUB version 2.04", I suspect your great-grandkids somehow managed to install the GRUB bootloader on your iMac's drive. This suggests to me that you are going to need to get into the iMac's recovery mode somehow and reinstall.
I know, not much help, but it's the best I've got. My experience with macs dates back 5-10 years when I upgraded the hard drive to a larger ssd on a family member's laptop.
I really hope someone more knowledgeable with macs chimes in.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I thank you again for your help, encouragement and concern. I also hope someone else will be able to help. My iMac is not Apple silicon. It has been a great machine for me but it is about 6 years old but able to run BigSur (MacOS 11.6). I do have Time Machine backups so it is mainly the inconvenience of not having my current stuff available. The MacBook has been tucked away for just such an occasion as this but it is not up-to-date with addresses and other things that I do not put in the cloud. I'll linger here, perhaps until Tuesday in hopes of someone who can help.
The version of rEFIND I downloaded was a zip file and as far as I can tell did not contain an image file. Unzippped it is just a folder with multiple folders and files. If someone can tell me just what command to enter I can probably make the flash drive on the MacBook. I'll also search the web for the command "dd" to learn its capabilities. Thanks again.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I did some more research on this and I think I can offer some more help.
First, it sounds like you might not have downloaded the right file. There are more than one to choose from for a given release of refind. They are described here: https://www.rodsbooks.com/refind/getting.html
When you unzip it, its contents should go into a folder (aka directory) named:
refind-flashdrive-0.13.3.1
That folder/directory should have these files in it:
COPYING.txt
CREDITS.txt
LICENSE.txt
NEWS.txt
README-flashdrive.txt
refind-flashdrive-0.13.3.1.img
SHELLS.txt
The USB image is the one with the .img extension:
refind-flashdrive-0.13.3.1.img
And, that's the value you need for the if= (input file) part of the dd command.
If you only have one hard drive in you macbook, there's a good chance the USB drive's device name will be /dev/disk2. So, once you've verified that with the help of the blog post, you need to make sure none of the file systems on the stick are mounted with the command:
sudo diskutil unmountDisk /dev/disk2
Then use the cd (change directory) command to get to the directory where you unzipped the files. Verify the .img file is there with the "ls" (list) command.
Now you should be ready for the dd command:
sudo dd if=refind-flashdrive-0.13.3.1.img of=/dev/disk2
You should now have a bootable USB stick. I suggest testing it on your macbook to make sure it really is bootable. You don't want to install refind on your macbook, just verify that the USB stick is bootable. And maybe play with it to see if you can use it to boot into the macbook.
Does your iMac have a wired Apple USB keyboard? When you hear the boot chime, hold down the option key and don't let go until you see the boot menu. One of the options should be macOS, unless it's been erased.
Hello everyone... Got it started! Here's what happened.
The problem, as mentioned by faginbagin, was the GRUB bootloader installed by Linux when the kids were using it. But I think the real problem, which I couldn't solve by myself, began about a week before. I was working at the iMac, in Pages if I remember correctly, and my Magic Keyboard suddenly began to go wild with characters. That is, what was printed on the page was not what I had typed. It was a complete jumble. I checked, disconnected and reconnected the Bluetooth connection and charge level. All seemed OK but I was not able to type with keyboard. The only replacement I had was an old Mac USB keyboard which worked.
The Apple tech came to the apartment today. One of the first things he did was disconnect everything including the keyboard. He then connected his own USB keyboard and Mouse, pressed "Command + R" and it worked. He then closed it down, restarted with the "Option" key and we got the normal choices of bootable drives. He chose the iMac drive (I have 2) I specified and it booted without a hitch.
Obviously, the old keyboard worked for typing but the iMac would not respond to the action of the Command or Option keys when try to boot using them. So, I'll find a new keyboard.
After the tech left I decided to restart the computer using the Option key, which I have done on many occasions. I noticed not 2 but 3 bootable options. My main drive, a 2nd internal drive and a 3rd drive labeled "EFI Boot". I suspect, since I cannot find a trace of a Linux install, that "EFI" is a remnant of whatever the great grandkids used and is useless. The technician didn't mention it. Only 2 drives are shown in the "Startup Disk" tab of System Preferences.
I'd be interested in knowing what that is and how, if possible, to get rid of it. But the machine is working well, no changes of any kind that I can find.
Many sincere thanks to each of you. I have made note of the referenced URLs posted. joevt is correct, one needs a keyboard that allows the boot keys to work. I'll make sure I have a working USB keyboard in a closet.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
About the keyboard - I know my Power Mac G5 doesn't accept keys from a USB 2.0 keyboard. It has to be a USB 1.1 keyboard. I don't think your newer iMac should have that problem though.
About boot stuff:
EFI Boot is where the Linux booter is located (on a EFI partition). Maybe just leave it?
Linux itself may be on a partition that is not mounted by macOS.
The Startup Disk preferences panel does not list Linux or EFI partitions. Just macOS and Windows. rEFInd or RefindPlus can list most things.
View all the partitions: diskutil list
If there's a Linux partition, You'll want to see how large it is. For example, one drive on my Mac Pro 2008:
The partition name does not necessarily match the file system volume name.
You can mount the EFI partition: sudo diskutil mount EFI
If you have more than one EFI partition, then you can mount a specific one: sudo diskutil mount disk0s1
In that case, you may want to rename each EFI partition so it indicates which drive it belongs to. For example, my iMac 2013 has a SATA drive and an NVMe drive, so I rename the EFI partitions to EFISATA and EFINVME.
You can paste an icon onto the EFI volume's Get Info window to give it a custom icon. rEFInd has many icons you can copy from. Choose one for type of Linux that is installed.
Depending on the model year of the iMac, you may be able to change the name that is shown in the Startup Manager (when you hold option key at boot) from "EFI Boot" to something else (works for my iMac 2013). I create a two-line label with the name of the OS on the first line and the version of the OS on the second line using the makemultilinedisklabel command from my DiskUtil.sh script at https://gist.github.com/joevt/6d7a0ede45106345a39bdfa0ac10ffd6 makemultilinedisklabel "/Volumes/EFISATA/EFI/BOOT" "Ubuntu"$'\n'"22.04 LTS"
The folder specified in the command is the location of the default efi booter for an EFI partition named EFISATA. macOS efi booters on APFS and HFS+ partitions are in a folder named "/System/Library/CoreServices/".
Disk label files and volume icon files are invisible. You can show or hide invisible files in the Finder by pressing Command-Shift-Period.
If you want to remove linux, Disk Utility.app may be able to remove a Linux partition. I like using iPartition.app https://coriolis-systems.com (but don't use it on APFS partitions). In the EFI partition, you can delete the /EFI/BOOT/BOOTX64.efi file - make sure it matches, by size in bytes at least, one of the efi files in the /EFI/BOOT/Linux folder where Linux is the name of the Linux distribution, for exampe "Ubuntu". By matching the size in bytes, you can ensure you are removing the correct BootX64.efi instead of the one meant for rEFInd or Clover or OpenCore or Windows.
If you just remove the bootx64.efi file and none of the /EFI/BOOT/Linux files, you'll stop EFI Boot from appearing in the Startup Manager (when you hold Option key at boot), but the other files (one of them is grub) can still be booted by rEFInd.
In my Ubuntu installation, the /EFI/BOOT/BOOTX64.efi matches the /EFI/ubuntu/shimx64.efi file. Booting either one of those files will boot the /EFI/ubuntu/grubx64.efi file.
rEFInd can boot any of those, or it can skip them and boot the linux kernel directly.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
joevt ... that is a lot of information that I, as a 92 year old, have a bit of difficulty following. That is probably not quite right, I follow the reasoning but please don't ask me tomorrow to explain any of it. But thank you for taking the time to detail what is where and where the "EFI Boot" may be located. I am not at all sure that I should try. It will depend on the actions I encounter on booting and re-booting.
As you will be able to see from the data listed below I have not yet reached any conclusions about anything regarding the EFI Boot that appears as a 3rd option in the "Option" boot sequence. I have 2 physical hard drives in this 2014 iMac27. I disassembled the machine a few years ago and installed the drive ID'ed as "PCIe1TBSSD" (1GB NVME) in place of the small NVME, removed the 5400RPM Fusion drive and installed a second hard drive on which I loaded Mojave. The PCIE1TB drive containing BigSur is identified as "disk0" with Container disk2 (BigSur) while the Mojave one is "disk1" with container disk3. The 2 physical drives are identified as "disk0" and "disk1" then the container are disk 2 and 3 respectively. Sorry, I don't know how to properly "Format" the following screen copy.
Last login: Mon May 23 19:48:00 on ttys000
donmac27 in ~ λ diskutil list
/dev/disk0 (internal, physical):
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *960.2 GB disk0
1: EFI EFI 209.7 MB disk0s1
2: Apple_APFS Container disk2 959.8 GB disk0s2
donmac27 in ~ λ sudo gpt -r show -l /dev/disk0
Password:
gpt show: unable to open device '/dev/disk0': Operation not permitted
donmac27 in ~ λ sudo gpt -r show -l /dev/disk1
Password:
start size index contents
0 1 PMBR
1 1 Pri GPT header
2 32 Pri GPT table
34 6
40 409600 1 GPT part - "EFI System Partition"
409640 1952853344 2 GPT part - ""
1953262984 262151
1953525135 32 Sec GPT table
1953525167 1 Sec GPT header
I did try to show any linux partitions using the gpt command but as you can see from the bottom section permission was denied for disk 0, disk1 is listed.
That's as far as I have gone. Your sysem is much more complicated than mine. I run my Linux Mint system in a Virtual Box so there would be nothing in diskutil on that.
Without having someone with your knowledge holding my hand, It would probably be better for me to let things go the way they are.
I do thank you very much for your effort and information. I did manage to get the rEFIND image onto a flash drive but have not attempted an install.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
diskutil list shows no linux partitions on your two disks, therefore there's no reason to keep the linux boot loader in the EFI partition.
Next thing to check is the contents of the EFI partitions. The following will mount the partitions, open them in the Finder, and list their contents in Terminal.app.
At a minimum, you can just move the bootx64.efi file from the /efi/boot folder to a new folder in the EFI partition if you don't want to delete it yet - just to verify that it solves the problem of "EFI Boot" appearing in the Startup Manager.
As for formatting, you can click the (?) button (Formatting Help) at the top right of your reply to see options. The "Preformatted Text" and "Code Highlighting" sections are most relevant. Click the Preview button to verify the formatting before submitting the reply. For large amounts of text, you can create a text file and zip it and add the zip file as an attachment to the post.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
diskutil list shows no linux partitions on your two disks, therefore
there's no reason to keep the linux boot loader in the EFI partition.
Next thing to check is the contents of the EFI partitions. The following
will mount the partitions, open them in the Finder, and list their contents
in Terminal.app.
sudo diskutil mount /dev/disk0s1sudo diskutil mount /dev/disk1s1open /Volumes/EFIfind /Volumes/EFI -exec stat -f "%9z %T %R" {} \;
At a minimum, you can just move the bootx64.efi file from the /efi/boot
folder to a new folder in the EFI partition if you don't want to delete it
yet - just to verify that it solves the problem of "EFI Boot" appearing in
the Startup Manager.
As for formatting, you can click the (?) button (Formatting Help) at the
top right of your reply to see options. The "Preformatted Text" and "Code
Highlighting" sections are most relevant. Click the Preview button to
verify the formatting before submitting the reply. For large amounts of
text, you can create a text file and zip it and add the zip file as an
attachment to the post.
The second EFI partition doesn't contain anything interesting - except I wonder what's in the bootlog and the Trashes folder? It's a very small bootlog (141 bytes). You can maybe view it's contents like this: cat "/Volumes/EFI 1/BOOTLOG"
In the first EFI partition, you can just delete the BOOT and Ubuntu folders. They all have the same date so they're all very likely related. Plus, you have no other OS on your iMac so they are not required. I don't think we need to look at the output of the find command (unless it shows something interesting in the Trashes folder?). Looking at the file sizes in Kilobytes, we can see that BOOTX64.efi probably matches shimx64.efi. You can use Get Info to view the sizes in bytes. Or compare the files use diff or compareing the checksums using md5 md5 /Volumes/EFI/BOOT/BOOTX64.EFI /Volumes/EFI/ubuntu/shimx64.efi
This is how efi boot loaders are usually setup - The boot folder contains the default BOOTX64.efi for the EFI partition which the firmware can find even if no boot nvram variables are set. The BOOTX64.EFI file is usually a copy of a efi file that is stored in a OS specific folder, in your case - the ubuntu folder's shimx64.efi. Windows will have something similar - and also rEFInd and OpenCore and Clover and other Linux distrubutions. If you had multiple boot loaders in the EFI partition, each would have their own folder and the BOOTX64.efi file in the BOOT folder would be a copy of a efi file from one of those other folders.
I'm not sure what kind of permissions problems you might have that would stop you from being able to move the BOOTX64.EFI file. Did you try moving it to the root of the EFI partition instead of the ubuntu folder? Or delete it since it is a copy (verify first) of the shimx64.efi file. But you can just delete the BOOT and ubuntu folders completely, like I already said, without worrying about them. Select them and drag them to the Trash or press Command-Delete.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I did look at the Bootlog files and there was nothing in them ... some "command not found" - 1. Slingshot:, 2. Disassociating:, 3. Booting: but nothing else.
I just moved the BOOTX64.EFI file into the ubuntu folder, did a shutdown and a reboot with the Option key and the EFI Boot icon is gone. I agree that as I looked at the BOOT and ubuntu folders I felt that they could probably be deleted without harm.
No extra permissions were asked for in moving the BOOTX64EFI file.
I have now moved the BOOT and ubuntu folders to the trash. Going to shut down and reboot just to check before posting this. Everything works smoothly. BOOT and ubuntu gone.
I'm sorry that my attachments were not what I had planned to show. Your directions are very clear and understandable. I have learned a lot about the "boot" actions and what they entail. I have saved copies of all this discussion so that I can refer to them. If the Lord leaves me here on earth for a while I trust I won't be having these types of computer issues but one never knows. I do know that I'll be careful who uses this one.
Thanks so much for your kind and willing assistance. All seems well.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am an old man in my 90s. My great grandkids used linux of some type on my iMac and I can no longer boot into BigSur. None of the various "key presses" work. Someone told me to download rEFIND and use it. I have downloaded it, read some of the guide on HTML and the readme.txt file but have no idea how to get the file onto a flash drive. I formatted the flash drive (I'm on an old MacBook (2014) and have unzipped the downloaded file but am not very familiar with the terminal. The flash drive appears in disk utility as "4s1". I have tried several times with various commands as seen in the docs but no success. Any help to get this done and hopefully get to a screen on the iMac where I can do a restore from my backup will be greatly appreciated.
First, I'm not a mac user, but I've tinkered with it, and since it's been a few hours since you posted and no one else has responded, I'll try to help.
I'm not sure what "key presses" you've tried, but if you've tried Command + R while restarting the iMac and that hasn't worked, then creating a bootable USB stick with rEFInd probably won't help. That's because Command + R is the mechanism you need to boot that USB stick. Command + R should also allow you to boot from your backup, too. So, if you aren't sure what I mean by Command + R, maybe this link will help:
https://support.apple.com/en-us/HT201255
If you still need to create a bootable USB stick with rEFInd, I think you may be stuck at this point in the README-flashdrive.txt file:
"To use this disk image, you must copy it to a USB flash drive or similar
medium. Under Linux or Mac OS X, you can do this with dd as root, as in:
dd if=refind-flashdrive-{version}.img of=/dev/sdx"
There's a lot to unpack for someone who isn't familiar with the terminal. First you need to become the root user in a terminal. Hopefully this link will help you do that on your MacBook:
https://support.apple.com/en-us/HT204012
Once you've logged in as the root user, you need to use the terminal to "cd" (change directory) to the location where you have unzipped the download from sourceforge.net. You also need to know the correct device name for the USD stick to use as the of= parameter. It isn't /dev/sdx and I don't know enough about macOS to help with that detail.
Let us know if this helps you get further or if you're still stuck.
You could also ask your great-grandkids for help, too! They created this mess. Maybe there's something simple they forgot to do to restore the iMac to the way you like it.
Hope this helps
Many, many thanks for your kindness. One can hardly believe that I used to be the "go to" guru at the community where I live ... but memory is something that just slips away. I didn't think I'd ever forget how to get around in a terminal session but it is all gone from my memory now.
The kids have no idea what they did except that one said "I have a USB stick that will do anything" and when they left here I discovered my dilemna.
I have tried the Apple commands "Command R"'; "Option"; "D"; all the others that I could find on the Apple site. All I get is a message on screen that begins "GNU GRUB version 2.04" and continues about using "TAB" in the BASH shell.
I don't know if a rEFIND flash drive will work but I feel I must try it before lugging this 27" iMac to a repair facility. I can use my MacBook to try that and you are correct that I am stuck at the point in the readme text file that mentions using the terminal.
I did use the terminal, without success. As root (sudo) I used the command as indicated but now realize the error I kept getting "unknown (something) may have been because I was using the identity of the flash drive as "4s1". I have no idea what that identity should be.
If I get no further help today that enables me to make a bootable rEFIND flash drive, I'll try to do the repair facility tomorrow. In the meantime I'll rely on this 9 year old MacBook.
Again, my thanks for your effort.
I should add: I did not use the (version) - 0.13.3.1 - in the command I tried in Terminal. So there are 2 items in the command I SHOULD USE that are probably causing my failure to get the result desired.
Last edit: Don MacDonald 2022-05-22
A couple of thoughts:
If your iMac is newish, it might be what the first link I sent:
https://support.apple.com/en-us/HT204012
refers to as a Mac with Apple silicon. In that case, you want to follow the "On a Mac with Apple silicon" directions. I.e. hold down (don't release) the power button when you turn it on.
Since you see "GNU GRUB version 2.04", I suspect your great-grandkids somehow managed to install the GRUB bootloader on your iMac's drive. This suggests to me that you are going to need to get into the iMac's recovery mode somehow and reinstall.
I know, not much help, but it's the best I've got. My experience with macs dates back 5-10 years when I upgraded the hard drive to a larger ssd on a family member's laptop.
I really hope someone more knowledgeable with macs chimes in.
I thank you again for your help, encouragement and concern. I also hope someone else will be able to help. My iMac is not Apple silicon. It has been a great machine for me but it is about 6 years old but able to run BigSur (MacOS 11.6). I do have Time Machine backups so it is mainly the inconvenience of not having my current stuff available. The MacBook has been tucked away for just such an occasion as this but it is not up-to-date with addresses and other things that I do not put in the cloud. I'll linger here, perhaps until Tuesday in hopes of someone who can help.
The version of rEFIND I downloaded was a zip file and as far as I can tell did not contain an image file. Unzippped it is just a folder with multiple folders and files. If someone can tell me just what command to enter I can probably make the flash drive on the MacBook. I'll also search the web for the command "dd" to learn its capabilities. Thanks again.
I did some more research on this and I think I can offer some more help.
First, it sounds like you might not have downloaded the right file. There are more than one to choose from for a given release of refind. They are described here:
https://www.rodsbooks.com/refind/getting.html
You want the link for "A USB flash drive image file", which is:
http://sourceforge.net/projects/refind/files/0.13.3.1/refind-flashdrive-0.13.3.1.zip/download
When you download this zip file, it should be named:
refind-flashdrive-0.13.3.1.zip
When you unzip it, its contents should go into a folder (aka directory) named:
refind-flashdrive-0.13.3.1
That folder/directory should have these files in it:
COPYING.txt
CREDITS.txt
LICENSE.txt
NEWS.txt
README-flashdrive.txt
refind-flashdrive-0.13.3.1.img
SHELLS.txt
The USB image is the one with the .img extension:
refind-flashdrive-0.13.3.1.img
And, that's the value you need for the if= (input file) part of the dd command.
Second, you need to figure out the device name for the USB stick. I think this link should help:
https://www.lewan.com/blog/2012/02/10/making-a-bootable-usb-stick-on-an-apple-mac-os-x-from-an-iso
Note that the blog post is 10 years old, but AFAICT it's still accurate, although maybe not step 3. Don't worry about step 3, you already have the image file. I think the man page for diskutil will also help to explain how each command outlined in the blog post works.
https://ss64.com/osx/diskutil.html
If you only have one hard drive in you macbook, there's a good chance the USB drive's device name will be /dev/disk2. So, once you've verified that with the help of the blog post, you need to make sure none of the file systems on the stick are mounted with the command:
sudo diskutil unmountDisk /dev/disk2
Then use the cd (change directory) command to get to the directory where you unzipped the files. Verify the .img file is there with the "ls" (list) command.
Now you should be ready for the dd command:
sudo dd if=refind-flashdrive-0.13.3.1.img of=/dev/disk2
You should now have a bootable USB stick. I suggest testing it on your macbook to make sure it really is bootable. You don't want to install refind on your macbook, just verify that the USB stick is bootable. And maybe play with it to see if you can use it to boot into the macbook.
And if you haven't already, I suggest you familiarize yourself with the documentation at:
https://www.rodsbooks.com/refind/
Does your iMac have a wired Apple USB keyboard? When you hear the boot chime, hold down the option key and don't let go until you see the boot menu. One of the options should be macOS, unless it's been erased.
You could try booting the iMac into target disk mode, then use the MacBook to examine the contents of the iMac's drive.
https://support.apple.com/en-ca/guide/mac-help/mchlp1443/mac
In either case, you need a keyboard that allows the boot keys to work.
What model iMac and MacBook do you have?
Sounds like a boot coup by Linux/Grub .
See https://www.rodsbooks.com/refind/bootcoup.html for how to stage a counter coup
Hello everyone... Got it started! Here's what happened.
The problem, as mentioned by faginbagin, was the GRUB bootloader installed by Linux when the kids were using it. But I think the real problem, which I couldn't solve by myself, began about a week before. I was working at the iMac, in Pages if I remember correctly, and my Magic Keyboard suddenly began to go wild with characters. That is, what was printed on the page was not what I had typed. It was a complete jumble. I checked, disconnected and reconnected the Bluetooth connection and charge level. All seemed OK but I was not able to type with keyboard. The only replacement I had was an old Mac USB keyboard which worked.
The Apple tech came to the apartment today. One of the first things he did was disconnect everything including the keyboard. He then connected his own USB keyboard and Mouse, pressed "Command + R" and it worked. He then closed it down, restarted with the "Option" key and we got the normal choices of bootable drives. He chose the iMac drive (I have 2) I specified and it booted without a hitch.
Obviously, the old keyboard worked for typing but the iMac would not respond to the action of the Command or Option keys when try to boot using them. So, I'll find a new keyboard.
After the tech left I decided to restart the computer using the Option key, which I have done on many occasions. I noticed not 2 but 3 bootable options. My main drive, a 2nd internal drive and a 3rd drive labeled "EFI Boot". I suspect, since I cannot find a trace of a Linux install, that "EFI" is a remnant of whatever the great grandkids used and is useless. The technician didn't mention it. Only 2 drives are shown in the "Startup Disk" tab of System Preferences.
I'd be interested in knowing what that is and how, if possible, to get rid of it. But the machine is working well, no changes of any kind that I can find.
Many sincere thanks to each of you. I have made note of the referenced URLs posted. joevt is correct, one needs a keyboard that allows the boot keys to work. I'll make sure I have a working USB keyboard in a closet.
About the keyboard - I know my Power Mac G5 doesn't accept keys from a USB 2.0 keyboard. It has to be a USB 1.1 keyboard. I don't think your newer iMac should have that problem though.
About boot stuff:
EFI Boot is where the Linux booter is located (on a EFI partition). Maybe just leave it?
Linux itself may be on a partition that is not mounted by macOS.
The Startup Disk preferences panel does not list Linux or EFI partitions. Just macOS and Windows. rEFInd or RefindPlus can list most things.
View all the partitions:
diskutil list
If there's a Linux partition, You'll want to see how large it is. For example, one drive on my Mac Pro 2008:
The linux partitions may have a name that you can see using the
gpt
command:gpt -r show -l /dev/disk0
For my disk:
The partition name does not necessarily match the file system volume name.
You can mount the EFI partition:
sudo diskutil mount EFI
If you have more than one EFI partition, then you can mount a specific one:
sudo diskutil mount disk0s1
In that case, you may want to rename each EFI partition so it indicates which drive it belongs to. For example, my iMac 2013 has a SATA drive and an NVMe drive, so I rename the EFI partitions to
EFISATA
andEFINVME
.You can paste an icon onto the EFI volume's Get Info window to give it a custom icon. rEFInd has many icons you can copy from. Choose one for type of Linux that is installed.
Depending on the model year of the iMac, you may be able to change the name that is shown in the Startup Manager (when you hold option key at boot) from "EFI Boot" to something else (works for my iMac 2013). I create a two-line label with the name of the OS on the first line and the version of the OS on the second line using the
makemultilinedisklabel
command from my DiskUtil.sh script at https://gist.github.com/joevt/6d7a0ede45106345a39bdfa0ac10ffd6makemultilinedisklabel "/Volumes/EFISATA/EFI/BOOT" "Ubuntu"$'\n'"22.04 LTS"
The folder specified in the command is the location of the default efi booter for an EFI partition named
EFISATA
. macOS efi booters on APFS and HFS+ partitions are in a folder named "/System/Library/CoreServices/".Disk label files and volume icon files are invisible. You can show or hide invisible files in the Finder by pressing Command-Shift-Period.
If you want to remove linux, Disk Utility.app may be able to remove a Linux partition. I like using iPartition.app https://coriolis-systems.com (but don't use it on APFS partitions). In the EFI partition, you can delete the /EFI/BOOT/BOOTX64.efi file - make sure it matches, by size in bytes at least, one of the efi files in the /EFI/BOOT/Linux folder where Linux is the name of the Linux distribution, for exampe "Ubuntu". By matching the size in bytes, you can ensure you are removing the correct BootX64.efi instead of the one meant for rEFInd or Clover or OpenCore or Windows.
If you just remove the bootx64.efi file and none of the /EFI/BOOT/Linux files, you'll stop
EFI Boot
from appearing in the Startup Manager (when you hold Option key at boot), but the other files (one of them is grub) can still be booted by rEFInd.In my Ubuntu installation, the /EFI/BOOT/BOOTX64.efi matches the /EFI/ubuntu/shimx64.efi file. Booting either one of those files will boot the /EFI/ubuntu/grubx64.efi file.
rEFInd can boot any of those, or it can skip them and boot the linux kernel directly.
joevt ... that is a lot of information that I, as a 92 year old, have a bit of difficulty following. That is probably not quite right, I follow the reasoning but please don't ask me tomorrow to explain any of it. But thank you for taking the time to detail what is where and where the "EFI Boot" may be located. I am not at all sure that I should try. It will depend on the actions I encounter on booting and re-booting.
As you will be able to see from the data listed below I have not yet reached any conclusions about anything regarding the EFI Boot that appears as a 3rd option in the "Option" boot sequence. I have 2 physical hard drives in this 2014 iMac27. I disassembled the machine a few years ago and installed the drive ID'ed as "PCIe1TBSSD" (1GB NVME) in place of the small NVME, removed the 5400RPM Fusion drive and installed a second hard drive on which I loaded Mojave. The PCIE1TB drive containing BigSur is identified as "disk0" with Container disk2 (BigSur) while the Mojave one is "disk1" with container disk3. The 2 physical drives are identified as "disk0" and "disk1" then the container are disk 2 and 3 respectively. Sorry, I don't know how to properly "Format" the following screen copy.
Last login: Mon May 23 19:48:00 on ttys000
donmac27 in ~ λ diskutil list
/dev/disk0 (internal, physical):
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *960.2 GB disk0
1: EFI EFI 209.7 MB disk0s1
2: Apple_APFS Container disk2 959.8 GB disk0s2
/dev/disk1 (internal, physical):
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *1.0 TB disk1
1: EFI EFI 209.7 MB disk1s1
2: Apple_APFS Container disk3 999.9 GB disk1s2
/dev/disk2 (synthesized):
#: TYPE NAME SIZE IDENTIFIER
0: APFS Container Scheme - +959.8 GB disk2
Physical Store disk0s2
1: APFS Volume PCIe1TBSSD - Data 715.0 GB disk2s1
2: APFS Volume Preboot 341.3 MB disk2s2
3: APFS Volume Recovery 623.5 MB disk2s3
4: APFS Volume VM 2.1 GB disk2s4
5: APFS Volume PCIe1TBSSD 15.3 GB disk2s5
6: APFS Snapshot com.apple.os.update-... 15.3 GB disk2s5s1
/dev/disk3 (synthesized):
#: TYPE NAME SIZE IDENTIFIER
0: APFS Container Scheme - +999.9 GB disk3
Physical Store disk1s2
1: APFS Volume QVO860 - Data 18.9 GB disk3s1
2: APFS Volume Preboot 45.2 MB disk3s2
3: APFS Volume Recovery 510.4 MB disk3s3
4: APFS Volume VM 2.1 GB disk3s4
5: APFS Volume QVO860Mojave 31.7 GB disk3s5
donmac27 in ~ λ sudo gpt -r show -l /dev/disk0
Password:
gpt show: unable to open device '/dev/disk0': Operation not permitted
donmac27 in ~ λ sudo gpt -r show -l /dev/disk1
Password:
start size index contents
0 1 PMBR
1 1 Pri GPT header
2 32 Pri GPT table
34 6
40 409600 1 GPT part - "EFI System Partition"
409640 1952853344 2 GPT part - ""
1953262984 262151
1953525135 32 Sec GPT table
1953525167 1 Sec GPT header
I did try to show any linux partitions using the gpt command but as you can see from the bottom section permission was denied for disk 0, disk1 is listed.
That's as far as I have gone. Your sysem is much more complicated than mine. I run my Linux Mint system in a Virtual Box so there would be nothing in diskutil on that.
Without having someone with your knowledge holding my hand, It would probably be better for me to let things go the way they are.
I do thank you very much for your effort and information. I did manage to get the rEFIND image onto a flash drive but have not attempted an install.
diskutil list
shows no linux partitions on your two disks, therefore there's no reason to keep the linux boot loader in the EFI partition.Next thing to check is the contents of the EFI partitions. The following will mount the partitions, open them in the Finder, and list their contents in Terminal.app.
At a minimum, you can just move the bootx64.efi file from the /efi/boot folder to a new folder in the EFI partition if you don't want to delete it yet - just to verify that it solves the problem of "EFI Boot" appearing in the Startup Manager.
As for formatting, you can click the (?) button (Formatting Help) at the top right of your reply to see options. The "Preformatted Text" and "Code Highlighting" sections are most relevant. Click the Preview button to verify the formatting before submitting the reply. For large amounts of text, you can create a text file and zip it and add the zip file as an attachment to the post.
Many thanks for the explanations. I have attached a zipped pdf file with
screen shots. My question at the bottom relates to moving that boot file.
I hope I've done the correct thing with the attached file, hoping it will
open in this forum.
On Mon, May 23, 2022 at 11:46 PM joevt joevt@users.sourceforge.net wrote:
I should have included a screen shot of the results of the final "find" command you listed. Here it is.
The second EFI partition doesn't contain anything interesting - except I wonder what's in the bootlog and the Trashes folder? It's a very small bootlog (141 bytes). You can maybe view it's contents like this:
cat "/Volumes/EFI 1/BOOTLOG"
In the first EFI partition, you can just delete the
BOOT
andUbuntu
folders. They all have the same date so they're all very likely related. Plus, you have no other OS on your iMac so they are not required. I don't think we need to look at the output of the find command (unless it shows something interesting in the Trashes folder?). Looking at the file sizes in Kilobytes, we can see that BOOTX64.efi probably matches shimx64.efi. You can use Get Info to view the sizes in bytes. Or compare the files use diff or compareing the checksums using md5md5 /Volumes/EFI/BOOT/BOOTX64.EFI /Volumes/EFI/ubuntu/shimx64.efi
This is how efi boot loaders are usually setup - The boot folder contains the default BOOTX64.efi for the EFI partition which the firmware can find even if no boot nvram variables are set. The BOOTX64.EFI file is usually a copy of a efi file that is stored in a OS specific folder, in your case - the ubuntu folder's shimx64.efi. Windows will have something similar - and also rEFInd and OpenCore and Clover and other Linux distrubutions. If you had multiple boot loaders in the EFI partition, each would have their own folder and the BOOTX64.efi file in the BOOT folder would be a copy of a efi file from one of those other folders.
I'm not sure what kind of permissions problems you might have that would stop you from being able to move the BOOTX64.EFI file. Did you try moving it to the root of the EFI partition instead of the ubuntu folder? Or delete it since it is a copy (verify first) of the shimx64.efi file. But you can just delete the BOOT and ubuntu folders completely, like I already said, without worrying about them. Select them and drag them to the Trash or press Command-Delete.
I did look at the Bootlog files and there was nothing in them ... some "command not found" - 1. Slingshot:, 2. Disassociating:, 3. Booting: but nothing else.
I just moved the BOOTX64.EFI file into the ubuntu folder, did a shutdown and a reboot with the Option key and the EFI Boot icon is gone. I agree that as I looked at the BOOT and ubuntu folders I felt that they could probably be deleted without harm.
No extra permissions were asked for in moving the BOOTX64EFI file.
I have now moved the BOOT and ubuntu folders to the trash. Going to shut down and reboot just to check before posting this. Everything works smoothly. BOOT and ubuntu gone.
I'm sorry that my attachments were not what I had planned to show. Your directions are very clear and understandable. I have learned a lot about the "boot" actions and what they entail. I have saved copies of all this discussion so that I can refer to them. If the Lord leaves me here on earth for a while I trust I won't be having these types of computer issues but one never knows. I do know that I'll be careful who uses this one.
Thanks so much for your kind and willing assistance. All seems well.