Dual Boot Fedora 20 Kali Linux UEFI

Dual Boot Fedora 20 Kali Linux UEFI

I have already got my Toshiba Ultra Book U840W-x0110 laptop running Fedora 20. This post is about getting the Kali Linux distro to dual boot with Fedora. I have created a Kali Live CD by downloading the ISO image from the official site.

The laptop hard disk size is 500GB. In my installation I had allocated 200GB for the Fedora installation. Hence the remaining approx. 300GB is free for Kali Linux.

The Toshiba Ultra Book U840W-x0110 laptop has UEFI boot enabled by default. The laptop could not directly boot Kali Linux live CD. This is because Kali Linux does not support UEFI boot. Hence to boot Kali Live CD we need to change the UEFI settings of the laptop. We need to make the laptop boot in the legacy BIOS interface (CSM Boot).

  1. Restart the laptop and hold the F12 key. In the Boot Menu navigate using the arrow keys to the <Enter Setup>. Under “Advanced” tab enter “System Configuration”. Here change the “Boot Mode” to “CSM Boot”. Press F10 to save and exit.
  2. Now the Kali Linux Live CD should boot with a loud annoying beep.  Trigger the installation by navigating to the “Install” option.
    IMG_2612
  3. Select the installation language, Location and the Keyboard in the subsequent windows.
  4. For the network interface I connected the internet via the Ethernet cable. Somehow the WiFi didn’t seem to work.
  5. Enter the host name of your choice.
  6. Enter a domain Name.
  7. Provide and verify the root password.
  8. Select the time zone.
  9. Select “Automatic Partition with the remaining free space” for installing Kali Linux in the remaining free space of the hard disk.
  10. Continue with the installation until the below window for GRUB boot loader appears. Do not install the GRUB loader. Press the escape key to do this.IMG_2613
  11. The below window should appear.
    IMG_2614
  12. Select “Continue without boot loader”. The below window should appear. Note down the partition. This is important for GRUB configuration. In my case it is sda4. Finish the installation.
    IMG_2615
  13. Now we need to boot into fedora again. For this we have to enable UEFI again. Follow step 1 but enable UEFI boot this time.
  14. Once in Fedora edit the 40_custom file. Run the below command in the terminal as root.
    gedit /etc/grub.d/40_custom
  15. Add a entry for the recently installed Kali Linux. The 40_custom file should look as below.  In my case I had installed Kali Linux on sda4. Hence the root is also set to (hd0,4).
    #!/bin/sh
    exec tail -n +3 $0
    # This file provides an easy way to add custom menu entries.  Simply type the
    # menu entries you want to add after this comment.  Be careful not to change
    # the 'exec tail' line above.
    menuentry "Kali Linux" {
        set root=(hd0,4)
        linuxefi /boot/vmlinuz-3.14-kali1-amd64 root=/dev/sda4 ro quiet splash
        initrdefi /boot/initrd.img-3.14-kali1-amd64
    }
    
  16. Now run the below command to update the GRUB menu. During the next boot the GRUB menu should show an entry for Kali Linux.
    grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg

Dual Boot Arch Linux and Windows 8

Dual Boot Arch Linux and Windows 8

I have a Toshiba Ultra Book U840W-x0110 that comes with WIndows 8 pre-installed.

Dual booting Linux with Windows has some risk associated. You might end up losing the Windows installation. Hence ensure that you have backed up all the data and have the recovery disk of Windows 8. If you don’t have the recovery disk then create one. (A good guide can be found here).

Prerequisite: A wired internet connection makes the Arch Linux installation easier.

This Ultra book does not have an optical drive. Hence I connected an external optical drive (ASUS DVD writer).

Setup

So here are the steps I followed to have a dual-boot configuration of Windows 8 and Arch Linux.

Steps to create Boot Media for Arch Linux :

    1. Download the Live Media for Arch Linux from here.
    2. Insert a blank DVD into the optical drive.
    3. Right click on the downloaded file and select “Burn to Disk” .
    4. The burn process takes about 5 minutes.
    5. The DVD ejects once the burn process is done.

Create an empty partition on the drive for installing Arch Linux:

    1. Press [Win-Logo]+[R] and type in “diskmgmt.msc” and press [ENTER] to open the Disk-Management in Windows-8.
    2. For my installation  I shrank the C drive to half its size. So that I could install the Arch Linux on a 250 GB (approximate) partition. Select the C drive in the Disk-Management, right-click and select “Shrink volume”.

