You are not logged in.

#1 2016-07-08 15:24:18

minimal
Member
From: Quito, Ecuador
Registered: 2009-10-29
Posts: 56

Windows8 hdd screwed up my UEFI Arch boot [SOLVED]

Hi everyone,
I have always struggled to understand and setup UEFI boot. Used grub years ago. On this laptop which I bought 3 years ago, have configured syslinux, then gummiboot and believe to be on systemd-boot which has been perfect up until last night that I removed the battery and replaced with factory hdd (to test hdmi successfully - no hdmi hw failure here since the port works flawlessly under Windows8).

Satisfied with my testing, I then concluded that hdmi is not being detected correctly by the Linux kernel. I then powered off, removed the battery and replaced the drive with my Linux SSD that has arch on it. By the looks of it, the windows8 setup has likely overwritten my MBR and the UEFI boot config is now lost. I was prompted to enroll the hash and now can boot off old arch bootable CD. I am also arch-chroot into my installation but unable to fix the boot so still cannot boot into my previous arch install.

I have tried recreating this from information on this thread (among others): https://bbs.archlinux.org/viewtopic.php … 0#p1090040 without success.

I also ran: cfdisk /dev/sda
and not that the efi partition is bootable. The nearest i have for is creating a boot entry which when Ireboot the BIOS tells me [Drive not found].

Really want to avoid rebuilding. Unable to boot off the install CD or latest USB boot media to graphical mode to just install the boot manager which I believe would resolve this.

Any hints to troubleshoot the boot process and find out exactly what's failing would be greatly appreciated as I have the perfect setup and would gate to have to rebuild (I knew I should have ran a Clonezilla backup weeks ago..). I think I am not to far off but some guidance to understand where UEFI is failing to find boot entry would bee excellent!

Any pointers also of how to back up UEFI boot config to avoid this situation would also be great!

Thanks,


Peter

Last edited by minimal (2016-07-16 21:59:16)


|\/|
_________________________________________________________________________________________
Never judge a man until you have walked 1000 miles in his shoes.
..that way you'll be 1000 miles away and you'll have his shoes.

Offline

#2 2016-07-08 15:46:56

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,774

Re: Windows8 hdd screwed up my UEFI Arch boot [SOLVED]

Hello.  First, stop.  Have you changed anything yet?
Think for a second.  How is Windows going to change anything on the SDD that is not in the system?  Nothing on the disk changed; don't start now.
What Windows can do, and was probably correct in doing, was to change the EFI variables that are stored in non-volatile memory.  Those EFI variables describe which partitions are used to boot.  When you removed the SDD and replaced it with another,those EFI variables became non-sensical.  I am somewhat amazed Windows booted.

Stop thinking about MBR and BIOS.  This is an EFI system (unless you are using legacy boot; something you have not mentioned).  From inside your chroot, can you post the output of efibootmgr -v ?


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#3 2016-07-08 21:02:15

Buddlespit
Member
From: Chesapeake, Va.
Registered: 2014-02-07
Posts: 501

Re: Windows8 hdd screwed up my UEFI Arch boot [SOLVED]

Disregard, I can't read...

Last edited by Buddlespit (2016-07-08 21:03:15)

Offline

#4 2016-07-08 23:14:31

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

Re: Windows8 hdd screwed up my UEFI Arch boot [SOLVED]

ewaller wrote:

From inside your chroot, can you post the output of efibootmgr -v ?

Just to note: that command can be run from the live environment without chrooting; the OP could even use a graphical live ISO image from Fedora (or so) -- the output for that command is taken from the motherboard and is thus operating-system independent smile

Offline

#5 2016-07-09 00:36:23

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,774

Re: Windows8 hdd screwed up my UEFI Arch boot [SOLVED]

Head_on_a_Stick wrote:

Just to note: that command can be run from the live environment without chrooting; the OP could even use a graphical live ISO image from Fedora (or so) -- the output for that command is taken from the motherboard and is thus operating-system independent smile

True, but, when I posted that I was too lazy to go find out if it was the on the installation iso.  I was pretty sure the OP had it installed, hence my chroot suggestion..

Last edited by ewaller (2016-07-09 00:37:18)


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#6 2016-07-09 00:57:25

minimal
Member
From: Quito, Ecuador
Registered: 2009-10-29
Posts: 56

Re: Windows8 hdd screwed up my UEFI Arch boot [SOLVED]

