Arch Linux / Linux · January 19, 2017 0

Arch Linux easy install UEFI dual boot with windows 10

Arch linux is the most anticipated linux distribution. It is lightweight, flexible and powered by a strong community. Its rolling release style keeps your PC ever updated.

We are going to install Arch Linux dual booting with windows.

Note: It is strongly recommended that you install windows prior to installing arch linux. Before installing windows create a boot partition of size 512MB.

So lets start.

Creating arch linux bootable usb

Get arch installation iso file from download here

After downloading arch.iso its time to create bootable usb drive using iso file.

If you are using linux then use dd

dd if=image.iso of=/dev/sdb bs=4M

If you are on windows, you can install Rufus utility to make your arch linux bootable usb.

If you want to install arch linux in uefi mode then in rufus select “GPT Partition Scheme for UEFI”. It is recommended that your windows installation should be also in UEFI mode if you are installing linux in UEFI Mode.

If you are not sure then just select MBR style partition. Windows 7+ supports GPT style partitions.

The best way to detect the boot mode of Windows is to do the following (info from here):
Boot into Windows
Press Win key and ‘R’ to start the Run dialog
In the Run dialog type “msinfo32” and press Enter
In the System Information windows, select System Summary on the left and check the value of BIOS mode item on the right
If the value is UEFI, Windows boots in UEFI-GPT mode. If the value is Legacy, Windows boots in BIOS-MBR mode.

In case where Windows and Linux dual boot from the same disk, it is advisable to follow the method used by Windows, ie. either go for UEFI-GPT boot or BIOS-MBR boot.

For more info please visit Arch Linux Dual boot with Windows.

I have windows 10 installed as UEFI-GPT so I am going to boot in UEFI mode and all my partitions will be in GPT style.

Partitioning

I have windows 10 installed in partition 2 already. Partition 1 of 512MB was created by windows to keep its boot loader.
So I am going to create 3 new partitions for linux.

First thing is to identify your existing disk partitions

# lsblk

Use cgdisk or cfdisk to create new partitions.  Here is a great article explaining how to create different partitions.

If you are setting up fresh disk i.e no data in it then it is recommended to create a boot partition of 512MB. This boot partition is also needed for UEFI based install.

All setup, lets start installing

I have created 3 linux partitions, using cfdisk and selecting GPT

Partitions

Disk Partitions

/dev/sda1 for efi boot
/dev/sda2 for windows
/dev/sda3 for linux root
/dev/sda4 for swap
/dev/sda5 for home

Formatting linux partitions

Partitions are created and now I am going to format them so linux can use them for root and home. Don’t format swap.

# mkfs.ext4 /dev/sda3
# mkfs.ext4 /dev/sda5

virtualbox_arch-linux_19_01_2017_18_49_08

virtualbox_arch-linux_19_01_2017_18_49_26

Creating Swap

# mkswap /dev/sda4
# swapon /dev/sda4

virtualbox_arch-linux_20_01_2017_16_12_29

Mounting Partitions

All partitions formatted and swap set, now mount them.

# mount /dev/sda3 /mnt

# mkdir /mnt/home
# mount /dev/sda5 /mnt/home

# mkdir /mnt/boot
# mount /dev/sda1 /mnt/boot

virtualbox_arch-linux_20_01_2017_16_35_22

Start install

Partitions setup and mounted, lets start installing arch linux.

Test internet connection

Make sure you are connected to internet.

# ping -c 3 www.google.com

If you have wifi, you can use “wifi-menu” to select the connection.

# wifi-menu

virtualbox_arch-linux_20_01_2017_16_56_50

verify-network

Install Arch

 

# pacstrap -i /mnt base

If you want to build packages then you would need “base-devel” as well.

# pacstrap -i /mnt base base-devel

 setting-up-pacstrap

pacstrap

Hit Enter and it will show the screen below

pacstrap-1

Hit enter and it will start downloading and installing.

Generate mount configuration file

linux needs to store partitions and mount information for future use to auto mount drives

lets generate that configuration file

# genfstab -U -p /mnt >> /mnt/etc/fstab

to make sure file has been create correctly please use following

# nano /mnt/etc/fstab

virtualbox_arch-linux_20_01_2017_17_34_58

Switching from usb to arch root on your system

# arch-chroot /mnt /bin/bash

chroot

BOOT Loader Configuration

I am going to use systemd-boot (previously known as gummiboot) to use as boot loader.

Make sure “/boot” is mounted on your efi boot partition i.e /dev/sda1.

# pacman -S efibootmgr
# bootctl --path=/boot install

screenshot-from-2017-01-20-17-54-48

After installing boot loader, configure boot loader defaults

# nano /boot/loader/loader.conf

Change file as below

default arch
timeout 3
editor 0

virtualbox_arch-linux_20_01_2017_17_39_18

Copy default arch entry to boot loader entries

# cp /usr/share/systemd/bootctl/arch.conf /boot/loader/entries/

Add root PARTUUID to arch boot entry
To get PARTUUID of your root partition use blkid

# blkid /dev/sda3

Command above will output something similar to

