Меню

Usr sbin grub probe ошибка не удалось найти устройство для dev смонтирован

I encountered the cannot find a device for /boot (is /dev mounted?) error message in a VM I was working on. I have no idea if my solution will apply to you, or to anyone else.

My VM was failing to boot. Therefore, I booted into a rescue environment. The rescue environment was probably running on read-only media that was mounted on /. As you can see below, I mounted the disk containing my broken desired host installation on /mnt.

I surmised that grub-install expects to run inside the host OS filesystem, and, furthermore, grub-install expects to be able to see the mount of the root filesystem for that host.

So the trick was to first chroot into the host OS, and then re-mount the host OS on /.

I did the following (which I am typing from memory, so it is possible there are errors).

# mount /dev/sdaN /mnt
# mount --rbind /dev  /mnt/dev
# mount --rbind /proc /mnt/proc
# mount --rbind /sys  /mnt/sys
# chroot /mnt bash
# mount /dev/sdaN /
# grub-install /dev/sda

I was then able to reboot the VM successfully. My host OS was Ubuntu 18.04, and the rescue environment was a version of Debian with a 4.x kernel.

This problem is most often seen during an apt-get update or similar.

Issues in chroot

Mostly this is caused by some issues when running in a chroot.
Before switching to the chroot, it’s necessary to mount at least the /dev and /proc directories.
However sometimes we’ve seen this issue even with these mounts properly configured.

In this example vm1 represens the device our system is running on; it could as easily have been /dev/sda1 or /dev/sdx4.

~ # mount /dev/vg0/vm1 /mnt/vm1
~ # mount -o bind /dev /mnt/vm1/dev
~ # mount -o bind /dev/pts /mnt/vm1/dev/pts
~ # mount -o bind /proc /mnt/vm1/proc
~ # mount -o bind /run /mnt/vm1/run
~ # mount -o bind /sys /mnt/vm1/sys
~ # chroot /mnt/vm1 /bin/bash

Viewing grub-mkconfig Details

Run grub-mkconfig with debug spew to see details.

~ # sh -x /usr/sbin/grub-mkconfig -o /boot/grub/grub.cfg

Work Arounds

If grub-probe still fails for you, even if properly entering chroot there is one last-ditch work-around.

The purpose of grub-probe is to simply output the file-system type for /.
So, in the worst case you can do this.

~ # mv /usr/sbin/grub-probe /usr/sbin/grub-probe.orig
~ # curl edoceo.com/pub/grub-probe.sh > /usr/sbin/grub-probe
~ # chmod 0755 /usr/sbin/grub-probe

Here we effectively replace the binary grub-probe with a shell script that simply echos a known good value.

Core of grub-probe

The grub-probe utility is a binary that does something like this.

  1. Examine /proc/filesystems
  2. Examine /boot/grub/device.map
  3. Probe /dev/sd*
  4. Examine /proc/devices
  5. Examine /proc/self/mountinfo

From that information it will output the file-system type, device, file-system UUID which are fed to the grub-mkconfig

Are you trying to install GRUB with grub-install /dev/sda1?

Since GRUB practically requires access to MBR and the unused space between the MBR and the first partition when installing for BIOS-style boot process, try grub-install /dev/sda. If it still displays the same error message, just write your own /boot/grub/device.map file. In your case, its contents could be just

(hd0)    /dev/sda

(Ideally, you would use an appropriate /dev/disk/by-id/... pathname in place of /dev/sda, but that’s not mandatory.)

grub-install /dev/sda1 would attempt to embed GRUB’s boot block into PBR of partition sda1 instead of the MBR. Since most filesystems won’t have a fixed space for bootloader, GRUB’s boot block would have to point at /boot/grub/i386-pc/core.img by physical disk location, which used to be a very seriously discouraged installation mode. Modern versions of GRUB might no longer support installing GRUB that way at all.