Thanks very much guys for helping me to think sensically! Head_on_a_Stick I have been reading your very helpful threads. Just got home after a long night at work. I will reply properly in the morning with the output of that command. I'm pretty sure it was just the cdrom drive showing up with that command.  Thanks again really appreciate the guidance!


|\/|
_________________________________________________________________________________________
Never judge a man until you have walked 1000 miles in his shoes.
..that way you'll be 1000 miles away and you'll have his shoes.

Offline

#7 2016-07-09 08:43:41

minimal
Member
From: Quito, Ecuador
Registered: 2009-10-29
Posts: 56

Re: Windows8 hdd screwed up my UEFI Arch boot [SOLVED]

So the problem is strictly with the EFI values. I can confirm that aside from enrolling the hash values there is nothing else i changed when putting the linux ssd disk back in. Because I did that I was then able to boot from the cd.

Running efibootmgr -v in the Arch CDROM booted environment (and also within chroot) shows only:

BootCurrent: 0001
Timeout: 0 seconds
BootOrder: 0001
Boot0001* UEFI: MATSHITABD-CMB UJ160    PciRoot(0x0)/Pci(0x1f,0x2)/Sata(2,65535,0)/CDROM(1,0x3f,0xf800)AMB0

I am definitely booted in UEFI mode. I ran:
ls /sys/firmware/efi/efivars
And it shows many lines

Running
cfdisk /dev/sda
shows that the disk is bootable too.

I have the following partitions:
/dev/sda1 512M EFI System
/dev/sda2 300M Linux Filesystem (cannot remember, could be /boot)
/dev/sda3 20G Linux Filesystem (/)
/dev/sda4 217.7G Linux Filesystem (/home)

Arch was booting up fine from /boot/loader/entries/arch.conf which has not been changed and contains:

title Arch Linux-ck
linux /vmlinuz-linux-ck
initrd /initramfs-linux-ck.img
options root=/dev/sda3 rw acpi_osi= acpi_backlight=vendor elevator=bfq nouveau.modeset=0 rd.driver.blacklist=nouveau

I tried creating:

# efibootmgr -d /dev/sda -p 2 -c -L "Arch Linux-ck" -l /vmlinuz-linux-ck -u "root=/dev/sda3 rw initrd=/initramfs-linux-ck.img"

but the laptop just goes into the Bios and this entry shows: Drive not found

I may have also screwed things by running this to restore the mbr 2 days ago before i got on the forum:

# dd bs=440 conv=notrunc count=1 if=/usr/lib/syslinux/mbr.bin of=/dev/sda

Hope someone can help me here. Really not sure where I should be going next with this problem.

Thanks,

Peter

Last edited by minimal (2016-07-10 13:37:53)


|\/|
_________________________________________________________________________________________
Never judge a man until you have walked 1000 miles in his shoes.
..that way you'll be 1000 miles away and you'll have his shoes.

Offline

#8 2016-07-09 15:53:58

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

Re: Windows8 hdd screwed up my UEFI Arch boot [SOLVED]

minimal wrote:
BootCurrent: 0001
Timeout: 0 seconds
BootOrder: 0001
Boot0001* UEFI: MATSHITABD-CMB UJ160    PciRoot(0x0)/Pci(0x1f,0x2)/Sata(2,65535,0)/CDROM(1,0x3f,0xf800)AMB0

You have no NVRAM entries.

However, if you were using systemd-boot then this would not matter as the `bootctl install` command copies the bootloader to $ESP/EFI/BOOT/BOOTX{IA32,X64}.EFI and this location should be booted even in the absence of NVRAM entries.

I have the following partitions:
/dev/sda1 512M EFI System
/dev/sda2 300M Linux Filesystem (cannot remember, could be /boot)
/dev/sda3 20G Linux Filesystem (/)
/dev/sda4 217.7G Linux Filesystem (/home)

Not that I don't believe you but can we see the output of:

# parted -l

Also, the EFI system partition should be mounted to /boot if you use systemd-boot.

I may have also screwed things by running this to restore the mbr 2 days ago before i got on the forum:

# dd bs=440 conv=notrunc count=1 if=/usr/lib/syslinux/mbr.bin of=/dev/sda

That doesn't matter, UEFI booting ignores any code in the MBR (this also renders bootable flags irrelevant, btw).

EDIT: Please use code tags when posting terminal output to aid readability.

Last edited by Head_on_a_Stick (2016-07-09 15:55:06)

Offline

#9 2016-07-10 13:59:23

minimal
Member
From: Quito, Ecuador
Registered: 2009-10-29
Posts: 56

Re: Windows8 hdd screwed up my UEFI Arch boot [SOLVED]

Hi again,
Here goes, finally on another PC where I can actually type and troubleshoot this easier than from android (which is how I have been doing this up until now). Sorry for the lack of code tags in my posts!

I just ran:

bootctl install

exited from chroot environment and checked with the:

efibootmgr -v

command and now I see:

..
BootOrder 0000,0001
Boot0000* Linux Boot Manager   HD(1,800,100000,1aaf525...)File\EFI\Systemd\systemd-bootx64.efi)
Boot0001* UEFI MATSHITABD-CMB UJ160     ACPI(..cdrom device)AMB0

running parted -l:

Model: ATA Samsung SSD 850 (scsi)
Disk /dev/sda: 256GB
Sector size (logical/physical): 512B/512B
Partition table: gpt
Disk Flags: pmbr_boot

Number   Start   End   Size   File system   Name   Flags
1   1049kB   538MB   fat32   EFI System   boot
2   538Mb   852MB   315MB   ext4   Linux filesystem
3   852MB   22.3GB   21.5GB   ext4   Linux filesystem
4   22.3GB   256GB   234GB   ext4   Linux filesystem


Model: Linux device-mapper (snapshot) (dm)
Disk /dev/mapper/arch_root-image: 1540MB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Disk Flags:


Number   Start   End   Size   File system   Flags
1   0.00B   1540MB   1540MB   ext2


Warning: Unable to open /dev/sr0 read-write (Read-only file system). /dev/sr0 has been opened read-only
Model: MATSHITA BD-CMB UJ160 (scsi)
Disk /dev/sr0: 574MB
Sector size: (logical/physical): 2048B/2048B
Partition Table: msdos
Disk Flags:

Number   Start   End   Size   Type   File System   Flags
2   516kB   131Mb   130MB   primary

Let me see what a reboot brings after reinstalling systemd-boot..

Thanks a lot!


|\/|
_________________________________________________________________________________________
Never judge a man until you have walked 1000 miles in his shoes.
..that way you'll be 1000 miles away and you'll have his shoes.

Offline

#10 2016-07-10 14:05:28

minimal
Member
From: Quito, Ecuador
Registered: 2009-10-29
Posts: 56

Re: Windows8 hdd screwed up my UEFI Arch boot [SOLVED]

Well, nothing unfortunately. I still go straight into the BIOS interface. I am assuming systemd-boot is installed fine but the EFI values pointing to the boot instructions are missing/incorrectly set still..

My BIOS btw, if this has anything to do with it, has the disk set as AHCI (as opposed to IDE mode)
'Launch CSM' legacy mode is disabled
Secure boot control mode is disabled
Fast Boot is also disabled now in case it's not helping things
I tried rebooting with the CDROM removed, I see now no boot options whatsoever in there.  Will repeat

bootctl install

and reboot with the CDROM inserted this time!

So, in sum, I am doing the following:
1. boot from arch livecd
2. setup chroot as follows:

mkdir -p /mnt/boot
mount /dev/sda3 /mnt
mount /dev/sda1 /mnt/boot
arch-chroot /mnt /bin/bash

Well, rebooted and still nothing!  Although the SSD was set first in the boot order, something is still wrong and it ignored it and boots off the CDROM instead again. Now its booted off the CDROM again, I notice I only have the CDROM device in there in the boot options when I type

efibootmgr -v

Is this normal? What am I doing wrong here? I can only run

bootctl install

from within chroot btw.

Many thanks for taking the time to read!

Peter

Last edited by minimal (2016-07-10 16:38:20)


|\/|
_________________________________________________________________________________________
Never judge a man until you have walked 1000 miles in his shoes.
..that way you'll be 1000 miles away and you'll have his shoes.

Offline

#11 2016-07-10 18:14:37

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

Re: Windows8 hdd screwed up my UEFI Arch boot [SOLVED]

minimal wrote:

What am I doing wrong here?

Nothing, as far as I can see hmm

Are all the necessary files present on the ESP?

# mount /dev/sda1 /mnt
find /mnt

Try copying the systemd-boot .efi loader to the default location:

