alexsb92

Q: Repair bootcamp after installing Linux

Hi,

 

So prior to all this I had Windows 10 running in parallel with OS X which worked fine. I had to install Ubuntu though, so I shrank the OS X partition and proceeded to install Ubuntu. During that process I created two partitions (the main Ubuntu one and a swap). Anyway, once I was done with all this and wanted to go back to the Windows partition, Windows gave me error 0xc000000e. This seems to be related to the MBR and I've attempted to fix it by following the instructions in this thread https://discussions.apple.com/thread/4144252?start=0&tstart=0 but that didn't really work. I fully admit that I don't understand all that happened in that thread so I did just wrongly assume that it might work for me too.

 

Based on what was asked of the poster in the link above, i'm attaching the output to a couple of commands.

 

sudo gpt -r -vv show disk0

gpt show: disk0: mediasize=1000555581440; sectorsize=512; blocks=1954210120
gpt show: disk0: Suspicious MBR at sector 0
gpt show: disk0: Pri GPT at sector 1
gpt show: disk0: Sec GPT at sector 1954210119
       start        size  index  contents
           0           1         MBR
           1           1         Pri GPT header
           2          32         Pri GPT table
          34           6         
          40      409600      1  GPT part - C12A7328-F81F-11D2-BA4B-00A0C93EC93B
      409640  1078638336      2  GPT part - 53746F72-6167-11AA-AA11-00306543ECAC
  1079047976     1269536      3  GPT part - 426F6F74-0000-11AA-AA11-00306543ECAC
  1080317512         440         
  1080317952    32000000      4  GPT part - 0657FD6D-A4AB-43C4-84E5-0933C84B4F4F
  1112317952   259184640      7  GPT part - 0FC63DAF-8483-4772-8E79-3D69D8477DE4
  1371502592   581785600      5  GPT part - EBD0A0A2-B9E5-4433-87C0-68B6B72699C7
  1953288192      921600      6  GPT part - DE94BBA4-06D1-4D40-A16A-BFD50179D6AC
  1954209792         295         
  1954210087          32         Sec GPT table
  1954210119           1         Sec GPT header


sudo fdisk /dev/disk0

Disk: /dev/disk0 geometry: 121643/255/63 [1954210120 sectors]
Signature: 0xAA55
         Starting       Ending
 #: id  cyl  hd sec -  cyl  hd sec [     start -       size]
------------------------------------------------------------------------
 1: EE    0   0   2 - 1023 254  63 [         1 - 1371502591] <Unknown ID>
*2: 07 1023 254  63 - 1023 254  63 [1371502592 -  581785600] HPFS/QNX/AUX
 3: 00    0   0   0 -    0   0   0 [         0 -          0] unused      
 4: 00    0   0   0 -    0   0   0 [         0 -          0] unused     

This is the modified output after attempting the instructions in the link above. The original output (and I hope I didn't screw it up much) is below.

Disk: /dev/disk0 geometry: 121643/255/63 [1954210120 sectors]
Signature: 0xAA55
         Starting       Ending
 #: id  cyl  hd sec -  cyl  hd sec [     start -       size]
------------------------------------------------------------------------
 1: EE    0   0   1 - 1023 254  63 [         1 -     409639] <Unknown ID>
*2: DA 1023 254  63 - 1023 254  63 [    409640 - 1078638336] <Unknown ID>
 3: AF 1023 254  63 - 1023 254  63 [1079047976 -    1269536] HFS+        
 4: 82 1023 254  63 - 1023 254  63 [1080317952 -   32000000] Linux swap  

 

Anyone has any advice to help me get out of this? It will be very appreciated!

MacBook Pro with Retina display, OS X El Capitan (10.11.6)

Posted on Sep 13, 2016 8:04 PM

Close

Q: Repair bootcamp after installing Linux

  • All replies
  • Helpful answers

Page 1 Next
  • by Loner T,

    Loner T Loner T Sep 14, 2016 1:35 PM in response to alexsb92
    Level 7 (23,828 points)
    Safari
    Sep 14, 2016 1:35 PM in response to alexsb92

    That link is not valid for your specific issue. Please post the output of

     

    diskutil list

    diskutil cs list

  • by alexsb92,

    alexsb92 alexsb92 Sep 14, 2016 3:04 PM in response to Loner T
    Level 1 (4 points)
    Windows Software
    Sep 14, 2016 3:04 PM in response to Loner T

    Sure!

     

    Output of diskutil list

    /dev/disk0 (internal, physical):
      #:                      TYPE NAME                    SIZE      IDENTIFIER
      0:      GUID_partition_scheme                        *1.0 TB    disk0
      1:                        EFI EFI                    209.7 MB  disk0s1
      2:          Apple_CoreStorage Macintosh HD            552.3 GB  disk0s2
      3:                Apple_Boot Recovery HD            650.0 MB  disk0s3
      4:                Linux Swap                        16.4 GB    disk0s4
      5:      Microsoft Basic Data BOOTCAMP                297.9 GB  disk0s5
      6:          Windows Recovery                        471.9 MB  disk0s6
      7:          Linux Filesystem                        132.7 GB  disk0s7
    /dev/disk1 (internal, virtual):
      #:                      TYPE NAME                    SIZE      IDENTIFIER
      0:                  Apple_HFS Macintosh HD          +551.9 GB  disk1
                                    Logical Volume on disk0s2
                                    5F58921C-2303-43C7-BC94-7909F29C8F82
                                    Unlocked Encrypted
    


    Output of diskutil cs list

    CoreStorage logical volume groups (1 found)
    |
    +-- Logical Volume Group 8168B0C8-6F5C-4ED5-A192-963F7FC204B7
        =========================================================
        Name:        Macintosh HD
        Status:      Online
        Size:        552262828032 B (552.3 GB)
        Free Space:  393216 B (393.2 KB)
        |
        +-< Physical Volume 5A9B09F0-1671-45B6-B7CB-6EBE4D3CF859
        |  ----------------------------------------------------
        |  Index:    0
        |  Disk:    disk0s2
        |  Status:  Online
        |  Size:    552262828032 B (552.3 GB)
        |
        +-> Logical Volume Family B53CCE57-0E54-4C47-9FDB-5E62BE395D7C
            ----------------------------------------------------------
            Encryption Type:        AES-XTS
            Encryption Status:      Unlocked
            Conversion Status:      Complete
            High Level Queries:      Fully Secure
            |                        Passphrase Required
            |                        Accepts New Users
            |                        Has Visible Users
            |                        Has Volume Key
            |
            +-> Logical Volume 5F58921C-2303-43C7-BC94-7909F29C8F82
                ---------------------------------------------------
                Disk:                  disk1
                Status:                Online
                Size (Total):          551913259008 B (551.9 GB)
                Revertible:            Yes (unlock and decryption required)
                Revert Status:        Reboot required
                LV Name:              Macintosh HD
                Volume Name:          Macintosh HD
                Content Hint:          Apple_HFS
    

     

    Can't remember if I had mentioned it in my original post, but the windows error is 0xc000000e.

  • by Loner T,

    Loner T Loner T Sep 14, 2016 5:41 PM in response to alexsb92
    Level 7 (23,828 points)
    Safari
    Sep 14, 2016 5:41 PM in response to alexsb92

    Your MBR is incorrect. Was Linux installed using EFI Boot? What year/model is your Mac?

     

    Please post the output of

     

    sudo dd if=/dev/rdisk0s5 count=1 2>/dev/null | hexdump -C

  • by alexsb92,

    alexsb92 alexsb92 Sep 14, 2016 9:34 PM in response to Loner T
    Level 1 (4 points)
    Windows Software
    Sep 14, 2016 9:34 PM in response to Loner T

    Hey Loner T, thanks for the help.

     

    To be honest I'm not 100% sure. I followed the instructions posted here http://askubuntu.com/a/688692 by Rod Smith. Technically the only step I didn't do was "csrutil enable" at the very end.

     

    The Mac is a MacBook Pro (Retina, 15-inch, Mid 2014) running El Capitan 10.11.6.

     

    The output to the command is:

    00000000  eb 52 90 4e 54 46 53 20  20 20 20 00 02 08 00 00  |.R.NTFS    .....|
    00000010  00 00 00 00 00 f8 00 00  3f 00 ff 00 00 78 bf 51  |........?....x.Q|
    00000020  00 00 00 00 80 00 80 00  ff 57 ad 22 00 00 00 00  |.........W."....|
    00000030  00 00 0c 00 00 00 00 00  02 00 00 00 00 00 00 00  |................|
    00000040  f6 00 00 00 01 00 00 00  c0 18 5d 6a 4d 5d 6a 28  |..........]jM]j(|
    00000050  00 00 00 00 fa 33 c0 8e  d0 bc 00 7c fb 68 c0 07  |.....3.....|.h..|
    00000060  1f 1e 68 66 00 cb 88 16  0e 00 66 81 3e 03 00 4e  |..hf......f.>..N|
    00000070  54 46 53 75 15 b4 41 bb  aa 55 cd 13 72 0c 81 fb  |TFSu..A..U..r...|
    00000080  55 aa 75 06 f7 c1 01 00  75 03 e9 dd 00 1e 83 ec  |U.u.....u.......|
    00000090  18 68 1a 00 b4 48 8a 16  0e 00 8b f4 16 1f cd 13  |.h...H..........|
    000000a0  9f 83 c4 18 9e 58 1f 72  e1 3b 06 0b 00 75 db a3  |.....X.r.;...u..|
    000000b0  0f 00 c1 2e 0f 00 04 1e  5a 33 db b9 00 20 2b c8  |........Z3... +.|
    000000c0  66 ff 06 11 00 03 16 0f  00 8e c2 ff 06 16 00 e8  |f...............|
    000000d0  4b 00 2b c8 77 ef b8 00  bb cd 1a 66 23 c0 75 2d  |K.+.w......f#.u-|
    000000e0  66 81 fb 54 43 50 41 75  24 81 f9 02 01 72 1e 16  |f..TCPAu$....r..|
    000000f0  68 07 bb 16 68 52 11 16  68 09 00 66 53 66 53 66  |h...hR..h..fSfSf|
    00000100  55 16 16 16 68 b8 01 66  61 0e 07 cd 1a 33 c0 bf  |U...h..fa....3..|
    00000110  0a 13 b9 f6 0c fc f3 aa  e9 fe 01 90 90 66 60 1e  |.............f`.|
    00000120  06 66 a1 11 00 66 03 06  1c 00 1e 66 68 00 00 00  |.f...f.....fh...|
    00000130  00 66 50 06 53 68 01 00  68 10 00 b4 42 8a 16 0e  |.fP.Sh..h...B...|
    00000140  00 16 1f 8b f4 cd 13 66  59 5b 5a 66 59 66 59 1f  |.......fY[ZfYfY.|
    00000150  0f 82 16 00 66 ff 06 11  00 03 16 0f 00 8e c2 ff  |....f...........|
    00000160  0e 16 00 75 bc 07 1f 66  61 c3 a1 f6 01 e8 09 00  |...u...fa.......|
    00000170  a1 fa 01 e8 03 00 f4 eb  fd 8b f0 ac 3c 00 74 09  |............<.t.|
    00000180  b4 0e bb 07 00 cd 10 eb  f2 c3 0d 0a 41 20 64 69  |............A di|
    00000190  73 6b 20 72 65 61 64 20  65 72 72 6f 72 20 6f 63  |sk read error oc|
    000001a0  63 75 72 72 65 64 00 0d  0a 42 4f 4f 54 4d 47 52  |curred...BOOTMGR|
    000001b0  20 69 73 20 63 6f 6d 70  72 65 73 73 65 64 00 0d  | is compressed..|
    000001c0  0a 50 72 65 73 73 20 43  74 72 6c 2b 41 6c 74 2b  |.Press Ctrl+Alt+|
    000001d0  44 65 6c 20 74 6f 20 72  65 73 74 61 72 74 0d 0a  |Del to restart..|
    000001e0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
    000001f0  00 00 00 00 00 00 8a 01  a7 01 bf 01 00 00 55 aa  |..............U.|
    00000200
    

     

    Is that error the cause of my troubles?

     

    Alex

  • by Loner T,

    Loner T Loner T Sep 14, 2016 9:46 PM in response to alexsb92
    Level 7 (23,828 points)
    Safari
    Sep 14, 2016 9:46 PM in response to alexsb92

    The dd output is as expected. Your 2014 Mac is a UEFI Mac, which means you can install OSes using EFI, rather than using a Hybrid MBR.

     

    We need to see the MBR prior to Windows and Ubuntu, both. If your Windows installation was EFI, you do not need an MBR, which implies that Ubuntu was installed using an MBR. Your Rod Smith link also clearly mentions the same...

     

    Try to find one that's relatively recent. Also, be aware that it's possible to install Ubuntu in either BIOS/CSM/legacy mode or in EFI mode. The latter is almost always preferable, but a lot of guides (especially older ones) describe the former -- often without properly describing the difference. See this page of mine for basic information on what the Compatibility Support Module (CSM) is and why it's problematic. (That page is geared more towards UEFI-based PCs than Macs, but it's still pretty applicable.)

     

    On your specific model, both Ubuntu and Windows should be installed using EFI. If either is not installed using EFI, you will get an MBR which is fragile.

     

    If you can, I suggest removing both Ubuntu and Windows, and re-installing using EFI, and you will have a much better experience, without partitioning limitations.

  • by alexsb92,

    alexsb92 alexsb92 Sep 14, 2016 10:53 PM in response to Loner T
    Level 1 (4 points)
    Windows Software
    Sep 14, 2016 10:53 PM in response to Loner T

    Hmm I think I'm starting to understand some of this. And thank you for the help.

     

    Reinstalling both is definitely an option, but I'm wondering if there's any way I could keep the Windows just due to some of the software set up on it. My understanding is that Windows was installed in EFI mode, and it was the Ubuntu that wasn't which caused the messed up MBR. Is that correct? Even if this is the case, I'm not sure that getting rid of the ubuntu and fixing the Windows is technically possible.

     

    Also, when installing Ubuntu in EFI mode (whether after both it and Windows are removed or just the Ubuntu is removed), does the swap partition screw anything up, or would that be ok since the 4 partition limit only exists for MBR?

     

    Alex

  • by Loner T,

    Loner T Loner T Sep 15, 2016 5:58 AM in response to alexsb92
    Level 7 (23,828 points)
    Safari
    Sep 15, 2016 5:58 AM in response to alexsb92

    To verify if Windows was installed using EFI, without actually booting Windows is tricky, but Can't resize Macintosh HD partition is almost a 99% certainty test.

     

    If you use EFI/GPT, the four(4) entry limit on an MBR is removed, and you have a 128-partition GPT limit. If you choose to remove Windows, please try to use BC assistant first, but it may not work because of the current partition state. Otherwise, we need to use Time Machine and rebuild the internal disk.

  • by alexsb92,

    alexsb92 alexsb92 Sep 15, 2016 12:18 PM in response to Loner T
    Level 1 (4 points)
    Windows Software
    Sep 15, 2016 12:18 PM in response to Loner T

    I am able to resize my Mac Partition but I'm not sure how much that would help since for one thing I haven't used Time Machine. And then second, when using BC assistant, it tells me that "The startup disk cannot be partitioned or restored to a single partition." which means it doesn't even give me the option to Install or Remove Windows. To fix this, I imagine I need to delete the Bootcamp, the 132.7GB Untitled which is my Ubuntu, 16GB Untitled which is the swap. The 471MB is for Windows Recovery based on diskutil list, that should go as well? And then merge all that free space with the Mac partition? Following this process, do I have to also make sure to also get rid of the MBR and make the booting all EFI? Any pointer on where I could find some guide on doing that?

    Screen Shot 2016-09-15 at 3.12.01 PM.png

     

    If I proceed with installing Windows and then Ubuntu EFI, is there anything I have to keep in mind? For Ubuntu I was planning on following method a) mentioned here http://askubuntu.com/questions/395879/how-to-create-uefi-only-bootable-usb-live- media/ to make sure it will be installed in EFI mode. As far as Windows is concerned, based on what I've read on post-2013 models bootcamp automatically installs it in EFI mode. And that seems to be the case as in rEFInd the Windows option shows up as "Boot Windows from EFI boot" or something similar to that. I'll be checking to see if the current Ubuntu is in EFI mode but I image that's the one that is using BIOS and that led to the MBR.

  • by Loner T,

    Loner T Loner T Sep 15, 2016 12:29 PM in response to alexsb92
    Level 7 (23,828 points)
    Safari
    Sep 15, 2016 12:29 PM in response to alexsb92

    alexsb92 wrote:

     

    I am able to resize my Mac Partition but I'm not sure how much that would help since for one thing I haven't used Time Machine. And then second, when using BC assistant, it tells me that "The startup disk cannot be partitioned or restored to a single partition." which means it doesn't even give me the option to Install or Remove Windows. To fix this, I imagine I need to delete the Bootcamp, the 132.7GB Untitled which is my Ubuntu, 16GB Untitled which is the swap. The 471MB is for Windows Recovery based on diskutil list, that should go as well? And then merge all that free space with the Mac partition?

    This may be a simpler method using OS X Terminal.

     

    diskutil eraseVolume jhfs+ BC1 disk0s4

    diskutil eraseVolume jhfs+ BC2 disk0s5

    diskutil eraseVolume jhfs+ BC3 disk0s6

    diskutil eraseVolume jhfs+ BC4 disk0s7

    diskutil mergePartitions jhfs+ BCMP disk0s4 disk0s7

    diskutil eraseVolume fat32 BOOTCAMP disk0s4

     

    Now run BCA and remove Windows which will merge all the disk space back into OS X.

     

    Following this process, do I have to also make sure to also get rid of the MBR and make the booting all EFI? Any pointer on where I could find some guide on doing that?

     

    Create two partitions. Install Linux using EFI boot. Once Linux is installed, format the remaining second partition to Free Space and then use EFI boot to install Windows,  this Free Space will be split into MSR(FAT32) and MSD(NTFS). Test.

  • by alexsb92,

    alexsb92 alexsb92 Sep 15, 2016 12:30 PM in response to Loner T
    Level 1 (4 points)
    Windows Software
    Sep 15, 2016 12:30 PM in response to Loner T

    I logged in Ubuntu to double check what mode it's running in. Followed the instructions here https://help.ubuntu.com/community/UEFI#Identifying_if_the_computer_boots_the_HDD _in_UEFI_mode which meant running the following command  [ -d /sys/firmware/efi ] && echo "EFI boot on HDD" || echo "Legacy boot on HDD"

     

    Problem is that it outputted EFI boot on HDD. So then I guess it's the Windows that was installed wrong.

  • by alexsb92,

    alexsb92 alexsb92 Sep 15, 2016 12:32 PM in response to Loner T
    Level 1 (4 points)
    Windows Software
    Sep 15, 2016 12:32 PM in response to Loner T

    Sure I'll give that a try! Thanks. I'll report back with the results.

  • by alexsb92,

    alexsb92 alexsb92 Sep 15, 2016 12:45 PM in response to Loner T
    Level 1 (4 points)
    Windows Software
    Sep 15, 2016 12:45 PM in response to Loner T

    Loner T wrote:

     

     

    Now run BCA and remove Windows which will merge all the disk space back into OS X.

     

     

    Following your commands, BCA still doesn't allow removing the partition, so I'll have to do it manually through Disk Utility.

  • by Loner T,

    Loner T Loner T Sep 15, 2016 2:09 PM in response to alexsb92
    Level 7 (23,828 points)
    Safari
    Sep 15, 2016 2:09 PM in response to alexsb92

    Do you get an error message? Can you post the output of

     

    diskutil list

  • by alexsb92,

    alexsb92 alexsb92 Sep 15, 2016 7:46 PM in response to Loner T
    Level 1 (4 points)
    Windows Software
    Sep 15, 2016 7:46 PM in response to Loner T

    So I had already deleted them through disk utility. In the meantime I've also already installed Linux and I was trying to install Windows but I got some issues. For one thing I tried to install it with Bootcamp and it's the same issue that the disk is no longer in the same format (due to the Linux), so I guess an old school Windows install is needed here, right?

     

    In the state that I'm in now (Linux and Mac, but no Windows) this is the output of that command:

    /dev/disk0 (internal, physical):
      #:                      TYPE NAME                    SIZE      IDENTIFIER
      0:      GUID_partition_scheme                        *1.0 TB    disk0
      1:                        EFI EFI                    209.7 MB  disk0s1
      2:          Apple_CoreStorage Macintosh HD            575.8 GB  disk0s2
      3:                Apple_Boot Recovery HD            650.0 MB  disk0s3
      4:                Linux Swap                        16.7 GB    disk0s4
      5:                  Apple_HFS Untitled                308.0 GB  disk0s5
      6:          Linux Filesystem                        99.0 GB    disk0s6
    /dev/disk1 (internal, virtual):
      #:                      TYPE NAME                    SIZE      IDENTIFIER
      0:                  Apple_HFS Macintosh HD          +575.5 GB  disk1
                                    Logical Volume on disk0s2
                                    5F58921C-2303-43C7-BC94-7909F29C8F82
                                    Unlocked Encrypted
    /dev/disk3 (disk image):
      #:                      TYPE NAME                    SIZE      IDENTIFIER
      0:                            CCSA_X64FRE_EN-US_DV5  +4.4 GB    disk3
    /dev/disk4 (disk image):
      #:                      TYPE NAME                    SIZE      IDENTIFIER
      0:                            Boot Camp              +2.8 GB    disk4
    
Page 1 Next