I think I heard about Gentoo first about 8 years ago, and maybe I should have had time to check it out before. I have used linux since 2006/2007, starting off with Ubuntu, since it was easy, and then switching to Debian around 2010-2011. Since Debian is moving to systemd, and I am not convinced about that, I should try out some other distributions. Time has come to test Gentoo. I tried installing it to a virtual machine on my workstation first, and I think I will be able to pull this off.
Hardware:All of my hardware is from 2011 or older.
CPU:Intel Core i5 2500K
Motherboard:Asus P8H61-M EVO
I will install it on a spare hard-drive, and will probably let it live parallel to my main Debian Jessie system, not even configuring the main boot-loader to have an option to start Gentoo, instead be forced to manually change the boot device to boot from the Gentoo disk. We will see what I am capable of doing before growing tired.
I will be following this guide:https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
I have verified the installation medium on my Debian system, and burned a CD.
Network configuration: I have a local dhcp server running, so the network was configured automatically.
Partitioning the disks. I will try out using UEFI, since my motherboard seems to have that option.
I have three hard drives in my current system
/dev/sda - storage
/dev/sdb - Debian system
/dev/sdc - I will install to this disk
Partitions:
/dev/sdc1 - Bios boot partition
/dev/sdc2 - boot 300MB
/dev/sdc3 - swap 12GB (2*RAM)
/dev/sdc4 - root 50GB
/dev/sdc5 - home 50GB (may use the home from my Debian system later /dev/sdb6)
I used gparted
to create my partition table.
Now create file systems.
I will use vfat
for boot, ext4
for root and home partitions.
Then just mount the partitions on the mount points:
mount /dev/sdc4 /mnt/gentoo
mkdir /mnt/gentoo/boot
mount /dev/sdc2 /mnt/gentoo/boot
mkdir /mnt/gentoo/home
mount /dev/sdc5 /mnt/gentoo/home
Now, it is time to download the stage3-file. I downloaded the stage3-amd64-20161020.tar.bz2
file, since my installation medium was downloaded from here. I think it might be safest to not mix them, which means my installation medium will be useless in a couple of weeks.
I extracted the stage file.
Next stop, compile options. This is a bit exciting, since it will be the first kernel I compile.
I’m using the options stated in the handbook, and use MAKEOPTS="-j5"
, since I have 4 CPU-cores.
Configure repos as the hand book does.
Mount necessary file systems for chroot and chroot to the new system.
Install the portage snapshot and read the news items.
I set my profile to /default/linux/amd64/13.0/desktop
.
Then I updated the world set. This took a long time, since I had 172 packages to emerge.
I configured time zone and locale.
Then I downloaded the kernel sources using the command in the hand book.
Now it is time to manually configure the kernel.
In menuconfig, I enabled EFI stub support
under Processor type and features ----->
and USB Serial Converter Support ----->
in Device Drivers ----> / USB Support ---->
since I got a USB serial converter I would like to use (maybe this is unimportant).
Note that you need to use a medium booted using EFI to be able to install grub in EFI-mode. Thus, using the minimal cd is not possible. Either use one of the live-cd or live-dvd, or use system rescue cd afterwards to install grub.
I compiled and installed the kernel.
Now configure the mount points in fstab. I am using the following:
<fs> <mountpoint> <type> <opts> <dump/pass>
/dev/sdc2 /boot vfat noauto,noatime 1 2
/dev/sdc4 / ext4 noatime 0 1
/dev/sdc5 /home ext4 noatime 0 1
/dev/sdc3 none swap sw 0 0
Options and dump/pass were taken from default values in the file from the stage3 file.
Then I configured host name and dns network.
Then, I configured the local wired ethernet to use dhcp in /etc/conf.d/net
:
config_enp4s0="dhcp"
I created a symlink to this device and added it to the default runlevel.
I created a password for root.
Then, I edited /etc/conf.d/keymaps
to use the "dvorak-sv-a1"
keymap.
I installed sysklogd
as system logger. Then I installed cron.
I installed e2fsprogs
and dosfstools
.
Then I installed dhclient.
I updated the make.conf
to have EFI support, and then installed grub2 boot loader.
Next, I installed grub using the EFI instructions and generated a configuration.
Now it is time to reboot and see if it works.
When umounting the /mnt/gentoo/sys file system, it complained that it couldn’t. Strange.
Booting doesn’t seem to work =(.
Maybe my motherboard doesn’t support UEFI after all, but it says so in the specifications. Trying to “Launch EFI Shell from filesystem device” when having sdc as boot device reports “Not found”. So maybe something with the installation has failed. Maybe the hard drive has to be connected to one of the first SATA ports? No, it is not that.
So investigate further tomorrow.
So, continuing. I have booted the live cd again, and chrooted into my install. This time, I will verify the files generated by grub. First, I read the “Important” note in the handbook – “Make sure /boot is mounted before running the grub-install command”. I checked, and my /boot wasn’t mounted in my chrooted system, even though I did mount it before chrooting. Strange.
Running the grub install command for efi:
grub-install --target=x86_64-efi --efi-directory=/boot
I got the error message:
Installing for x86_64-efi platform.
efibootmgr: EFI variables are not supported on this system.
efibootmgr: EFI variables are not supported on this system.
Installation finished. No error reported.
Searching for this term lead to this thread. I think my cd was not started in EFI-mode, because it is the minimal install cd. The fallback instructions in the second answer says you should copy the grubx64.efi file from /boot/efi, but my installation only has a /boot/EFI folder, so I will test if it boots, then resort to other measures listed there.
When I the exit the chroot, I notice that the boot partition has two entries in mount. Strange. Unmounting /boot does remove one entry. One entry is still listed. Trying to unmount again fails – Strange.
Booting didn’t work. So, now I will copy the grubx64.efi file to the location specified in the forum answer. That didn’t work either.
I think I will fall back to normal mbr next time I try it.
I have created a systemrescuecd(download, and booted it in EFI-mode.
I tried the instructions in this link, but the efivars file system type wasn’t found.
I exited the chroot, looked at the kernel modules, then chrooted back again, and this time, the command
grub-install --target=x86_64-efi --efi-directory=/boot
worked. Strange. Now reboot and try it. It didn’t work. Next reboot, without choosing boot medium, it booted. Hooray. Maybe because choosing the hard drive as boot medium will boot non UEFI. I should choose the name of OS instead (It showed up as “Gentoo” in the menu).
Next is to install desktop environment etc. I will create a new post for that part.
But, no network card seems to be detected. Maybe I need to enable some modules in the kernel configuration.
So, reconfigure the kernel then.
I checked my network interfaces before on my running debian system, and found out that I have a Realtek RTL8111/8168B as a wired ethernet interface. So I enabled
Device Drivers -> Network device support -> Ethernet driver support
“Realtek devices” in the kernel (*) and “Realtek 8169 gigabit ethernet support” in the kernel (*).
I have also a wireless interface which is a Atheros Wireless 802.11n. So I enabled Device Drivers -> Network device support -> Wireless LAN -> Atheros Wireless Cards
and enabled the Atheros 802.11n wireless card support
with all the sub options.
That did the trick for the wired ethernet at least. Will try the wireless when I have a desktop to start.