# mount /dev/sda1 /mnt
# mkdir -p /mnt/EFI/BOOT
# cp /mnt/EFI/Systemd/systemd-bootx64.efi /mnt/EFI/BOOT/BOOTX64.EFI

The systemd-boot manager screen should now load with the NVRAM entries left empty.

By the way, I like your signature -- it matches my avatar smile

Offline

#12 2016-07-12 14:59:19

minimal
Member
From: Quito, Ecuador
Registered: 2009-10-29
Posts: 56

Re: Windows8 hdd screwed up my UEFI Arch boot [SOLVED]

Hello again,
I was thinking the same about the avatar and signature! Your signature is the hacker symbol I believe..

I tried copying the BOOTX64.EFI to the location you mention but if I do not have to Arch CDROM inserted, it will not bring up the UEFI boot menu (or is this the systemd-boot bootmanager screen?):

Arch Linux archiso x86_64 UEFI CD
UEFI shell x86_64 v1
UEFI shell x86_64 v2
EFI Default Loader
Reboot into firmware interface

Running your first mount command and then:

find /mnt

brings up at least 70 lines:

/mnt/vmlinuz-linux
/mnt/initramfs-linux.img
/mnt/initramfs-linux-fallback.img
..then about 60 lines of
/mnt/syslinux/...(all ending in .c32 except for these 2 files: /mnt/syslinux/syslinux.cfg and /mnt/syslinux/SYSLINUX_AUTOUPDATE.
.
.
..then 
/mnt/EFI
/mnt/EFI/systemd
/mnt/EFI/systemd/systemd-bootx64.efi
/mnt/EFI/Boot
/mnt/EFI/Boot/BOOTX64.EFI
/mnt/loader
/mnt/loader/entries
/mnt/loader/entries/arch.conf
/mnt/loader/loader.conf
/mnt/intel-ucode.img
/mnt/vmlinuz-linux-ck
/mnt/initramfs-linux-ck.img
/mnt/initramfs-linux-ck-fallback.img

I am so stuck not knowing how to get a valid NVRAM .efi efibootmgr entry to be found and recognised by the laptop that if I don't succeed soon, I will backup the list pf packages, /etc and /home to an external USB drive and start again with a fresh install soon from the CD.

Thanks for the ideas!

Last edited by minimal (2016-07-12 15:24:46)


|\/|
_________________________________________________________________________________________
Never judge a man until you have walked 1000 miles in his shoes.
..that way you'll be 1000 miles away and you'll have his shoes.

Offline

#13 2016-07-12 15:54:03

minimal
Member
From: Quito, Ecuador
Registered: 2009-10-29
Posts: 56

Re: Windows8 hdd screwed up my UEFI Arch boot [SOLVED]

I am just trying again in the archiso booted environment:

efibootmgr -c -d /dev/sda -p 1 -L "Arch" -l '\EFI\BOOT\BOOTX64.EFI'

..but on reboot its just not showing up in the menu, doesn't seem to survive a reboot ufortunately sad


|\/|
_________________________________________________________________________________________
Never judge a man until you have walked 1000 miles in his shoes.
..that way you'll be 1000 miles away and you'll have his shoes.

Offline

#14 2016-07-12 16:05:49

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,774

Re: Windows8 hdd screwed up my UEFI Arch boot [SOLVED]

minimal wrote:

I was thinking the same about the avatar and signature! Your signature is the hacker symbol I believe..

I thought his signature was just a glider from Conway's game of life. hmm

Can you set efi variables from your computer setup menus?
You might also consider setting them from an efi  shell as a posibility.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#15 2016-07-12 19:26:02

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

Re: Windows8 hdd screwed up my UEFI Arch boot [SOLVED]

minimal wrote:

I tried copying the BOOTX64.EFI to the location you mention but if I do not have to Arch CDROM inserted, it will not bring up the UEFI boot menu (or is this the systemd-boot bootmanager screen?):

Arch Linux archiso x86_64 UEFI CD
UEFI shell x86_64 v1
UEFI shell x86_64 v2
EFI Default Loader
Reboot into firmware interface

The "EFI Default Loader" should start up your system -- have you tried selecting that option?

If that fails, try using the Windows loader location.

Again, from the Arch live ISO:

# mount /dev/sda1 /mnt
# mkdir -p /mnt/EFI/Microsoft/Boot
# cp /mnt/EFI/Systemd/systemd-bootx64.efi /mnt/EFI/Microsoft/Boot/bootmgfw.efi
minimal wrote:

Your signature is the hacker symbol I believe..

ewaller wrote:

I thought his signature was just a glider from Conway's game of life.

Yes, you are both correct smile

http://www.catb.org/hacker-emblem/

Offline

#16 2016-07-12 19:33:16

minimal
Member
From: Quito, Ecuador
Registered: 2009-10-29
Posts: 56

Re: Windows8 hdd screwed up my UEFI Arch boot [SOLVED]

I was just trying to setup UEFI shell v2 to dabble with that but no luck getting the shellx64_v2.efi from the boot image recognised, or the one downloaded from sourceforge for that matter.

Unfortunately there is something wrong with my latest (july 2016) arch iso I put on a USB with tuxboot. I also verified the iso MD5 checksum and it downloaded fine. I tried unetbootin too but still get:

ERROR: '/dev/disk/by-label/ARCH_201607' device did not show up after 30 seconds...
    Falling back to interactive prompt
    You can try to fix the problem manually, log out when you are finished
sh: can't access tty: job control turned off
[rootfs ]#

The 2014 arch bootable cdrom works fine though and that is what I have been using to get into arch-chroot environment and see my disk.

I tried adding a new boot device going into the setup menus (I thought this was the BIOS - this is the last 'Reboot into firmware interface' option in the menu) but the drive is never recognised.  There are 3 variables, and the one I cannot change I think is the culprit 'Select Filesystem' seems to be hardcoded to:

PCI(1D¦0)\USB(1,0)\HD(Part1,Sig00000000)

The other 2 options are:
'Add Boot Option' (I set this to 'Arch' - I believe just lower and uppercase letters are accepted here)
'Path for Boot Option' (I tried 'fsx:\boot\EFI\BOOT\BOOTX64.EFI' and fsx:\EFI\BOOT\BOOTX64.EFI' since it recommends fsx:\path\filename.efi format)

I am now trying to find out how to rsync my /home and /etc off to an external USB drive before formatting and starting again. I think that will be faster!

Last edited by minimal (2016-07-12 19:35:14)


|\/|
_________________________________________________________________________________________
Never judge a man until you have walked 1000 miles in his shoes.
..that way you'll be 1000 miles away and you'll have his shoes.

Offline

#17 2016-07-12 22:56:28

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: Windows8 hdd screwed up my UEFI Arch boot [SOLVED]

minimal wrote:

Unfortunately there is something wrong with my latest (july 2016) arch iso I put on a USB with tuxboot. I also verified the iso MD5 checksum and it downloaded fine. I tried unetbootin too but still get:

As you've just discovered you shouldn't use unetbootin or tuxboot to create a bootable Arch USB, the recommended method is to use dd...

https://wiki.archlinux.org/index.php/US … tion_media


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#18 2016-07-13 13:19:40

minimal
Member
From: Quito, Ecuador
Registered: 2009-10-29
Posts: 56

Re: Windows8 hdd screwed up my UEFI Arch boot [SOLVED]

Thank you very much for this important tip Slithery I was convinced it was something specific to my laptop which was not allowing me to boot into the graphical installation. I will create the bootable USB using the latest .iso from your link now for reinstall!

I have now mounted my external USB drive (within arch-chroot) as follows:

mkdir -p /media/usb
mount /dev/sdb1 /media/usb

I then created an arch-july2016-bak directory inside /media/usb and changed to this directory.

From here I backed up all important files using rsync:

rsync -aHAXv --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} / .

..as well as backing up the list of programs installed by creating /media/usb/arch-packages directory and ran:

pacman -Qqen > pkglist.txt
pacman -Qm > aur-packages.txt

and backing up the current partition table information for future reference:

parted -l > partitions.txt

From here, I really don't think I am missing any other information I could need later for reference, or is there something else I should worry about backing up before formatting the SSD?

This community and rolling release is what has made Arch a firm favourite distro for me for over 12 years now! I am close to marking this thread solved.  I am now considering Antergos (to test out the hardware detection with my laptop and see if the HDMI port is picked up). How is Manjaro at detecting newer hardware? I understand that one is also Arch-based.

Thanks a lot to everyone who has taken the time to help me! big_smile

Last edited by minimal (2016-07-13 14:21:49)


|\/|
_________________________________________________________________________________________
Never judge a man until you have walked 1000 miles in his shoes.
..that way you'll be 1000 miles away and you'll have his shoes.

Offline

Board footer

Powered by FluxBB