The problem is, the boot block code needs to be so small it won’t understand filesystems, so it reads the GRUB image using raw disk block numbers determined at GRUB installation time. For this to work, the GRUB core image needs to be placed somewhere where its physical location on disk is guaranteed to stay the same. From the OS viewpoint, /boot/grub/i386-pc/core.img is a regular file, so a defragmentation tool or a smart filesystem driver might occasionally move it to a different physical location on-disk: that would cause a total boot failure.

When GRUB is installed to the actual Master Boot Record of a MBR-partitioned disk, the empty space between the MBR and the beginning of the first partition (almost 1 MB) is used for the GRUB core image. Since this place is outside any partitions, no filesystem driver or defragmenting tool is going to touch it. This is enough space to embed the GRUB core image, a filesystem driver and any other GRUB modules needed to access /boot as a real filesystem. After loading these, GRUB will then be able to load additional modules (including normal.mod) and its configuration file as regular files, by pathname.


Incidentally, if you wanted to boot the i386-pc version of GRUB from a GPT-partitioned disk, you would need a «biosboot» partition that is sized 1 MB and contains no filesystem: it is used to hold the GRUB core image, as the MBR-style space before the first partition will now be occupied by GPT partition table structures instead.

The empty space between the MBR and the beginning of the first partition is a historical remnant: back when disks still used C/H/S addressing, there was a convention to place the beginning of a partition always to the first sector of a track. Since MBR was the very first block of the disk (C/H/S address 0/0/1), that meant the earliest possible start of first partition would be C/H/S 0/1/1, and the rest of track #0 (= cylinder #0, head #0) would be left unused.

Roughly in the Windows XP era, as C/H/S addressing was no longer meaningful and data alignment on RAID arrays, enterprise storage systems and SSDs was becoming an important performance issue, the start-of-first-partition convention was changed: now the recommended place to start the first partition of the disk was at exactly 1 MiB from the beginning of the disk, or at the LBA block number #2048 (assuming classic 512-byte disk blocks).

Я пытался установить новую установку Ubuntu 12.04 рядом с моей старой установкой 10.10, и я столкнулся с проблемой. Мой компьютер, кажется, имеет привередливый BIOS и хочет загрузочный раздел размером менее 40 ГБ. Итак, когда я установил 10.10, я разделил систему на / boot на / dev / sda1 и / on /dev/sda6.

Когда я установил 12.04 LTS, я полностью забыл об этом, и теперь мне нужно переустановить GRUB. Но, похоже, я получаю ошибку.

mint@mint ~ $ sudo grub-install --root-directory=/mnt /dev/sda
grub-probe: error: cannot find a device for /boot (is /dev mounted?).
Installation finished. No error reported.

Я запускаю это с живого USB-устройства Linux Mint, которое у меня лежало, версия GRUB такая же, как и Ubuntu 12.04, я думаю.

Итак, я что-то упускаю или лучше перезапустить установку Ubuntu?

задан
3 January 2013 в 00:51

поделиться

1 ответ

Я столкнулся с сообщением об ошибке cannot find a device for /boot (is /dev mounted?) на виртуальной машине, с которой я работал. Я понятия не имею, применимо ли мое решение к вам или кому-либо еще.

Я предположил, что grub-install ожидает запуска внутри файловой системы ОС хоста и сможет увидеть монтирование корневой файловой системы этого хоста.

Я сделал следующее (что я печатаю по памяти, так что, возможно, есть ошибки).

# mount /dev/sdaN /mnt
# mount --rbind /dev  /mnt/dev
# mount --rbind /proc /mnt/proc
# mount --rbind /sys  /mnt/sys
# chroot /mnt bash
# mount /dev/sdaN /
# grub-install /dev/sdaN

Затем я смог успешно перезагрузить ВМ. Моей операционной системой была Ubuntu 18.04, а среда спасения была версией Debian с ядром 4.x.

ответ дан mpb
3 January 2013 в 00:51

поделиться

Другие вопросы по тегам:

