Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
GRUB on a virtual machine
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
knirirr
n00b
n00b


Joined: 20 Jan 2010
Posts: 33

PostPosted: Tue Feb 21, 2017 2:13 pm    Post subject: GRUB on a virtual machine Reply with quote

I'm installing Gentoo on a commercially-provided VM. The root disk shows up as /dev/vda in the chroot:

Code:

$ mount | grep vda
/dev/vda3 on / type ext4 (rw,relatime,data=ordered)
/dev/vda1 on /boot type ext2 (rw,relatime,block_validity,barrier,user_xattr,acl)


Attempts to run grub-install fail as follows:

Code:

grub-install: warning: disk does not exist, so falling back to partition device /dev/vda1.
grub-install: error: disk `hostdisk//dev/vda1' not found.


This is not something I've encountered before - does anyone have any suggestions?
Back to top
View user's profile Send private message
John R. Graham
Administrator
Administrator


Joined: 08 Mar 2005
Posts: 10261
Location: Somewhere over Atlanta, Georgia

PostPosted: Tue Feb 21, 2017 2:34 pm    Post subject: Reply with quote

What does
Code:
ls -l /dev/vd*
show?

- John
_________________
I can confirm that I have received between 0 and 499 National Security Letters.
Back to top
View user's profile Send private message
knirirr
n00b
n00b


Joined: 20 Jan 2010
Posts: 33

PostPosted: Tue Feb 21, 2017 2:40 pm    Post subject: Reply with quote

John R. Graham wrote:
What does
Code:
ls -l /dev/vd*
show?

- John


Code:

brw-rw---- 1 root disk 252,   0 Feb 21 14:30 /dev/vda
brw-rw---- 1 root disk 252,   1 Feb 21 14:30 /dev/vda1
brw-rw---- 1 root disk 252,   2 Feb 21 14:30 /dev/vda2
brw-rw---- 1 root disk 252,   3 Feb 21 14:30 /dev/vda3
brw-rw---- 1 root disk 252,   16 Feb 21 14:30 /dev/vdb
brw-rw---- 1 root disk 252,   17 Feb 21 14:30 /dev/vdb1


/ is vda3 with /boot as vda1.
/dev/block/252:0 is a symlink to /dev/vda, and so on.
Back to top
View user's profile Send private message
John R. Graham
Administrator
Administrator


Joined: 08 Mar 2005
Posts: 10261
Location: Somewhere over Atlanta, Georgia

PostPosted: Tue Feb 21, 2017 2:54 pm    Post subject: Reply with quote

Interesting. I assume that /dev/vda exists as far as your partitioning tool is concerned?

- John
_________________
I can confirm that I have received between 0 and 499 National Security Letters.
Back to top
View user's profile Send private message
knirirr
n00b
n00b


Joined: 20 Jan 2010
Posts: 33

PostPosted: Tue Feb 21, 2017 2:58 pm    Post subject: Reply with quote

John R. Graham wrote:
Interesting. I assume that /dev/vda exists as far as your partitioning tool is concerned?

- John


Indeed so.
I used fdisk to set up the virtual disks and 'fdisk -l /dev/vda' from the boot iso environment produces the expected list of partitions
However, on entering the chroot the above fdisk command gives me 'operation not permitted'. I therefore wonder if there's any means to install grub from outside the chroot.
Back to top
View user's profile Send private message
windscape
n00b
n00b


Joined: 27 Feb 2012
Posts: 18
Location: Littleton, MA USA

PostPosted: Tue Feb 21, 2017 3:00 pm    Post subject: Shot in the dark... Reply with quote

This is a shot in the dark, but as I recall, /dev/vda represent Xen virtual disks, specifically Xen PV disks, an older form of virtualization, used before hardware-assisted virtualization was commonplace. A while back I had Xen running at home and I believe I had CentOS 6 running as a Xen guest, although I can't recall if it was a PV guest or not. I do know that CentOS 6 uses grub legacy (0.97) and that it installed properly in the Xen guest. You might want to try installing grub 0.97 and see if the behavior is any different. It may be a regression in grub 2.02.
Back to top
View user's profile Send private message
knirirr
n00b
n00b


Joined: 20 Jan 2010
Posts: 33

PostPosted: Tue Feb 21, 2017 3:29 pm    Post subject: Re: Shot in the dark... Reply with quote

windscape wrote:
This is a shot in the dark, but as I recall, /dev/vda represent Xen virtual disks, specifically Xen PV disks, an older form of virtualization, used before hardware-assisted virtualization was commonplace. A while back I had Xen running at home and I believe I had CentOS 6 running as a Xen guest, although I can't recall if it was a PV guest or not. I do know that CentOS 6 uses grub legacy (0.97) and that it installed properly in the Xen guest. You might want to try installing grub 0.97 and see if the behavior is any different. It may be a regression in grub 2.02.


Thanks for the suggestion. I gave it a try but legacy grub doesn't seem to have any luck finding drives either. For example, "setup (hd0)" will tell me that an invalid drive has been requested.
Back to top
View user's profile Send private message
windscape
n00b
n00b


Joined: 27 Feb 2012
Posts: 18
Location: Littleton, MA USA

PostPosted: Tue Feb 21, 2017 3:34 pm    Post subject: Reply with quote

In that case, how about trying LILO?
Back to top
View user's profile Send private message
John R. Graham
Administrator
Administrator


Joined: 08 Mar 2005
Posts: 10261
Location: Somewhere over Atlanta, Georgia

PostPosted: Tue Feb 21, 2017 4:13 pm    Post subject: Reply with quote

knirirr wrote:
John R. Graham wrote:
Interesting. I assume that /dev/vda exists as far as your partitioning tool is concerned?

- John


Indeed so.
I used fdisk to set up the virtual disks and 'fdisk -l /dev/vda' from the boot iso environment produces the expected list of partitions
However, on entering the chroot the above fdisk command gives me 'operation not permitted'. I therefore wonder if there's any means to install grub from outside the chroot.
Could you report the exact command you used to mount /dev on /mnt/gentoo/dev please?

- John
_________________
I can confirm that I have received between 0 and 499 National Security Letters.
Back to top
View user's profile Send private message
knirirr
n00b
n00b


Joined: 20 Jan 2010
Posts: 33

PostPosted: Tue Feb 21, 2017 4:18 pm    Post subject: Reply with quote

John R. Graham wrote:
Could you report the exact command you used to mount /dev on /mnt/gentoo/dev please?

- John



I've listed them all including /dev in case I've made a mistake with one or more of them:

Code:

mount /dev/vda3 /mnt/gentoo
mount /dev/vda1 /mnt/gentoo/boot
mount -t proc proc /mnt/gentoo/proc
mount --rbind /sys /mnt/gentoo/sys
mount --rbind /dev /mnt/gentoo/dev


I'm still compiling LILO. Hopefully it's my mounting mistake but if not I'll continue with a trial of LILO.
Back to top
View user's profile Send private message
axl
Guru
Guru


Joined: 11 Oct 2002
Posts: 537
Location: Romania

PostPosted: Tue Feb 21, 2017 9:07 pm    Post subject: Reply with quote

just a shot in the dark here. but did you run grub-install /dev/vda? or just grub-install?
Back to top
View user's profile Send private message
knirirr
n00b
n00b


Joined: 20 Jan 2010
Posts: 33

PostPosted: Wed Feb 22, 2017 8:00 am    Post subject: Reply with quote

axl wrote:
just a shot in the dark here. but did you run grub-install /dev/vda? or just grub-install?


Definitely the former.
Back to top
View user's profile Send private message
knirirr
n00b
n00b


Joined: 20 Jan 2010
Posts: 33

PostPosted: Fri Feb 24, 2017 9:12 am    Post subject: Reply with quote

In the end I couldn't find out the cause for this. It was suggested that it might be missing virtio drivers but they were loaded from the live DVD and all was find until I chrooted.
Instead, on the recommendations of the cloud provider, I used their netboot environment (Debian) and chrooted from there; /dev/vda was accessible thereafter and I was able to run grub-install.
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