/dev/sda3: UUID="4c746b66-9a47-4938-9710-3f5b65238d89" TYPE="ext4"
PARTLABEL="root" PARTUUID="b9a3b9c1-0f4b-4be1-9ea9-4ed503b6c49a"

in that case we need

PARTUUID="b9a3b9c1-0f4b-4be1-9ea9-4ed503b6c49a"

Add this to arch entry

# nano /boot/loader/entries/arch.conf

Change

options root=PARTUUID=xxxx...

to following, and replace xxxx with your PARTUUID

options root=PARTUUID=b9a3b9c1-0f4b-4be1-9ea9-4ed503b6c49a rootfstype=ext4 add_efi_memmap rw

Make Sure you have following two files located in your /boot directory
vmlinuz-linux
initramfs-linux.img

Configure your net work

We need to configure network so it would be connected automatically after reboot.

If you prefer wifi:

# pacman -S iw wpa_supplicant dialog wpa_actiond
# wifi-menu
# systemctl enable netctl-auto@interface_name.service

If you prefer lan then do following

# systemctl enable dhcpcd@interface_name.service
example for ethernet:
# systemctl enable dhcpcd@enp38s0.service
example for wifi:
# systemctl enable dhcpcd@wlo1.service

To find your interface name you can use either

# ip link
or
# ls /sys/class/net

network-setup

You will see your device name as some thing like “enp38s0” for ethernet and “wlo1” for wifi.

Bravo!!! our new arch installation completed 🙂

 

Restart the system and then continue post configuration i.e adding hostname, adding user and installing gnome.

# reboot

Post Configuration

Set the root password with:

# passwd

root-password

Now it’s time to create a user for the system and also add some groups to it.

So run the following command and replace ‘tofeeq‘ with your user-name.

# useradd -m -g users -G wheel,storage,power -s /bin/bash tofeeq

add a password to tofeeq

# passwd tofeeq

user-create

Once that is done, we will now allow the users in wheel group to be able to performance administrative tasks with sudo. Run the following command to edit the sudoers:

# EDITOR=nano visudo

editor

It will open the sudoers file where you have to uncomment this line:

%wheel ALL=(ALL) ALL

wheel

I will also recommend installing bash-completion so that Arch auto-complete commands of names of packages:

# pacman -S bash-completion

Installing display managers

install xserver

# pacman -S xorg-server xorg-server-utils xorg-xinit

Now we will also install mesa for 3D support:

# pacman -S mesa

It’s time to install video drivers. I am using intel graphic card so would be using

# sudo pacman -S xf86-video-intel intel-dri

If you are not using intel then you might explore

https://wiki.archlinux.org/index.php/General_recommendations

If you are using a laptop you need to install the drivers for input devices like touch-pad

# pacman -S xf86-input-synaptics
# pacman -S xorg-twm xorg-xclock xterm

 

install network managers

# pacman -S NetworkManager
# systemctl enable NetworkManager.service
# systemctl start NetworkManager.service

 

Audio management

# pacman -S alsa-utils pulseaudio pavucontrol

 

Install Desktop Environment

# sudo pacman -S gnome gnome-extra

gnome-install

System Configuration

Select a mirror list

It is recommended that you select nearest mirror to get fast downloads

# nano /etc/pacman.d/mirrorlist

edit-mirror

find your country or nearest one in file by pressing ctrl+w and type your country name and hit enter

copy whole line using alt+6 and now go to start by using pageup button or home button on keyboard

paste that line on the top of file using ctrl+u
now save the file using ctrl+x and enter y to save

mirrorset

Set your locale

edit locales file

# nano /etc/locale.gen

and uncomment your locale

I uncomment en_US.UTF-8 UTF-8 for english

Generate the locale(s) specified in /etc/locale.gen:

# locale-gen

Create the /etc/locale.conf file substituting your chosen locale:

# echo LANG=en_US.UTF-8 > /etc/locale.conf

Export substituting your chosen locale:

# export LANG=en_US.UTF-8

Time zone

Available time zones and subzones can be found in the /usr/share/zoneinfo/Zone/SubZone directories.

To view the available zones, check the directory /usr/share/zoneinfo/:

# ls /usr/share/zoneinfo/

Similarly, you can check the contents of directories belonging to a subzone:

# ls /usr/share/zoneinfo/Asia

Create a symbolic link /etc/localtime to your subzone file /usr/share/zoneinfo/Zone/SubZone using this command:

# ln -s /usr/share/zoneinfo/Zone/SubZone /etc/localtime

Example:

# ln -s /usr/share/zoneinfo/Asia/Karachi /etc/localtime

localesettings

Hardware clock

Set the hardware clock mode uniformly between your operating systems. Otherwise, they may overwrite the hardware clock and cause time shifts.

# hwclock --systohc --utc

Hostname

Set the hostname of your computer (e.g. arch):

# echo arch > /etc/hostname

hostname

Start Gnome

exit from root to normal user

# exit

edit xinit file

$ nano ~/.xinitrc

add-gnome-session

Add instructions to start gnome

exec gnome-session

hit ctrl+x to save
Start Gnome

$ startx

startx

Now you see gnome desktop appears

gnome-running

All done … Cheers 🙂