Re: GRUB always enters a rescue shell.

2017-07-27 Thread Hao Lee
Hi,

Thanks to all of you and sorry for the delayed response.
I have addressed this problem. Using `kpartx` instead of `losetup` to
mount partition and I finally make a bootable disk image.
The explanation of this problem together with the solution is here:
http://lists.gnu.org/archive/html/help-grub/2017-07/msg00017.html
Thanks for your help and I hope this will help people who encounter
the same error.

Regards,
Hao Lee

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: GRUB always enters a rescue shell.

2017-07-24 Thread Aruna Hewapathirane
>
>
> On 22.07.2017 19:35, Aruna Hewapathirane wrote:
> [...]
> >>> sudo losetup -o $((2048*512)) /dev/loop1 hd.img
> >>
> >> should'nt it be 63*512 ?
> >>
> >
> > nope should be 2048 and this is why -->
> > https://superuser.com/questions/352572/why-does-the-
partition-start-on-sector-2048-instead-of-63
>
> it is for new hard disks,

Yes agreed it is for newer hard disks..

> here it conflicts with geometry used:
>
>  fdisk -u -C100 -S63 -H16 hd.img

Actually no because if you look at the initial email hao sent carefully in
step 2:

2. Create a primary partition.
fdisk -u -C100 -S63 -H16 hd.img

Notice even though hao *has* specified the geometry, fdisk does not show
this ? Try it and see... if we go through the process and ask fidsk to
print the partition information. This is what I see :




Command (m for help): p
Disk hd.img: 49.2 MiB, 51609600 bytes, 100800 sectors ---> geometry is
usually shown on the next line but zilch here ?
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x4c0d7fa4

Device Boot StartEnd Sectors  Size Id Type
hd.img1  2048 100799   98752 48.2M 83 Linux




But if I do this: /sbin/fdisk -c=dos -u -C100 -S63 -H16 hd3.img

then fdisk complains saying DOS-compatible mode is deprecated, and after
going through the process once again and we ask fdisk to print the
partition we see:

--
Command (m for help): p
Disk hd3.img: 49.2 MiB, 51609600 bytes, 100800 sectors
Geometry: 16 heads, 63 sectors/track, 100 cylinders <  fdisk shows
geometry this time around ah-ha !
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x030e7198
--

I put together a small video will make it easier for you to see all the
above: https://youtu.be/kmG7CCy-F9Q

> and maybe conflicts with Bochs BIOS options or disk geometry options ?

Mmm.. I don't believe there are any conflicts. Please watch the video I
sent earlier.
It has a fix and working solution : https://youtu.be/6oqTu8utMe4

:)

Thank's - Aruna



>
> --
> Best regards,
> Kamil Konieczny
> Samsung R Institute Poland
>
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: GRUB always enters a rescue shell.

2017-07-24 Thread Kamil Konieczny


On 22.07.2017 19:35, Aruna Hewapathirane wrote:
[...]
>>> sudo losetup -o $((2048*512)) /dev/loop1 hd.img
>>
>> should'nt it be 63*512 ?
>>
> 
> nope should be 2048 and this is why -->
> https://superuser.com/questions/352572/why-does-the-partition-start-on-sector-2048-instead-of-63

it is for new hard disks,
here it conflicts with geometry used:

 fdisk -u -C100 -S63 -H16 hd.img

and maybe conflicts with Bochs BIOS options or disk geometry options ?

-- 
Best regards,
Kamil Konieczny
Samsung R Institute Poland


___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: GRUB always enters a rescue shell.

2017-07-22 Thread Aruna Hewapathirane
On Mon, Jul 17, 2017 at 11:16 AM, Kamil Konieczny <
k.koniec...@partner.samsung.com> wrote:

> Hi,
>
> On 13.07.2017 10:39, Hao Lee wrote:
>
> > I encounter a problem when making a bootable disk image because GRUB
> > always enters a
> > rescue shell.
> >
> > I want to create a disk image and install GRUB 2 on it and then use
> > Bochs to run it. The steps are as follows.
> > [...]
>
> > Bochs BIOS - build: 02/16/17
> > ata0 master: Generic 1234 ATA-6 Hard-Disk (  49 MBytes)
> > Press F12 for boot menu.
> > Booting from Hard Disk...
> > .
> > error: no such device: c5b2c483-70c2-4212-840b-da5f965d0555.
> > error: unknown filesystem.
> > Entering rescue mode...
> > grub rescue>
> > [...]
>
> Looks like that blkid 'c5b2c483...' is not valid for your boot device,
> see command:
> blkid
>
> also:
> lsblk
>
> or search with google: grub2 without uuid
>
> or discover what uuid your partition will have (or assign it)
> or turn to some grub2 guru/forum for help
>
> or it may be problem with disk configuration, like loop1 is using
> linear mode, and bochs uses incompatible one (? i am not sure here)
> then bios geometry is mixing up sectors sequence
>
> or in step 3:
>
> > sudo losetup -o $((2048*512)) /dev/loop1 hd.img
>
> should'nt it be 63*512 ?
>

nope should be 2048 and this is why -->
https://superuser.com/questions/352572/why-does-the-partition-start-on-sector-2048-instead-of-63




> Regards,
> Kamil Konieczny
>
> ___
> Kernelnewbies mailing list
> Kernelnewbies@kernelnewbies.org
> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: GRUB always enters a rescue shell.

2017-07-22 Thread Aruna Hewapathirane
Hello Hao,

On Thu, Jul 13, 2017 at 4:39 AM, Hao Lee  wrote:

> Hi,
>
> I encounter a problem when making a bootable disk image because GRUB
> always enters a
> rescue shell.
>
> I want to create a disk image and install GRUB 2 on it and then use
> Bochs to run it. The steps are as follows.
>
> System Environment:
> OS: Fedora 25 x86
> GRUB version: grub2-install (GRUB) 2.02~beta3
> Bochs version: 2.6.9
>
> 1. Create a empty disk image.
>
> dd if=/dev/zero of=hd.img bs=$((16*63*512)) count=100
>
> 2. Create a primary partition.
>
> fdisk -u -C100 -S63 -H16 hd.img
>
> The partition  table is:
> Device Boot StartEnd Sectors  Size Id Type
> hd.img1  2048 100799   98752 48.2M 83 Linux
>
>
Hint: when you run: /usr/bin/file hd.img what do you see ?



> 3. Attach the whole image to /dev/loop0 and attach the first partition
> to /dev/loop1
>
> sudo losetup /dev/loop0 hd.img
> sudo losetup -o $((2048*512)) /dev/loop1 hd.img
>
> 4. Format the first partition to ext4 and mount it to /mnt/
>
> sudo mkfs.ext4 /dev/loop1
> sudo mount -t ext4 /dev/loop1 /mnt
>
> 5. Create GRUB directory.
>
> sudo mkdir -p /mnt/boot/grub2
>
> 6. Install GRUB 2
>
> sudo grub2-install --boot-directory=/mnt/boot /dev/loop0
>


2nd hint: ask yourself does the grub *core.img" have the required module
built-in by default ?


>
> 7. Start Bochs.
>
> bochs -f test.bxrc
>
> These steps are straight and simple. However, GRUB always enters a
> rescue shell instead of entering normal mode.
> When I use the set and ls command to show more information, I can only
> see (hd0) and the first partition (hd0,1) is disappeared. The screen
> output is as follows:
> 
> Bochs BIOS - build: 02/16/17
> ata0 master: Generic 1234 ATA-6 Hard-Disk (  49 MBytes)
> Press F12 for boot menu.
> Booting from Hard Disk...
> .
> error: no such device: c5b2c483-70c2-4212-840b-da5f965d0555.
> error: unknown filesystem.
> Entering rescue mode...
> grub rescue> set
> prefix=(hd0)/boot/grub2
> root=hd0
> grub rescue> ls
> (hd0)
> grub rescue>
> 
>
> Could someone help me out? Many thanks!
>

Yes *someone* can and will help you. Please watch till the very end. You
will not be disappointed :)

https://youtu.be/6oqTu8utMe4

Good luck and hope this helps - Aruna


>
> Regards,
> Hao Lee
>
> ___
> Kernelnewbies mailing list
> Kernelnewbies@kernelnewbies.org
> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: GRUB always enters a rescue shell.

2017-07-17 Thread Kamil Konieczny
Hi,

On 13.07.2017 10:39, Hao Lee wrote:

> I encounter a problem when making a bootable disk image because GRUB
> always enters a
> rescue shell.
> 
> I want to create a disk image and install GRUB 2 on it and then use
> Bochs to run it. The steps are as follows.
> [...]

> Bochs BIOS - build: 02/16/17
> ata0 master: Generic 1234 ATA-6 Hard-Disk (  49 MBytes)
> Press F12 for boot menu.
> Booting from Hard Disk...
> .
> error: no such device: c5b2c483-70c2-4212-840b-da5f965d0555.
> error: unknown filesystem.
> Entering rescue mode...
> grub rescue> 
> [...]

Looks like that blkid 'c5b2c483...' is not valid for your boot device,
see command:
blkid

also:
lsblk

or search with google: grub2 without uuid

or discover what uuid your partition will have (or assign it)
or turn to some grub2 guru/forum for help

or it may be problem with disk configuration, like loop1 is using
linear mode, and bochs uses incompatible one (? i am not sure here)
then bios geometry is mixing up sectors sequence

or in step 3:

> sudo losetup -o $((2048*512)) /dev/loop1 hd.img

should'nt it be 63*512 ?


Regards,
Kamil Konieczny

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies