Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
an other grub issue
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
b0zzo
n00b
n00b


Joined: 23 May 2013
Posts: 10

PostPosted: Thu May 23, 2013 4:18 pm    Post subject: an other grub issue Reply with quote

Hello!

I'm new on Gentoo and like so many others before me.. got and error with grub.

Trying to install an amd64 version (latest) on VirtualBox for now.


First of all.. "fstab -l" does not work while I'm on my chrooted environnment.

So I ran the following commands outside my chrooted environnement.

see screenshot

( i had to use a screenshot cause I cant copy/paste with virtualbox (other problem, not my priority for now) )

grub-install --no-floppy /dev/sda
returns
The file /boot/grub/stage1 not read correctly.

from grub shell, any commands (i.e root, geometry.. ) returns:
Error 21: Selected disk does not exist

Finally.. my device.map contains one single line:

Code:
(hd0)        /dev/sda




Thank you!
Back to top
View user's profile Send private message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6281

PostPosted: Thu May 23, 2013 4:59 pm    Post subject: Reply with quote

It looks like you forgot to mount your /dev into the chroot. When you have done this you should be able to run fdisk -l and to install grub within the chroot.

Last edited by mv on Thu May 23, 2013 5:00 pm; edited 1 time in total
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43178
Location: 56N 3W

PostPosted: Thu May 23, 2013 4:59 pm    Post subject: Reply with quote

b0zzo,

Welcome to Gentoo.

I'm not sure what you mean by
Code:
fstab -l
I guess, its fdisk -l or df.
The former should work in the chroot but the latter will not as it depends on /etc/mtab which is not in the chroot.

Grub installs depend on being able to determine your /boot. This what the Gentoo Handbook Code Listing 2.5 does. It makes the missing /etc/mtab inside the chroot.

Your grub.conf screenshot reads as if you may have confused the two different meanings for root.
root (hdx,y) is grubspeak for where grub will find all the files to /boot the system. If your boot is /dev/sda1, you need root (hd0,0).
Likewise all the other grub partition specifiers in grub.conf, in grubspeak.

root=/dev/sda3 is an instruction to the kernel as to which device holds the root filesystem.
If your /boot is a directory on your root partition, then root (x,y) and root=/dev/sdAB will describe the same filesystem in two different syntaxes.
If you have a real boot partition then root(x,y) is grubspeak for that partition and will be a different partition to that described by root=/dev/sdAB

In short, based on your fdisk -l output, I think your grub.conf is incorrect.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
b0zzo
n00b
n00b


Joined: 23 May 2013
Posts: 10

PostPosted: Thu May 23, 2013 7:07 pm    Post subject: Reply with quote

Ok thank you

I did mount dev into my chroot env with
Code:
mount --rbind /dev /mnt/gentoo/dev


and yes, that was a "fdisk -l" obviously .. I think I'm a bit tired :)


I'm probably missing something in my grub configuration file.. I do have a separate '/boot' (/dev/sda1) and my '/' is /dev/sda3.

I should have something like:

Code:
root (hd0,0) #  means /boot is on /dev/sda1
kernel /boot/<kernelimg> real_root=/dev/sda3


That was actually my first attempt. Even with those settings, grub wont install.. or maybe I'm still wrong.


Thanks for your help.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43178
Location: 56N 3W

PostPosted: Thu May 23, 2013 7:20 pm    Post subject: Reply with quote

b0zzo,

grub.conf is not used during the grub install.

What you posted looks better - but do not forget your splashimage line.

With both /dev and /etc/mtab in the chroot, grub should install.

Does using the grub shell help ?
Code:
grub --no-floppy
root (hd0,0)
setup (hd0)
quit
are the commands you need.

You should not need to make a device.map file for grub to install, grub will make one for you in the course of the install.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
b0zzo
n00b
n00b


Joined: 23 May 2013
Posts: 10

PostPosted: Thu May 23, 2013 7:33 pm    Post subject: Reply with quote

Yes I also tried with the grub shell.

I get this:

Quote:
Error 21: Selected disk does not exist.



And I now get :

/dev/sda/ does not have any corresponding bios drive.



Looking in this direction now.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43178
Location: 56N 3W

PostPosted: Thu May 23, 2013 8:02 pm    Post subject: Reply with quote

b0zzo,

I have not seen that in Virtualbox before, unless you are using the virtio block device but then you don't get /dev/sda and friends.

The fix is to make a device.map file and tell grub to use it instead of trying to discover your HDD for itself.
info grub tells the format of device.map and the grub command line options to use.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
666threesixes666
Veteran
Veteran


Joined: 31 May 2011
Posts: 1248
Location: 42.68n 85.41w

PostPosted: Thu May 23, 2013 8:07 pm    Post subject: Reply with quote

call me crazy, but i think having the /boot partitions boot flag might help you down the road.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43178
Location: 56N 3W

PostPosted: Thu May 23, 2013 8:21 pm    Post subject: Reply with quote

666threesixes666,

You are crazy :)

You may be correct about down the road but it does not prevent grub installing to the MBR.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
b0zzo
n00b
n00b


Joined: 23 May 2013
Posts: 10

PostPosted: Thu May 23, 2013 8:27 pm    Post subject: Reply with quote

666threesixes666 wrote:
call me crazy, but i think having the /boot partitions boot flag might help you down the road.


Actually I was so desperate that I tried to put it on every partition.. That didn't help.

And as far as I know, I do not use virtio block device (i don't even know what it is).


I'm almost out of ideas but thank you again!
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43178
Location: 56N 3W

PostPosted: Thu May 23, 2013 8:44 pm    Post subject: Reply with quote

b0zzo,

Post your
Code:
fdisk -l
and explain what each partition is for.

Forget that I mentioned Virtualbox ... you didn't bring it up.
I must be going crazy.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
b0zzo
n00b
n00b


Joined: 23 May 2013
Posts: 10

PostPosted: Thu May 23, 2013 8:55 pm    Post subject: Reply with quote

screenshot

As mentionned in my first post.. it doesn't work in my chroot env (you'll see with the screenshot).


sda1 is /boot
sda2 is swap
sda3 is /
sda4 is extended
sda5 is /usr/portage

sda6 is not used

Maybe the reason why fdisk doenst work in my chrooted env explains why I can't install grub.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43178
Location: 56N 3W

PostPosted: Thu May 23, 2013 9:06 pm    Post subject: Reply with quote

b0zzo,

Possibly. What do you have in /proc in the chroot?
The answer will be nothing or lots of stuff.
Lots of stuff is probably right, nothing means you forgot to mount /proc inside the chroot.
You need /proc to generate /etc/mtab

Take care in /dev, its possible to have lots of stuff and for it to be wrong.
The stage3 used to provide a static /dev?
What does /dev/sd* show inside and outdside the chroot.?
If its different, you probably did not mount /dev inside the chroot.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
b0zzo
n00b
n00b


Joined: 23 May 2013
Posts: 10

PostPosted: Thu May 23, 2013 9:17 pm    Post subject: Reply with quote

proc is here and I copied mtab from /proc/mounts as mentionned in the doc.



I checked the stage3 tarball and there are /dev/* files..

Code:
(chroot) livecd  tmp # ls -l

brw-rw---- 1 root disk 8, 0 May 23 22:15 /dev/sda
brw-rw---- 1 root disk 8, 1 May 23 17:12 /dev/sda1
brw-rw---- 1 root disk 8, 2 May 23 17:14 /dev/sda2
brw-rw---- 1 root disk 8, 3 May 23 17:12 /dev/sda3
brw-rw---- 1 root disk 8, 4 May 23 22:15 /dev/sda4
brw-rw---- 1 root disk 8, 5 May 23 17:12 /dev/sda5
brw-rw---- 1 root disk 8, 6 May 23 22:15 /dev/sda6





Never seen a static 'dev' before! gentoo is definitely something :)


EDIT: might have found something.. devtmpfs was not enabled in the kernel configuration. I'm gonna try to rebuild it, re emerge grub and then try to install it again! will let you know.
Back to top
View user's profile Send private message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6281

PostPosted: Fri May 24, 2013 5:11 am    Post subject: Reply with quote

Independent of the other issues, I think that it might cause issues that your first partition starts on block 1: When you create with parted, it lets the first partition start at 63, and new cfdisk defaults even to 255 IIRC. I am not such a grub expert, but I think it uses the free disk space at the beginning to write its stage 0/1.
However, an expert might correct me...
Back to top
View user's profile Send private message
b0zzo
n00b
n00b


Joined: 23 May 2013
Posts: 10

PostPosted: Fri May 24, 2013 9:49 am    Post subject: Reply with quote

I've partitioned with parted and 'almost' (ext4 instead of ext3.. a bit more partitions..) like proposed in the documentation.

Maybe the output is more clear when showed with parted:

Code:
Modèle: ATA VBOX HARDDISK (scsi)
Disque /dev/sda : 8590MB
Taille des secteurs (logiques/physiques): 512B/512B
Table de partitions : msdos
Disk Flags:

Numéro  Début   Fin     Taille  Type      Système de fichiers  Fanions
 1      512B    32,0MB  32,0MB  primary   ext2                 démarrage
 2      32,0MB  544MB   512MB   primary   linux-swap(v1)
 3      544MB   5000MB  4455MB  primary   ext4
 4      5000MB  8000MB  3000MB  extended                       lba
 5      5000MB  7000MB  2000MB  logical   ext4
 6      7000MB  8000MB  1000MB  logical   ext4


It starts after the first 512 bytes.. so I guess it's ok.



Regarding my problem, my new kernel configuration didnt help. So, I decided to install grub from outside my chroot env and managed to do so.

My new gentoo has started correctly and I tried grub immediately, guess what? no problem at all .. i reinstall it and reboot, still works.

I booted on the admincd again, got into my chroot env, tried with grub again.. it didnt work!

Shall I file a bug? I'd like to understand but i'm not sure I've the appropriate skills.


Thank you for your time!
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43178
Location: 56N 3W

PostPosted: Fri May 24, 2013 6:03 pm    Post subject: Reply with quote

b0zzo,

With having only 512B before the start of the first partition, there is no space for grub to install the stage1.5
It will still work but will not be as robust. The stage1.5 reads your /boot filesystem to find the stage2.
When the stage1.5 is missing, the MBR uses a block list to load stage2 directly. That works until you get an update for grub, since the new stage2 will be in a different place on the filesystem. You must reinstall grub to the MBR every time you you get a grub update.
While this is interesting, it has nothing to do with your ability to install grub in the first place.

I'm not sure what attempting to install grub from outside the chroot does. It does not intstall your version of grub since that can't be seen.

Missing DEVTMPFS in your own kernel would cause problems later, as your own /dev would be empty, but your own kernel is not in use in the chroot.

Did you have a USB memory device connected when you were installing grub?
That can cause your internal HDD to become /dev/sdb.

I guess not as there is no /dev/sdb listed in your dev ... hmm that reads as if you did cd /tmp then ls -l
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
b0zzo
n00b
n00b


Joined: 23 May 2013
Posts: 10

PostPosted: Fri May 24, 2013 8:42 pm    Post subject: Reply with quote

NeddySeagoon wrote:

With having only 512B before the start of the first partition, there is no space for grub to install the stage1.5
It will still work but will not be as robust. The stage1.5 reads your /boot filesystem to find the stage2.
When the stage1.5 is missing, the MBR uses a block list to load stage2 directly. That works until you get an update for grub, since the new stage2 will be in a different place on the filesystem. You must reinstall grub to the MBR every time you you get a grub update.
While this is interesting, it has nothing to do with your ability to install grub in the first place.


Indeed! I didn't know that.. I will read more about this! Thanks

Quote:

I'm not sure what attempting to install grub from outside the chroot does. It does not intstall your version of grub since that can't be seen.


Not sure what that made.. but I know from experience that it works!

Quote:

Missing DEVTMPFS in your own kernel would cause problems later, as your own /dev would be empty, but your own kernel is not in use in the chroot.


Yes I know that, but I thought maybe there had some connections when building grub... it seems like I was wrong.

Quote:

Did you have a USB memory device connected when you were installing grub?
That can cause your internal HDD to become /dev/sdb.

I guess not as there is no /dev/sdb listed in your dev ... hmm that reads as if you did cd /tmp then ls -l


Nope, nothing like that!


I'll give this partition problem a try.. I'm gonna install a new VM, paying attention to start the 1st partition at block 63.

About that 'ls -l' .. I actually copied the result manually.. that's why! was not very smart from me! sorry. I can now make copy/paste since I can connect through ssh.
Back to top
View user's profile Send private message
666threesixes666
Veteran
Veteran


Joined: 31 May 2011
Posts: 1248
Location: 42.68n 85.41w

PostPosted: Sat May 25, 2013 12:21 am    Post subject: Reply with quote

nope you'll be able to insert grub with missing devtmpfs and kernel panic quickly and be rescuing & rebuilding kernels. id use cfdisk, rather than parted or any other partition editor. id get into lilo & or grub2 before giving up and starting from scratch.
Back to top
View user's profile Send private message
b0zzo
n00b
n00b


Joined: 23 May 2013
Posts: 10

PostPosted: Wed May 29, 2013 2:51 pm    Post subject: Reply with quote

I ve been busy but didnt give up!


I tried to setup lilo.. and once again, inside my chroot environnement, it failed.

Code:
(chroot) livecd etc # more /etc/lilo.conf
boot=/dev/sda
prompt
timeout=50
default=gentoo

image=/boot/kernel-3.8.13-gentoo
label=gentoo
read-only
root=/dev/sda1
append="real_root=/dev/sda3"
initrd=/boot/initramfs-genkernel-amd64-3.4.9-gentoo

image=/boot/kernel-3.8.13-gentoo
label=gentoo.rescue
read-only
root=/dev/sda3
append="init=/bin/bb"
(chroot) livecd etc # /sbin/lilo
Warning: LBA32 addressing assumed
Fatal: open /dev/sda: Operation not permitted



I booted on grub again and installed lilo.. worked! It's like I cant do anything with my disk when I'm in the chrooted environnement..

Code:
(chroot) livecd / # fdisk -l
(chroot) livecd / # file -s /dev/sda1
/dev/sda1: writable, no read permission
(chroot) livecd / # exit
exit
livecd ~ # fdisk -l

Disk /dev/sda: 8589 MB, 8589934592 bytes, 16777216 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000a0d3e

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1       62500       31250   83  Linux
/dev/sda2           62501     1062500      500000   82  Linux swap / Solaris
/dev/sda3         1062912     9764863     4350976   83  Linux
/dev/sda4         9764864    15624191     2929664    f  W95 Ext'd (LBA)
/dev/sda5         9764927    13671875     1953474+  83  Linux
/dev/sda6        13671877    15624191      976157+  83  Linux
livecd ~ # file -s /dev/sda
sda   sda1  sda2  sda3  sda4  sda5  sda6
livecd ~ # file -s /dev/sda1
/dev/sda1: Linux rev 1.0 ext2 filesystem data (mounted or unclean), UUID=7e7419c0-209e-47b0-a9fe-2bbe0972c445



Investigation continues!
Back to top
View user's profile Send private message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6281

PostPosted: Wed May 29, 2013 3:26 pm    Post subject: Reply with quote

It alwaysl looks like /dev is not properly mounted inside the chroot. Does ls -l /dev/sda (inside the chroot show something like this
ls -l /dev/sda wrote:
brw-rw---- 1 root disk 8,0 [...] /dev/sda

(especially the 8,0 is important). Maybe your livecd is broken (e.g. it uses a hardened kernel with certain restrictions for chroot, or it has some other security measurements which interfere).
Back to top
View user's profile Send private message
b0zzo
n00b
n00b


Joined: 23 May 2013
Posts: 10

PostPosted: Wed May 29, 2013 4:08 pm    Post subject: Reply with quote

I'm using admincd-amd64-20130516.iso :

Code:
Linux livecd 3.8.6-hardened #1 SMP Thu May 16 21:05:54 UTC 2013 x86_64 Intel(R) Core(TM) i5 CPU 750 @ 2.67GHz GenuineIntel GNU/Linux



dev is properly filled !

Code:

mount /dev/sda3 /mnt/gentoo
mount /dev/sda1 /mnt/gentoo/boot
mount /dev/sda5 /mnt/gentoo/usr/portage

mount -t proc none /mnt/gentoo/proc
mount --rbind /sys /mnt/gentoo/sys
mount --rbind /dev /mnt/gentoo/dev

swapon /dev/sda2



Ok.. so I think the problem comes from the ISO i'm using (and its hardened kernel which i'm not very familiar with yet).. will check and report.


EDIT:

Well.. thank you mv! you were right. I downloaded and booted on the install cd.. I feel really sorry for the waste of time! I did not know such restrictions existed.. so it's not a total loss!
Thank you all
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
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