Grub2 install error failed to get canonical path of

That seems to work.

That seems to work.

With all the juggling around of the order of things to do in the two guides, have I made any obvious errors in the following commands? This includes redoing the last two sections in the original post in a different order but otherwise continues from there and seems to work other than that I still have to enter the passphrase twice, and it uses a US keymap rather than a Danish one for the first of those prompts, but these are at least obvious problems that are easy enough to work on, I’m more worried about having done something wrong that’s non-obvious.

# Installation guide, Installation, Install the base packages
packstrap /mnt base base-devel vim

# Installation guide, Installation, Configure the system, Fstab
genfstab -U /mnt >> /mnt/etc/fstab

# Installation guide, Installation, Configure the system, Chroot
arch-chroot /mnt

# Installation guide, Installation, Configure the system, Time zone
ln -sf /usr/share/zoneinfo/Europe/Copenhagen /etc/localtime

# Installation guide, Installation, Configure the system, Localization
vim /etc/locale.gen
# Uncomment en_US.UTF-8 UTF-8 and other needed locales in /etc/locale.gen, and generate them with:
locale-gen
# Set the LANG variable in locale.conf(5) accordingly, for example:
vim /etc/locale.conf
# LANG=en_US.UTF-8
# If you set the keyboard layout, make the changes persistent in vconsole.conf(5):
vim /etc/vconsole.conf
# KEYMAP=dk-latin1

# Installation guide, Installation, Configure the system, Network configuration
vim /etc/hostname
# lenovo-u41-70
vim /etc/hosts
# 127.0.0.1	localhost
# ::1		localhost
# 127.0.1.1	lenovo-u41-70.localdomain	lenovo-u41-70
pacman -S networkmanager
systemctl enable NetworkManager

# dm-crypt/Encrypting an entire system, Encrypted boot partition (GRUB), Configuring mkinitcpio
vim /etc/mkinitcpio.conf
# Change HOOKS line to:
# HOOKS=(base systemd autodetect keyboard sd-vconsole modconf block sd-encrypt sd-lvm2 filesystems fsck)

# Installation guide, Installation, Configure the system, Initramfs
mkinitcpio -p linux

# Installation guide, Installation, Configure the system, Root password
passwd

# dm-crypt/Encrypting an entire system, Encrypted boot partition (GRUB), Configuring GRUB
pacman -S grub efibootmgr
grub-install --target=x86_64-efi --efi-directory=/efi --bootloader-id=GRUB --recheck
grub-install --target=i386-pc --recheck /dev/sda
# Configure GRUB to recognize the LUKS encrypted /boot partition and unlock the encrypted root partition at boot:
vim /etc/default/grub
# GRUB_CMDLINE_LINUX="... rd.luks.name=<sda4-UUID>=cryptlvm" ...
# GRUB_ENABLE_CRYPTODISK=y
grub-mkconfig -o /boot/grub/grub.cfg
# Use workaround if grub-mkconfig hangs: https://bbs.archlinux.org/viewtopic.php?pid=1820949#p1820949

# dm-crypt/Encrypting an entire system, Encrypted boot partition (GRUB), Configuring fstab and crypttab
dd bs=512 count=4 iflag=fullblock if=/dev/random of=/etc/mykeyfile
chmod 600 /etc/mykeyfile
cryptsetup luksAddKey /dev/sda3 /etc/mykeyfile
vim /etc/crypttab
# cryptboot /dev/sda3   none    luks
vim /etc/crypttab
# cryptboot    UUID=<UUID identifier of crypto_LUKS partition on sda3>    /etc/mykeyfile
vim /etc/fstab
# /dev/mapper/cryptboot        /boot   ext4        defaults        0       2
vim /etc/pacman.conf
# It may be worth considering to add the GRUB bootloader to the ignore list of /etc/pacman.conf in order to take particular control of when the bootloader (which includes its own encryption modules) is updated.

# Installation guide, Installation, Configure the system, Boot loader
pacman -S intel-ucode
grub-mkconfig -o /boot/grub/grub.cfg

# Installation guide, Installation, Reboot
exit
umount -R /mnt
reboot

# TODO:
# Installation guide, Installation, Post-Installation
# Fix keymap for GRUB stage 1 https://bbs.archlinux.org/viewtopic.php?id=240739
# Fix having to enter passphrase twice to boot.
# WiFi https://wiki.archlinux.org/index.php/Network_configuration
# Suspend to disk https://wiki.archlinux.org/index.php/Dm-crypt/Swap_encryption#With_suspend-to-disk_support
# https://wiki.archlinux.org/index.php/General_recommendations
# See tip about cryptboot after install. https://wiki.archlinux.org/index.php/Dm-crypt/Encrypting_an_entire_system#Encrypted_boot_partition_(GRUB)

Last edited by BearerOfHonesty (2019-01-08 03:09:00)

Ответ на:

комментарий
от fresa 13.01.21 15:31:58 MSK

Ответ на:

комментарий
от PURGEN143 13.01.21 15:34:07 MSK

Ответ на:

комментарий
от fresa 13.01.21 15:42:56 MSK

Ответ на:

комментарий
от PURGEN143 13.01.21 15:44:21 MSK

как то ты поперёк ман читаешь, там же написано что нужно создать /есп/ефи

fresa

(13.01.21 15:50:01 MSK)

  • Ссылка

я использую refind (тоже арчик), потому точно не подскажу. единственное, что в --efi-directory=, ты должен указать путь к директории с прошивкой. у меня выглядит так:

/dev/nvme0n1p2     312M          60M  253M           20% /boot
/dev/nvme0n1p1     200M         1,2M  199M            1% /boot/EFI

Ну, т.е. в твоём случае /dev/sda1 — должен быть efi раздел, /dev/sda2 — boot раздел и подмонтирован /dev/sda1 в /boot/EFI. Это и надо указать скорее всего (/boot/EFI), если ты примонтировал всё как надо.
Пакет efibootmgr так же должен быть установлен.

fehhner ★★★★★

(13.01.21 15:54:24 MSK)

  • Показать ответ
  • Ссылка

Ответ на:

комментарий
от fehhner 13.01.21 15:54:24 MSK

Да, щас вот допер и сделал все как вы озвучили. Теперь

 installing for x86_64-efi platform.
Grub-install: error: failed to get canonical path of "airootfs"
  • Показать ответ
  • Ссылка

Ответ на:

комментарий
от PURGEN143 13.01.21 15:34:07 MSK

Ответ на:

комментарий
от cica 13.01.21 16:01:00 MSK

grub-install /boot/efi

anonymous

(13.01.21 16:27:40 MSK)

  • Ссылка

Ответ на:

комментарий
от PURGEN143 13.01.21 15:57:09 MSK

Grub-install: error: failed to get canonical path of «airootfs»

Видимо, граб не может получить какие-то переменные окружение. Попробуй всё примонтировать и повторить уже в чруте (сначала arch-chroot).

fehhner ★★★★★

(13.01.21 16:29:06 MSK)

  • Ссылка

Ответ на:

комментарий
от PURGEN143 13.01.21 16:08:05 MSK

Ты пытаешься поставить груб не примонтировав корень или не чрутнувшись в него

anonymous

(13.01.21 16:31:11 MSK)

  • Показать ответ
  • Ссылка

Ответ на:

комментарий
от anonymous 13.01.21 16:31:11 MSK

то есть мне в /esp запихать корневой раздел, потом в /esp/efi запихать ефи и chroot /esp?

  • Показать ответ
  • Ссылка

Ответ на:

комментарий
от PURGEN143 13.01.21 16:33:07 MSK

Нет, в вики же все расписано. Монтируешь корень в /mnt арчрут в /mnt потом монтируешь ефи раздел в /efi или если так хочешь в /esp и ставишь груб

anonymous

(13.01.21 16:36:58 MSK)

  • Показать ответ
  • Ссылка

Ответ на:

комментарий
от anonymous 13.01.21 16:36:58 MSK

Прими пургена, может полегчает

anonymous

(13.01.21 16:46:49 MSK)

  • Ссылка

Я просто пишу grub-install /dev/nvme0n1. ESP смонтирован в /boot/efi.

anonymous

(13.01.21 16:51:07 MSK)

  • Показать ответ
  • Ссылка

Ответ на:

комментарий
от PURGEN143 13.01.21 16:46:31 MSK

Ответ на:

комментарий
от anonymous 13.01.21 16:56:15 MSK

Ответ на:

комментарий
от anonymous 13.01.21 16:51:07 MSK

Если б так просто. Я уже за вечер весь мозг себе вытрахал этим грабли, самому смешно аж

  • Показать ответы
  • Ссылка

Ответ на:

комментарий
от PURGEN143 13.01.21 16:57:46 MSK

да чтож такое а. чрут сделал? ефи примонтировал? ядро в бут лежит? как не видит, елки-палки, ты что-то делаешь не так.

anonymous

(13.01.21 17:02:30 MSK)

  • Показать ответ
  • Ссылка

Ответ на:

комментарий
от PURGEN143 13.01.21 16:59:54 MSK

забей на груб и всего делов. используй efistub!

anonymous

(13.01.21 17:03:30 MSK)

  • Ссылка

Ответ на:

комментарий
от PURGEN143 13.01.21 16:57:46 MSK

А ты оспробер поставил , чтоб он находил? С таким чтением вики ты и ядро мог не поставить.
Читай еще раз русскую вики по грубу, там все расписано.
И можешь загрузить арч и из своего груба вручную, конечно если ядро поставил.
В вики даны команды консоли груба.

anonymous

(13.01.21 17:08:04 MSK)

  • Показать ответы
  • Ссылка

Ответ на:

комментарий
от anonymous 13.01.21 17:08:04 MSK

Ответ на:

комментарий
от anonymous 13.01.21 17:02:30 MSK

Чё делал
sudo mount /dev/sda5 /mnt
Chroot /mnt
Sudo mount /dev/sda1 /mnt/efi
Sudo grub-install
Sudo update-grub
С телефа чет коды не работают, сорян за такую пасту

PURGEN143

(13.01.21 17:46:42 MSK)



Последнее исправление: PURGEN143 13.01.21 17:48:35 MSK
(всего

исправлений: 2)

  • Показать ответы
  • Ссылка

Ответ на:

комментарий
от anonymous 13.01.21 17:08:04 MSK

Арчем я уже пользуюсь недели 3, так что ядро там стоит :)

PURGEN143

(13.01.21 17:51:27 MSK)



Последнее исправление: PURGEN143 13.01.21 17:52:01 MSK
(всего

исправлений: 1)

  • Ссылка

Ответ на:

комментарий
от PURGEN143 13.01.21 17:46:42 MSK

че за sudo?

короче… надо как-то так:

mount /dev/sda2 /mnt
mount /dev/sda1 /mnt/boot/efi
cd /mnt
mount -t proc /proc /mnt/proc
mount --rbind /sys /mnt/sys
mount --rbind /dev /mnt/dev
mount --rbind /dev/pts /mnt/dev/pts
mount --rbind /run /mnt/run
mount --rbind /sys/firmware/efi/efivars /mnt/sys/firmware/efi/efivars
chroot /mnt /bin/bash
grub-install /boot/efi
grub-mkconfig -o /boot/grub/grub.cfg

anonymous

(13.01.21 18:00:42 MSK)

  • Показать ответы
  • Ссылка

Ответ на:

комментарий
от PURGEN143 13.01.21 17:46:42 MSK

Ну а конфиг груба кто генерировать будет, еще раз прочти вики.
И если не можешь простейшие действия по вики повторить, арч пока рано

anonymous

(13.01.21 18:01:46 MSK)

  • Показать ответ
  • Ссылка

Ответ на:

комментарий
от anonymous 13.01.21 17:19:46 MSK

Чтоб другие оси находил. Но ТС и основной конфиг не сгенерировал

anonymous

(13.01.21 18:03:23 MSK)

  • Ссылка

Ответ на:

комментарий
от anonymous 13.01.21 18:00:42 MSK

В арче есть arch-chroot он сам монтирует proc run и прочее

anonymous

(13.01.21 18:05:08 MSK)

  • Показать ответ
  • Ссылка

sudo shred /dev/sda тебе поможет, но это не точно.

anonymous

(13.01.21 18:08:02 MSK)

  • Ссылка

Ответ на:

комментарий
от anonymous 13.01.21 18:05:08 MSK

ну и пусть будет. новичку лучше мотировать все ручками, потом пригодиться.

anonymous

(13.01.21 18:08:12 MSK)

  • Ссылка

Ответ на:

комментарий
от anonymous 13.01.21 18:01:46 MSK

Да чё рано, как будто если я запорю граб на убунте то его будет проще восстановить. Поставил арч как-то, юзаю, прикольно

  • Показать ответ
  • Ссылка

Ответ на:

комментарий
от PURGEN143 13.01.21 18:12:40 MSK

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

anonymous

(13.01.21 18:14:58 MSK)

  • Ссылка

Ответ на:

комментарий
от PURGEN143 13.01.21 16:59:54 MSK

Именно так просто работает в Ubuntu и Debian.

anonymous

(13.01.21 18:27:20 MSK)

  • Ссылка

Ответ на:

комментарий
от anonymous 13.01.21 18:00:42 MSK

Достаточно

mount -t sysfs none /mnt/sys
mount -t proc none /mnt/proc
mount --bind /dev /mnt/dev

Размахивать --rbind ни к чему, это даст только неудобства с отмонтированием /dev/pts/. /sys/firmware тут тоже само подтянется.

anonymous

(13.01.21 18:31:11 MSK)

  • Ссылка

Ответ на:

комментарий
от anonymous 13.01.21 18:00:42 MSK

Ответ на:

комментарий
от PURGEN143 13.01.21 18:37:17 MSK

в первом же комменте лучшее решение, чем systemd-boot не подходит?

d09

(13.01.21 18:44:05 MSK)

  • Показать ответ
  • Ссылка

Ответ на:

комментарий
от d09 13.01.21 18:44:05 MSK

Ответ на:

комментарий
от anonymous 13.01.21 18:39:54 MSK

Хм, я когда арч ставил то боялся угрохать все другие записи в ефи разделе и создал отдельный, туда и поставил граб, все работало, однако сейчас поставил граб в ефи и нифига

  • Показать ответ
  • Ссылка

Ответ на:

комментарий
от PURGEN143 13.01.21 17:46:42 MSK

sudo mount /dev/sda5 /mnt Chroot /mnt Sudo mount /dev/sda1 /mnt/efi

Это совсем плохо.

Toxo2 ★★☆

(13.01.21 18:54:33 MSK)

  • Ссылка

Ответ на:

комментарий
от PURGEN143 13.01.21 18:49:52 MSK

Если boot отдельным разделом то и его монтировать надо.
Смотри русскую вики арча груб, там очень хорошо расписан порядок и действия

anonymous

(13.01.21 18:54:49 MSK)

  • Ссылка

Ответ на:

комментарий
от PURGEN143 13.01.21 18:48:25 MSK

Ответ на:

комментарий
от d09 13.01.21 19:27:28 MSK

Всё не так просто, я думаю ПУРГЕН наш не осилит. systemd-boot умеет грузить ядра только с того раздела, куда он сам установлен. То есть если он будет ставить его, ему надо будет писать хук пакмана, чтобы ядра перекидывались в его esp при обновлении или сделать /boot своим esp. Ещё bootloader entry надо написать, что легко, но пусть лучше осилит разделы примонтировать нормально и сгенерирует наконец grub.cfg, оно ему так проще будет.

cica

(13.01.21 19:46:47 MSK)

  • Показать ответ
  • Ссылка

Ответ на:

комментарий
от PURGEN143 13.01.21 17:46:42 MSK

Я же сказал: снчала смонтируй всё нормально.

mount /dev/sda5 /mnt  Здесь корень должен быть, если на sda5
mount /dev/sda2 /mnt/boot
mount /dev/sda1 /mnt/boot/EFI
arch-chroot /mnt

потом ставь

fehhner ★★★★★

(13.01.21 20:07:01 MSK)

  • Ссылка

Ответ на:

комментарий
от dimuska139 13.01.21 20:47:47 MSK

Зачем? Если нефиг делать есть много других полезных и интересных занятий

anonymous

(13.01.21 21:11:58 MSK)

  • Показать ответ
  • Ссылка

Ответ на:

комментарий
от anonymous 13.01.21 21:11:58 MSK

В том и суть, что переставить Linux куда быстрее, чем в этом ковыряться. И освободится время на «много других полезных и интересных занятий».

  • Показать ответ
  • Ссылка

Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.

Всем привет. не могу поставить grub выходит ошибка
Installing for i386-pc platform
grub-install: error: failed to get canonical path of » /cow».

Как только запускаю команду
grub-install /dev/sda то сразу выходит эта ошибка…

Installing for i386-pc platform
grub-install: error: failed to get canonical path of » /cow».

что можно сделать?
На автомате ставится без проблем, а если делаю ручную разметку то не ставится. В чем может быть дело?
использую вот этот мануал https://losst.ru/ustanovka-zagruzchika-grub#commen…


  • Вопрос задан

    более трёх лет назад

  • 26560 просмотров

Пригласить эксперта

Решил проблему с установкой на gpt , оказалось все очень просто для раздела загрузчика не хватало флага legacy_boot . Должно на разделе загрузчика стоять 2 флага bios_grub и legacy_boot

делал вот по этой инструкции https://losst.ru/ustanovka-zagruzchika-grub#commen… раздел «УСТАНОВКА ЗАГРУЗЧИКА GRUB В GPT ДЛЯ BIOS»

С консоли вот такую команду не запускал sudo grub-install /dev/sda
а просто как только разметил диски через gparted и поставил флаги, создал LVM тома для root home и swap . Запустил установщик стандартный указал для чего какой раздел, для своего grub раздела указал что-то типа «резервный загрузочный раздел Bios» и нажал установка и все встало без проблем.


  • Показать ещё
    Загружается…

09 февр. 2023, в 22:06

500 руб./за проект

09 февр. 2023, в 22:01

50000 руб./за проект

09 февр. 2023, в 22:00

1 руб./за проект

Минуточку внимания

View previous topic :: View next topic  
Author Message
mv
Watchman
Watchman

Joined: 20 Apr 2005
Posts: 6623

PostPosted: Sat Apr 16, 2016 2:54 pm    Post subject: grub2 w/ gpt: Failed to get canonical path of `none’ SOLVED Reply with quote

After some harddisk crash, I am trying to install with GPT (previously it was msdos label).

Can I somehow arrange this with grub2 without a complicated EFI setup? My motherboard is Gigabyte GA-H81MD2V

What I did so far is to use parted to create the label and setup my partitions and formatted some of them with ext4 (not all are formatted yet; all are empty).

I booted from rescueCD, and in order to check whether I can install grub2, I issued the command

Code:
grub2-install /dev/sda

(I checked that the device name sda is correct for the harddisk).

Unfortunately, all I receive is the message

grub2-install /dev/sda wrote:
Installing for i386-pc platform.

grub2-install: error: failed to get canonical path of `none’

Last edited by mv on Wed Apr 20, 2016 4:09 pm; edited 1 time in total

Back to top

View user's profile Send private message

324874
Apprentice
Apprentice

Joined: 26 Jul 2014
Posts: 168

PostPosted: Sun Apr 17, 2016 2:36 pm    Post subject: Reply with quote

Hi mv,

you are at least an advanced user, so, why didn’t solve your problem yourself ? :P :wink:

Best regards,

neoptslap

Back to top

View user's profile Send private message

mv
Watchman
Watchman

Joined: 20 Apr 2005
Posts: 6623

PostPosted: Sun Apr 17, 2016 3:49 pm    Post subject: Reply with quote

neoptslap wrote:
you are at least an advanced user, so, why didn’t solve your problem yourself ? :P :wink:



I suppose that there are people here who already installed a gpt disk (for booting) — I never did, and the only obvious (to me) attempt didn’t work as my question shows.

I wanted to know whether my labeling/partitioning makes sense (and can be arranged to boot) before spending many hours/days reinstalling and restoring data from backups (and hopefully still some from the broken disk).

Since nobody replied and I need my computer, I gave up gpt and use my old scheme for using msdos labels although the harddisk is 3TB, and «officially» my method is therefore not documented to work and might break with some future kernel.

Back to top

View user's profile Send private message

324874
Apprentice
Apprentice

Joined: 26 Jul 2014
Posts: 168

PostPosted: Sun Apr 17, 2016 5:40 pm    Post subject: Reply with quote

I warn you that I haven’t enough knowledge about the disk partitioning scheme so I advise you to check the information.

mv wrote:
I gave up gpt and use my old scheme for using msdos labels …



Gentoo Handbook wrote:
To have the disk with MBR layout, use mklabel msdos.



Gentoo Handbook wrote:
When a system’s software interface between the operating system and firmware is UEFI (instead of BIOS), GPT is almost mandatory as compatibility issues will arise with MBR here.



Gentoo Handbook wrote:
Some buggy BIOSes or EFIs configured to boot in BIOS/CSM/legacy mode might also have problems with booting from GPT labeled disks. If that is the case, it might be possible to work around the problem by adding the boot/active flag on the protective MBR partition which has to be done through fdisk with the -t dos option to force it to read the partition table using the MBR format.



Gentoo Handbook wrote:
Each partition is limited to 2 TB in size (due to the 32-bit identifiers). Also, the MBR setup does not provide any backup-MBR, so if an application or user overwrites the MBR, all partition information is lost.



So, I conclude your partition scheme isn’t correct if you want to use UEFI (cf. handbook). It is possible to use MBR on very large disks but require that the partitions have a size less than 2TB.

Best regards,

neoptslap

Back to top

View user's profile Send private message

mv
Watchman
Watchman

Joined: 20 Apr 2005
Posts: 6623

PostPosted: Mon Apr 18, 2016 8:00 am    Post subject: Reply with quote

neoptslap wrote:
I warn you that I haven’t enough knowledge about the disk partitioning scheme so I advise you to check the information.



That’s why I had asked. However, all information I found says that it is possible to boot gpt with BIOS (using grub2), but no source said how: As mentioned, my straightforward attempt to install grub2 failed.

Quote:
So, I conclude your partition scheme isn’t correct if you want to use UEFI



I want to use BIOS since UEFI appeared too complicated for me to setup. Moreover, I know that everything works fine on my machine with BIOS, since the only thing replaced is the harddisk.

Quote:
It is possible to use MBR on very large disks but require that the partitions have a size less than 2TB.



… and if each partition starts below the 2TB boundary, i.e. 4TB is the absolute limit. That’s the trick I used previously, although I heard that this is not officially supported: In theory, the next kernel version could calculate modulo 2TB, and who knows what windows does should I ever need it. This was the reason why I considered switching to gpt when I had to reinstall anyway.

Back to top

View user's profile Send private message

324874
Apprentice
Apprentice

Joined: 26 Jul 2014
Posts: 168

PostPosted: Mon Apr 18, 2016 10:02 am    Post subject: Reply with quote

Hi mv,

mv wrote:
I want to use BIOS since UEFI appeared too complicated for me to setup. Moreover, I know that everything works fine on my machine with BIOS, since the only thing replaced is the harddisk.

UEFI and BIOS are both firmwares ! Your machine has UEFI or BIOS ? Most new computers have UEFI software.

If you wanted to replace the BIOS firmware with UEFI firmware I can’t help you.

If you want to use UEFI firmware without legacy compatibility mode I might be able to help you.

—— Indeed, approximately, you have to make an EFI partition, create some directories, place some files as the Linux kernel,

—— and do some configurations, that’s all ! It isn’t complicated and may be easier than using a boot loader.

neoptslap wrote:

mv wrote:
… However, all information I found says that it is possible to boot gpt with BIOS (using grub2), but no source said how …



Gentoo Handbook wrote:
Using GPT on a BIOS-based computer works, but then one cannot dual-boot with a Microsoft Windows operating system. The reason is that Microsoft Windows will boot in EFI mode if it detects a GPT partition label.



Gentoo Handbook wrote:
… it might be possible to work around the problem by adding the boot/active flag on the protective MBR partition … to force it to read the partition table using the MBR format.



So, use a system partition software for GPT and add the boot/active flag on the protective MBR partition.

Otherwise, take another drive whose size is less than 2TB (approximately) because of BIOS limitations that will stop you, no choice ! :(

I’ve read this in a book : «Sometimes, partition’s size is restricted to 128 GiB due to BIOS limitations !»

neoptslap wrote:
It is possible to use MBR on very large disks but require that the partitions have a size less than 2TB.



So, I think I was wrong !

Best regards,

neoptslap

Back to top

View user's profile Send private message

mv
Watchman
Watchman

Joined: 20 Apr 2005
Posts: 6623

PostPosted: Mon Apr 18, 2016 3:55 pm    Post subject: Reply with quote

neoptslap wrote:
Your machine has UEFI or BIOS?



I am not sure, but I suppose it could already have UEFI.

Quote:
If you want to use UEFI firmware without legacy compatibility mode I might be able to help you.



I would prefer a boot loader which allows me to change and combine kernels, ramdisks, and kernel parameters at boot time.

Quote:
you have to make an EFI partition, create some directories, place some files as the Linux kernel



So my first mistake was to just create the partitions which I wanted. Apparently, I need at least one EFI partition (one for each kernel?).

Quote:
So, use a system partition software for GPT and add the boot/active flag on the protective MBR partition



Does this mean that I will need a hybrid MBR/GPT setup to use grub2? (BTW, the only partition software for GPT which I know is parted.)

None of these 2 options (hybrid GPT or no bootloader at all) are very attractive to me. I think I will stay with my old MBR-only «hack».

Quote:
Otherwise, take another drive whose size is less than 2TB (approximately) because of BIOS limitations that will stop you, no choice !



The hack with starting an extended partition before 2TB and making it 2TB large worked so far (even on several systems). As far as I understand, it is essentially just a question of the linux kernel (and perhaps the grub2 loader in case the kernel lies beyond 2TB), because the kernel has its own driver for the harddisk controller and need not fall back to BIOS.

Back to top

View user's profile Send private message

324874
Apprentice
Apprentice

Joined: 26 Jul 2014
Posts: 168

PostPosted: Mon Apr 18, 2016 4:56 pm    Post subject: Reply with quote

mv,

mv wrote:
I am not sure, but I suppose it could already have UEFI.



Be sure because it’s the most important thing to solve this case !

— topic 1042820 —

The Doctor wrote:
UEFFI has some really cool toys that come with it. A bootloader for example.



Just remember to turn off secure boot.



I believe that if your machine has a firmware based on UEFI you may boot with a GPT partition scheme without problem. :wink:

You have to disable secure boot in the UEFI firmware ‘s interface and boot with a media that boot «in UEFI mode».

I don’t know if it is useful using GPT on a BIOS-based computer ?

Gentoo Handbook wrote:
Using GPT on a BIOS-based computer works, but then one cannot dual-boot with a Microsoft Windows operating system. The reason is that Microsoft Windows will boot in EFI mode if it detects a GPT partition label.



Your main problem is the disk ‘s size if the machine has a firmware based on BIOS due to BIOS limitations (and maybe because of operating system ‘s limitations in some cases).

mv wrote:
The hack with starting an extended partition before 2TB and making it 2TB large worked so far (even on several systems). As far as I understand, it is essentially just a question of the linux kernel (and perhaps the grub2 loader in case the kernel lies beyond 2TB), because the kernel has its own driver for the harddisk controller and need not fall back to BIOS.



If it works it could be good !

mv wrote:
I would prefer a boot loader which allows me to change and combine kernels, ramdisks, and kernel parameters at boot time.



None of these 2 options (hybrid GPT or no bootloader at all) are very attractive to me. I think I will stay with my old MBR-only «hack».



A firmware based on UEFI may load a bootloader like GRUB so you may keep same functionnalities as previous (see Bootloader / Gentoo Handbook).

mv wrote:

So my first mistake was to just create the partitions which I wanted. Apparently, I need at least one EFI partition (one for each kernel?).



Does this mean that I will need a hybrid MBR/GPT setup to use grub2?



You have to adapt your partition scheme to the firmware, not GRUB2 (see Preparing the disks / Gentoo Handbook).

mv wrote:
… Apparently, I need at least one EFI partition (one for each kernel?).



No, there is only one EFI System Partition (ESP) for all kernels. Indeed, the «UEFI» firmware stores some of its data

on this specific partition to increase flexibility and improve management (cf. Unified Extended Firmware Interface specification).

mv wrote:
… who knows what windows does should I ever need it. This was the reason why I considered switching to gpt when I had to reinstall anyway.



I’m not sure I understand because I’m not a native english speaker but if you want to use Windows operating system so

you have to use a GPT partition scheme for recent releases.

Best regards,

neoptslap

Back to top

View user's profile Send private message

324874
Apprentice
Apprentice

Joined: 26 Jul 2014
Posts: 168

PostPosted: Tue Apr 19, 2016 5:42 am    Post subject: Reply with quote

— edition of my previous post (2016-04-19) —

—————neoptslap——————
Back to top

View user's profile Send private message

mv
Watchman
Watchman

Joined: 20 Apr 2005
Posts: 6623

PostPosted: Tue Apr 19, 2016 6:19 am    Post subject: Reply with quote

Thanks a lot for your help; I think that I can figure out the rest.

Just one final (unrelated) question: For external USB hard drives (from which I do not want to boot), can I expect that a recent kernel will be able to read GPT even beyond the 4TB limit on an older machine?

Back to top

View user's profile Send private message

Roman_Gruber
Advocate
Advocate

Joined: 03 Oct 2006
Posts: 3836
Location: Austro Bavaria

PostPosted: Tue Apr 19, 2016 10:14 am    Post subject: Reply with quote

I did not read everything.

I used the gentoo handbook, did the stuff as suggested.

I used grub2. and the ubuntu livecd (dvd) disc for installation with sysrescuecd in september.

The uefi thing needs something disabled so you can utilize grub, (secure booting i think)

the initramfs from gentoo needed some tweaking to be bootable for my box, but that depends on your scenario …

The only drawback for uefi is, everytime you remove the disc, the boot entry is gone for uefi and has to be redone

when you do a mistake in the uefi thing it may forget the boot entry and has to be redone

replug a disc which worked on teh same box wont work, everytime the bootloader has to be redone (uefi limitation which is a bit annoying)

Therefore i have now sysrescue cd next ot me always with the one command to write back the grub2 bootloader to uefi

(grub2-install —efi-directory=/boot/EFI) in my case

Back to top

View user's profile Send private message

324874
Apprentice
Apprentice

Joined: 26 Jul 2014
Posts: 168

PostPosted: Tue Apr 19, 2016 10:22 am    Post subject: Reply with quote

:D

Hi mv,

I know some things I have said may be incomplete and the final result may be very different (see below).

Indeed, I would have liked to have more knowledge about BIOS firmware and UEFI firmware but

I haven’t found time yet (cf. the last two posts / topic 1037574).

You may search NeddySeagoon ‘s posts using author and keywords boxes with the Gentoo forums search utility

about BIOS and UEFI, etc… (because NeddySeagoon ‘s posts are concise and informative) :!:

mv wrote:
Just one final (unrelated) question: For external USB hard drives (from which I do not want to boot), can I expect that a recent kernel will be able to read GPT even beyond the 4TB limit on an older machine?



wikipedia (english) wrote:


The fundamental purposes of the BIOS in modern PCs are to initialize and test the system hardware components, and to load a boot loader or an operating system from a mass memory device.



MS Windows NT, Linux, and other protected mode operating systems in general ignore the abstraction layer provided by the BIOS and do not use it after loading, instead accessing the hardware components directly.


I just remembered I have experienced an interresting case a few months ago. I was able to boot with

a bootloader located on a usb key detected by the firmware.

Indeed, the internal hard disk drive (hdd) I’ve used one wasn’t suited to the firmware and it hadn’t detected.

However, the Linux kernel was able to detect the hdd and I was able to use Gentoo on this computer.

So, I believe you may use an external hdd with GPT to store data (filesystems other the boot filesystem) with a recent Linux kernel.

Best regards,

neoptslap

Last edited by 324874 on Tue Apr 19, 2016 1:01 pm; edited 1 time in total

Back to top

View user's profile Send private message

mv
Watchman
Watchman

Joined: 20 Apr 2005
Posts: 6623

PostPosted: Tue Apr 19, 2016 12:50 pm    Post subject: Reply with quote

neoptslap and tw04l124, thank you very much for your help!
Back to top

View user's profile Send private message

kurisu
Apprentice
Apprentice

Joined: 19 Jan 2011
Posts: 159
Location: Munich, Germany

PostPosted: Tue Apr 19, 2016 5:29 pm    Post subject: Reply with quote

Appears like you have simply missed to create a small BIOS boot partition with type EF02. Mandatory in that case.

https://wiki.gentoo.org/wiki/GRUB2#BIOS_with_GPT

However, as long as you are not going for secure boot it is not that much of a hassle to switch to EFI. I have been using EFI stub kernels on various boxes for years now without encountering significant issues at all.

Back to top

View user's profile Send private message

axl
Veteran
Veteran

Joined: 11 Oct 2002
Posts: 1124
Location: Romania

PostPosted: Tue Apr 19, 2016 9:16 pm    Post subject: Reply with quote

i dont think you need a partition ef02. you would need that if you would have a gpt drive that you want to boot in legacy mode. as in not uefi mode.

in order to boot uefi mode, you need the following.

an efi enabled bios. and efi enabled boot media (gentoo suggests something i am not familiar with — i used an ubuntu image that i dd-ed onto an usb stick). actually booting in efi mode. and finally a gpt drive with an efi partition EF00.

Code:
[root@ana:~]# gdisk /dev/nvme0n1

GPT fdisk (gdisk) version 1.0.1

Partition table scan:

  MBR: protective

  BSD: not present

  APM: not present

  GPT: present

Found valid GPT with protective MBR; using GPT.

Command (? for help): p

Disk /dev/nvme0n1: 781422768 sectors, 372.6 GiB

Logical sector size: 512 bytes

Disk identifier (GUID): 9EF90B95-7D73-4CF4-9A6A-46D95ABA9DA4

Partition table holds up to 128 entries

First usable sector is 34, last usable sector is 781422734

Partitions will be aligned on 2048-sector boundaries

Total free space is 2014 sectors (1007.0 KiB)

Number  Start (sector)    End (sector)  Size       Code  Name

   1            2048          206847   100.0 MiB   EF00  efi

   2          206848       105064447   50.0 GiB    8300  gentoo

   3       105064448       209922047   50.0 GiB    AF00  osx

   4       209922048       781422734   272.5 GiB   0700  ten

Command (? for help):

IF you booted in EFI mode of the install media, then command efivar -l should show some results. if it doesn’t… then you are not booted in efi mode. but if the command does get you some results, then you are in efi mode.

from that point forward you can use handbooks method to write kernel directly to efi partition (which i dont like) or use grub to load kernel. as you are trying.

this is the background of the story as i understand it. now, in the case of the original poster, i am not clear if he is booted in efi mode or not. nor am i clear if his grub is compiled with x86_64-efi support. so compile grub with x86_64-efi support and try again. if that doesn’t work, try grub2-install —target=x86_64-efi. in this scenario, the efi partition should be mounted on /boot/efi. and should be like the one posted by me. if that doesn’t work play with grub2-install —target=x86_64-efi —efi-directory=/boot. but in this scenario, you already made something wrong.

will pay close attention to your reply.

EDIT: when system is properly setup, you can call grub2-install sda and everything _IS_ done automatically. if the conditions explained before are met.

[root@ana:~]# grub2-install /dev/nvme0n1

Installing for x86_64-efi platform.

Installation finished. No error reported.

Wed Apr 20 — 00:21:17

PS i mean without arguments. grub2-install /dev/sda should have worked if everything else was in order.

Back to top

View user's profile Send private message

324874
Apprentice
Apprentice

Joined: 26 Jul 2014
Posts: 168

PostPosted: Wed Apr 20, 2016 8:02 am    Post subject: Reply with quote

Hi,

Quote:

kurisu wrote:
Appears like you have simply missed to create a small BIOS boot partition with type EF02. Mandatory in that case.



… is not that much of a hassle to switch to EFI. I have been using EFI stub kernels on various boxes for years now without encountering significant issues at all.



axl wrote:
i dont think you need a partition ef02. you would need that if you would have a gpt drive that you want to boot in legacy mode. as in not uefi mode.



… now, in the case of the original poster, i am not clear if he is booted in efi mode or not …





( … ) («answer» below)

Quote:

mv wrote:


I suppose that there are people here who already installed a gpt disk (for booting) — I never did, and the only obvious (to me) attempt didn’t work as my question shows.

I wanted to know whether my labeling/partitioning makes sense (and can be arranged to boot) before spending many hours/days reinstalling and restoring data from backups (and hopefully still some from the broken disk).



The Doctor (in his signature) wrote:
First things first, but not necessarily in that order.





The first thing, here, is to know how to proceed. mv has said something and we have to know how to proceed.

Otherwise, we may take a wrong path.

Quote:

kurisu wrote:
https://wiki.gentoo.org/wiki/GRUB2#BIOS_with_GPT



Gentoo wiki / Grub2 (bios with gpt)

Gentoo wiki / Hybrid partition table



Thank you very much, kurisu ! It’s a good reference. axl, your work is good too but I think mv will be able to follow the handbook.

N.B : I did some mistakes. I need more trainings !

Best regards,

neoptslap

Back to top

View user's profile Send private message

324874
Apprentice
Apprentice

Joined: 26 Jul 2014
Posts: 168

PostPosted: Wed Apr 20, 2016 2:42 pm    Post subject: Reply with quote

My mistakes were

1. …

neoptslap wrote:


So, use a system partition software for GPT and add the boot/active flag on the protective MBR partition.



neoptslap wrote:
mv wrote:
… although the harddisk is 3TB …



neoptslap wrote:
I’ve read this in a book : «Sometimes, partition’s size is restricted to 128 GiB due to BIOS limitations !»



neoptslap wrote:
5 x 128 < 2TB ([5 partitions]



… take another drive whose size is less than 2TB (approximately) because of BIOS limitations…



1. My mistakes, here, was to make a generalization.

Gentoo Handbook wrote:
… Some buggy BIOSes or EFIs configured to boot in BIOS/CSM/legacy mode …



neoptslap wrote:

… partition <128GiB (some BIOS)


mv wrote:
neoptslap wrote:
… It is possible to use MBR on very large disks but require that the partitions have a size less than 2TB.



… and if each partition starts below the 2TB boundary, i.e. 4TB is the absolute limit … although I heard that this is not officially supported …

… This was the reason why I considered switching to gpt when I had to reinstall anyway.



neoptslap wrote:
3TB < 4TB (maybe, it could be work with the hard disk if there aren’t another limitations)



neoptslap wrote:
If the BIOS isn’t buggy so we can use GPT without adding the boot/active flag on the protective MBR partition and maybe there aren’t limitations (OS, bootloader).

… no hybrid partition table (MBR/GPT)



2. …

neoptslap wrote:
You have to adapt your partition scheme to the firmware, not GRUB2



2. My mistake, here, was to think that if the first element (the firmware) of the association (firmware + boot loader) was incorrect [1]

then the association was incorrect and therefore I could say that the second element (the bootloader) was unimportant

(= correct or incorrect, regardless). However, there are other combination and the «value» [1] of the second element (bootloader) may be of importance.

[1] … in a comparison to the partitioning scheme.

The next time I will do better because correct errors may be hell. :roll:

Best regards,

neoptslap

Back to top

View user's profile Send private message

mv
Watchman
Watchman

Joined: 20 Apr 2005
Posts: 6623

PostPosted: Wed Apr 20, 2016 4:17 pm    Post subject: Reply with quote

Again thanks a lot. I can really figure out the rest.

In the moment I hope that I can save huge parts of my original data (which was not all backed up) by cloning sectorwise (although it will take about 30 days…), and for this reason I must currently keep my original hack anyway until this is finished. Probably, I will be afraid to repartition later on when everything is full of data, but it is good that I understood now how to do it correctly next time…

Back to top

View user's profile Send private message

axl
Veteran
Veteran

Joined: 11 Oct 2002
Posts: 1124
Location: Romania

PostPosted: Wed Apr 20, 2016 7:01 pm    Post subject: Reply with quote

mv wrote:
but it is good that I understood now how to do it correctly next time…

had to be done. i’m pretty sure bios will become obsolete in the years that follow.

Back to top

View user's profile Send private message

Display posts from previous:   

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Forum rules
Before you post please read how to get help. Topics in this forum are automatically closed 6 months after creation.

User avatar

Reljoy

Level 4
Level 4
Posts: 300
Joined: Sat Mar 13, 2010 12:12 am

[SOLVED] Windows install broke grub

Installed win xp
Dual boot installed Mint 17.1 Mate 64bit
Installed win 8 to upgrade the windows XP partition
Lost my grub boot menu.

Now when I try to
sudo grub-install /dev/sda
I get
Grub-probe: error: failed to get canonical path of ‘/cow’.
Installing for i386-pc platform.
Grub-install.real: error: failed to get canonical path of ‘/cow’.

If i try
Sudo mount /dev/sda2 /mnt/boot
It says
Mount: mount point /mnt/boot does not exist

I have been looking at and trying things from
https://help.ubuntu.com/community/Grub2 … ken_System

Code: Select all

mint@mint ~ $ sudo fdisk -l

Disk /dev/sda: 2000.4 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders, total 3907029168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00011056

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048  1024002047   512000000    7  HPFS/NTFS/exFAT
/dev/sda2      1024002048  1025025485      511719   83  Linux
/dev/sda3      1025028094  3907028991  1441000449    5  Extended
Partition 3 does not start on physical sector boundary.
/dev/sda5      1025028096  1034790911     4881408   82  Linux swap / Solaris
/dev/sda6      1034792960  1151987711    58597376   83  Linux
/dev/sda7      1151989760  3907028991  1377519616   83  Linux

Code: Select all

mint@mint ~ $ sudo blkid
/dev/loop0: TYPE="squashfs" 
/dev/sr0: LABEL="Linux Mint 17.1 MATE 64-bit" TYPE="iso9660" 
/dev/sda1: UUID="B694CBEC94CBAD65" TYPE="ntfs" 
/dev/sda2: UUID="d250d8b4-82c9-4b40-9fd1-40fb4ecf547a" TYPE="ext2" 
/dev/sda5: UUID="e56b41bd-3849-442b-8f6e-052f6ad308e3" TYPE="swap" 
/dev/sda6: UUID="29a46605-59c0-4845-b9cd-a22d5bfeb672" TYPE="ext4" 
/dev/sda7: UUID="ffd02ebf-6297-473e-a65f-f77bcb318bde" TYPE="ext4" 

I have booted from the live DVD to try to fix it and to post this request for help.

Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.

Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.

User avatar

Pierre

Level 21
Level 21
Posts: 12788
Joined: Fri Sep 05, 2008 5:33 am
Location: Perth, AU.

Re: Windows install broke grub

Post

by Pierre » Sun May 31, 2015 9:41 am

the Windows O/S typically overwrites the MBR and any boot_menu.

so — you have to boot the Mint live_disk / stick,
& you will then have to re-install the LinuxMint boot_loader AKA : GRUB_LOADER.
http://community.linuxmint.com/tutorial/view/245

& so you will have to use the live_disk to do that.

Image
Please edit your original post title to include [SOLVED] — when your problem is solved!
and DO LOOK at those Unanswered Topics — — you may be able to answer some!.

User avatar

Reljoy

Level 4
Level 4
Posts: 300
Joined: Sat Mar 13, 2010 12:12 am

Re: Windows install broke grub

Post

by Reljoy » Mon Jun 01, 2015 4:33 am

Thanks for the reply. Unfortunately I cannot get it to work.
I went to the link you gave Pierre, and steps 1 and 2 were fine:

Now we need to mount the Linux Mint partition so that we are able to use it (access it) . To do this copy and paste this code into the terminal sudo mount /dev/sdXY /mnt

Code: Select all

mint@mint ~ $ sudo mount /dev/sda6 /mnt
mint@mint ~ $ sudo mount /dev/sda2 /mnt

Note: sda2 is /boot
sda6 is /

But I got confused on step 3 which says:

sudo grub-install —root-directory=/mnt/ /dev/sdX

Code: Select all

mint@mint ~ $ sudo grub-install --root-directory=/mnt/ /dev/sda
grub-probe: error: failed to get canonical path of `/cow'.
Installing for i386-pc platform.
Installation finished. No error reported.

I do not know what that means but it doesn’t look right to me.

You should then see a message saying Grub installer finished or something like that.

Code: Select all

mint@mint ~ $ sudo grub-install --root-directory=/mnt/ /dev/sda
grub-probe: error: failed to get canonical path of `/cow'.
Installing for i386-pc platform.
Installation finished. No error reported.

Well it did say «Installation finished. No error reported.»
So now I will reboot and see if it works.

User avatar

Pjotr

Level 23
Level 23
Posts: 18550
Joined: Mon Mar 07, 2011 10:18 am
Location: The Netherlands (Holland) 🇳🇱
Contact:

Re: Windows install broke grub

Post

by Pjotr » Mon Jun 01, 2015 4:44 am

Reljoy wrote:grub-probe: error: failed to get canonical path of `/cow’.

That particular error is harmless. You should be fine now. :)

User avatar

Reljoy

Level 4
Level 4
Posts: 300
Joined: Sat Mar 13, 2010 12:12 am

Re: Windows install broke grub

Post

by Reljoy » Mon Jun 01, 2015 4:51 am

Well, I managed to stop it booting straight into windows.
Now it stops in grub. There is a heading :
GNU GRUB version 2.02~beta2-9ubuntu1
and a couple of sentences about Minimal BASH-like line editing being supported.
Then it has on the left hand side

So I tried:

Code: Select all

mint@mint ~ $ sudo mount /dev/sda2 /mnt
mint@mint ~ $ sudo grub-install --root-directory=/mnt/ /dev/sda
grub-probe: error: failed to get canonical path of `/cow'.
Installing for i386-pc platform.
Installation finished. No error reported.
mint@mint ~ $ sudo update-grub
/usr/sbin/grub-probe: error: failed to get canonical path of `/cow'.

But it didn’t work.
I do not know what to do now.

User avatar

Pjotr

Level 23
Level 23
Posts: 18550
Joined: Mon Mar 07, 2011 10:18 am
Location: The Netherlands (Holland) 🇳🇱
Contact:

Re: Windows install broke grub

Post

by Pjotr » Mon Jun 01, 2015 5:01 am

You’ve got Grub back in the MBR (it replaced NTLoader from Windows), but apparently it doesn’t point to your Linux root partition yet. Edit: I see that you’ve apparently separated /boot (sda2) from root (sda6). Why this complication?

Oh, and by the way: you shouldn’t run «sudo update-grub» afterwards. That you should only do when back in your successfully booted Linux (in order to make it recognize the new Windows).

User avatar

Reljoy

Level 4
Level 4
Posts: 300
Joined: Sat Mar 13, 2010 12:12 am

Re: Windows install broke grub

Post

by Reljoy » Mon Jun 01, 2015 6:09 am

This looks helpful. I will reboot and try it. By putting the link here I will not lose it when I reboot with the live DVD.
http://askubuntu.com/questions/207663/c … n-live-usb

I separate /boot from / as it was recommended in a tutorial about partitioning and installing Linux Mint. I also have a separate /home

Code: Select all

mint@mint /mnt $ blkid
/dev/loop0: TYPE="squashfs" 
/dev/sda1: UUID="B694CBEC94CBAD65" TYPE="ntfs" 
/dev/sda2: UUID="d250d8b4-82c9-4b40-9fd1-40fb4ecf547a" TYPE="ext2" 
/dev/sda5: UUID="e56b41bd-3849-442b-8f6e-052f6ad308e3" TYPE="swap" 
/dev/sda6: UUID="29a46605-59c0-4845-b9cd-a22d5bfeb672" TYPE="ext4" 
/dev/sda7: UUID="ffd02ebf-6297-473e-a65f-f77bcb318bde" TYPE="ext4" LABEL="Home" 
/dev/sr0: LABEL="Linux Mint 17.1 MATE 64-bit" TYPE="iso9660" 

sda2 is /boot
sda6 is /
sda7 is /home

User avatar

Pjotr

Level 23
Level 23
Posts: 18550
Joined: Mon Mar 07, 2011 10:18 am
Location: The Netherlands (Holland) 🇳🇱
Contact:

Re: Windows install broke grub

Post

by Pjotr » Mon Jun 01, 2015 6:14 am

Reljoy wrote:I separate /boot from / as it was recommended in a tutorial about partitioning and installing Linux Mint. I also have a separate /home

A separate /home is no problem in this case (although I don’t find that very useful, so I don’t have one myself). But the separate /boot is at best a needless complication, which might well be an extra problem in this case.

User avatar

Reljoy

Level 4
Level 4
Posts: 300
Joined: Sat Mar 13, 2010 12:12 am

Re: Windows install broke grub

Post

by Reljoy » Mon Jun 01, 2015 6:23 am

mint@mint ~ $ sudo mount /dev/sda6 /mnt
mint@mint ~ $ sudo mount /dev/sda2 /mnt/boot
So far so good.

sudo grub-install —root-directory=/mnt /dev/sda

Code: Select all

mint@mint ~ $ sudo grub-install --root-directory=/mnt /dev/sda
grub-probe: error: failed to get canonical path of `/cow'.
Installing for i386-pc platform.
Installation finished. No error reported.

That doesn’t look good. Looks like something didn’t work.

Code: Select all

mint@mint ~ $ df
Filesystem     1K-blocks    Used Available Use% Mounted on
/cow             1764912   78708   1686204   5% /
udev             1720464      12   1720452   1% /dev
tmpfs             352984    1360    351624   1% /run
/dev/sr0         1594656 1594656         0 100% /cdrom
/dev/loop0       1554816 1554816         0 100% /rofs
none                   4       0         4   0% /sys/fs/cgroup
tmpfs            1764912       4   1764908   1% /tmp
none                5120       0      5120   0% /run/lock
none             1764912      76   1764836   1% /run/shm
none              102400      36    102364   1% /run/user
/dev/sda6       57546748 5229748  49370748  10% /mnt
/dev/sda2         495560    6781    463195   2% /mnt/boot

User avatar

Pjotr

Level 23
Level 23
Posts: 18550
Joined: Mon Mar 07, 2011 10:18 am
Location: The Netherlands (Holland) 🇳🇱
Contact:

Re: Windows install broke grub

Post

by Pjotr » Mon Jun 01, 2015 6:25 am

Reljoy wrote:mint@mint ~ $ sudo mount /dev/sda6 /mnt
mint@mint ~ $ sudo mount /dev/sda2 /mnt/boot
So far so good.

sudo grub-install —root-directory=/mnt /dev/sda

Code: Select all

mint@mint ~ $ sudo grub-install --root-directory=/mnt /dev/sda
grub-probe: error: failed to get canonical path of `/cow'.
Installing for i386-pc platform.
Installation finished. No error reported.

That doesn’t look good. Looks like something didn’t work.

That *does* look good! As I said before: the «cow» error is harmless. :)

I advise to try a normal boot now.

User avatar

Pjotr

Level 23
Level 23
Posts: 18550
Joined: Mon Mar 07, 2011 10:18 am
Location: The Netherlands (Holland) 🇳🇱
Contact:

Re: Windows install broke grub

Post

by Pjotr » Mon Jun 01, 2015 6:39 am

Well, in this case I’d consider the «nuclear option»: do a clean re-install of Linux Mint 17.1. In this case you have a separate /home anyway, so that should save you some time and trouble.

When you do this: do *not* create a separate /boot again. It’s an unnecessary complication.

Laurent85

Level 17
Level 17
Posts: 7015
Joined: Tue May 26, 2015 10:11 am

Re: Windows install broke grub

Post

by Laurent85 » Mon Jun 01, 2015 6:41 am

Reljoy wrote:

Code: Select all

mint@mint ~ $ sudo update-grub
/usr/sbin/grub-probe: error: failed to get canonical path of `/cow'.

But it didn’t work.
I do not know what to do now.

You need to chroot before updating grub menu list. Try :

Code: Select all

$ sudo mount /dev/sda6 /mnt
$ sudo mount /dev/sda2 /mnt/boot
$ sudo mount -o bind /dev /mnt/dev
$ sudo -s
# chroot /mnt
# mount -t proc proc /proc && mount -t sysfs sysfs /sys && mount -t devpts devpts /dev/pts
# grub-install /dev/sda
# update-grub
# umount /dev/pts /sys /proc
# exit
another exit
# exit
$ sudo umount /mnt/dev /mnt/boot /mnt

Then reboot.

Image

User avatar

Reljoy

Level 4
Level 4
Posts: 300
Joined: Sat Mar 13, 2010 12:12 am

Re: Windows install broke grub

Post

by Reljoy » Mon Jun 01, 2015 6:47 am

That looks a lot better!

Code: Select all

mint@mint ~ $ sudo mount /dev/sda6 /mnt
mint@mint ~ $ sudo mount /dev/sda2 /mnt/boot
mint@mint ~ $ sudo mount -o bind /dev /mnt/dev
mint@mint ~ $ sudo -s
mint ~ # chroot /mnt
mint / # mount -t proc proc /proc && mount -t sysfs sysfs /sys && mount -t devpts devpts /dev/pts
mint / # grub-install /dev/sda
Installing for i386-pc platform.
Installation finished. No error reported.
mint / # update-grub
Generating grub configuration file ...
  No volume groups found
Found Windows 8 (loader) on /dev/sda1
done
mint / # umount /dev/pts /sys /proc
mint / # exit
exit
mint ~ # exit
exit
mint@mint ~ $ sudo umount /mnt/dev /mnt/boot /mnt
mint@mint ~ $ 

What does this line do?

And what does this line do?

Code: Select all

mount -t proc proc /proc && mount -t sysfs sysfs /sys && mount -t devpts devpts /dev/pts

About to reboot now.

User avatar

Reljoy

Level 4
Level 4
Posts: 300
Joined: Sat Mar 13, 2010 12:12 am

Re: Windows install broke grub

Post

by Reljoy » Mon Jun 01, 2015 6:54 am

Grub menu has Windows 8 in it.
I can boot into Windows 8.

But there is no entry for Linux Mint in the Grub menu.

Laurent85

Level 17
Level 17
Posts: 7015
Joined: Tue May 26, 2015 10:11 am

Re: Windows install broke grub

Post

by Laurent85 » Mon Jun 01, 2015 7:00 am

Reljoy wrote:

Code: Select all

mint / # update-grub
Generating grub configuration file ...
  No volume groups found
Found Windows 8 (loader) on /dev/sda1
done 

Humm no kernel image reported by update-grub. Grub could not find any kernel image installed. Please check :

Code: Select all

$ sudo mount /dev/sda2 /mnt
$ sudo ls /mnt
$ sudo umount /mnt
$ sudo mount /dev/sda6 /mnt
$ sudo ls /mnt/boot
$ sudo umount /mnt

Please report command output.

Image

User avatar

Reljoy

Level 4
Level 4
Posts: 300
Joined: Sat Mar 13, 2010 12:12 am

Re: Windows install broke grub

Post

by Reljoy » Mon Jun 01, 2015 7:06 am

Code: Select all

mint@mint ~ $ sudo mount /dev/sda2 /mnt
mint@mint ~ $ sudo ls /mnt
boot  grub  lost+found
mint@mint ~ $ sudo umount /mnt
mint@mint ~ $ sudo mount /dev/sda6 /mnt
mint@mint ~ $ sudo ls /mnt/boot
grub
mint@mint ~ $ sudo umount /mnt
mint@mint ~ $ 

User avatar

Reljoy

Level 4
Level 4
Posts: 300
Joined: Sat Mar 13, 2010 12:12 am

Re: Windows install broke grub

Post

by Reljoy » Mon Jun 01, 2015 7:15 am

Code: Select all

mint@mint ~ $ sudo mount /dev/sda2 /mnt
mint@mint ~ $ sudo ls /mnt
boot  grub  lost+found
mint@mint ~ $ sudo umount /mnt
mint@mint ~ $ sudo mount /dev/sda6 /mnt
mint@mint ~ $ sudo ls /mnt/boot
grub
mint@mint ~ $ sudo umount /mnt
mint@mint ~ $ sudo mount /dev/sda2 /mnt
mint@mint ~ $ sudo ls /mnt/boot
grub
mint@mint ~ $ sudo umount /mnt
mint@mint ~ $ sudo mount /dev/sda6 /mnt
mint@mint ~ $ sudo cat /mnt/etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sda6 during installation
UUID=29a46605-59c0-4845-b9cd-a22d5bfeb672 /               ext4    errors=remount-ro 0       1
# /boot was on /dev/sda2 during installation
UUID=2efbf722-5cd4-4f18-a1cb-dbfa18e403d0 /boot           ext2    defaults        0       2
# /home was on /dev/sda7 during installation
UUID=ffd02ebf-6297-473e-a65f-f77bcb318bde /home           ext4    defaults        0       2
# swap was on /dev/sda5 during installation
UUID=e56b41bd-3849-442b-8f6e-052f6ad308e3 none            swap    sw              0       0
mint@mint ~ $ sudo umount /mnt
mint@mint ~ $ 

Laurent85

Level 17
Level 17
Posts: 7015
Joined: Tue May 26, 2015 10:11 am

Re: Windows install broke grub

Post

by Laurent85 » Mon Jun 01, 2015 7:21 am

So your boot directory has no kernel image installed. Type this commands to fix :

Code: Select all

$ sudo mount /dev/sda6 /mnt
$ sudo mount /dev/sda2 /mnt/boot
$ sudo mount -o bind /dev /mnt/dev
$ sudo -s
# chroot /mnt
# mount -t proc proc /proc && mount -t sysfs sysfs /sys && mount -t devpts devpts /dev/pts
Cleaning boot
# rm -r /boot/*
# grub-install /dev/sda
# apt-get --reinstall install linux-kernel-generic linux-headers-3.13.0-37 linux-headers-3.13.0-37-generic linux-image-3.13.0-37-generic linux-image-extra-3.13.0-37-generic
Reinstall shoud update initramfs & grub but to be sure :
# update-initramfs -u
# update-grub
Grub should report kernel image found
# umount /dev/pts /sys /proc
# exit
another exit
# exit
$ sudo umount /mnt/dev /mnt/boot /mnt

Reboot.

Image

For what it’s worth, I get a similar behavior on Debian Jessie (installed roughly according to the guide, but with LUKS encrypted root) if I use the grub-pc package from jessie-backports (2017-03-28) but it works if I use the version from Debian testing instead.

I thought at first that I wouldn’t need the newer grub version from testing because I was going to use /boot on ext4, but I found out the grub package is involved in figuring out the root=ZFS= kernel parameter. So I needed the testing version anyways.

The versions were like this:

# Before upgrade (does not work)
root@debnastest:/etc/grub.d# /.zfs/snapshot/seems-to-work-now/usr/sbin/grub-probe --version
/.zfs/snapshot/seems-to-work-now/usr/sbin/grub-probe (GRUB) 2.02~beta2-22+deb8u1

# After upgrade (works)
root@debnastest:~# grub-probe --version
grub-probe (GRUB) 2.02~beta3-5

root@debnastest:/etc/grub.d# apt-cache policy grub-pc
grub-pc:
  Installed: 2.02~beta3-5
  Candidate: 2.02~beta3-5
  Version table:
 *** 2.02~beta3-5 0
        600 http://ftp.debian.org/debian/ testing/main amd64 Packages
        100 /var/lib/dpkg/status
     2.02~beta2-22+deb8u1 0
        700 http://ftp.us.debian.org/debian/ jessie/main amd64 Packages
        700 http://security.debian.org/ jessie/updates/main amd64 Packages

With grub-pc from jessie-backports grub-probe is broken:

root@debnastest:~# zpool status
  pool: rpool
 state: ONLINE
  scan: resilvered 996K in 0h0m with 0 errors on Sat Mar 25 12:42:14 2017
config:

        NAME               STATE     READ WRITE CKSUM
        rpool              ONLINE       0     0     0
          mirror-0         ONLINE       0     0     0
            crypt-rpool-a  ONLINE       0     0     0
            crypt-rpool-b  ONLINE       0     0     0

errors: No known data errors
root@debnastest:~# grub-probe /boot
ext2
root@debnastest:~# grub-probe /
grub-probe: error: failed to get canonical path of `/dev/crypt-rpool-a'.
root@debnastest:~# ln -s /dev/mapper/crypt-rpool-* /dev/
root@debnastest:~# grub-probe /
grub-probe: error: unknown filesystem.

The first problem is that it looks for the devices in the wrong place. Symlinking them causes another unknown filesystem error in this version of grub from jessie-backports.

After upgrading to grub-pc from Debian testing it works even without the symlinks:

root@debnastest:~# zpool status
  pool: rpool
 state: ONLINE
  scan: resilvered 996K in 0h0m with 0 errors on Sat Mar 25 12:42:14 2017
config:

        NAME               STATE     READ WRITE CKSUM
        rpool              ONLINE       0     0     0
          mirror-0         ONLINE       0     0     0
            crypt-rpool-a  ONLINE       0     0     0
            crypt-rpool-b  ONLINE       0     0     0

errors: No known data errors
root@debnastest:~# grub-probe --version
grub-probe (GRUB) 2.02~beta3-5
root@debnastest:~# grub-probe /
zfs
root@debnastest:~# ls -l /dev/crypt*
ls: cannot access /dev/crypt*: No such file or directory

The command used by /etc/grub.d/10_linux to find out the pool name for the root also started working when upgrading to grub from testing:

root@debnastest:/etc/grub.d# grub-probe --device /dev/mapper/crypt-rpool-a --target=fs_label                  
rpool

-edit-: here is what the partitioning looks like:

root@debnastest:~# gdisk -l /dev/sda
GPT fdisk (gdisk) version 0.8.10

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.
Disk /dev/sda: 31457280 sectors, 15.0 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): C9A4B367-0338-4234-AF67-0A75E82ABF5C
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 31457246
Partitions will be aligned on 2-sector boundaries
Total free space is 0 sectors (0 bytes)

Number  Start (sector)    End (sector)  Size       Code  Name
   1         1667072        31440861   14.2 GiB    BF01  rpool-b
   2              34            4095   2.0 MiB     EF02  bios-boot
   3            4096          618495   300.0 MiB   EF00  efi-boot
   4          618496         1667071   512.0 MiB   FD00  boot-b
   9        31440862        31457246   8.0 MiB     8301  Linux reserved

root@debnastest:~# gdisk -l /dev/sdb
GPT fdisk (gdisk) version 0.8.10

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.
Disk /dev/sdb: 31457280 sectors, 15.0 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): F6113851-6D14-4C39-AE43-D14B2B36DD13
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 31457246
Partitions will be aligned on 2-sector boundaries
Total free space is 0 sectors (0 bytes)

Number  Start (sector)    End (sector)  Size       Code  Name
   1         1667072        31440861   14.2 GiB    BF01  rpool-a
   2              34            4095   2.0 MiB     EF02  bios-boot
   3            4096          618495   300.0 MiB   EF00  efi-boot
   4          618496         1667071   512.0 MiB   FD00  boot-a
   9        31440862        31457246   8.0 MiB     8301  Linux reserved

I boot using the BIOS method with GPT partitioning, but have prepared the efi partitions for future use (unformatted). I’m testing this in VirtualBox as a candidate for a home server install. /boot is on ext4 on mdadm RAID1 on the boot-{a,b} partitions.

mdadm and cryptsetup:

root@debnastest:~# cat /etc/crypttab 
# <target name> <source device>         <key file>      <options>
crypt-rpool-a /dev/disk/by-partlabel/rpool-a none luks,initramfs
crypt-rpool-b /dev/disk/by-partlabel/rpool-b none luks,initramfs

root@debnastest:~# cat /etc/mdadm/mdadm.conf 
# mdadm.conf
#
# Please refer to mdadm.conf(5) for information about this file.
#

# by default (built-in), scan all partitions (/proc/partitions) and all
# containers for MD superblocks. alternatively, specify devices to scan, using
# wildcards if desired.
#DEVICE partitions containers

# auto-create devices with Debian standard permissions
CREATE owner=root group=disk mode=0660 auto=yes

# automatically tag new arrays as belonging to the local system
HOMEHOST <system>

# instruct the monitoring daemon where to send mail alerts
MAILADDR root

# definitions of existing MD arrays
ARRAY /dev/md/0  metadata=1.2 UUID=985a044f:1e43f780:7df469cf:48b6eca2 name=debian:0

# This configuration was auto-generated on Thu, 23 Mar 2017 19:18:37 +0100 by mkconf

fstab:

root@debnastest:~# cat /etc/fstab 
rpool/ROOT/debian / zfs defaults 0 1
/dev/md/0 /boot ext4 defaults 0 2

Понравилась статья? Поделить с друзьями:

Читайте также:

  • Grub rescue insmod normal error
  • Grub register command lockdown not found error symbol
  • Grub probe ошибка не удалось найти привод grub для dev sdb1 проверьте device map
  • Grub probe error disk lvmid not found
  • Grub minimal bash like line editing is supported как исправить

  • 0 0 голоса
    Рейтинг статьи
    Подписаться
    Уведомить о
    guest

    0 комментариев
    Старые
    Новые Популярные
    Межтекстовые Отзывы
    Посмотреть все комментарии