Roughly 48 hours and 3 DVD’s later, I finally got Archlinux+Win8 working on my brand new Lenovo Y410p laptop.
This install is probably the 2nd highest in terms of time-spent for me. The linux code base has grown tremendously since when I first started, and it’s no longer the device drivers that give me headaches, but the architecture.
My Y410p comes with a 24GB SSD and a 1TB HDD. Further, it has an Intel Integrated Graphics Card along with Nvidia Geforce GT750M…with SLI enabled. Pretty damn good specs on paper, but this hybrid-ness, combined with the new UEFI (replacing Bios), made dual-booting damned difficult.
The laptop come preloaded with the drivers loaded in the SSD, and 4 partitions in the HDD. I backed up all the drivers and wiped everything clean with a GParted LiveCD.
1. Linux Mint
I liked Ubuntu pre-Unity/Apple-wannabe, but unfortunately the repository and packages pre-unity are phasing out. So I decided to go with Linux Mint+Cinnamon. I downloaded the LiveCD, the steps were:
- At the “Lenovo” logo screen, press “F2” to get into UEFI Boot Menu
- Disable “Secure Boot” in Configuration. (This option is UEFI’s effort to stop malicious softwares from operating before the OS is even booted — but installing non-Win8 systems require a UEFI signature, a major pain).
- Change the boot option (4th tab) from “UEFI” to “Legacy Support”, and move the DVD option up.
- “F10” to save and exit. Upon reboot, the LinuxMint liveCD will start.
- But I never even got to the setup…a black screen greets me after the LM logo. Turns out it’s due to a graphics card drive incompatibility with Nvidia (my nemisis since 2007).
This thwarts my attempt. I have to use a text-based liveCD installer. Going back to
2. Arch Linux
Arch Linux is very labor intensive because one has to build up the system from scratch, but is also super dependable, due to how little its initial installation requires. The LiveCD I used was Archlinux-2013-9-1, 64 bit. From the LiveCD Menu, select the “install option”
I followed the ArchLinux Beginner’s Guide until the partioning. Then I used the following:
1) 24GB SDD is /dev/sda. Use gdisk to format the partitions. I used the option “o” for GUID partition table, which is what UEFI requires.
#1GB, EFI partition. gdisk partition code="ef00" /dev/sda1 #100MB, /ext2 boot partition, gdisk partition code="ef02" /dev/sda2 #20GB, /ext4 partition for /root, gdisk partition code="8300" /dev/sda3
The EFI partition is necessary for EFI-booting, this is where UEFI looks for bootloaders. The 100MB boot partition is also necessary for booting.
2) 1TB HDD is /dev/sdb.
#1GB: Swap. gdisk partition code="8200" /dev/sdb1 #700GB: /ext4 for /home directory. gdisk partition code="8300". /dev/sdb2 #229.5GB: /ntfs for windows, gdisk partition code="0700". /dev/sdb3
I have lots of swap space…because I have a lot of storage.
3) Format all the partitions:
mkfs.vfat F32 /dev/sda1 mkfs.ext2 /dev/sda2 mkfs.ext4 /dev/sda3 mkswap /dev/sdb1 mkfs.ext4 /dev/sdb2 # -f for fast, otherwise you need to wait hours mkfs.ntfs -f /dev/sdb3 # tell the system where swap is swapon /dev/sdb1
4) Mount partitions
# Mount root to /mnt mount /dev/sda3 /mnt #Mount home mkdir /mnt/home mount /dev/sdb2 /mnt/home
5) Install base system
pacstrap -i /mnt base
The first time I did this, I followed it with
to update my system. However, later on when I downloaded grub2 and efibootmgr, a version problem occurs and the system gets sad. So just do “pacman -Sy” instead to update the package database (not the packages themselves).
6) Mount the /boot partition
mkdir -P /mnt/boot mnt /dev/sda1 /mnt/boot
Generate fstab — that’s how your system knows what partitions to look at and how to mount them (simplistic explanation).
genfstab -U -p /mnt >>/mnt/etc/fstab # make sure everything looks alright nano /mnt/etc/fstab
7) Change to chroot to configure base system
Set locale by uncommenting “en_US.UTF-8” inside “/etc/locale.gen” Then
Create locale.config file:
echo LANG=en_US.UTF-8 > /etc/locale.conf export LANG=en_US.UTF-8
Set the timezone to US Eastern
ln -s /usr/share/zoneinfo/US/eastern /etc/localtime
Set hardware clock to UTC
hwclock --systohc --utc
echo myHostname > /etc/hostname
Set root password
8) This is something I completely skipped the first time through the beginner’s guide. I didn’t realize that in LiveCD, “/mnt” actually refers to the new system. And while I had internet access there, it also needed to be set up in “/mnt” so access is there when we finish install and reboot (not into the LiveCD). For this I followed the Beginners’ Guide.
9) Now it’s time to install the bootloader.
# Exit out of chroot exit # Reload the efivars module umount /sys/firmware/efi/efivars modprobe -r efivars modprobe efivars # install efibootmgr, so we can edit the EFI boot menu pacman -S efibootmgr # install grub2 pacman -S grub # Enter chroot again arch-chroot /mnt # Install the bootloader grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=arch_grub --recheck --debug # Make and update the grub menu grub-mkconfig -o /boot/grub/grub.cfg
That…took forever, because I didn’t read the entire guide and underestimated UEFI’s backward incompatibility.
10) Unmount the partition and reboot:
exit umount -R /mnt reboot
11) Upon reboot, sign in use username=’root’, passwd=what you set before. Then do the user management setup.
# I want to use the bash shell useradd -m -s /bin/bash allenyin # Enter the passwd passwd allenyin
12) Run DHCP at boot:
systemctl enable dhcpcd@enp8s0
This was later revoked, after I installed WICD to manage my connections.
13) Now we can upgrade all the packages
pacman -Syy pacman -S pkgfile
14) Sound setup
# Use alsamixer pacman -S alsa-utils alsa-plugins # Unmute amixer set Master unmute
I had to press “F6” after launching alsamixer, and select “Intel HDA PCH” instead of the default “Intel HDA MID”. Otherwise, there would be no sound. Then speaker test:
speaker-test -c 2[/bash] 15) Now it's time to setup X, the GUI # basic setup pacman -S xorg-server xorg-server-utils xorg-xinit # Intel driver pacman -S xf86-video-intel
I later on spent >5 hours trying to get my Nvidia card to work as well by using the Nvidia drivers (see this guide). But no matter what driver I used, proprietary or open source, running "Nvidia-settings" always gives me the same "error: no screen found". This is not related SLI or Optimus, but just driver incompatiblity. So NVidia wins again, and I'm using only the Intel graphics card on Arch...until the driver updates.
pacman -S xf86-input-synaptics
17) Install xterm so we can boot up and check X11 out
pacman -S xorg-twm xorg-xclock xterm # boot up GUI startx
18) Install Yaourt, a package manager for Arch's User Driven packages. Basically all the packages that's not "official". It has the same syntax as Pacman, the official package manager. The wiki page directs you to another page, with directioins for installing yaourt embedded:
# Need to update pacman to get the right packages pacman -U # Some tools needed pacman -S wget gcc make # Also need new kernel headers pacman -S kernel26-headers # Get yaourt and friends pacman -S --needed base-devel curl -O https://aur.archlinux.org/packages/pa/package-query/package-query.tar.gz tar zxvf package-query.tar.gz cd package-query makepkg -si cd .. curl -O https://aur.archlinux.org/packages/ya/yaourt/yaourt.tar.gz tar zxvf yaourt.tar.gz cd yaourt makepkg -si cd ..
19) Window Manager and Desktop Environment.
I don't want Gnome, because it's bloated. But I like its design, so I tried Cinnamon, Mate, and LXDE. All of them were either too ugly, or had some issue I decided were too laborious to fix. Eventually I settled on XFCE4.
I use this instead of Network-Manager...which is very unreliable, to manage connections. Also download 'wicd-client' and put 'wicd-client --tray' in startup applications for a system tray indicator.
Another nasty problem was suspend. I first used XFCE's default power-manager to configure the behaviors when I press the power-button, close the lid, press the sleep button, etc. Everything's fine until when the system resumes from suspension (save in ram as supposed to hybernate=saving in HD and cut all power), the internet connection does not work and everything slows down and eventually requires reboot.
"dmesg" shows endless lines of
alx 0000:04:00.0: invalid PHY speed/duplex: 0xffff
This confirms with slow network, since "alx" controls the ethernet controller. I read a bug report somewhere that a particular kernel commit caused this problem. A solution to this problem is to remove the "alx" module from kernel before suspension, and then put it back in on resume.
I found this is best done through the systemd. The relationship between the power management programs is a bit convoluted (there are tools like systemd, pm-utils, acpid, laptop-tools, etc). But by default, it is controlled by the systemd, which allows user customization of power-related events through hooks, through edditing the /etc/systemd/logind.conf file.
Having all the options in the file commented out, or having value of "ignore" gave control to XFCE's power-manager. However, since XFCE's power-manager is uncapable of executing event-hooks, I made the response to all power-related events to "nothing" in the power manager.
So my "/etc/systemd/logind.conf" file looks like this
[Login] #NAutoVTs=6 #ReserveVT=6 #KillUserProcesses=no #KillOnlyUsers= #KillExcludeUsers=root #InhibitDelayMaxSec=5 HandlePowerKey=suspend HandleSuspendKey=suspend #HandleHibernateKey=hibernate HandleLidSwitch=suspend #PowerKeyIgnoreInhibited=no #SuspendKeyIgnoreInhibited=no #HibernateKeyIgnoreInhibited=no #LidSwitchIgnoreInhibited=yes #IdleAction=suspend #IdleActionSec=30min
Now make "/etc/system/systemd/root-suspend.service" to take out alx before suspending
[Unit] Description=Local system suspend actions Before=sleep.target [Service] Type=simple ExecStart=modprobe -r alx [Install] WantedBy=sleep.target
And "/etc/system/systemd/root-resume.service" to put it back:
[Unit] Description=Local system resume actions After=suspend.target [Service] Type=simple ExecStart=modprobe alx [Install] WantedBy=suspend.target
Now I get the correct suspend response.
Now it's time to install windows. I spent hours trying to install windows 7, attempts include:
- Windows 7 Professional: Press "F2" during booting. Choose UEFI for boot options(since now arch can boot in UEFI). Goes through "Loading Windows" screens, but stuck on "Starting Windows" screen, with no CD activity. I've tried this using both options available for "SATA" in the UEFI Bios menu. None works.
- Windows 7 Professiona: Press "F2" during booting. Choose "Legacy Support" for boot options. We get to the part where the installation asks which partition you want it windows to be. However, none works because "windows cannot be installed onto a gpt partition". This is because booting through "Legacy Support" booting and EFI conflict.
- Windows 7 SPI 64-bits. I downloaded and burned the DVD, because some people have reported success installing this on GPT partitions. Same problem when booting through UEFI.
- Windows 7 SPI 64-bits. Booting through "Legacy Support", actually goes through the process of installing a bootloader, reboots, and then during selection of partition, gives the same error about "windows cannot be installed onto gpt partition".
- Finally, Windows 8 worked...which is expected, since the original system was Win8+UEFI+GPT...
I then installed all the backed-up drivers (a lot easier than installation during arch, TBH). Now the laptop automatically boots into Windows every time, because windows bootloader has over-written the EFI boot menu and made itself the top choice. We need to get the Grub2 back:
1) Press "F2" on booting. Go to boot menu, and switch "Arch grub" back onto the top choice.
2) Boot into arch, and do the following:
3) Find the UUIDs of the partitions available
my outputs are:
NAME FSTYPE LABEL UUID MOUNTPOINT sda ├─sda1 vfat DD04-C04C /boot ├─sda2 ext2 70ac0488-ddaf-4029-9045-e3b8b8d3950c └─sda3 ext4 eba0fae9-5f60-484c-baba-73b1b9cb82d1 / sdb ├─sdb1 swap e19b73aa-fdf9-499a-8a3d-0bec6bea3793 [SWAP] ├─sdb2 ├─sdb3 ext4 cd05db80-cf38-4299-9a14-800db9e72804 /home └─sdb4 ntfs 054ED50B0465BF4F /mnt/windows sr0
Note that Win8 is installed on /dev/sdb4, but has also created a small boot partition on /dev/sdb2 of about 128Mb (see outputs below)
allenyin@Swordforge:/etc/systemd/system$ sudo fdisk -l WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion. Disk /dev/sda: 24.0 GB, 24015495168 bytes, 46905264 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk label type: gpt # Start End Size Type Name 1 2048 2099199 1G EFI System EFI System 2 4196352 4401151 100M BIOS boot parti BIOS boot partition 3 4401152 46344191 20G Linux filesyste Linux filesystem WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion. Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes, 1953525168 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disk label type: gpt # Start End Size Type Name 1 2048 2099199 1G Linux swap Linux swap 2 2099200 2361343 128M Microsoft reser Microsoft reserved partition 3 4196352 1472202751 700G Linux filesyste Linux filesystem 4 1472202752 1953525134 229.5G Microsoft basic Microsoft basic data
4) Write down the UUID for the EFI partition. We need to tell grub2 to create a new entry for booting windows. To do this, grub2 needs to know where the Win8 bootloader is -- the EFI partition. Use the UUID and follow this guide.
5) On rebooting, there should be choices to boot into Windows in the grub2 menu.
6) Accessing Windows partition from Arch.
I dual-booted because some programs run better on Windows. But I use linux most of the time for computation and typesetting (vim-latex, linux pipes, and programming), it would be nice to be able to access the Windows files while on Arch. So I followed this guide on ntfs-3g to enable auto-mounting of the windows partition in arch.