Thursday, May 19, 2016

Debian and it's love ...!

I have been using a lot of Linux/based distribution during my UG days. It all started with installing solaris on my 512MB RAM machine after an installation demo by CSE seniors(Krithika, Balachandran and others) . Then, I went on to Ubuntu, Fedora, OpenSUSE, Debian for reasons during my project work. Of all, my Favorite is Debian for their less memory or/and power consumption with simple neat looks. 

During my PG days I installed Ubuntu 14.04 and were using for the past 2 years (almost). Now that I wanted to get back to my fav Debian and went into so many issues which I haven't faced during those days. Moreover, hardware/software itself got too complicated with BIOS/UEFI/Legacy mode/Safeboot/Fastboot/Win8/Win10. 

Objective, I wanted to replace Ubuntu with Debian and still use it a dual boot alongside windows. Specs: Debian 8.4, Dell Inspiron 3000 series, I7, 8GB RAM

Initial steps 
0. To live boot F12 key at boot, I have to choose boot from pendrive under Legacy option in boot menu options. In UEFI mode with safeboot OFF already.
1. Downloaded Debian with Mate desktop environment[DE] as I preferred Mate over other DE than cinnamon, current gnome, KDE, etc
2. I installed with manual partitioning. Formatted the existing ubuntu "/" and "/home" and then while writing to boot loader it said Ubuntu detected. OMG. windoz? :-/ 
3. I went ahead and completed. As I booted, I could see only grub prompt. However, when I live booted all my partitions are safe.

Errors and steps taken to resolve
4.
grub>  ls
hd0 (hd0,gpt12) (hd0,gpt11) (hd0,gpt9) (hd0,gpt8) ...

It will list the partitions in Harddisk


5. Find out where "/"  of linux files is installed by pressing "tab"

press tab after typing as below..
grub> (hd0,gpt11)/
/bin /boot /etc /opt /home /root /sys lost+found  ...

you can figure out what for you, for me it is 11 here in this example. It is used below        

6.
grub>  set boot=(hd0,gpt11)
grub>  set prefix=(hd0,gpt11)/boot/grub
grub>  insmod normal  
grub>  normal

This will make the grub OS chooser window to appear. But it showed only Debian. Where is the windoz ? :-/

7.
Do the below in termial after login to debain
# grub-mkdevicemap
# update-grub
# grub-install /dev/sdX

If these 3 steps are complete then you are done!!

8.
find out X as below
​root@warriorwithin:~# lsblk -f
NAME    FSTYPE LABEL      UUID                                 MOUNTPOINT
sda                                                            
├─sda1  vfat   ESP        CAE4-7B30                            
├─sda2  vfat   DIAGS      F640-9997                            
├─sda3                                                         
├─sda4  ntfs   WINRETOOLS 8A1442471442370B                     
├─sda5  ntfs   OS         7C80471B8046DB72                     
├─sda6  ntfs   New Volume 0604B4F304B4E6B9                     
├─sda7  ntfs   New Volume 1EA62DCBA62DA3ED                     
├─sda8  ntfs   New Volume 24786E8A786E5B16                     
├─sda9  ntfs   PBR Image  A2E878FBE878CED3                     
├─sda10 swap              f594b846-2211-4e70-bbcd-f97a6e05e036 [SWAP]
├─sda11 ext4              32ae4ff5-10fd-4992-a70d-21b07dfce9da /
└─sda12 ext4              331172f1-2eea-4589-a5ef-c1ab2f4975e0 /home

X for me is "a"  

9.
root@warriorwithin:~# grub-install /dev/sda
Installing for x86_64-efi platform.
grub-install: error: cannot find EFI directory.

what to do now? :-(

10.
Check if /sys/firmware/efi exists if so then mount as below. And we know that step 8 ESP is in sda1 we will mount that in efi
root@warriorwithin:~# mkdir -p /boot/efi
root@warriorwithin:~# mount /dev/sda1 /boot/efi

11.
root@warriorwithin:~# grub-install /dev/sda
Installing for x86_64-efi platform.
Installation finished. No error reported.
root@warriorwithin:~# 

All Done!!
Cheers




sed, awk and bash it

Edit the files in folder 1. Chop off few words from the 1st line 2. Reads a particular word from the 1st line and then replaces that w...