Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
VM with UEFI, /sbin/init not found [SOLVED]
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
audiodef
Watchman
Watchman


Joined: 06 Jul 2005
Posts: 6639
Location: The soundosphere

PostPosted: Thu Oct 05, 2017 1:18 pm    Post subject: VM with UEFI, /sbin/init not found [SOLVED] Reply with quote

Trying to install Gentoo on a Virtualbox VM using UEFI. (TLDR; I need to use this option, I know it's easier not to.)

Boot medium is sysresccd. When I'm done installing, it boots into the installed GRUB. Subsequently, starting up this machine results in sysresccd being booted and if I choose the "boot OS on disk" option, I get an /sbin/init not found.

I formatted /dev/sda2 (boot) as vfat.

fstab:
Code:

/dev/sda2               /boot           vfat            defaults,noatime 0 2
/dev/sda4               /               ext4            noatime         0 1
/dev/sda3               none            swap            sw              0 0


Using genkernel, no special options.

What did I miss?

I'm looking at my EFI physical machines and I'm seeing sda2 listed in fstab as ext2. Not sure why this works. I see fat32 as the fs in parted.
_________________
decibel Linux: https://decibellinux.org
Github: https://github.com/Gentoo-Music-and-Audio-Technology
Facebook: https://www.facebook.com/decibellinux
Discord: https://discord.gg/73XV24dNPN


Last edited by audiodef on Fri Oct 06, 2017 3:15 am; edited 1 time in total
Back to top
View user's profile Send private message
joanandk
Apprentice
Apprentice


Joined: 12 Feb 2017
Posts: 169

PostPosted: Thu Oct 05, 2017 8:20 pm    Post subject: Reply with quote

You are not giving enough information.

Can you exactly say what is your partition table? Where is Gentoo installed (sda?)? What is the Kernel boot parameter (root=?)?

For using UEFI you can use EFI-Stub (I have been using it over 8 years now). For this you copy the Kernel (with the activated efi-stub) to /EFI/efi/boot/bootx64.efi, where /EFI is mounted on /dev/sda1 and is fat32 and has the boot flag.
In the Kernel you will also activate "built in Kernel command" to "root=/dev/sda?" where sda? is the partition of Gentoo installation.

BR
Back to top
View user's profile Send private message
audiodef
Watchman
Watchman


Joined: 06 Jul 2005
Posts: 6639
Location: The soundosphere

PostPosted: Thu Oct 05, 2017 8:55 pm    Post subject: Reply with quote

My boot setup, using grub-install, looks like:
Code:

audiodef@GSVirtualDev ~ $ ls /boot/
EFI   initramfs-genkernel-x86_64-4.12.12-gentoo  kernel-genkernel-x86_64-4.12.12-gentoo  System.map-genkernel-x86_64-4.12.12-gentoo
grub  initramfs-genkernel-x86_64-4.12.5-gentoo   kernel-genkernel-x86_64-4.12.5-gentoo   System.map-genkernel-x86_64-4.12.5-gentoo
audiodef@GSVirtualDev ~ $ ls /boot/EFI/
gentoo
audiodef@GSVirtualDev ~ $ ls /boot/EFI/gentoo/
grubx64.efi
audiodef@GSVirtualDev ~ $ ls /boot/grub/
fonts  grub.cfg  grubenv  locale  themes  x86_64-efi
audiodef@GSVirtualDev ~ $


Trying the extra kernel options from https://wiki.gentoo.org/wiki/EFI_stub_kernel

EDIT: Nope, that did not matter. Still not finding /sbin/init.
_________________
decibel Linux: https://decibellinux.org
Github: https://github.com/Gentoo-Music-and-Audio-Technology
Facebook: https://www.facebook.com/decibellinux
Discord: https://discord.gg/73XV24dNPN
Back to top
View user's profile Send private message
audiodef
Watchman
Watchman


Joined: 06 Jul 2005
Posts: 6639
Location: The soundosphere

PostPosted: Fri Oct 06, 2017 1:17 am    Post subject: Reply with quote

So here is exactly what I did:
Code:

parted -a optimal /dev/sda
mklabel gpt
unit mib
mkpart primary 1 3
name 1 grub
set 1 bios_grub on
mkpart primary 3 131
name 2 boot
mkpart primary 131 643
name 3 swap
mkpart primary 643 -1
name 4 rootfs
set 2 boot on
mkfs.fat -F 32 /dev/sda2
mkfs.ext4 /dev/sda4
mkswap /dev/sda3
swapon /dev/sda3
mount /dev/sda4 /mnt/gentoo
cd /mnt/gentoo
wget http://gentoo.osuosl.org/releases/amd64/autobuilds/current-stage3-amd64/stage3-amd64-20170907.tar.bz2
tar xvjpf stage3-*.tar.bz2 --xattrs --numeric-owner
set MAKEOPTS
mirrorselect -i -o >> /mnt/gentoo/etc/portage/make.conf
mkdir /mnt/gentoo/etc/portage/repos.conf
cp /mnt/gentoo/usr/share/portage/config/repos.conf /mnt/gentoo/etc/portage/repos.conf/gentoo.conf
cp -L /etc/resolv.conf /mnt/gentoo/etc/
mount -t proc /proc /mnt/gentoo/proc
mount --rbind /sys /mnt/gentoo/sys
mount --rbind /dev /mnt/gentoo/dev
chroot /mnt/gentoo /bin/bash
source /etc/profile
mkdir /boot
mount /dev/sda2 /boot
emerge-webrsync
echo "America/New_York" > /etc/timezone
emerge --config timezone-data
nano /etc/locale.gen
locale-gen
eselect locale set 2
env-update && source /etc/profile
emerge gentoo-sources
emerge genkernel
nano /etc/fstab: /dev/sda2   /boot   vfat   defaults   0 2
genkernel --menuconfig all, build MSDOS and VFAT into kernel
emerge linux-firmware
nano /etc/fstab:
   /dev/sda2   /boot        vfat    noauto,noatime       0 2
   /dev/sda3   none         swap    sw                   0 0
   /dev/sda4   /            ext4    noatime              0 1
nano /etc/conf.d/hostname
emerge netifrc
passwd
emerge dhcpcd
emerge grub
grub-install --target=x86_64-efi --efi-directory=/boot
grub-mkconfig -o /boot/grub/grub.cfg
exit
cd
umount -l /mnt/gentoo/dev{/shm,/pts,}
umount -R /mnt/gentoo
reboot


Chrooting from sysresccd and re-installing GRUB, then rebooting brings up the installed GRUB and I can boot into my installed system, so... why? After that, if I halt the system and boot it up, I get /sbin/init not found.

EDIT:

Solved. Turned out I needed the --removable option for grub-install. Note to Virtualbox users.
_________________
decibel Linux: https://decibellinux.org
Github: https://github.com/Gentoo-Music-and-Audio-Technology
Facebook: https://www.facebook.com/decibellinux
Discord: https://discord.gg/73XV24dNPN
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