You are not logged in.

#1 2018-03-27 09:03:58

chaff800
Member
Registered: 2017-12-05
Posts: 9

[Solved] Boot not working problem

Hi everybody!
I've got a computer with 2 HDD, on one, we'll call it p0, ArchLinux is installed, in the other, we shall call it p1, Windows is installed. For the first time in my life I've installed ArchLinux (or Linux in general), costumed it, and haven't reinstalled everything in more than two months since I haven't broken anything (I'm really proud of myself). There is just a little problem when it boots. I've set the boot order to first boot from p0, then from p1, then external/removable devices if any. UEFI is enabled. When I first installed ArchLinux, I checked if UEFI was enabled:

ls /sys/firmware/efi

returned something, then I created a gpt partition table, and 5 partitions:
Parted output:
Number     Start        End         Size    File system         Name  Flags
1          1049kB   2097kB    1049kB                                      bios_grub
2          2097kB    579MB     577MB   fat32                           boot, esp
3           579MB  9169MB   8590MB   linux-swap(v1)
4         9169MB    117GB      107GB   ext4
5           117GB     500GB     384GB   ext4
fdisk output:
Device                 Start             End        Sectors         Size           Type
/dev/sda1            2048           4095             2048          1M   BIOS boot
/dev/sda2            4096      1130495       1126400      550M   EFI System
/dev/sda3      1130496     17907711    16777216          8G   Linux swap
/dev/sda4    17907712   227622911  209715200      100G   Linux root (x86)
/dev/sda5  227622912  976773134   749150223   357.2G   Linux home
I installed grub, can't remember the options I used, probably the ones suggested on the Wiki for UEFI.
The problem is this: when I turn the computer on, it boots to Windows (p1), even though Linux's HDD (p0) is first in order, and I installed grub there. So I thought, why don't I just take the Windows HDD (p1) out since I don't use it. If I do so, it'll just me the following message:

Reboot and Select proper Boot device or insert Boot Media in selected Boot device and press a key_

If I want to boot to Linux I need to press F10 at start-up to go to boot menu and choose manually p0. It's quite troublesome, especially since I'm connecting through ssh from another location.
Yesterday I tried to change the installation of grub, first I checked again for UEFI, and this time I couldn't get anything: no /sys/firmware/efi. So I tried reinstalling grub for BIOS:

grub-install --target=i386-pc /dev/sdx

But nothing changed. So I thought that maybe I used the same command when I installed the OS, and executed the command for UEFI. Since my /etc/fstab is:
# <file system> <dir> <type> <options> <dump> <pass>
# /dev/sda4
UUID=21062882-78cc-4a6f-a8b3-371c6cdd6c9c    /             ext4          rw,relatime,data=ordered    0 1

# /dev/sda2
UUID=B5FE-150F          /boot         vfat          rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro    0 2

# /dev/sda5
UUID=089caf98-0b94-4448-9e12-4d664177a27b    /home         ext4          rw,relatime,data=ordered    0 2

# /dev/sda3
UUID=f78f410f-3c4d-49ce-b063-4dad1f2fd227    none          swap          defaults      0 0

The command I used was:

grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=arch_grub

But still nothing changed.
I don't really know what to do and I really don't want to reinstall everything now that everything else works fine. Does anyone have any clue to help me?
Thank you very much!

Last edited by chaff800 (2018-04-16 18:55:51)

Offline

#2 2018-03-27 12:25:22

kreatous
Member
Registered: 2018-03-27
Posts: 3

Re: [Solved] Boot not working problem

did you mount /dev/sda2 in EFI directory in boot??
use live usb then do this

mount /dev/sda4 /mnt
mount /dev/sda5 /mnt/home
mkdir /mnt/boot/EFI
mount /dev/sda2 /mnt/boot
swapon /dev/sda3

then chroot into your arch installation and reconfigure grub

arch-chroot /mnt
grub-mkconfig /boot/grub/grub.cfg
grub-install --target=x86_64-efi --efi-directory=/boot/EFI

Offline

#3 2018-03-27 13:01:51

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,543
Website

Re: [Solved] Boot not working problem

kreatous wrote:
mkdir /mnt/boot/EFI
mount /dev/sda2 /mnt/boot

Why would you create a directory only to mask it by mounting something over it's containing directory?  I'm not sure what you intend those commands to do, but whatver it is, they will not do it.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#4 2018-03-27 13:09:42

robg
Member
Registered: 2015-03-05
Posts: 225

Re: [Solved] Boot not working problem

Reading the note here, I am not sure if your transition

chaff800 wrote:

Yesterday I tried to change the installation of grub, first I checked again for UEFI, and this time I couldn't get anything: no /sys/firmware/efi. So I tried reinstalling grub for BIOS:

is possible without repartitioning. In any case, it is weird that your device appears to be no longer EFI-compatible after removing a disk. Have you made sure that your BIOS did not switch-for whatever reason-into legacy boot mode? If so, set it back to UEFI and reinstall GRUB (don't follow kreatous' suggested commands though, the outline is reasonable but apart from the mistake pointed out by Tribly, you don't need the swapon and have to make sure the ESP location is correct...).

Last edited by robg (2018-03-27 13:13:33)

Offline

#5 2018-03-27 14:01:25

chaff800
Member
Registered: 2017-12-05
Posts: 9

Re: [Solved] Boot not working problem

For @kreatous: shouldn't I install grub first and then execute grub-mkconfig?

For @robg: to say the truth I checked it before removing Windows' HDD. And I've checked, UEFI is enabled in BIOS.
I think that I've made some mistakes during installation trying to figure out ESP location. I remember I had to reinstall the OS more then once cause at the begining I couldn't boot in any way. If I'm not mistaking, the first time I created the wrong set of partitions, the second time I mounted the wrong partition, and a third time I created a directory in /boot nd used it for grub, but I think it was a mistake. Finally I'd tried simply with /boot and it "worked", I mean, I got to this situation

Can someone explain me how to get the right ESP location, 'cause I tried following the Wiki, and the results were the ones I've just told you

If I try to install refind, or another boot manager, instead of grub, may it work?

Offline

#6 2018-03-27 14:39:00

kreatous
Member
Registered: 2018-03-27
Posts: 3

Re: [Solved] Boot not working problem

@chaff800: basically you need to do a grub-update after you make any changes to the grub even if you used grub-mkconfig how ever grub-update is not present and grub-install does it and yes @Trilby is right sorry for the mistake don't create EFI directory in /boot just mount it with

mount /dev/sda2 /mnt/boot

if you are have RAM of 8GB+ then you should put swap space as around 2GB and if you are using an SSD then swap space tends to reduce the life span of you SSD. I had the same problem i was trying dual boot on Windows 10 and Arch but grub didn't seem to work but if on start if i checked BOOT Options i could see `Arch` in list of bootable devices along with `Windows Boot Manager` i even tried other *nix OS also had the same problem no grub

EDIT: if on dual boot install os-prober

Last edited by kreatous (2018-03-27 14:40:58)

Offline

#7 2018-03-27 15:26:55

robg
Member
Registered: 2015-03-05
Posts: 225

Re: [Solved] Boot not working problem

chaff800 wrote:

If I try to install refind, or another boot manager, instead of grub, may it work?

Sure, it might, but why don't we try to fix your problem before moving to circumvent it?

I suggest you begin by following the _exact_ (judging from the mistakes you mentioned, you might have not been paying enough attention) steps outlined in the wiki and, if things still fail, report back with a detailed description of your endeavor, including all the issued commands with their corresponding outputs, the contents of /boot, any error messages you've encountered and the output of `efibootmgr`.

Offline

#8 2018-03-28 06:49:16

chaff800
Member
Registered: 2017-12-05
Posts: 9

Re: [Solved] Boot not working problem

@kreatous: Yeah ok I got that, but shouldn't I execute first grub-install and then grub-mkconfig? Because that's what I've been doing following the Wiki and maybe that's the mistake

@robg: I'll try again to follow it more carefully, and maybe reading other parts like configuration.

Thank you all for your help, I'm going home for Easter vactions, so I'm trying your suggestions next week.

Offline

#9 2018-04-16 16:21:52

chaff800
Member
Registered: 2017-12-05
Posts: 9

Re: [Solved] Boot not working problem

Hi! I'm sorry for the waiting but it's been a hell of a period.

I tried to follow @kreatous steps but nothing changed.

I noticed though then when I reinstalled grub it told me:

efi variables are not supported on this system
efi variables are not supported on this system

I proceeded to run efibootmgr and the output was:

EFI variables are not supported on this system

I figure that I must have allucinated when installing Arch and thought my PC supported UEFI when it does not (although the BIOS interface let me turn UEFI on, so I don't really know).

I'll give one last try following again the wiki, and then I'll give up.

If I made a mistake is there a way to correct it without reinstalling everything?

Thank you for yout patience!

Offline

#10 2018-04-16 18:54:23

chaff800
Member
Registered: 2017-12-05
Posts: 9

Re: [Solved] Boot not working problem

Okay, I've found a solution, even though it's not perfect.

I tried to follow the wiki page again and again and nothing was working. I even got to a point were the only thing after booting was

GRUB_

And it was not a console.

After a lot of tries (btw I found out I had mounted uncorrectly /boot since I had no vmlinuz-linux) I've decided to try to install grub on a usb key, and it worked.

So if anyone ever found themselves in troubles like mine, just get a usb-key, say it'll be /dev/sdc
Then arch-chroot to /mnt

mkfs.vfat /dev/sdc1 #be careful to have only 1 partition on the usb
mkdir /mnt/usb #This mount is the one on the root partition 
mount /dev/sdc1 /mnt/usb
grub-install --target=i386-pc --boot-directory=/mnt/usb/boot /dev/sdc
grub-mkconf -o /mnt/usb/boot/grub/grub.cfg
sync
umount /dev/sdc

Then exit arch-chroot and reboot.

Thanks anyway for all the support you gave!

P.S. Setting this as solved anyway. If you have suggestions, please do.

Last edited by chaff800 (2018-04-16 18:55:12)

Offline

Board footer

Powered by FluxBB