Archlinux Installation Note (dual boot with Windows)

14 January 2015

Finally switch back to Arch linux again after trying so many linux systems. The main reason is Arch linux is rolling release, I never need to reinstall the system again!

A brief note of all steps in installing the Arch linux system would be helpful for future use.

  1. Make a bootable USB stick of the Arch linux (See here). Without doubt using dd is the easiest method, however you should be very careful when using this command:

    dd bs=4M if=/path/to/archlinux.iso of=/dev/sdx && sync
    

    most of the time /dev/sdx should be /dev/sdb, the usb disk.

  2. Use cfdisk command to partition the hard disk and flag the partition where the /boot to be installed as bootable and hit Write. For my case I will install /, /boot and /home to the same partition(sda4), so only one partition is needed.

  3. Create file sytems. Usually use ext4 format.

    mkfs.ext4 /dev/sda4
    
  4. mount /dev/sda4 /mnt.

  5. Connect to wifi. First use ip link command to find the code for the wireless network interface(start with w) and then use wifi-menu command to connect to wifi.

    ip link
    

    1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    2: enp8s0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether 08:9e:01:1d:6e:9c brd ff:ff:ff:ff:ff:ff
    3: wlp7s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DORMANT group default qlen 1000
    link/ether dc:85:de:88:24:09 brd ff:ff:ff:ff:ff:ff

    wifi-menu wlp7s0
    
  6. Select nearest mirror (can ignore this step):

    nano /etc/pacman.d/mirrorlist
    
  7. Install Arch system files

    pacstrap /mnt base base-devel
    
  8. Run the following command

    genfstab -U -p /mnt >> /mnt/etc/fstab
    
  9. Switch root from usb to hard disk. After running the command, the prompt changes to something like sh-4.3#.

    arch-chroot /mnt
    
  10. Set hostname and add the same host name to /etc/hosts, here using ‘dh’ as hostname

    echo dh > /etc/hostname
    nano /etc/hosts
    

    # 127.0.0.1 localhost.localdomain localhost dh ::1 localhost.localdomain localhost dh

  11. Set timezone. zone and subzone are set according to your location(use tab to see all options).

    ln -sf /usr/share/zoneinfo/zone/subzone /etc/localtime
    
  12. Uncomment the needed locales in /etc/locale.gen and run locale-gen. For example en_US.UTF-8.

  13. Set locale preference in /etc/locale.conf.

    echo LANG=en_US.UTF-8 > /etc/locale.conf
    
  14. Install wifi driver, otherwise can’t connect to the internet after restarting! (Later on, after restarting use the same strategy in step 3 to connect to the internet. DO NOT REBOOT NOW if you want dual boot)

    pacman -S iw wpa_supplicant dialog
    
  15. Dual boot setting (dual boot with Windows)

    pacman -S grub
    grub-install /dev/sda
    pacman -S os-prober
    os-prober
    grub-mkconfig -o /boot/grub/grub.cfg
    exit
    umount /mnt
    
  16. REBOOT

After reboot, login as root:

  1. Connect to wifi using the same method as introduced in step 4. The following command makes computer automatically connect to this wifi later(change wlp7s0 accordingly):

    wifi-menu wlp7s0
    pacman -S wpa_actiond
    systemctl enable dhcpd@wlp7s0.service
    
  2. Add user to the wheel group (only change weicheng accordingly):

    useradd -m -G wheel -S /bin/bash weicheng
    passwd weicheng
    

    and then uncomment the line

    %wheel ALL=(ALL) ALL
    

    in the /etc/sudoers file so that the user can use sudo command.


UI installation I (nouveau, kde, xintrc)

  1. Graphics card installation. I used nouveau graphics driver, kde desktop and no display manager (use xinitrc instead) the first time I installed Archlinux:

    # Install graphics driver & dependency mesa-libgl
    pacman -S mesa-libgl xf86-video-nouveau
    pacman -S xorg-server 
    pacman -S xorg-xinit xorg-twm xorg-xclock xterm
    
  2. KDE installation.

    pacman -S kde
    # Language support for Chinese
    pacman -S kde-l10n-zh_cn
    

    I used xinitrc method to start kde: uncomment the line exec startkde in the .xinitrc file and then run startx or xinit to start KDE. (See here).

    To start X at login: Add the following line to the bottom of the ~/.bash_profile(See here)

    [[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && exec startx
    

UI installation II (bumblebee(nvidia/ intel), xfce4, LXDM)

I used bumblebee(to make NVIDIA Optimus enabled laptops work), xfce4 desktop and LXDM display manager the second time I installed Archlinux. I have to say I’m really satisfied with this setup - powerful, flexible and stable (thus far).

Bumblebee installation

Bumblebee is an effort to make NVIDIA Optimus enabled laptops work in GNU/Linux systems.

So make sure your computer is NVIDIA Optimus enabled. See Q1 at the end of this post.

Before installing Bumblebee, check your BIOS and activate Optimus.(See here)

Note: Don’t try to install bumblebee, mesa, nvidia and so on seprately, because it did not work when I did so!

When executing the second line command, there is some message saying that bumblebee and nvidia-libgl are in conflict. Remove nvidia-libgl? [y/N], select y. (Use pacman -Si bublebee command you’ll see that bumblebee actually provides nvidia-libgl.)

pacman -S nvidia-libgl xorg-server xorg-server-utils xorg-xinit xorg-twm xorg-xclock xterm
pacman -S bumblebee mesa xf86-video-intel nvidia

Then add user to the bumblebee group(change weich accordingly), enable bumblebeed.service and reboot:

gpasswd -a weich bumblebee
systemctl enable bumblebeed.service
reboot

Test bumblebee works or not (See here)

After running startx, there will be some x windows(terminal) and clock pop out, then run optirun glxspheres64. (optirun uses NVIDIA card to run application.)

startx
optirun glxspheres64

If bumblebee works, you’ll see this image: link

Note: You need to install mesa-demos first if you wnat to run glxinfo or glxgears commands.

Xfce4 & LXDM installation

pacman -S xfce4 xfce4-goodies lxdm

Set xfce4 as the default window manager of the system by editing /etc/lxdm/lxdm.conf and change the session line to session=/usr/bin/startxfce4. (Maybe it is already set correctly, no action needed.)

To login to one account automatically on setup, find the line in /etc/lxdm/lxdm.conf that looks like #autologin=dgod and change dgod to the desired user name.

Enable lxdm by running

systemctl enable lxdm

All Done! Cheers!


Q1. How to find out what graphics card I’m using?

Answer: Use the following command to check what graphics card you have in the computer. To my understanding, if you have both intel and NVIDIA graphics card, your computer is using the NVIDIA Optimus (I’m not sure whether it is right, but I think most of the time it should be right.)

bash # lspci | grep VGA 00:02.0 VGA compatible controller: Intel Corporation 3rd Gen Core processor Graphics Controller (rev 09) 01:00.0 VGA compatible controller: NVIDIA Corporation GK107M [GeForce GT 650M] (rev a1)

blog comments powered by Disqus