Arch linux восстановление загрузчика

[РЕШЕНО] Восстановить загрузку Archlinux!

Если выбрать загрузку Archlinux, то он не загрузится.
Разбивка дисков:

$ sudo fdisk -l Disk /dev/sda: 931.51 GiB, 1000204886016 bytes, 1953525168 sectors (HDD) . Device Start End Sectors Size Type /dev/sda1 34 1065560063 1065560030 508,1G Linux file system (btrfs Archlinux /home) /dev/sda2 1065560064 1191389183 125829120 60G Linux file system (ext4 Fedora /root) /dev/sda3 1921198080 1953523711 32325632 15,4G Microsoft Recovery Environment /dev/sda4 1191389184 1921198079 729808896 348G Linux file system (ext4 Fedora /home) . Disk /dev/nvme0n1: 119.24 GiB, 128035676160 bytes, 250069680 sectors (SSD) . Device Start End Sectors Size Type /dev/nvme0n1p1 2048 616447 614400 300M EFI /dev/nvme0n1p2 616448 878591 262144 128M Microsoft Reserved Partition /dev/nvme0n1p3 878592 143366143 142487552 67,9G Microsoft basic data /dev/nvme0n1p4 143366144 151754751 8388608 4G Linux swap /dev/nvme0n1p5 248225792 250068991 1843200 900M Microsoft Recovery Environment /dev/nvme0n1p6 151754752 248225791 96471040 46G Linux file system (btrfs Archlinux /root) 

При установке Fedora я указал установку загрузчика /boot/efi на /dev/nvme0n1p1.
Вопрос!
Как мне восстановить загрузчик Archlinux?
или
Как заставить загрузчик Fedora загружать Archlinux?
Please, help!
Archlinux — моя основная система

[РЕШЕНИЕ]
По всей видимости Fedora затерла efi запись Archlinux
делаем следующее:

$ sudo efibootmgr -c -d /dev/nvme0n1 -p 1 -w -L Archlinux -l '\EFI\Archlinux\grubx64.efi' $ efibootmgr -v BootCurrent: 0008 Timeout: 1 seconds BootOrder: 0001,0008,0000 Boot0000* Windows Boot Manager HD(1,GPT,5f774f65-6102-4e95-9fe0-06fb49f7d6e1,0x800,0x96000)/File(\EFI\MICROSOFT\BOOT\BOOTMGFW.EFI)WINDOWS. x. B.C.D.O.B.J.E.C.T.=.. Boot0001* Archlinux HD(1,GPT,5f774f65-6102-4e95-9fe0-06fb49f7d6e1,0x800,0x96000)/File(\EFI\Archlinux\grubx64.efi) Boot0008* Fedora HD(1,GPT,5f774f65-6102-4e95-9fe0-06fb49f7d6e1,0x800,0x96000)/File(\EFI\FEDORA\SHIM.EFI)..BO $ sudo grub2-mkconfig -o /boot/grub2/grub.cfg

Источник

How to Restore/Reinstall GRUB Bootloader in Arch Linux

Sometimes disaster may happen and your GRUB bootloader may stop working. In this situation you may need to reinstall/restore GRUB bootloader. For this you need a bootable drive with Arch Linux.

So if you don’t have Arch Linux download iso file and create one.

Recover GRUB Bootloader in Arch Linux

  • Insert and boot your Arch Linux installation media.
  • Select Arch Linux archiso x86_64 UEFI CD.
  • If you want to connect to WiFi then you can connect using # wifi-menu , but it is optional.
  • After that you need to mount the root partition of Arch Installation to /mnt .
  • To check your boot / EFI and root partitions use, # fdisk -l
  • Then mount your root partition to /mnt , # mount /dev/sda4 /mnt
  • chroot using, # arch-chroot /mnt /bin/bash
  • Then you need to mount boot partition, mount it to /boot/efi , # mount /dev/sda2/ /boot/efi
  • You can check if all are mounted using, # lsblk -l
  • Now install GRUB, # grub-install —target=x86_64-efi —efi-directory=/boot/efi —bootloader-id=GRUB
  • Then, generate grub.cfg, # grub-mkconfig -o /boot/grub/grub.cfg
  • Now you are done, # exit , # reboot .
