grub2 error disk 'hd0,msdos1' not found, ls shows no disk
Clash Royale CLAN TAG#URR8PPP
I have googled a lot for this problem.
I found this,
but it didn't solve my problem.
Other solutions suggest me to reinstall grub (run grub-install), which didn't work either.
Here is what I am doing: (my grub version is 2.02)
- I use grub2-mkrescue to make my X.iso
- I boot a VMWareWorkstation virtual machine, which has a 1.0GB SATA disk, from X.iso
- I install X.iso on disk, the details are:
3.1. erase /dev/sda in case there are old partitions on it:dd if=/dev/zero of=/dev/sda bs=1M count=1
3.2. Create 3 primary partitions on /dev/sda as dev/sda1,sda2,sda3 (the size is 100M, 30M and 70M),
and toggle sda1 to be bootable
Disk /dev/sda: 1024 MB, 1073741824 bytes, 2097152 sectors
130 cylinders, 255 heads, 63 sectors/track
Units: sectors of 1 * 512 = 512 bytes
Device Boot StartCHS EndCHS StartLBA EndLBA Sectors Size Id Type
/dev/sda1 * 0,1,1 12,191,50 63 204862 204800 100M 83 Linux
/dev/sda2 12,191,51 16,147,2 204863 266302 61440 30.0M 83 Linux
/dev/sda3 16,147,3 25,127,37 266303 409662 143360 70.0M 83 Linux
3.3. Format the 3 partitions as ext2, and mount /dev/sda1
mkfs.ext2 /dev/sda1
mkfs.ext2 /dev/sda2
mkfs.ext2 /dev/sda3
ROOTFS_PATH=/var/.rootfs
mkdir $ROOTFS_PATH
mount /dev/sda1 $ROOTFS_PATH
3.4 copy files...
for i in bzImage initrd.img vmlinuz-*; do
cp -rf /boot/$i $ROOTFS_PATH/boot
done
cp -f /boot/grub/device.map $ROOTFS_PATH/boot/grub/device.map
for i in init linuxrc; do
cp -rf /$i $ROOTFS_PATH
done
for i in bin etc lib sbin share usr; do
cp -a /$i $ROOTFS_PATH
done
for i in dev var proc sys tmp data log; do
mkdir -p $ROOTFS_PATH/$i
done
3.5 Install grub and make grub config file
chroot $ROOTFS_PATH <<EOF
mount -a
mdev -s
grub-install $tdisk
grub-install --recheck $tdisk
grub-mkconfig -o /boot/grub/grub.cfg
exit
EOF
- reboot
It says:
.
error: disk 'hd0,msdos1' not found
Entering rescue mode...
grub rescue>
And the most strange thing is that ls
command shows nothing in grub-rescue cli
---- as someone says, it should show disk list.
linux boot system-installation grub2 boot-loader
add a comment |
I have googled a lot for this problem.
I found this,
but it didn't solve my problem.
Other solutions suggest me to reinstall grub (run grub-install), which didn't work either.
Here is what I am doing: (my grub version is 2.02)
- I use grub2-mkrescue to make my X.iso
- I boot a VMWareWorkstation virtual machine, which has a 1.0GB SATA disk, from X.iso
- I install X.iso on disk, the details are:
3.1. erase /dev/sda in case there are old partitions on it:dd if=/dev/zero of=/dev/sda bs=1M count=1
3.2. Create 3 primary partitions on /dev/sda as dev/sda1,sda2,sda3 (the size is 100M, 30M and 70M),
and toggle sda1 to be bootable
Disk /dev/sda: 1024 MB, 1073741824 bytes, 2097152 sectors
130 cylinders, 255 heads, 63 sectors/track
Units: sectors of 1 * 512 = 512 bytes
Device Boot StartCHS EndCHS StartLBA EndLBA Sectors Size Id Type
/dev/sda1 * 0,1,1 12,191,50 63 204862 204800 100M 83 Linux
/dev/sda2 12,191,51 16,147,2 204863 266302 61440 30.0M 83 Linux
/dev/sda3 16,147,3 25,127,37 266303 409662 143360 70.0M 83 Linux
3.3. Format the 3 partitions as ext2, and mount /dev/sda1
mkfs.ext2 /dev/sda1
mkfs.ext2 /dev/sda2
mkfs.ext2 /dev/sda3
ROOTFS_PATH=/var/.rootfs
mkdir $ROOTFS_PATH
mount /dev/sda1 $ROOTFS_PATH
3.4 copy files...
for i in bzImage initrd.img vmlinuz-*; do
cp -rf /boot/$i $ROOTFS_PATH/boot
done
cp -f /boot/grub/device.map $ROOTFS_PATH/boot/grub/device.map
for i in init linuxrc; do
cp -rf /$i $ROOTFS_PATH
done
for i in bin etc lib sbin share usr; do
cp -a /$i $ROOTFS_PATH
done
for i in dev var proc sys tmp data log; do
mkdir -p $ROOTFS_PATH/$i
done
3.5 Install grub and make grub config file
chroot $ROOTFS_PATH <<EOF
mount -a
mdev -s
grub-install $tdisk
grub-install --recheck $tdisk
grub-mkconfig -o /boot/grub/grub.cfg
exit
EOF
- reboot
It says:
.
error: disk 'hd0,msdos1' not found
Entering rescue mode...
grub rescue>
And the most strange thing is that ls
command shows nothing in grub-rescue cli
---- as someone says, it should show disk list.
linux boot system-installation grub2 boot-loader
add a comment |
I have googled a lot for this problem.
I found this,
but it didn't solve my problem.
Other solutions suggest me to reinstall grub (run grub-install), which didn't work either.
Here is what I am doing: (my grub version is 2.02)
- I use grub2-mkrescue to make my X.iso
- I boot a VMWareWorkstation virtual machine, which has a 1.0GB SATA disk, from X.iso
- I install X.iso on disk, the details are:
3.1. erase /dev/sda in case there are old partitions on it:dd if=/dev/zero of=/dev/sda bs=1M count=1
3.2. Create 3 primary partitions on /dev/sda as dev/sda1,sda2,sda3 (the size is 100M, 30M and 70M),
and toggle sda1 to be bootable
Disk /dev/sda: 1024 MB, 1073741824 bytes, 2097152 sectors
130 cylinders, 255 heads, 63 sectors/track
Units: sectors of 1 * 512 = 512 bytes
Device Boot StartCHS EndCHS StartLBA EndLBA Sectors Size Id Type
/dev/sda1 * 0,1,1 12,191,50 63 204862 204800 100M 83 Linux
/dev/sda2 12,191,51 16,147,2 204863 266302 61440 30.0M 83 Linux
/dev/sda3 16,147,3 25,127,37 266303 409662 143360 70.0M 83 Linux
3.3. Format the 3 partitions as ext2, and mount /dev/sda1
mkfs.ext2 /dev/sda1
mkfs.ext2 /dev/sda2
mkfs.ext2 /dev/sda3
ROOTFS_PATH=/var/.rootfs
mkdir $ROOTFS_PATH
mount /dev/sda1 $ROOTFS_PATH
3.4 copy files...
for i in bzImage initrd.img vmlinuz-*; do
cp -rf /boot/$i $ROOTFS_PATH/boot
done
cp -f /boot/grub/device.map $ROOTFS_PATH/boot/grub/device.map
for i in init linuxrc; do
cp -rf /$i $ROOTFS_PATH
done
for i in bin etc lib sbin share usr; do
cp -a /$i $ROOTFS_PATH
done
for i in dev var proc sys tmp data log; do
mkdir -p $ROOTFS_PATH/$i
done
3.5 Install grub and make grub config file
chroot $ROOTFS_PATH <<EOF
mount -a
mdev -s
grub-install $tdisk
grub-install --recheck $tdisk
grub-mkconfig -o /boot/grub/grub.cfg
exit
EOF
- reboot
It says:
.
error: disk 'hd0,msdos1' not found
Entering rescue mode...
grub rescue>
And the most strange thing is that ls
command shows nothing in grub-rescue cli
---- as someone says, it should show disk list.
linux boot system-installation grub2 boot-loader
I have googled a lot for this problem.
I found this,
but it didn't solve my problem.
Other solutions suggest me to reinstall grub (run grub-install), which didn't work either.
Here is what I am doing: (my grub version is 2.02)
- I use grub2-mkrescue to make my X.iso
- I boot a VMWareWorkstation virtual machine, which has a 1.0GB SATA disk, from X.iso
- I install X.iso on disk, the details are:
3.1. erase /dev/sda in case there are old partitions on it:dd if=/dev/zero of=/dev/sda bs=1M count=1
3.2. Create 3 primary partitions on /dev/sda as dev/sda1,sda2,sda3 (the size is 100M, 30M and 70M),
and toggle sda1 to be bootable
Disk /dev/sda: 1024 MB, 1073741824 bytes, 2097152 sectors
130 cylinders, 255 heads, 63 sectors/track
Units: sectors of 1 * 512 = 512 bytes
Device Boot StartCHS EndCHS StartLBA EndLBA Sectors Size Id Type
/dev/sda1 * 0,1,1 12,191,50 63 204862 204800 100M 83 Linux
/dev/sda2 12,191,51 16,147,2 204863 266302 61440 30.0M 83 Linux
/dev/sda3 16,147,3 25,127,37 266303 409662 143360 70.0M 83 Linux
3.3. Format the 3 partitions as ext2, and mount /dev/sda1
mkfs.ext2 /dev/sda1
mkfs.ext2 /dev/sda2
mkfs.ext2 /dev/sda3
ROOTFS_PATH=/var/.rootfs
mkdir $ROOTFS_PATH
mount /dev/sda1 $ROOTFS_PATH
3.4 copy files...
for i in bzImage initrd.img vmlinuz-*; do
cp -rf /boot/$i $ROOTFS_PATH/boot
done
cp -f /boot/grub/device.map $ROOTFS_PATH/boot/grub/device.map
for i in init linuxrc; do
cp -rf /$i $ROOTFS_PATH
done
for i in bin etc lib sbin share usr; do
cp -a /$i $ROOTFS_PATH
done
for i in dev var proc sys tmp data log; do
mkdir -p $ROOTFS_PATH/$i
done
3.5 Install grub and make grub config file
chroot $ROOTFS_PATH <<EOF
mount -a
mdev -s
grub-install $tdisk
grub-install --recheck $tdisk
grub-mkconfig -o /boot/grub/grub.cfg
exit
EOF
- reboot
It says:
.
error: disk 'hd0,msdos1' not found
Entering rescue mode...
grub rescue>
And the most strange thing is that ls
command shows nothing in grub-rescue cli
---- as someone says, it should show disk list.
linux boot system-installation grub2 boot-loader
linux boot system-installation grub2 boot-loader
edited Mar 13 at 2:36
Hurry Zeng
asked Feb 20 at 7:55
Hurry ZengHurry Zeng
12
12
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
cp -f /boot/grub/device.map $ROOTFS_PATH/boot/grub/device.map
So, you copied the GRUB device.map
file from the GRUB rescue ISO image to your disk?
It might be forcing grub-install
to associate the GRUB device identifier hd0
with a disk device other than /dev/sda
.
Before running grub-install
, verify that the device.map
file actually associates hd0
with the disk you're installing GRUB to (i.e. /dev/sda
in your case).
Also, why are you doing all this? It looks like you're trying to make a grub2-mkrescue
VM image that might be useable in rescuing some other VM that has lost its bootloader - is that what you're planning to do? If so, simply booting the problem VM using an ISO image of any Live CD/DVD Linux distribution would give you a more extensive set of tools and more comfortable environment for fixing your original problem, whether it's a missing bootloader or something else.
If you specifically need grub2-mkrescue
, you already have your X.iso
- why you are trying to convert it to a virtual-disk-based installation?
thanks for your reply. What I'm trying is to build a very small x86 Linux distro with only a few feature. Just like other Linux distro, Ubuntu,CentOS - Someone download a ubuntu-x.iso, boot from it and install it into the disk.That's what I want.
– Hurry Zeng
Mar 5 at 6:21
I want a disk-based installation, instead of a virtual-disk-based installation. However, I'm testing it on the virtual machine, before a real machine.
– Hurry Zeng
Mar 5 at 6:28
As this page says: If the device map file does not exist, then the GRUB utilities will assume a temporary device map on the fly. This is often good enough, particularly in the common case of single-disk systems. So I deletedevice.map
from X.iso and donot copy it when installing, But the problem remained the same. Any other suggestions?
– Hurry Zeng
Mar 5 at 6:48
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f501782%2fgrub2-error-disk-hd0-msdos1-not-found-ls-shows-no-disk%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
cp -f /boot/grub/device.map $ROOTFS_PATH/boot/grub/device.map
So, you copied the GRUB device.map
file from the GRUB rescue ISO image to your disk?
It might be forcing grub-install
to associate the GRUB device identifier hd0
with a disk device other than /dev/sda
.
Before running grub-install
, verify that the device.map
file actually associates hd0
with the disk you're installing GRUB to (i.e. /dev/sda
in your case).
Also, why are you doing all this? It looks like you're trying to make a grub2-mkrescue
VM image that might be useable in rescuing some other VM that has lost its bootloader - is that what you're planning to do? If so, simply booting the problem VM using an ISO image of any Live CD/DVD Linux distribution would give you a more extensive set of tools and more comfortable environment for fixing your original problem, whether it's a missing bootloader or something else.
If you specifically need grub2-mkrescue
, you already have your X.iso
- why you are trying to convert it to a virtual-disk-based installation?
thanks for your reply. What I'm trying is to build a very small x86 Linux distro with only a few feature. Just like other Linux distro, Ubuntu,CentOS - Someone download a ubuntu-x.iso, boot from it and install it into the disk.That's what I want.
– Hurry Zeng
Mar 5 at 6:21
I want a disk-based installation, instead of a virtual-disk-based installation. However, I'm testing it on the virtual machine, before a real machine.
– Hurry Zeng
Mar 5 at 6:28
As this page says: If the device map file does not exist, then the GRUB utilities will assume a temporary device map on the fly. This is often good enough, particularly in the common case of single-disk systems. So I deletedevice.map
from X.iso and donot copy it when installing, But the problem remained the same. Any other suggestions?
– Hurry Zeng
Mar 5 at 6:48
add a comment |
cp -f /boot/grub/device.map $ROOTFS_PATH/boot/grub/device.map
So, you copied the GRUB device.map
file from the GRUB rescue ISO image to your disk?
It might be forcing grub-install
to associate the GRUB device identifier hd0
with a disk device other than /dev/sda
.
Before running grub-install
, verify that the device.map
file actually associates hd0
with the disk you're installing GRUB to (i.e. /dev/sda
in your case).
Also, why are you doing all this? It looks like you're trying to make a grub2-mkrescue
VM image that might be useable in rescuing some other VM that has lost its bootloader - is that what you're planning to do? If so, simply booting the problem VM using an ISO image of any Live CD/DVD Linux distribution would give you a more extensive set of tools and more comfortable environment for fixing your original problem, whether it's a missing bootloader or something else.
If you specifically need grub2-mkrescue
, you already have your X.iso
- why you are trying to convert it to a virtual-disk-based installation?
thanks for your reply. What I'm trying is to build a very small x86 Linux distro with only a few feature. Just like other Linux distro, Ubuntu,CentOS - Someone download a ubuntu-x.iso, boot from it and install it into the disk.That's what I want.
– Hurry Zeng
Mar 5 at 6:21
I want a disk-based installation, instead of a virtual-disk-based installation. However, I'm testing it on the virtual machine, before a real machine.
– Hurry Zeng
Mar 5 at 6:28
As this page says: If the device map file does not exist, then the GRUB utilities will assume a temporary device map on the fly. This is often good enough, particularly in the common case of single-disk systems. So I deletedevice.map
from X.iso and donot copy it when installing, But the problem remained the same. Any other suggestions?
– Hurry Zeng
Mar 5 at 6:48
add a comment |
cp -f /boot/grub/device.map $ROOTFS_PATH/boot/grub/device.map
So, you copied the GRUB device.map
file from the GRUB rescue ISO image to your disk?
It might be forcing grub-install
to associate the GRUB device identifier hd0
with a disk device other than /dev/sda
.
Before running grub-install
, verify that the device.map
file actually associates hd0
with the disk you're installing GRUB to (i.e. /dev/sda
in your case).
Also, why are you doing all this? It looks like you're trying to make a grub2-mkrescue
VM image that might be useable in rescuing some other VM that has lost its bootloader - is that what you're planning to do? If so, simply booting the problem VM using an ISO image of any Live CD/DVD Linux distribution would give you a more extensive set of tools and more comfortable environment for fixing your original problem, whether it's a missing bootloader or something else.
If you specifically need grub2-mkrescue
, you already have your X.iso
- why you are trying to convert it to a virtual-disk-based installation?
cp -f /boot/grub/device.map $ROOTFS_PATH/boot/grub/device.map
So, you copied the GRUB device.map
file from the GRUB rescue ISO image to your disk?
It might be forcing grub-install
to associate the GRUB device identifier hd0
with a disk device other than /dev/sda
.
Before running grub-install
, verify that the device.map
file actually associates hd0
with the disk you're installing GRUB to (i.e. /dev/sda
in your case).
Also, why are you doing all this? It looks like you're trying to make a grub2-mkrescue
VM image that might be useable in rescuing some other VM that has lost its bootloader - is that what you're planning to do? If so, simply booting the problem VM using an ISO image of any Live CD/DVD Linux distribution would give you a more extensive set of tools and more comfortable environment for fixing your original problem, whether it's a missing bootloader or something else.
If you specifically need grub2-mkrescue
, you already have your X.iso
- why you are trying to convert it to a virtual-disk-based installation?
answered Mar 4 at 9:07
telcoMtelcoM
19.2k12348
19.2k12348
thanks for your reply. What I'm trying is to build a very small x86 Linux distro with only a few feature. Just like other Linux distro, Ubuntu,CentOS - Someone download a ubuntu-x.iso, boot from it and install it into the disk.That's what I want.
– Hurry Zeng
Mar 5 at 6:21
I want a disk-based installation, instead of a virtual-disk-based installation. However, I'm testing it on the virtual machine, before a real machine.
– Hurry Zeng
Mar 5 at 6:28
As this page says: If the device map file does not exist, then the GRUB utilities will assume a temporary device map on the fly. This is often good enough, particularly in the common case of single-disk systems. So I deletedevice.map
from X.iso and donot copy it when installing, But the problem remained the same. Any other suggestions?
– Hurry Zeng
Mar 5 at 6:48
add a comment |
thanks for your reply. What I'm trying is to build a very small x86 Linux distro with only a few feature. Just like other Linux distro, Ubuntu,CentOS - Someone download a ubuntu-x.iso, boot from it and install it into the disk.That's what I want.
– Hurry Zeng
Mar 5 at 6:21
I want a disk-based installation, instead of a virtual-disk-based installation. However, I'm testing it on the virtual machine, before a real machine.
– Hurry Zeng
Mar 5 at 6:28
As this page says: If the device map file does not exist, then the GRUB utilities will assume a temporary device map on the fly. This is often good enough, particularly in the common case of single-disk systems. So I deletedevice.map
from X.iso and donot copy it when installing, But the problem remained the same. Any other suggestions?
– Hurry Zeng
Mar 5 at 6:48
thanks for your reply. What I'm trying is to build a very small x86 Linux distro with only a few feature. Just like other Linux distro, Ubuntu,CentOS - Someone download a ubuntu-x.iso, boot from it and install it into the disk.That's what I want.
– Hurry Zeng
Mar 5 at 6:21
thanks for your reply. What I'm trying is to build a very small x86 Linux distro with only a few feature. Just like other Linux distro, Ubuntu,CentOS - Someone download a ubuntu-x.iso, boot from it and install it into the disk.That's what I want.
– Hurry Zeng
Mar 5 at 6:21
I want a disk-based installation, instead of a virtual-disk-based installation. However, I'm testing it on the virtual machine, before a real machine.
– Hurry Zeng
Mar 5 at 6:28
I want a disk-based installation, instead of a virtual-disk-based installation. However, I'm testing it on the virtual machine, before a real machine.
– Hurry Zeng
Mar 5 at 6:28
As this page says: If the device map file does not exist, then the GRUB utilities will assume a temporary device map on the fly. This is often good enough, particularly in the common case of single-disk systems. So I delete
device.map
from X.iso and donot copy it when installing, But the problem remained the same. Any other suggestions?– Hurry Zeng
Mar 5 at 6:48
As this page says: If the device map file does not exist, then the GRUB utilities will assume a temporary device map on the fly. This is often good enough, particularly in the common case of single-disk systems. So I delete
device.map
from X.iso and donot copy it when installing, But the problem remained the same. Any other suggestions?– Hurry Zeng
Mar 5 at 6:48
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f501782%2fgrub2-error-disk-hd0-msdos1-not-found-ls-shows-no-disk%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown