Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[Not solved] Merge Grub on VirtualBox, no /boot files
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
elmar283
Apprentice
Apprentice


Joined: 06 Dec 2004
Posts: 292
Location: Haarlem, Netherlands

PostPosted: Tue Dec 29, 2015 10:44 pm    Post subject: [Not solved] Merge Grub on VirtualBox, no /boot files Reply with quote

I'm trying to install grub on an new install from VirtualBox. I'm using Virtualbox on my new MacBook Pro from OSX El Capitan.
The problem is that Grub thinks /boot is read only. I've seen this before. The trick was to mark the line '/dev/sda2 /boot ext2 defaults,noatime 0 2' with a # and then install it. After that I copy the content of '/boot' somewhere else, mount '/boot' and then copy the 'grub' directory to '/boot'.
But now this also doesn't work. After installing no 'grub' directory is on '/boot'.

So now I can't install grub with 'grub2-install /dev/sda' because there is no 'grub' directory on '/boot'.

If I type 'mount' from the chroot I get this:
Code:

sysresccd / # mount
/dev/sda2 on /boot type ext2 (ro,noatime)


If I type 'mount' from outsite the chroot I get:
Code:

root@sysresccd /mnt/gentoo/boot % mount
rootfs on / type rootfs (rw,size=2010964k,nr_inodes=502741)
udev on /dev type devtmpfs (rw,relatime,size=10240k,nr_inodes=502744,mode=755)
/dev/sr0 on /livemnt/boot type iso9660 (ro,relatime,mode=0644)
/dev/loop0 on /livemnt/squashfs type squashfs (ro,relatime)
tmpfs on /livemnt/memory type tmpfs (rw,relatime)
none on / type aufs (rw,noatime,si=fe1408ab0575148c)
tmpfs on /livemnt/tftpmem type tmpfs (rw,relatime,size=524288k)
none on /tftpboot type aufs (rw,relatime,si=fe1408aac471748c)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
tmpfs on /run type tmpfs (rw,nosuid,nodev,relatime,size=404724k,mode=755)
mqueue on /dev/mqueue type mqueue (rw,nosuid,nodev,noexec,relatime)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
shm on /dev/shm type tmpfs (rw,nosuid,nodev,noexec,relatime)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,nosuid,nodev,noexec,relatime)
configfs on /sys/kernel/config type configfs (rw,nosuid,nodev,noexec,relatime)
fusectl on /sys/fs/fuse/connections type fusectl (rw,nosuid,nodev,noexec,relatime)
tmpfs on /tmp type tmpfs (rw)
/dev/sda4 on /mnt/gentoo type ext4 (rw)
proc on /mnt/gentoo/proc type proc (rw)
/dev on /mnt/gentoo/dev type none (rw,bind,rbind)
/sys on /mnt/gentoo/sys type none (rw,bind,rbind)
/dev/sda2 on /mnt/gentoo/boot type ext2 (rw)


This are my config files:
Code:

sysresccd / # cat /etc/portage/make.conf
# These settings were set by the catalyst build script that automatically
# built this stage.
# Please consult /usr/share/portage/config/make.conf.example for a more
# detailed example.
#CFLAGS="-O2 -pipe"
CFLAGS="-march=native -O2 -pipe"
CXXFLAGS="${CFLAGS}"
# WARNING: Changing your CHOST is not something that should be done lightly.
# Please consult http://www.gentoo.org/doc/en/change-chost.xml before changing.
CHOST="x86_64-pc-linux-gnu"
MAKEOPTS="-j5"
# These are the USE flags that were used in addition to what is provided by the
# profile used for building.
USE="bindist mmx sse sse2"
PORTDIR="/usr/portage"
DISTDIR="${PORTDIR}/distfiles"
PKGDIR="${PORTDIR}/packages"

GENTOO_MIRRORS="rsync://mirror.leaseweb.com/gentoo/ http://mirror.leaseweb.com/gentoo/ ftp://mirror.leaseweb.com/gentoo/ ftp://ftp.snt.utwente.nl/pub/os/linux/gentoo http://ftp.snt.utwente.nl/pub/os/linux/gentoo rsync://ftp.snt.utwente.nl/gentoo"

#GRUB_PLATFORMS="emu efi-64 pc"

INPUT_DEVICES="evdev"
VIDEO_CARDS="virtualbox"


What can I do to install grub?
I'm now going to reboot and try again. If that doesn't work I'm going to try the official gentoo minimal install cd.


Last edited by elmar283 on Wed Dec 30, 2015 2:37 am; edited 1 time in total
Back to top
View user's profile Send private message
ian.au
Guru
Guru


Joined: 07 Apr 2011
Posts: 433
Location: Australia

PostPosted: Tue Dec 29, 2015 11:25 pm    Post subject: Reply with quote

elmar283 wrote:
I'm trying to install grub on an new install from VirtualBox. I'm using Virtualbox on my new MacBook Pro from OSX El Capitan.
The problem is that Grub thinks /boot is read only. I've seen this before. The trick was to mark the line '/dev/sda2 /boot ext2 defaults,noatime 0 2' with a # and then install it. After that I copy the content of '/boot' somewhere else, mount '/boot' and then copy the 'grub' directory to '/boot'.
But now this also doesn't work. After installing no 'grub' directory is on '/boot'.

So now I can't install grub with 'grub2-install /dev/sda' because there is no 'grub' directory on '/boot'.

If I type 'mount' from the chroot I get this:
Code:

sysresccd / # mount
/dev/sda2 on /boot type ext2 (ro,noatime)



Inside the chroot you needed to remount rw the /boot directory.
Code:
mount -o remount,rw /boot
Back to top
View user's profile Send private message
elmar283
Apprentice
Apprentice


Joined: 06 Dec 2004
Posts: 292
Location: Haarlem, Netherlands

PostPosted: Wed Dec 30, 2015 12:12 am    Post subject: Reply with quote

I've done the remount.
Now it say's:
Code:
livecd boot # mount
/dev/sda2 on /boot type ext2 (rw,noatime)


But after emerging grub there is still no 'grub' directory on '/boot'
Back to top
View user's profile Send private message
ian.au
Guru
Guru


Joined: 07 Apr 2011
Posts: 433
Location: Australia

PostPosted: Wed Dec 30, 2015 12:27 am    Post subject: Reply with quote

elmar283 wrote:
I've done the remount.
Now it say's:
Code:
livecd boot # mount
/dev/sda2 on /boot type ext2 (rw,noatime)


But after emerging grub there is still no 'grub' directory on '/boot'


Is that from inside the chroot?

In any case I think the directory is created from the grub-install phase, (its been a few months since I built a system, and my memory 'ain't what it used to be) so, after emerging grub:2 you would run as root#
Code:
grub2-install /dev/sda
what happens then?

Assuming you get a successful install you then run also as root#
Code:
grub2-mkconfig -o /boot/grub/grub.cfg
to install the boot menu options and you should be done.

There is good information in the wiki https://wiki.gentoo.org/wiki/GRUB2_Quick_Start
Back to top
View user's profile Send private message
elmar283
Apprentice
Apprentice


Joined: 06 Dec 2004
Posts: 292
Location: Haarlem, Netherlands

PostPosted: Wed Dec 30, 2015 12:30 am    Post subject: Reply with quote

Yes, that's from the chroot.
And no, there is no 'grub' directory on '/boot', so 'grub2-install /dev/sda' will fail.
Back to top
View user's profile Send private message
elmar283
Apprentice
Apprentice


Joined: 06 Dec 2004
Posts: 292
Location: Haarlem, Netherlands

PostPosted: Wed Dec 30, 2015 12:35 am    Post subject: Reply with quote

Because I see no result I've installed 'grub:0'.
Now I have a 'grub' directory on '/boot'.
I've done, from memory, 'grub-install --no-floppy /dev/sda'. I'll see if this works.
But still no solution on the grub-2.x.
Back to top
View user's profile Send private message
ian.au
Guru
Guru


Joined: 07 Apr 2011
Posts: 433
Location: Australia

PostPosted: Wed Dec 30, 2015 12:40 am    Post subject: Reply with quote

Sorry, did grub:2 not emerge properly? Did you re-emerge it since making the /boot rw able?

That's all I can think of, usually the quick start instructions just work for grub2.
Back to top
View user's profile Send private message
elmar283
Apprentice
Apprentice


Joined: 06 Dec 2004
Posts: 292
Location: Haarlem, Netherlands

PostPosted: Wed Dec 30, 2015 12:59 am    Post subject: Reply with quote

Yes, I'd tried everything. Emerge it with remounting rw on the chroot, emerging it without a '/boot' mounted and # /boot in '/etc/fstab'. None worked.
But I was able to reboot with grub:0. So I'll stick with that now, because it works.

But it still is a bug on 'grub:2'. It doesn't matter on what system I trie to install it, it always remounts it 'ro'. Just on any other system it works with '#' the boot on /etc/fstab. Even on my toshiba Gentoo Linux it works in VirtualBox, but not in my MacBook Pro that I bought yesterday. But until that bug is resolved I'll go with 'grub:0'
Back to top
View user's profile Send private message
ian.au
Guru
Guru


Joined: 07 Apr 2011
Posts: 433
Location: Australia

PostPosted: Wed Dec 30, 2015 1:52 am    Post subject: Reply with quote

elmar283 wrote:
Yes, I'd tried everything. Emerge it with remounting rw on the chroot, emerging it without a '/boot' mounted and # /boot in '/etc/fstab'. None worked.
But I was able to reboot with grub:0. So I'll stick with that now, because it works.

I figured that you would have, by your join date, which I didn't notice on first post.

Quote:
But it still is a bug on 'grub:2'. It doesn't matter on what system I trie to install it, it always remounts it 'ro'. Just on any other system it works with '#' the boot on /etc/fstab. Even on my toshiba Gentoo Linux it works in VirtualBox, but not in my MacBook Pro that I bought yesterday. But until that bug is resolved I'll go with 'grub:0'


There is a problem, in part, because the handbook doesn't recommend remounting /boot rw after entering the chroot.

If following the handbook verbatim currently, user will always get an error thrown when grub:2 tries to install to a ro filesystem on /boot.

It really should be added to the handbook, if you just
Code:
mount -o remount,rw /boot
after the chroot, it won't happen. There are lots of forum messages about it.

The bug is known, it's in the mount.boot.eclass, so not really grub2, here's a post about it from earlier this month that summarises it :

red-0ne wrote:
dpshak wrote:
Hmm, this is the first time I'm seeing that as well - and I recently put a new hard drive in this machine...

There was this:
Code:
INFO: postinst                                                                                                     
Your boot partition, detected as being mounted at /boot, is read-only.                                             
It will be remounted in read-write mode temporarily.                                                               
Automatically remounting /boot as ro as it was previously.
after the compilation of grub (2.02_beta2-r7) that I haven't seen before, either.


This is certainly a bug. It was introduced by /usr/portage/eclass/mount-boot.eclass.

Testing if the boot partition is read only at line 61 is successful because proc_ro searches for a /boot readonly mount point and wrongly assumes that (for me) /dev/sr0 /livemnt/boot iso9660 ro,relatime,mode=0644 0 0 is the mount point he's looking for.
You can workaround the issue by replacing the sed command with sed -n '/^\/boot at line 57 of mount-boot.eclass by
Code:

local proc_ro=$(awk '{ print $2 " ," $4 "," }' /proc/mounts | sed -n '/^\/boot .*,ro,/p')


Anyway, you're booting so that's the main thing.
Back to top
View user's profile Send private message
elmar283
Apprentice
Apprentice


Joined: 06 Dec 2004
Posts: 292
Location: Haarlem, Netherlands

PostPosted: Wed Dec 30, 2015 1:59 am    Post subject: Reply with quote

I've seen that post. But the solution is something about rewriting the grub installation on line 58. I'm not going to do that, the developers should fix that.
But the strange thing about this one is that if I do not have a '/boot' partition it still doesn't install anything on '/boot'.

But yes indeed, installing grub:0 works for me. I'm not going to try anything else until this bug is resolved. Thanks for the help!
Back to top
View user's profile Send private message
Irre
Guru
Guru


Joined: 09 Nov 2013
Posts: 340
Location: Stockholm

PostPosted: Wed Dec 30, 2015 4:03 pm    Post subject: Reply with quote

You can also try the "lilo" boot loader. It is easy to install and use.
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