You are not logged in.

#1 2016-02-10 12:02:57

Marein
Member
Registered: 2016-02-10
Posts: 3

[SOLVED] Recover Linux boot after installing Windows 10 on 2nd HDD

Hello all,

I've had Arch installed on my machine for about a year now. Recently I've had a need to a Windows environment so I installed Windows 10 on a spare bit of my hard drive. That went well and I was able to set up grub such that I could access both Linux and Windows. However I soon ran out of space on the drive, so I acquired a second hard drive and installed Windows 10 on it. Contrary to before, I have been unable to regain access to my Linux installation since installing Windows 10 on the second drive.

In summary my actions were as follows:

  • Install Arch Linux on sda (a year ago)

  • Install Windows 10 on sda (recently)

  • Succesfully fix grub using a live SD, as follows:

mount /dev/sda2 /mnt
mount /dev/sda1 /mnt/boot
arch-chroot /mnt /bin/bash
# in chroot:
grub-install --efi-directory=/boot/EFI /dev/sda
  • This got me 'Linux Boot Manager (P1: ...)' and 'Windows Boot Manager (P1: ...)' as an option in UEFI

  • I could happily boot both Linux and Windows at this point.

  • Install Windows 10 on sdb

  • The above sequence of commands now only gets me 'arch (P1: ...)' as an option in UEFI, which upon selection bring me back to UEFI, except when the live SD is inserted: then it starts the live SD. The Windows Boot Manager does work for starting either Windows installation.

  • I have since removed Windows 10 from sdb and ran the commands again, to no avail.

  • I am still able to boot the original Windows 10 on sda through the 'Windows Boot Manager (P1: ...)' option. But I cannot recover the 'Linux Boot Manager' option, only the apparently broken 'arch (P1: ...)' option.

Current parted -l output below. Here sda is the first drive, sdb is the second drive, sdd is the Arch live SD, and sde I used to store the output of parted.

Model: ATA ST1000DM003-1ER1 (scsi)
Disk /dev/sda: 1000GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags: 

Number  Start   End    Size    File system     Name                          Flags
 1      1049kB  513MB  512MB   fat32           esp                           boot, esp
 2      513MB   750GB  749GB   ext4            linux
 3      750GB   766GB  16.0GB  linux-swap(v1)  swap
 4      766GB   883GB  117GB   ntfs            win10                          msftdata
 5      883GB   883GB  134MB                   Microsoft reserved partition  msftres


Model: ATA Hitachi HDE72101 (scsi)
Disk /dev/sdb: 1000GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start  End  Size  File system  Name  Flags


Model: Generic STORAGE DEVICE (scsi)
Disk /dev/sdd: 4025MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End     Size    Type     File system  Flags
 2      88.1kB  32.6MB  32.5MB  primary  fat16        esp


Model: WD Elements 10A8 (scsi)
Disk /dev/sde: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End    Size   Type     File system  Flags
 1      1049kB  500GB  500GB  primary  ntfs         boot

Maybe of relevance: Secure Boot is enabled in UEFI. I cannot disable it (the option is greyed out), even if I set an administrator password for UEFI. UEFI version: 2.10.1208

This recent post seems very similar to my problem, except that in their case Linux is on sdb. Also, they mention that they found a 500 MB bootsector written on sda by Windows 10. However in my case this space seems to still be occupied by the 512MB bootsector that I made for Linux (in accordance with the Beginner's Guide).

I hope someone has an idea of how to fix this. I'm not very experienced with things like bootloaders, so I hope I've given the right information. If not, I'll be happy to supply more information where needed.

Thanks very much in advance!

Last edited by Marein (2016-02-13 17:06:50)

Offline

#2 2016-02-10 12:22:22

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,732
Website

Re: [SOLVED] Recover Linux boot after installing Windows 10 on 2nd HDD

Marein wrote:
grub-install --efi-directory=/boot/EFI /dev/sda

Is there a particular reason why you are instructing GRUB to use /boot/EFI rather than /boot (which would appear to be the actual ESP mountpoint)?

What was the output after running the `grub-install` command?

See https://bbs.archlinux.org/viewtopic.php?id=57855

Please post the output of:

# efibootmgr -v

Offline

#3 2016-02-10 15:26:10

Marein
Member
Registered: 2016-02-10
Posts: 3

Re: [SOLVED] Recover Linux boot after installing Windows 10 on 2nd HDD

Hey Head_on_a_Stick, thanks for your reply.

I used the --efi-directory option because without it the below happened and I read in this post to use the --efi-directory option.

# grub-install /dev/sda
Installing for x86_64-efi platform.
grub-install: error: cannot find EFI directory.

The output after running the commands that I wrote in my post was always normal as seen below. That's why I didn't think to mention the output.

# grub-install --efi-directory=/boot/EFI /dev/sda
Installing for x86_64-efi platform.
Installation finished. No errors reported.

The output of efibootmgr -v is:

BootCurrent: 0003
Timeout: 2 seconds
BootOrder: 0001,0002,0003,0000
Boot0000  Windows Boot Manager	HD(1,GPT,ae2a86bb-fff9-4577-8d0d-119f0af78c73,0x800,0xf4000)/File(\EFI\Microsoft\Boot\bootmgfw.efi)WINDOWS.........x...B.C.D.O.B.J.E.C.T.=.{.9.d.e.a.8.6.2.c.-.5.c.d.d.-.4.e.7.0.-.a.c.c.1.-.f.3.2.b.3.4.4.d.4.7.9.5.}...s................
Boot0001* arch	HD(1,GPT,ae2a86bb-fff9-4577-8d0d-119f0af78c73,0x800,0xf4000)/File(\EFI\arch\grubx64.efi)
Boot0002* UEFI: WD Elements 10A8	PciRoot(0x0)/Pci(0x12,0x2)/USB(5,0)/HD(1,MBR,0x4294967243,0x800,0x3a375800)AMBO
Boot0003* UEFI: Generic STORAGE DEVICE	PciRoot(0x0)/Pci(0x13,0x2)/USB(1,0)/HD(1,MBR,0x49,0xac,0xf800)AMBO

As I mentioned, those last two entries correspond to my external drive for saving ouptut and my Arch live SD.

After reading your post I tried some more options with grub-install. I was able to make some progress by using --efi-directory=/boot instead of /boot/EFI, with the rest of the commands the same as in my original post. This resulted in the same 'no errors' output as above. Now the option 'arch (P1: ...)' in UEFI works. It takes me to Grub, where I have a choice of:

- Arch Linux, with linux core repo kernel
- Arch Linux, with linux core repo kernel (Fallback initramfs)

Unfortunately, both of these options result in:

error: no such device ad4103fa-d940......467
Loading Linux core repo kernel ...
error: no such partition.
Loading initial ramdisk ...
alloc magic is broken at 0xcb720100: cb7b3600
Aborted. Press any key to exit.

I only copied part of the device ID on the first line, let me know if I should post the whole ID.

Any ideas? Thanks!

NB: I had to manually copy some of the output in this post so please excuse small errors.

Offline

#4 2016-02-10 15:31:54

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,732
Website

Re: [SOLVED] Recover Linux boot after installing Windows 10 on 2nd HDD

Marein wrote:
error: no such device ad4103fa-d940......467

I think you need to generate a new grub.cfg

See https://wiki.archlinux.org/index.php/Beginners'_guide#BIOS.2FMBR

Offline

#5 2016-02-13 17:05:16

Marein
Member
Registered: 2016-02-10
Posts: 3

Re: [SOLVED] Recover Linux boot after installing Windows 10 on 2nd HDD

Head_on_a_Stick wrote:
Marein wrote:
error: no such device ad4103fa-d940......467

I think you need to generate a new grub.cfg

See https://wiki.archlinux.org/index.php/Beginners'_guide#BIOS.2FMBR

Great, that did it! I used the below command. The 'arch (P1: ...)' option in UEFI now presents a Grub menu. There is no option there for Windows, but I guess that's an issue for another time (I can still access Windows from the 'Windows Boot Manager' option in UEFI).

grub-mkconfig -o /boot/grub/grub.cfg

This yielded output that seemed to contain errors (maybe just about connected drives that it tried to scan for operating systems, finding none) but ending in 'done'.

Thanks!

Offline

Board footer

Powered by FluxBB