Похожие вопросы:

  • Home
  • Forum
  • The Ubuntu Forum Community
  • Ubuntu Official Flavours Support
  • Installation & Upgrades
  • [SOLVED] update-grub error {cannot find device for /}

  1. update-grub error {cannot find device for /}

    Hello every1, I’ve been trying to install xubuntu on my Asus EEE 1101ha, which is known to present some problems due to lack of efficient poulsbo drivers. By following the instructions in the official documentation of Ubuntu, I managed to reach a working live CD environment and install Xubuntu. The next step I had to follow was to edit a grub text and then update grub for the changes to take effect {If I discarded this step, grub wouldn’t load, giving me an error message which I will mention if needed}. Unfortunately, when I used «sudo update-grub» to update it, the following error came up:

    /usr/sbin/grub-probe: error: cannot find a device for / (is /dev mounted?).

    I mounted all the filesystems yet it didn’t help. I tried running grub-probe by double clicking it, but again it didn’t seem to run, nor was grub updated since it kept giving me the same error. I googled the error a bit, but although I tried a thing or two, it was no use. Any help would be appreciated.


  2. Re: update-grub error {cannot find device for /}

    It sounds like you’re trying to make the grub changes on your (Xubuntu-installed) filesystem from a LiveCD. Is that correct? Please do explain what was wrong in the first place requiring a change.

    If you are indeed running update-grub from a live CD you’ll need to mount the virtual filesystems and chroot first:

    Code:

    # Mount root partition:
    sudo mount /dev/sdXY /mnt # /dev/sdXY is your root partition, e.g. /dev/sda1
    
    # If you have a separate boot partition you'll need to mount it also:
    sudo mount /dev/sdYY /mnt/boot
    
    # Mount your virtual filesystems:
    for i in /dev /dev/pts /proc /sys /run; do sudo mount -B $i /mnt$i; done
    
    # Chroot
    sudo chroot /mnt

    NOW you can do grub-install and update-grub and whatnot and it’ll operate on your installed system rather than the LiveCD.


  3. Question Re: update-grub error {cannot find device for /}

    Hey I’m was having the same problem with 32bit and trying to setup dual boot with xp (got 32bit working minus some drivers missing as a solo OS never dual) but have 4gb ram so wanted to use 64bit to utilize hardware n figured id just emulate xp if I have too, but while installing 64bit server or desktop, I cannot get around this error.

    I was given a vaio vpcz11cgx/x, has dual solid state drives Im pretty sure it’s raid0. I’ve tried letting it auto setup on (striped drive) and errors on bootloader install. /dev/mapper is what shows up as default it, I’ve tried /dev/sda and the Ubuntu OS partition, blank partitions fat/ext/blank on beginning and end of disk =P. On manual partitions I’ve tried just ext4 n swap space as primary, I’ve left a 2gb primary partition to instal grub n put ext4 n swap in extended logical partition, also tried 2gb primary with ext as primary n swap on extended. I think my error due to either a raid config or partitioning… Lol or both

    Also curious which has a more stability 64bit server or desktop. Thanx for help in advanced.


  4. Re: update-grub error {cannot find device for /}

    The virtual filesystems are not found. What do I do wrong? Sry, I’m kinda new to linux… heres what I type and what it returns:

    Code:

    xubuntu@xubuntu:~$ for i in /dev /dev/pts /proc /sys /run; do sudo mount -B $i /mnt$i; done
    mount: mount point /mnt/dev does not exist
    mount: mount point /mnt/dev/pts does not exist
    mount: mount point /mnt/proc does not exist
    mount: mount point /mnt/sys does not exist
    mount: mount point /mnt/run does not exist

    I reinstalled Xubuntu in a single partition choosing the automatic installation option. The root partition is therefore /dev/sda1. What is there to be done then?

    P.S. You guessed right, I’m using the console from a Live USB stick


  5. Re: update-grub error {cannot find device for /}

    The error message usually means the system partition was not mounted properly. Did you mount your real xubuntu partition (sda1) on /mnt before running the command?

    You might try installing Boot Repair (see link in my sig line) from the LiveCD/USB Desktop and let it try to fix GRUB. If it can’t do it with the «Recommended repair» button there is an Advanced option that can take you through the ‘chroot’ method.

    If neither of the Boot Repair options fixes things, it has an option to run a boot info script, which can provide us with information we need to give you more specific advice.


  6. Re: update-grub error {cannot find device for /}

    Nvm, although the update-grub didn’t work so the text file wasn’t modified, grub2 loads normally and I finally booted xubuntu from the hard disk installation. I hope grub keeps that way. I won’t label the thread as solved today, cause, I’m not still sure about how stable grub is. Furthermore, maybe Bluphx can get some help from here before I close it. Thanks again for your help guys, I hope someday I’ll be amongst you who offer help around here.


  7. Re: update-grub error {cannot find device for /}

    Yo thanx for the heads up, Im going to try to run the bootrepair program if this install doesn’t work. I’ve setup the partition in gpart before hand this time as:

    ATARaid volume 0 238.48gb /dev/mapper/isw_bfdjejgiae
    extended 238.48gb
    ext4 200gb
    unallocated 39gb
    linux-swap 4.2gb
    unallocated 4mb

    I have left 4mb on the end of the drive b/c all the other screens and my other computer that runs ubuntu fine has an extra 2mb on end of HD. I’ve also left 39gb floating between ext4 and swap b/c if i can get a working install I’d like a XP partition to dualboot or VM from.

    All goes fine till very end of install n get a GRUB error and ask to reselect where to install boot. Default it tries /dev/mapper/, i’ve tried volume #’s and sda/b/ect.

    Thanx again in advanced, ex apple genius so starting to learn the lingo n new ways of ubuntu.


  8. Re: update-grub error {cannot find device for /}

    Here I am again… ok, I don’t know how I did it, but it seems like grub tries to load from the live usb, even though I have already installed xubuntu on the hard disk. Here’s the case: If I try to load xubuntu from the hard disk without having the usb stick plugged, grub doesn’t load. If I plug the usb stick, grub loads normally and xubuntu boots from the hard disk {This means I can’t even boot from the live usb, yet I can’t boot from hard disk without it!}. So… please tell me some good news… I will keep you updated in case I successfully update grub and solve this nonsense


  9. Re: update-grub error {cannot find device for /}

    Well… I’ve done all I could. I followed all three steps of this guide: https://wiki.ubuntu.com/HardwareSupp…oCardsPoulsbo/

    yet nothing changed. I still need the usb stick to boot. If I don’t use it, grub doesn’t start and I only see a flashing cursor. I believe that the problem lies in that grub tries to load from the usb stick instead of the hard disk. I came to this conclusion after I prompted:
    sudo update-grub
    in order to finish the third option given on the guide linked above, for as soon as I pressed enter the usb started flashing, indicating data transmission to the usb stick! I don’t believe its a coincidence. I prompted «sudo update-grub» while the console was running from the hard disk, but I believe that this commanded the update of the usb stick’s grub. When I removed the usb stick and retried using the update-grub command, the update was again completed successfully {Which means that after I removed the usb stick, the command now went for the hard disk’s grub… right? :O} Omg I know all this is confusing but, does anyone know some way to direct grub startup to the hard disk’s grub installation {In human terms: I want the .txt file where the grub boot path is written, so that I can modify it to lead grub to boot from the hard disk}? Or is it something else? Help!!!


  10. Re: update-grub error {cannot find device for /}

    Odys1,

    Normally all that should be required is to change your boot drive’s MBR instructions to point to your Ubuntu partition rather than the external device. You do this with the ‘grub-install’ command.

    Boot to your normal Ubuntu OS (even if it requires using the USB initially). After it boots, run the following command, using the correct drive letter. Just make sure the drive designation is what you think it is (sda, sdb, etc). You can run «sudo fdisk -l» to check first if necessary. Do NOT use the partition number:

    Code:

    sudo grub-install /dev/sda

    The next time you boot just make sure the external is not inserted and the BIOS should look to the sda drive’s MBR for instructions on where the bootloader files are located.


Tags for this Thread

Bookmarks

Bookmarks


Posting Permissions

  • Печать

Страницы: [1] 2  Все   Вниз

Тема: Восстановление GRUB  (Прочитано 4632 раз)

0 Пользователей и 1 Гость просматривают эту тему.

Оффлайн
S9

Доброго вечера! Вообщем, обновил при очередном обновлении системы, также обновилось ядро. Т.к. на компе, помимо Ubuntu 12.04 стоит ещё и Windows 7, то в меню выбора системы, при загрузке компа было что то такого

Ubuntu, c Linux 3.2.0-25 generic
Ubuntu, c Linux 3.2.0-26 generic
Ubuntu, c Linux 3.2.0-26 generic (режим востановления)
Windows 7

Решил сделать то, что и всегда делал: убрать старое ядро из загрузчика GRUB (v 1.99)
Вроде сделал, как обычно, но теперь в окне выбора осей только винда….
В гугле только описаны критические случаи… т.е. когда, например, ничего не выбирается и т.д.
Как вернуть назад Ubuntu?

P.S. Сейчас зашел с Ubuntu 12.04 с помощью LiveCD…

Вот что получается, при попытки поставить GRUB с LiveCD…

Заранее спасибо!

« Последнее редактирование: 29 Июня 2012, 22:55:09 от S9 »

