Sunday, February 28, 2016

A New Linux Distro for 2016 (Compiling...)

I'm getting back into more technical projects than the many research topics I have been working on of late and I am going to turn this blog into a publishing ground for these projects. A streamlined version of what is here will probably end up on my Github for those who are interested.

The first project is to do another Linux setup with one of the more complicated distros: Gentoo. I had machines running earlier versions of Ubuntu (over 5 years ago) and CrunchBang (2 years ago). In what follows, I will discuss some of the challenges I ran into during the initial installation. Subsequent posts will discuss other details.

System Specs:
Acer V3-571-6447 (refurbished)
Intel Core i3-2328M
Intel HD Graphics 3000
Atheros 9k Wifi Card

I mainly followed the handbook for amd64. If you are using something else, the approach might be different.

Using Gentoo amd64 minimal installation CD (date stamped 2016-02-18).
I burned it to a DVD ROM rather than a CD. No problem.

Challenge 1: UEFI
The system was set up with native Windows 8 support so you can't boot to the UEFI menu from startup. I found out how to get there from this site.
Following these instructions, I then turned off UEFI, rebooted, hit F2 for bios, and then swapped the boot order so the disc drive was highest priority.
Easy enough.

Challenge 2: Wifi Setup
Setup for Atheros 9k Card driver went well (modprobe ath9k).
My network was running WPA encryption so I had to switch to WEP-ASCII in order to get the network working properly. I intend to switch it back once I have the system up.
ifconfig gave me the network names and net-setup <wifi name> provided the initial setup with dhcpcd <wifi name> providing the means to get the network off the ground (i.e., successful ping of

Challenge 3: Wifi Hell
After I booted into the new kernel, I found that I didn't have access to iwconfig, so I had to boot back into the livecd and emerge --ask net-wireless/wireless-tools. My suggestion is that you do this before this point.

After that was fixed, I couldn't seem to get the wifi up. But ,there seems to be an extremely strict order to the setup. First you modprobe ath9k then you take down the network with ifconfig <wifi name> down. The next step is to set the ESSID and key with iwconfig as follows:
iwconfig <wifi name> essid "<name of network>"
iwconfig <wifi name> key s:"<ASCII-password>"
After that, ifconfig <wifi name> up has to be called before dhcpcd <wifi name> is called. That got the wifi up and running for me when no other combination or order could.

Challenge 4: Adding wpa_supplicant
This was surprisingly easy. Just follow the instructions here. Honestly, I would suggest emerging this to the new kernel from the livecd rather than dealing with iwconfig.

Note: you have to /etc/init.d/dhcpcd restart before trying to run anything. A fresh reboot always works, too.

(as one line)
wpa_supplicant -B -i<wifi name> 
is also a good command to get things rolling.

Challenge 5: Xorg
Turns out you can modify the kernel directly from within the kernel easily enough as shown here. I followed instructions for Xorg's kernel setup from here. I also built-in synaptic's touchpad source files as follows:

Device Drivers --->
  I2C support --->
    -*- I2C support
  Input device support --->
    Mice --->
      <*> Synaptics I2C Touchpad support
      <*> Synaptics USB device support

Challenge 6: systemd Nightmare
I got it up and running but I am not even confident what I did. I used these three websites (1, 2, 3).

Steps that I am confident happened:

Update USE:
nano -w /etc/portage/make.conf
add systemd dbus -consolekit to USE=

Using genkernel-next:
emerge -aC sys-kernel/genkernel
emerge -a sys-kernel/genkernel-next

To begin source set and installation (I did not use lvm or udev for initramfs though both sources were available in the kernel):
genkernel --menuconfig --install all

This source parameter was set:
Gentoo Linux --->
  Support for init systems, system and service managers --->
    [*] systemd

Symlink for mtab:
ln -sf /proc/self/mounts /etc/mtab

Install systemd (I tried setting the USE before installing and it failed):
emerge -av systemd

Updated the system:
emerge -avuND @world

Update grub (real_init worked in the final attempt... did not care to try if init would work):

And rebooted.

Challenge 7: NetworkManager
Had to recompile the source for a couple options listed here. In emerge'd dhclient first then set dhclient and networkmanager into the USE of make.conf. Then I emerge'd networkmanager.
emerge -a net-misc/dhcp
emerge -a net-misc/networkmanager

I then shut off dhcpcd with:
/etc/init.d/dhcpcd stop

Then booted up NetworkManager through systemd:
systemctl start NetworkManager

This initialized the network but it needed to be connected. I looked up dhclient and found the command line call here.
nmcli dev wifi connect <ssid> password <password>

This got me up and running. But, as a final cleanup I removed dhcpcd and enabled NetworkManager on boot.
emerge -cav dhcpcd
systemctl enable NetworkManager

Challenge 8: Gnome
I just followed the instructions for gnome-base/gnome-light, which can be found here.