Manjaro Difference between pages "GRUB/Restore the GRUB Bootloader" and "Check a Downloaded ISO Image For Errors"

Difference between pages "GRUB/Restore the GRUB Bootloader" and "Check a Downloaded ISO Image For Errors"

From Manjaro
(Difference between pages)
imported>Peter li
m (Peter li moved page Restore the GRUB Bootloader to GRUB/Restore the GRUB Bootloader: Its a subsection of GRUB now)
 
imported>Verityproductions
(Created page with "= Overview = Prior to burning your downloaded ISO image (or using it as a virtual disc in Virtualbox), it is '''strongly''' recommended that you first check that it hasn't be...")
 
Line 1: Line 1:
__TOC__
= Overview =
= Overview =


In order to boot Manjaro, a Linux-capable boot loader such as GRUB, rEFInd or Syslinux needs to be installed to the Master Boot Record (MBR) or the GUID Partition Table (GPT) of the media containing the Operating System. The boot loader used on official Manjaro installations and generaly suggested is GRUB. Sometimes the MBR or GPT gets corrupted, erased or misconfigured for various reasons resulting to a black screen with a failure message during boot, like '''No boot loaders found in /dev/...'''. Fortunatelly, there is a way to restore GRUB without re-installing your OS or losing your data. For this, you will need to use your Manjaro installation media, such as, a CD/DVD or USB Flashdrive.
Prior to burning your downloaded ISO image (or using it as a virtual disc in Virtualbox), it is '''strongly''' recommended that you first check that it hasn't been corrupted during the process of being downloaded. The consequences of not doing so - especially if you intend on installing Manjaro as your main operating system - should be obvious (i.e. a corrupted image will result in a corrupted installation).  
{{tip|More information about the boot process on Archlinux based distributions is available at [https://wiki.archlinux.org/index.php/Arch_boot_process Archwiki]}}
 
= Boot the Manjaro Installation Media =
 
'''1.''' Insert and boot your Manjaro installation media.
 
'''2.''' Select your '''preferred language''' (F2) and '''keyboard layout''' (F3).
 
{{tip|Setting the language and keyboard layout are undertaken by pressing the ''Function'' (F) keys. As many computers have multiple functions assigned to each function key, it may be necessary to hold down another key first to use them. For example, on a HP G62 laptop, to use the function keys, the 'fn' key must first be pressed and held.}}
 
 
'''3.''' Boot Manjaro Linux. It does not matter which boot option you choose, as the installation media is being used solely to repair/reinstate the GRUB, and not to install a fresh system.
 
'''4.''' Open the terminal or access the command line of the live CD.
 
* '''From the desktop environment''': open a terminal from your desktop menu, and enter ''sudo su'' in the terminal.
 
or
 
* '''From the command line''' of the Manjaro Architect Edition or having used option '''5. System Rescue''' : enter the default login username ''root'' and then the password "manjaro" to log in.
 
=Chroot into your existing Manjaro Installation=
 
{{note| Look here to read more about [https://wiki.archlinux.org/index.php/Change_Root chroot](ing).}}
 
There are 2 different ways to chroot into your exising Manjaro installation: Using manjaro-chroot or doing it manually. Please choose one:
 
 
==Use manjaro-chroot==
 
'''1.''' Start by identifying the partition where your Manjaro installation controlling the active Grub menu resides and needs repairing. If you are in Graphical mode you can use an application called ''GPartEd'', which should be in Menu > System > GPartEd. This will provide a simple visual illustration of the partitions on your hard drive(s).
 
To do the same thing from terminal or TTY you can use this command
 
lsblk -f
 
 
'''2.''' manjaro-chroot is a tool to easily setup a functional chroot into an installed Linux installation from a live boot of a Manjaro Installation Media.
 
To setup the chroot use the command
sudo manjaro-chroot -a
 
You will be presented with a terminal. Wait until it shows a list with the available system partitions on your computer and choose the one you want to repair.
 
== Manually Identify and Prepare the Installed Partition(s) ==
 
'''1.''' Ensure that you are using the Root account, which is identified by a hash ('#') at the beginning of the command line, rather than a dollar ('$'). To switch to Root, enter the command:
 
sudo su
 
 
'''2.''' List your partitions. This is necessary in order to identify the partition your Manjaro system is installed on. If you have used a separate boot partition, it will be necessary to identify this as well. For a list of your paritions, enter the command:
 
lsblk -f
 
  or
 
sudo blkid -o list -c /dev/nul
 
 
In this particular instance, '''having used the assisted preparation method to install Manjaro earlier''', the partitions for the author's Manjaro system are as follows:
 
* '''/dev/sda1''': Boot partition
* '''/dev/sda2''': Swap partition
* '''/dev/sda3''': Manjaro system
* '''/dev/sda4''': Space for personal files.
 
 
If you are still unsure, then you can also use an application called ''gparted'', which should be in Menu > System > GPartEd. This will provide a simple visual illustration of the partitions on your hard drive(s). If a separate partition for the GRUB exists, it will be marked as 'bootable', and should only be about 100MB in size.
 
 
'''3.''' Mount your Manjaro system partition. The syntax to mount the Manjaro system partition is:
 
mount /dev/'''[partition used for Manjaro system]''' /mnt
 
 
In this instance, as the Manjaro system partition is ''/dev/sda3'', this will be mounted using the following command:
 
mount /dev/'''sda3''' /mnt
 
 
'''IF''' you have used a separate partition for your GRUB bootloader, then this must also be mounted. The syntax to mount a separate partition used to boot is:
 
mount /dev/'''[partition used for GRUB]''' /mnt/boot
 
 
In this instance, a separate partition --''/dev/sda1''-- has been used for the GRUB, and will be mounted using the following command:
 
mount /dev/'''sda1''' /mnt/boot
 
{{note|Again, if you have not used a separate boot partition, then it (obviously) does not need to be mounted!}}
 
 
'''4.''' Change to the root directory of your mounted partitions.
 
cd /mnt
 
This is undertaken so that you are working from  --and with-- your installed system, rather than the installation media. To do so, it will be necessary to enter a series of commands in the following order:
 
mount -t proc proc /mnt/proc
mount -t sysfs sys /mnt/sys
mount -o bind /dev /mnt/dev
mount -t devpts pts /mnt/dev/pts/
chroot /mnt
 
 
= Restore GRUB =
 
First, install the software applications ''mtools'' and ''os-prober''. mtools is a collection of tools to access MS-DOS disks from GNU/Linux and Unix without mounting them. os-prober is a utility that detects if there are any other operating systems present. Install them both with the following command:
 
sudo pacman -S mtools os-prober
 
 
== For BIOS Systems ==
 
'''1.''' Install a new GRUB bootloader with the following command:
 
grub-install /dev/sda
{{Note|sda is the disk device where you want to install GRUB. You can check it using ''lsblk -f'' or using GParted as explained before.}}
 
 
'''2.''' Recheck to ensure the that installation has completed without any errors:
 
grub-install --recheck /dev/sda
 
 
'''3.''' Finally, configure the freshly installed GRUB bootloader:
 
update-grub
 
 
All done! Now close the terminal and reboot your system to use your freshly re-installed GRUB.
 
 
== For UEFI Systems ==
 
{{Warning|You need to be [https://wiki.archlinux.org/index.php/Change_Root chrooted] for this procedure as mentioned in the [[Restore_the_GRUB_Bootloader#Identify_and_Prepare_the_Installed_Partition.28s.29 | previous step.]]}}
 
 
1.) First of all check the partition for the ESP (EFI System Partition). An ESP is a fat32 partition and contains .efi files for booting.
 
It can be checked using Gparted or from the terminal using ''fdisk -l''
 
 
('''Note:'''
''If you do not have a EFI partition'', you will need to create it.
Use Gparted for that.
 
Type- ''fat32''
 
Size- ''512 mb to 1 gb'')
 
 
2.) Create the ''/boot/efi'' directory
sudo mkdir /boot/efi
 
 
3.) Mount the EFI partition as ''/boot/efi''
sudo mount /dev/sdXY /boot/efi
X = Alphabet of the drive = a,b,c ...
Y = Partition number of the EFI partition = 1,2,3,4...
 
Example - ''/dev/sda4''
 
 
4.) Re-install Grub.
sudo grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=manjaro --recheck
 
 
5.) Update Grub configuration file.
sudo update-grub
 
=== Note ===
 
If you get something like
 
EFI variables are not supported on this system.
 
Then install the {{ic|efibootmgr}}, {{ic|dosfstools}} and {{ic|grub}} packages and try steps 4 and 5 again.
 
If it still doesn't work, then try exiting the chroot environnment by typing '''exit''', then loading the '''efivarfs''' module:
sudo modprobe efivarfs
 
and in the chroot
mount -t efivarfs efivarfs /sys/firmware/efi/efivars
 
 
And if you get something like
 
grub-install: error: failed to get canonical path of `union'.
 
means that probably you forgot to [[Restore_the_GRUB_Bootloader#Identify_and_Prepare_the_Installed_Partition.28s.29 | chroot]].


'''See also'''
To do so, you must first download the appropriate ''checksum file'' from the same Sourceforge folder as your chosen ISO image. A checksum file will have the same name as the ISO image that it is to be used with; the only difference is that it will end in either ''-sha1.sum''' or '''-sha256.sum'''. For example, the appropriate checksum file for the ''manjaro-xfce-0.8.1-x86_64.iso'' file (64 bit Manjaro release 0.8.1 with the XFCE desktop) will be manjaro-xfce-0.8.1-x86_64'''-sha1.sum''', and/or manjaro-xfce-0.8.1-x86_64'''-sha256.sum'''.


[http://wiki.manjaro.org/index.php?title=UEFI_-_Install_Guide UEFI Install Guide]
The 'sha' part of the checksum file name stands for '''S'''ecure '''H'''ash '''A'''lgorithm, which is used to generate a particular code unique to the downloaded ISO image; sha1 and sha256 are different versions of this algorithm that you can use to do this. While sha1 is the most widely used version, sha256 is a later and more secure version. Which you decide to use is entirely your choice. However, if you are unsure, then it is recommended to use sha256.


[https://wiki.archlinux.org/index.php/GRUB#UEFI_systems_2 Arch Wiki:GRUB#UEFI_systems_2]
The checksum file itself is just a text document that contains the code that should be generated by the sha1 or sha256 algorithm. If the code generated from the ISO file matches that contained in the checkum file, then the ISO is fine. Otherwise - if the two codes don't match - then it means that the ISO file has changed in some way, most likely due to being corrupted. You can think of it like two people using a secret password to identify who they are: If the visitor uses the wrong password, then something is obviously amiss!


=== Alternative method ===
Don't worry if this all sounds a bit much - it's actually very straightforward and easy to use!


Mount the ext4 Manjaro root partition at {{ic|/install}}


Mount the vfat Manjaro efi partition at {{ic|/install/boot/efi}}
== Checking in Linux ==


And then install Grub as:
To check the integrity of your downloaded file, it will be necessary to first open the downloaded checksum file using a text editor such as ''Gedit''. Depending on whether you intend to use sha1 or sha256, ensure that you have downloaded and opened the appropriate checksum file (i.e. ending in -sha1.sum or sha256.sum, respectively) as they will contain different codes. Once the checksum file has been opened - and the code is visible - open up your terminal and change to the directory where your downloaded ISO is stored. For example, if your ISO file is located in the default ''Downloads'' folder, you would enter the following command:


  grub-install --target=x86_64-efi --efi-directory=/install/boot/efi --bootloader-id=manjaro --boot-directory=/install/boot --recheck --debug
  cd Downloads


After the above you could chroot and try the '''update-grub''' command as earlier.


The command to then perform a checksum uses the following syntax:


= Troubleshooting =
[sha1sum or sha256sum] [ISO Image]


=== Arch Linux is not recognized ===
If Arch Linux wasn't recognized after an update-grub then probably your Arch installation is missing the package lsb-release.


For example, the following command will use sha256 generate a code from the 64 bit Manjaro XFCE 0.8.1 ISO. The code generated can then be compared tothe code provided by the appropriate sha256 checksum file:


=More=
sha256sum  manjaro-xfce-0.8.1-x86_64.iso


[https://forum.manjaro.org/index.php?topic=7552.0 Forum topic]


[https://wiki.archlinux.org/index.php/GRUB The Arch Wiki]
As illustrated, in this instance both codes match confirming that the downloaded ISO file is completely fine. The following command would use sha1 to undertake exactly the same task:


Post for support at the [http://forum.manjaro.org/index.php?board=3.0 forums]
sha1sum manjaro-xfce-0.8.1-x86_64.iso




[[Category:Contents Page]]
Where satisifed that both codes match, then it is safe to proceed to either burning the ISO to your chosen installation, or using it immediately in Virtualbox. Otherwise, it will be necessary to delete the ISO image and download it again.


== Checking in Windows ==


[[Category:Contents Page]]
(TBA)

Revision as of 21:26, 19 October 2012

Overview

Prior to burning your downloaded ISO image (or using it as a virtual disc in Virtualbox), it is strongly recommended that you first check that it hasn't been corrupted during the process of being downloaded. The consequences of not doing so - especially if you intend on installing Manjaro as your main operating system - should be obvious (i.e. a corrupted image will result in a corrupted installation).

To do so, you must first download the appropriate checksum file from the same Sourceforge folder as your chosen ISO image. A checksum file will have the same name as the ISO image that it is to be used with; the only difference is that it will end in either -sha1.sum' or -sha256.sum. For example, the appropriate checksum file for the manjaro-xfce-0.8.1-x86_64.iso file (64 bit Manjaro release 0.8.1 with the XFCE desktop) will be manjaro-xfce-0.8.1-x86_64-sha1.sum, and/or manjaro-xfce-0.8.1-x86_64-sha256.sum.

The 'sha' part of the checksum file name stands for Secure Hash Algorithm, which is used to generate a particular code unique to the downloaded ISO image; sha1 and sha256 are different versions of this algorithm that you can use to do this. While sha1 is the most widely used version, sha256 is a later and more secure version. Which you decide to use is entirely your choice. However, if you are unsure, then it is recommended to use sha256.

The checksum file itself is just a text document that contains the code that should be generated by the sha1 or sha256 algorithm. If the code generated from the ISO file matches that contained in the checkum file, then the ISO is fine. Otherwise - if the two codes don't match - then it means that the ISO file has changed in some way, most likely due to being corrupted. You can think of it like two people using a secret password to identify who they are: If the visitor uses the wrong password, then something is obviously amiss!

Don't worry if this all sounds a bit much - it's actually very straightforward and easy to use!


Checking in Linux

To check the integrity of your downloaded file, it will be necessary to first open the downloaded checksum file using a text editor such as Gedit. Depending on whether you intend to use sha1 or sha256, ensure that you have downloaded and opened the appropriate checksum file (i.e. ending in -sha1.sum or sha256.sum, respectively) as they will contain different codes. Once the checksum file has been opened - and the code is visible - open up your terminal and change to the directory where your downloaded ISO is stored. For example, if your ISO file is located in the default Downloads folder, you would enter the following command:

cd Downloads


The command to then perform a checksum uses the following syntax:

[sha1sum or sha256sum] [ISO Image]


For example, the following command will use sha256 generate a code from the 64 bit Manjaro XFCE 0.8.1 ISO. The code generated can then be compared tothe code provided by the appropriate sha256 checksum file:

sha256sum  manjaro-xfce-0.8.1-x86_64.iso


As illustrated, in this instance both codes match confirming that the downloaded ISO file is completely fine. The following command would use sha1 to undertake exactly the same task:

sha1sum manjaro-xfce-0.8.1-x86_64.iso


Where satisifed that both codes match, then it is safe to proceed to either burning the ISO to your chosen installation, or using it immediately in Virtualbox. Otherwise, it will be necessary to delete the ISO image and download it again.

Checking in Windows

(TBA)

Cookies help us deliver our services. By using our services, you agree to our use of cookies.