Burning on the flame
Played the waiting game


Оффлайн
Легас

Бес труда и пальцем в носу не по ковыряешься и в Linuxe не разбирёси!!!


Оффлайн
S9

Вот что сделал..
Сейчас перегружу комп и отпишусь о результате

Burning on the flame
Played the waiting game


Оффлайн
rumit


Оффлайн
S9

Мне не надо удалять старые ядра.. Мне надо добавить Ubuntu в список загружаемых осей.. А то там только винда осталась.. Вот и с неё пишу тут…((

P.S. Мои деяния из второго поста никаких деяний не дали…

Burning on the flame
Played the waiting game


Оффлайн
MEXAHOTABOP


Оффлайн
rumit


Оффлайн
jura12


Оффлайн
S9

Burning on the flame
Played the waiting game


Оффлайн
MEXAHOTABOP


Оффлайн
S9

Делал все, как написано в хелпе.

только на последнюю команду sudo update-grub —output=/mnt/boot/grub/grub.cfg
он пишет /usr/sbin/grub-probe: error: cannot find a device for / (is /dev mounted?).
Это нормально?

P.S. Комп пока не перегружал

« Последнее редактирование: 30 Июня 2012, 16:46:53 от S9 »

Burning on the flame
Played the waiting game


Оффлайн
MEXAHOTABOP


Оффлайн
S9

На sudo update-grub пишет тоже самое ругательство /usr/sbin/grub-probe: error: cannot find a device for / (is /dev mounted?).


Пользователь решил продолжить мысль 30 Июня 2012, 17:04:29:


ты не подмонтировал /dev

а как его подмонтировать?
Написать
sudo mount —bind /dev /mnt/dev ??


Пользователь решил продолжить мысль 30 Июня 2012, 17:07:13:


sudo mount —bind /dev /mnt/dev не помогает..


Пользователь решил продолжить мысль 30 Июня 2012, 17:36:35:


Вообщем, попробовал написать sudo mount /dev, получил вот что.
ubuntu@ubuntu:~$ sudo mount /dev
mount: udev already mounted or /dev busy
mount: according to mtab, udev is already mounted on /dev
ubuntu@ubuntu:~$

Сейчас ребут — и напишу о результате


Пользователь решил продолжить мысль 30 Июня 2012, 17:51:10:


Результат тот же: в окне загрузчика GRUB доступна только Windows 7…

« Последнее редактирование: 30 Июня 2012, 17:51:10 от S9 »

Burning on the flame
Played the waiting game


Оффлайн
Легас

вариант 1.:  в LiveCD —> в Gparted посмотри, активный ли раздел dev/sda8, если нет сделай активным — т.е. примонтируй и снова попробуй восстановить GRUB

вариант 2.: не очень приятный (подразумеваю о затёртости boot-раздела) — попытайся использовать режим восстановления

вариант 3,: если ничего не поможет, то только полная переустановка.

Бес труда и пальцем в носу не по ковыряешься и в Linuxe не разбирёси!!!


Оффлайн
jura12

S9,
в моем способе надо system заменить на mnt или создать папку system.


  • Печать

Страницы: [1] 2  Все   Вверх

Для восстановления GRUB потребуется загрузочный диск или флешка с дистрибутивом Linux. Итак, вы загрузились в Live-режиме. Теперь нужно открыть терминал.

1.Нужно определить раздел диска, на котором был установлен GRUB fdisk -l.

2.Например установлен в /dev/sda, примонтируем корневой раздел, выполняем команду (вместо /dev/sda вы должны указать свой раздел):sudo mount /dev/sda /mnt. Если для загрузчика у вас выделен отдельный раздел, то нужно примонтировать еще и его (вместо /dev/sdX укажите ваш boot-раздел):sudo mount /dev/sdX /mnt/boot

3.Посмотреть содержимое директории /mnt, чтобы убедиться, что мы примонтировали верный раздел:ls /mnt.

4.Нужно создать ссылки на несколько директорий, к которым GRUB должен иметь доступ для обнаружения всех операционных систем. Для этого выполните команды:sudo mount --bind /dev /mnt/dev sudo mount --bind /dev/pts /mnt/dev/pts sudo mount --bind /proc /mnt/proc sudo mount --bind /sys /mnt/sys.Если у вас используется UEFI, то еще нужно примонтировать EFI-раздел в директорию /mnt/boot/efi :sudo mount /dev/nvme0n1p1 /mnt/boot/efi например…

5.Для генерации файла конфигурации GRUB используется команда update-grub. Данная команда автоматически определяет файловые системы на вашем компьютере и генерирует новый файл конфигурации. Выполняем команду:sudo update-grub.
Если вдруг утилита update-grub не определила ваш Windows ,то можно будет запустить update-grub повторно уже из вашей Linux-системы, когда вы в нее загрузитесь (мне это помогло и Windows определился).

6.Осталось выполнить установку GRUB на диск. Мы определили раздел на котором у нас установлен GRUB на первом шаге данного руководства. Это раздел /dev/sda.

Для установки GRUB используется команда grub-install, которой нужно передать в качестве параметра диск, на который будет выполняться установка (в моем случае это диск /dev/sda):grub-install /dev/sda.

7.Выходим из окружения chroot: exit.

8.Отмонтируем все разделы, которые мы примонтировали:sudo umount /mnt/sys sudo umount /mnt/proc sudo umount /mnt/dev/pts sudo umount /mnt/dev. Если вы монтировали boot-раздел, то его тоже нужно отмонтировать:sudo umount /mnt/boot.Если вы монтировали EFI-раздел, отмонтируем:sudo umount /mnt/boot/efi.Отмонтируем корневой раздел:sudo umount /mnt.

9.Перезагружаем компьютер:reboot.

Если во время перезагрузки компьютера меню GRUB не появилось, то это еще не значит, что он не восстановился. Возможно, просто установлена нулевая задержка и меню не показывается. Чтобы показать меню GRUB нужно во время загрузки, после того, как появился логотип материнской платы:
удерживать клавишу Shift, если у вас классический BIOS; нажать Esc, если у вас UEFI.

Если у вас, при выполнении grub-update, не определился Windows и не был добавлен в меню GRUB, то уже загрузившись в вашу систему Linux (не LiveCD), откройте терминал и выполните:sudo grub-update.

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

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

А вот еще интересные материалы:

  • Яшка сломя голову остановился исправьте ошибки
  • Ясность цели позволяет целеустремленно добиваться намеченного исправьте ошибки
  • Ясность цели позволяет целеустремленно добиваться намеченного где ошибка
  • Using render selected with empty selection ошибка
  • Using namespace system c ошибка