{"id":6,"date":"2016-11-07T13:37:17","date_gmt":"2016-11-07T13:37:17","guid":{"rendered":"http:\/\/www.hestben.se\/HestbenTechnical\/?p=6"},"modified":"2016-11-07T13:37:17","modified_gmt":"2016-11-07T13:37:17","slug":"a-noobs-guide-to-installing-gentoo-on-a-core-i5-2500k-part1","status":"publish","type":"post","link":"https:\/\/www.hestben.se\/HestbenTechnical\/?p=6","title":{"rendered":"A noobs guide to installing Gentoo on a core i5 2500K part1"},"content":{"rendered":"<p>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.<\/p>\n<p>Hardware:All of my hardware is from 2011 or older.<\/p>\n<p>CPU:Intel Core i5 2500K<br \/>\nMotherboard:Asus P8H61-M EVO<\/p>\n<p>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.<\/p>\n<p>I will be following this guide:<a href=\"https:\/\/wiki.gentoo.org\/wiki\/Handbook:AMD64\/Full\/Installation\">https:\/\/wiki.gentoo.org\/wiki\/Handbook:AMD64\/Full\/Installation<\/a><\/p>\n<p>I have verified the installation medium on my Debian system, and burned a CD.<\/p>\n<p>Network configuration: I have a local dhcp server running, so the network was configured automatically.<\/p>\n<p>Partitioning the disks. I will try out using UEFI, since my motherboard seems to have that option.<\/p>\n<p>I have three hard drives in my current system<br \/>\n<code>\/dev\/sda - storage<br \/>\n\/dev\/sdb - Debian system<br \/>\n\/dev\/sdc - I will install to this disk<\/code><br \/>\nPartitions:<br \/>\n<code>\/dev\/sdc1 - Bios boot partition<br \/>\n\/dev\/sdc2 - boot 300MB<br \/>\n\/dev\/sdc3 - swap 12GB (2*RAM)<br \/>\n\/dev\/sdc4 - root 50GB<br \/>\n\/dev\/sdc5 - home 50GB (may use the home from my Debian system later \/dev\/sdb6)<\/code><br \/>\nI used <code>gparted<\/code> to create my partition table.<\/p>\n<p>Now create file systems.<\/p>\n<p>I will use <code>vfat<\/code> for boot, <code>ext4<\/code> for root and home partitions.<\/p>\n<p>Then just mount the partitions on the mount points:<br \/>\n<code>mount \/dev\/sdc4 \/mnt\/gentoo<br \/>\nmkdir \/mnt\/gentoo\/boot<br \/>\nmount \/dev\/sdc2 \/mnt\/gentoo\/boot<br \/>\nmkdir \/mnt\/gentoo\/home<br \/>\nmount \/dev\/sdc5 \/mnt\/gentoo\/home<\/code><br \/>\nNow, it is time to download the stage3-file. I downloaded the <code>stage3-amd64-20161020.tar.bz2<\/code> 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.<\/p>\n<p>I extracted the stage file.<\/p>\n<p>Next stop, compile options. This is a bit exciting, since it will be the first kernel I compile.<\/p>\n<p>I&#8217;m using the options stated in the handbook, and use <code>MAKEOPTS=\"-j5\"<\/code>, since I have 4 CPU-cores.<\/p>\n<p>Configure repos as the hand book does.<\/p>\n<p>Mount necessary file systems for chroot and chroot to the new system.<\/p>\n<p>Install the portage snapshot and read the news items.<\/p>\n<p>I set my profile to <code>\/default\/linux\/amd64\/13.0\/desktop<\/code>.<\/p>\n<p>Then I updated the world set. This took a long time, since I had 172 packages to emerge.<\/p>\n<p>I configured time zone and locale.<\/p>\n<p>Then I downloaded the kernel sources using the command in the hand book.<\/p>\n<p>Now it is time to manually configure the kernel.<\/p>\n<p>In menuconfig, I enabled <code>EFI stub support<\/code> under <code>Processor type and features -----&gt;<\/code> and <code>USB Serial Converter Support -----&gt;<\/code> in <code>Device Drivers ----&gt; \/ USB Support ----&gt;<\/code> since I got a USB serial converter I would like to use (maybe this is unimportant).<\/p>\n<blockquote><p><strong>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.<\/strong><\/p><\/blockquote>\n<p>I compiled and installed the kernel.<\/p>\n<p>Now configure the mount points in fstab. I am using the following:<br \/>\n<code>&lt;fs&gt; &lt;mountpoint&gt; &lt;type&gt; &lt;opts&gt; &lt;dump\/pass&gt;<br \/>\n\/dev\/sdc2 \/boot vfat noauto,noatime 1 2<br \/>\n\/dev\/sdc4 \/ ext4 noatime 0 1<br \/>\n\/dev\/sdc5 \/home ext4 noatime 0 1<br \/>\n\/dev\/sdc3 none swap sw 0 0<\/code><br \/>\nOptions and dump\/pass were taken from default values in the file from the stage3 file.<\/p>\n<p>Then I configured host name and dns network.<\/p>\n<p>Then, I configured the local wired ethernet to use dhcp in <code>\/etc\/conf.d\/net<\/code>:<\/p>\n<p><code>config_enp4s0=\"dhcp\"<\/code><\/p>\n<p>I created a symlink to this device and added it to the default runlevel.<\/p>\n<p>I created a password for root.<\/p>\n<p>Then, I edited <code>\/etc\/conf.d\/keymaps<\/code> to use the <code>\"dvorak-sv-a1\"<\/code> keymap.<\/p>\n<p>I installed <code>sysklogd<\/code> as system logger. Then I installed cron.<\/p>\n<p>I installed <code>e2fsprogs<\/code> and <code>dosfstools<\/code>.<\/p>\n<p>Then I installed dhclient.<\/p>\n<p>I updated the <code>make.conf<\/code> to have EFI support, and then installed grub2 boot loader.<\/p>\n<p>Next, I installed grub using the EFI instructions and generated a configuration.<br \/>\nNow it is time to reboot and see if it works.<br \/>\nWhen umounting the \/mnt\/gentoo\/sys file system, it complained that it couldn&#8217;t. Strange.<br \/>\nBooting doesn&#8217;t seem to work =(.<br \/>\nMaybe my motherboard doesn&#8217;t support UEFI after all, but it says so in the specifications. Trying to &#8220;Launch EFI Shell from filesystem device&#8221; when having sdc as boot device reports &#8220;Not found&#8221;. 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.<br \/>\nSo investigate further tomorrow.<br \/>\nSo, 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 &#8220;Important&#8221; note in the handbook &#8211; &#8220;Make sure \/boot is mounted before running the grub-install command&#8221;. I checked, and my \/boot wasn&#8217;t mounted in my chrooted system, even though I did mount it before chrooting. Strange.<br \/>\nRunning the grub install command for efi:<br \/>\n<code>grub-install --target=x86_64-efi --efi-directory=\/boot<\/code><br \/>\nI got the error message:<br \/>\n<code>Installing for x86_64-efi platform.<br \/>\nefibootmgr: EFI variables are not supported on this system.<br \/>\nefibootmgr: EFI variables are not supported on this system.<br \/>\nInstallation finished. No error reported. <\/code><br \/>\nSearching for this term lead to this <a href=\"http:\/\/www.gossamer-threads.com\/lists\/gentoo\/user\/304687\">thread<\/a>. 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.<br \/>\nWhen 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 &#8211; Strange.<br \/>\nBooting didn&#8217;t work. So, now I will copy the grubx64.efi file to the location specified in the forum answer. That didn&#8217;t work either.<br \/>\nI think I will fall back to normal mbr next time I try it.<br \/>\nI have created a systemrescuecd(<a href=\"http:\/\/sysresccd.org\/Download\">download<\/a>, and booted it in EFI-mode.<br \/>\nI tried the instructions in <a href=\"https:\/\/wiki.gentoo.org\/wiki\/Efibootmgr#Configuration\">this link<\/a>, but the efivars file system type wasn&#8217;t found.<br \/>\nI exited the chroot, looked at the kernel modules, then chrooted back again, and this time, the command<br \/>\n<code>grub-install --target=x86_64-efi --efi-directory=\/boot<\/code><br \/>\nworked. Strange. Now reboot and try it. It didn&#8217;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 &#8220;Gentoo&#8221; in the menu).<br \/>\nNext is to install desktop environment etc. I will create a new post for that part.<br \/>\nBut, no network card seems to be detected. Maybe I need to enable some modules in the kernel configuration.<br \/>\nSo, reconfigure the kernel then.<br \/>\nI 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<br \/>\n<code>Device Drivers -&gt; Network device support -&gt; Ethernet driver support<\/code> &#8220;Realtek devices&#8221; in the kernel (*) and &#8220;Realtek 8169 gigabit ethernet support&#8221; in the kernel (*).<br \/>\nI have also a wireless interface which is a Atheros Wireless 802.11n. So I enabled <code>Device Drivers -&gt; Network device support -&gt; Wireless LAN -&gt; Atheros Wireless Cards<\/code> and enabled the <code>Atheros 802.11n wireless card support<\/code> with all the sub options.<br \/>\nThat did the trick for the wired ethernet at least. Will try the wireless when I have a desktop to start.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 &hellip; <a href=\"https:\/\/www.hestben.se\/HestbenTechnical\/?p=6\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;A noobs guide to installing Gentoo on a core i5 2500K part1&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/www.hestben.se\/HestbenTechnical\/index.php?rest_route=\/wp\/v2\/posts\/6"}],"collection":[{"href":"https:\/\/www.hestben.se\/HestbenTechnical\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hestben.se\/HestbenTechnical\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hestben.se\/HestbenTechnical\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hestben.se\/HestbenTechnical\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6"}],"version-history":[{"count":15,"href":"https:\/\/www.hestben.se\/HestbenTechnical\/index.php?rest_route=\/wp\/v2\/posts\/6\/revisions"}],"predecessor-version":[{"id":21,"href":"https:\/\/www.hestben.se\/HestbenTechnical\/index.php?rest_route=\/wp\/v2\/posts\/6\/revisions\/21"}],"wp:attachment":[{"href":"https:\/\/www.hestben.se\/HestbenTechnical\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hestben.se\/HestbenTechnical\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hestben.se\/HestbenTechnical\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}