Steps to change to boot order so that Arch Linux Live Media in the Optical Drive is booted after restart.

  1. Restart the Ultra Book with the shift key pressed. IMG_1664
  2. In the following screen select the troubleshoot option.IMG_1665
  3. In the following screen select the Advanced option.IMG_1666
  4. In the following screen select the UEFI Firmware settings.IMG_1667
  5. Now the BIOS settings are shown.IMG_1668
  6. Move to the security settings and disable the Secure Boot.IMG_1669
  7. Move to the boot settings and change the boot order so that the optical drive is checked first.IMG_1672
  8. Press F10 to “Save and exit”.IMG_1673
  9. Connect to internet via ethernet cable. See that the Arch Linux Live Media DVD is inserted and then restart the Ultra Book.

Booting of the Arch Linux live media and install on hard disk:

  1. After the restart the first screen should have the option “Arch Linux archiso …”. Select it.IMG_2277
  2. Now Arch Linux should boot from the Live Media DVD.IMG_2276

To find out if there is an Internet connection run the command:

 ping -c 3 www.google.com

If you don’t get the below error then you are doing fine else there is something wrong with your internet connection.

ping: unknown host

Toshiba Ultra Book U840W-x0110 has UEFI boot supported. The steps mentioned in this post are for PCs which are booted with UEFI mode. To confirm this run the following command:

mount -t efivarfs efivarfs /sys/firmware/efi/efivars
efivar -l

This will display a list of UEFI variables without errors confirming that we have booted in UEFI mode. Now we can continue with our installation.

Next run the following command to list the block devices (hard disk).

 lsblk

The output should be similar to this :

 
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda       8:0    0  229.8G  0 disk 
├─sda1   8:1    0   450M   0 part 
├─sda2   8:2    0   260M   0 part
├─sda3   8:3    0   128M   0 part 
├─sda4   8:4    0 219.3G   0 part 
├─sda5   8:5    0   8.9G   0 part 
sdb      8:16   0  29.8G  0 disk

Create Linux partitions :

 cgdisk /dev/sda

The sda is the name of the block device got by running the lsblk command.

Now you get a table similar to the one below:

                                 cgdisk 0.8.10

                              Disk Drive: /dev/sda
                           Size: 976773168, 465.8 GiB

Part. #     Size        Partition Type            Partition Name
----------------------------------------------------------------
            1007.0 KiB  free space
   1        450.0 MiB   Windows RE                Basic data partition
   2        260.0 MiB   EFI System                Basic data partition
   3        128.0 MiB   Microsoft reserved        Basic data partition
   4        219.3 GiB   Microsoft basic data      Basic data partition
            236.8 GiB   free space
   5        8.9 GiB     Windows RE                Basic data partition
            1.0 MiB     free space
    [ Align  ]  [ Backup ]  [  Help  ]  [  Load  ]  [  New   ]  [  Quit  ]
    [ Verify ]  [ Write  ]

                      Create new partition from free space

Press the down arrow key until you reach the row with a large free space (236.8 GiB in this example).

Press N, followed by Enter (For the line starting with "First Sector ..."), 
Type the size of the sector (230G in my example), 
followed by another Enter (For the line starting with "Hex code ..."), 
followed by another Enter (For the line starting with "Enter new partition name, ....").

This creates a new Linux Filesystem type partition (of size 230G in my example). This will be my root partition.

Next create a Linux Swap partition.

Again press the down (or up) arrow key until you reach the row with the free space(6.8GiB).

Press N, followed by Enter (For the line starting with "First Sector ..."), 
Type the size of the sector (5G in my example), 
followed by 8200 (For the line starting with "Hex code ..."), 
followed by another Enter (For the line starting with "Enter new partition name, ....").

Next create a EFI partition.

Again press the down (or up) arrow key until you reach the row with the free space(1.8GiB).

Press N, followed by Enter (For the line starting with "First Sector ..."), 
Type the size of the sector (512M in my example), 
followed by EF00 (For the line starting with "Hex code ..."), 
followed by another Enter (For the line starting with "Enter new partition name, ....").

Now the partition table will look like:

                                cgdisk 0.8.10

                              Disk Drive: /dev/sda
                           Size: 976773168, 465.8 GiB

Part. #     Size        Partition Type            Partition Name
----------------------------------------------------------------
            1007.0 KiB  free space
   1        450.0 MiB   Windows RE                Basic data partition
   2        260.0 MiB   EFI System                Basic data partition
   3        128.0 MiB   Microsoft reserved        Basic data partition
   4        219.3 GiB   Microsoft basic data      Basic data partition
   6        230.0 GiB   Linux filesystem
   7        5.0 GiB     Linux swap
   8        512.0 MiB   EFI System
            1.3 GiB     free space
   5        8.9 GiB     Windows RE                Basic data partition
            1.0 MiB     free space

Now there are 2 EFI partition. One of them (512M) was created by us. The other from the Windows 8 installation. Note down the partition number of the 260M Windows 8 EFI partition. In this example its 2 (i.e sda2).

Create File Systems:
Next steps are for creating the file systems in the partitions that were created in the previous steps.
To review the partitions we created in the previous steps run the below command:

lsblk

The output should be similar to :

NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 465.8G  0 disk 
├─sda1   8:1    0   450M  0 part 
├─sda2   8:2    0   260M  0 part
├─sda3   8:3    0   128M  0 part 
├─sda4   8:4    0 219.3G  0 part 
├─sda5   8:5    0   8.9G  0 part 
├─sda6   8:6    0   230G  0 part
├─sda7   8:7    0     5G  0 part
└─sda8   8:8    0   512M  0 part
sdb      8:16   0  29.8G  0 disk

In my example the sda6 of size 230G is the first Linux partition created as a root partition, sda7 of 5G as a swap partition, sda8 of 512M as a EFI partition. Also there is a EFI partition created by the Windows 8 installation. This is a 260MB EFI partition (sda2 in this example). Knowing these partition numbers (sda6,sda7,sda8 and sda2) correctly is very important for the following steps. In your situation these partitions numbers may be different. Hence take caution.

Create the ext4 file system in the root partition:

mkfs.ext4 /dev/sda6

Create the swap file system for the swap partition:

mkswap /dev/sda7
swapon /dev/sda7

Create a EFI system partition:

mkfs.fat -F32 /dev/sda8

Mount the partitions:

Mount the root partition (sda6 in this example):

mount /dev/sda6 /mnt

Mount the EFI partition created by us:

mkdir /mnt/boot
mount /dev/sda8 /mnt/boot

Mount the EFI partition from the Windows 8:

mkdir /mnt/MicrosoftBoot
mount /dev/sda2 /mnt/MicrosoftBoot

Install the base system:

pacstrap -i /mnt base

Generate the File System Table:

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

change root :

arch-chroot /mnt /bin/bash

Set Locale :

nano /etc/locale.gen

I will generate the locale for US english with UTF-8 encoding.

Remove the # from the line en_US.UTF-8 UTF-8. Press Control + O to save the file. Control + X to exit the nano editor.

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

Set the time Zone. For Berlin,Europe :

ln -s /usr/share/zoneinfo/Europe/Berlin /etc/localtime

To find out available time zones:

ls /usr/share/zoneinfo/

To find the sub-zones for the zones displayed for the previous command. For Europe:

ls /usr/share/zoneinfo/Europe

Set the hardware clock:

hwclock --systohc --utc

Set the host name. oopra in my case:

echo oopra > /etc/hostname

Set the root password and remember it:

passwd

Install and configure the boot loader:

mount -t efivarfs efivarfs /sys/firmware/efi/efivars
pacman -S grub efibootmgr
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=arch_grub --recheck

Run the below command and note down the output (MicrosoftBoot is the directory where we mounted the Windows 8 EFI partition):

grub-probe --target=fs_uuid /MicrosoftBoot/EFI/Microsoft/Boot/bootmgfw.efi

In the example the output is :

4252-7460

Also run the below command and note down the output:

grub-probe --target=hints_string /MicrosoftBoot/EFI/Microsoft/Boot/bootmgfw.efi

In the example the output is:

--hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2

With the outputs of the above two commands add a custom entry in the grub menu:

nano /etc/grub.d/40_custom

Add the Windows 8 entry. Now the 40_custom file looks like the one below (The outputs of the commands that we noted down are inserted after “–hint-bios=”):

#!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.
        menuentry "Windows 8" {
                insmod part_gpt
                insmod fat
                insmod search_fs_uuid
                insmod chain
                search --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2 4252-7460
                chainloader /EFI/Microsoft/Boot/bootmgfw.efi
        }

Now create the grub configuration :

grub-mkconfig -o /boot/grub/grub.cfg

Exit the Chroot, unmount, reboot. Importantly eject the installation CD before the laptop starts up again :

exit
umount -R /mnt
reboot

Now the laptop will boot into the Arch Linux we have installed with the previous steps.

Now we have logged-in as root user. Working as a root user is not recommended for regular use.

So add a new user ( hackoopra in this example):

useradd -m -s /bin/bash hackoopra

Set a password for the new user:

passwd hackoopra

Add sound driver:

pacman -S alsa-utils

unmute ALSA:

amixer sset Master unmute

Install the Graphical User Interface :

pacman -S xorg-server xorg-server-utils xorg-xinit
pacman -S mesa

Install the Intel Video card driver (The Toshiba Ultra Book U840W-x0110 has a Intel Corporation 3rd Gen Core processor Graphics Controller (rev 09)
) :

pacman -S xf86-video-intel

Install input drivers :

pacman -S xf86-input-synaptics

Install the default environment for X :

pacman -S xorg-twm xorg-xclock xterm

Check if X is running :

startx

Now there should be few movable windows. Close them by typing exit in every window.

I prefer the KDE Desktop environment. Hence the below steps are for installing KDE.

Run the below command to install KDE. This takes a while.

pacman -S kde

Install the KDE Display manager (KDM):

pacman -S kdebase-workspace

Configure the KDM:

systemctl enable kdm

Now reboot with the “reboot” command and you should be presented with a login screen. Your minimal Arch Linux is ready.

References :

Arch Linux Wiki

Dual Boot Windows 8.1 and Fedora 20

Dual Boot Windows 8.1 and Fedora 20

I have a Toshiba Ultra Book U840W-x0110. It comes with Windows 8 pre-installed. I later got it upgraded to Windows 8.1 for free (It was offered as a software update). The below mentioned steps should work for Windows 8.0 as well.

In this post I will mention certain important steps that are required before dual booting Linux and Windows 8 in general. Once this is done installing Linux distros like Ubuntu or Fedora should be self-explanatory. Although In this post I have explained to steps for Fedora, it will be similar for other Linux distros as well.

Dual booting Linux with Windows has some risk associated. You might end up losing the Windows installation. Hence ensure that you have backed up all the data and have the recovery disk of Windows 8. If you don’t have the recovery disk then create one. (A good guide can be found here).

Prerequisite: This Ultra book does not have an optical drive. Hence I connected an external optical drive (ASUS DVD writer).

Setup

So here are the steps I followed to have a dual-boot configuration of Windows 8.1 and Fedora 20.

Steps to create Boot Media for Fedora 20 :

    1. Download the Live Media for Fedora 20 from here.
    2. Insert a blank DVD into the optical drive.
    3. Right click on the downloaded file and select “Burn to Disk” .
    4. The burn process takes about 5 minutes.
    5. The DVD ejects once the burn process is done.

IMG_1661

Create an empty partition on the drive for installing Fedora:

    1. Press [Win-Logo]+[R] and type in “diskmgmt.msc” and press [ENTER] to open the Disk-Management in Windows-8.
    2. For my installation  I shrank the C drive to half its size. So that I could install the Fedora on a 250 GB (approximate) partition. Select the C drive in the Disk-Management, right-click and select “Shrink volume”.

Steps to change to boot order so that Fedora Live Media in the Optical Drive is booted after restart.

  1. Restart the Ultra Book with the shift key pressed. IMG_1664
  2. In the following screen select the troubleshoot option.IMG_1665
  3. In the following screen select the Advanced option.IMG_1666
  4. In the following screen select the UEFI Firmware settings.IMG_1667
  5. Now the BIOS settings are shown.IMG_1668
  6. Move to the security settings and disable the Secure Boot.IMG_1669
  7. Move to the boot settings and change the boot order so that the optical drive is checked first.IMG_1672
  8. Press F10 to “Save and exit”.IMG_1673
  9. See that the Fedora Live Media DVD is inserted and then restart the Ultra Book.

Booting of the Fedora live media and install on hard disk:

  1. After the restart the first screen should have the option “Start Fedora Live”. Select it.IMG_1674
  2. Now Fedora should boot from the Live Media DVD.
  3. After some considerable time (more than 5 minutes) the following screen will show up.Select “Install to Hard Drive” .IMG_1676
  4. Wait for some time until the language selection menu appears.Press continue.IMG_1678
  5. The next screen gives the installation summary. Select Installation Destination under system. Normally it should show your hard disk under “Local Standard Disk”. If so you’re in luck, you can continue the installation procedure which is very self-explanatory ( Else there is a good guide here (From Step 5). If no Hard Disk is show then the workaround is mentioned in my other post.