Читайте также:  All about networking in linux

If you have problems then feel free to comment.

You Might Also Like

Read more about the article Dual Boot Phoenix OS with Linux

Dual Boot Phoenix OS with Linux

Read more about the article Using Android/PC as a Second Monitor in Linux

July 7, 2019

Using Android/PC as a Second Monitor in Linux

Read more about the article How to Install uGet and Setup for Torrent in Ubuntu

August 1, 2019

Источник

Как восстановить загрузчик Grub в Linux

Большой унифицированный загрузчик GRUB – это мощная и гибкая утилита, которая связывает BIOS материнской платы с ядром операционной системы. Она работает путем загрузки небольшой программы в память материнской платы, которая используется для загрузки более крупного двоичного файла мультизагрузки.

Но бывают случаи, когда GRUB не может загрузить ядро операционной системы. Например, двойная загрузка с Linux и Windows часто приводит к тому, что последняя стирает загрузчик. В этом руководстве показано, как можно восстановить систему, переустановив GRUB , используя некоторые из наиболее популярных дистрибутивов Linux.

Восстановление GRUB в Ubuntu и Debian

Одним из самых быстрых способов переустановки GRUB в Ubuntu и Debian является загрузка живой копии любого из этих дистрибутивов. Это позволит вам подключить корневой раздел вашей системы и использовать исполняемые файлы GRUB дистрибутива для воссоздания загрузчика вашей системы.

Примечание: когда вы загрузитесь с живого USB , нажмите «Try Ubuntu» для доступа к рабочему столу. Не нажимайте «Установить Ubuntu.»

    Откройте терминал в среде дистрибутива.

sudo fdisk -l | grep "Linux filesystem$"

sudo grub-install --force --boot-directory=/mnt/ /dev/sda1

Совет: хотя переустановка GRUB исправит большинство проблем с мультизагрузкой, новичкам может показаться сложной командная строка. В связи с этим, вы также можете исправить GRUB с помощью графической утилиты Boot Repair Utility.

Восстановление GRUB в Arch Linux

Наряду с Ubuntu и Debian, для восстановления загрузчика можно использовать живую копию Arch Linux. Одним из преимуществ этого является то, что живой Arch Linux не полагается на графическое отображение, поэтому вы можете легко восстановить GRUB даже на машинах по SSH .

Читайте также:  Driver linux realtek 8822ce

    Определите корневой раздел вашей системы с помощью lsblk:

mount --bind /sys /mnt/sys mount --bind /proc /mnt/proc mount --bind /run /mnt/run mount --bind /dev /mnt/dev

/sbin/grub-install --target=i386-pc /dev/sda

/sbin/grub-mkconfig > /boot/grub/grub.cfg

Нажмите Ctrl + D , чтобы выйти из корневой сессии вашей системы.

Восстановление GRUB на Fedora

Подобно Ubuntu и Debian, восстановление Grub на Fedora также просто.

#Найдите корневой раздел вашей машины:

sudo fdisk -l | grep "Linux filesystem$"

    Смонтируйте корневой раздел вашей системы и создайте связующее монтирование между ним и вашей живой сессией:

sudo mount /dev/sda3 /mnt sudo mount --bind /sys /mnt/root/sys sudo mount --bind /proc /mnt/root/proc sudo mount --bind /run /mnt/root/run sudo mount --bind /dev /mnt/root/dev
sudo chroot /mnt/root bash mount /dev/sd3 / mount /dev/sda2 /boot

rm -f /etc/grub.d/* rm -f /etc/sysconfig/grub

grub2-mkconfig -o /boot/grub2/grub.cfg
grub2-install --target=i386-pc /dev/sda

Часто задаваемые вопросы

Можно ли восстановить GRUB , если моя система использует LVM ?

Да. Вы можете восстановить GRUB , даже если ваша система использует LVM . Для этого выполните ls /dev/mapper/*—vg-root , чтобы определить абсолютный путь к корневому разделу вашей машины. Используйте этот абсолютный путь вместо традиционного «/dev/sda1.»

Восстановление GRUB сотрет другие операционные системы на моем диске?

Нет. Загрузчик, по своей конструкции, знает, где найти только первые несколько байт ядра операционной системы. Замена загрузчика не повлияет на существующую на диске операционную систему.

Можно ли переустановить GRUB на системе UEFI ?

Да. Для этого вам нужно убедиться, что вы правильно смонтировали раздел «/boot/efi» вашей системы UEFI . Вам также нужно изменить значение флага —boot-directory в grub-install на «/boot/efi».

Для Fedora, вам также нужно изменить значение флага -o для grub2-mkconfig на /boot/efi/EFI/fedora/grub.cfg

Парашютист со стажем. Много читаю и слушаю подкасты. Люблю посиделки у костра, песни под гитару и приближающиеся дедлайны. Люблю путешествовать.

Источник

How to Reinstall the Boot Loader in Arch Linux

Jeremy Morgan

Jeremy

Let’s learn together on YouTube!

Recently I tried dual-booting FreeBSD and Arch Linux on my laptop. I already installed Arch Linux and left a partition open for FreeBSD later. I hosed my Grub, and the machine wouldn’t boot.

It’s an easy fix, so I wanted to share it. This is similar to how to restore your bootloader after installing Windows. The only difference is this laptop is 100% Arch Linux, and it’s a UEFI machine.

So, let’s say you’re like me and have Arch Linux installed, and you’ve toasted your GRUB bootloader. Here’s what you do.

Boot from an Arch Linux ISO

The first step is to get an Arch Linux ISO, burn it to a USB stick, and boot it.

Читайте также:  Astra linux совместимость с принтерами

How to reinstall boot loader Arch Linux

You’ll land on a prompt that looks like this:

How to reinstall boot loader Arch Linux

Know Your Disks

It’s important to know where your disks are and what partitions are where. You can do this by checking with:

How to reinstall boot loader Arch Linux

As you can see on my machine, I have my hard drive (/dev/sda), an SDcard (/dev/mmcblk0), and the USB drive I booted into Arch with (/dev/sdb1). I’m most concerned with /dev/sda.

/dev/sda1 is my EFI system. /dev/sda2 is where my Linux installation is that I need to point to again.

Technically since I only have one operating system, I don’t need GRUB, but I have it set up because someday I’ll take the time to wrangle in FreeBSD or something else. I digress.

Mount Your Arch System

I need to mount the / partition of my Arch system.

mkdir /mnt/arch mount -t auto /dev/sda2 /mnt/arch 

Ok, now it’s mounted, and time to chroot into it.

Now my system is up and running on my root drive. Any changes made here will be as if I logged into my system.

Next, I’ll mount my EFI folder:

I’ll need that when running my update.

Updating GRUB

Now I need to update GRUB. First, I’ll run OS Prober:

I only have one, but it will update my GRUB config. If you have multiple operating systems, you should do this as well. It should find them.

Now I’ll copy over the new grub config:

grub-mkconfig > /boot/grub/grub.cfg 

Cool! I’m ready to install it now.

Installing GRUB

Now I’ll need to install GRUB again, and I do that with the following command:

grub-install --efi-directory=/efi --target=x86_64-efi /dev/sda 

Now, this is the string that’s tricky to find in the documentation. There are many options for grub-install, and I learned the above string works due to trial and error, which is why I’m sharing it.

How to reinstall boot loader Arch Linux

Sweet! Now it’s time to reboot.

You’re Done!

How to reinstall boot loader Arch Linux

If you see this, you’re a happy camper! There’s the GRUB menu!

I’ve hosed my GRUB boot so many times I’ve become a pro at this. I hope it helps! Let me know if you have any questions!

Want to learn more about Linux? Of course you do. Check out this Linux Fundamentals course. You can sign up for a free trial here and take it today!

Published: Aug 14, 2020 by Jeremy Morgan. Contact me before republishing this content.

Источник

Оцените статью
Adblock
detector