Как сделать загрузку windows первой в grub

Немного теории

Как я уже сказал, основная задача загрузчика — предоставить возможность выбора операционной системы перед загрузкой. Не думайте, что в Windows загрузчик не используется, там он тоже есть и работает, подобно тому, как работает Grub.

Загрузчик может быть установлен в различные таблицы разделов диска. Сейчас самые используемые это GPT и MBR. Установка загрузчика Grub немного отличается для каждой из этих таблиц, учитывая их особенности. Подробнее об отличиях MBR vs GPT можно почитать в отдельной статье. Тут же я скажу, что GPT — более новая и функциональная таблица разделов, MBR — уже устаревшая, но до сих пор часто используемая.

В MBR вариантов немного, Grub записывается в область MBR на диске. Размер сектора MBR занимает первых 512 байт и этого вполне достаточно для того, чтобы установить туда загрузчик.

GPT предоставляет более широкие возможности. Во-первых, для совместимости в GPT эмулируется сектор MBR, и мы можем установить GRUB туда, но такой вариант очень ненадежный и не рекомендуемый. Во-вторых, теперь появилась возможность устанавливать Grub на раздел диска. Мы просто создаем раздел на диске размером 1 Мб и записываем туда то, что раньше записывалось в MBR, это делает установку загрузчика более надежной и защищенной от сбоев.

UEFI предоставляет совсем иной способ установки загрузчика. Тут его не нужно никуда записывать, загрузчик — это обычное приложение EFI, которое помещается на раздел EFI и уже там полностью успешно работает наряду с другими приложениями.

Для установки Grub будет использоваться команда grub-install, во всех случаях. Давайте кратко рассмотрим ее синтаксис и параметры. Синтаксис:

$ grub-install опции диск

Параметров здесь достаточно много, но нам будут нужны только некоторые:

  • —compress — сжать файлы загрузчика;
  • —install-modules=модули — установить только эти модули;
  • —modules — записать эти модули в MBR;
  • —boot-directory — использовать другой каталог для файлов Grub;
  • —bootloader-id — имя загрузчика в меню EFI;
  • —core-compress — сжимать образ, загружаемый в MBR;
  • —efi-directory — использовать системный раздел EFI;
  • —force — установить несмотря на ошибки;
  • —recheck — удалить существующую карту устройств, помогает если возникают ошибки;
  • —removable — установка grub на флешку (только EFI);

Основу разобрали. Теперь перейдем к установке. Дальше я буду предполагать, что все действия выполняются из системы, для которой нужно установить загрузчик или из chroot окружения этой системы.

Installing Grub Customizer

Follow the below steps to install Grub Customizer:

Open the Terminal in your Debian OS by going in to the Activities tab on the left corner of your desktop. Then in the search bar, type terminal. when the icon appears, click on it to open.

Step 1: Install prerequisites

Initially, we will need to meet prerequisites before moving towards the installation process.

To do so, run the below command in Terminal:

$ sudo apt-get install build-essential cmake libgtkmm-3.0-dev libssl-dev gettext libarchive-dev

Step 2: Download Grub Customizer

Now in order to download Grub Customizer, run the following command in Terminal:

$ wget https://launchpad.net/ubuntu/+archive/primary/+sourcefiles/grub-customizer/5.1.0-1/grub-customizer_5.1.0.orig.tar.gz

To check for the latest version of Grub Customizer, use the following link:

The file will be downloaded in your Terminal’s current directory.

Advertisement

Step 3: Unzip the downloaded file

Now we will need to unzip the downloaded grub customizer file. For that run the following command in terminal:

$ tar xzf grub-customizer_5.1.0.org.tar.gz

Step 4: Compiling sources

Now navigate to the extracted folder using the cd command as follows:

$ cd grub-customizer-5.1.0/

And then run the following command in Terminal:

$ cmake . && make -j8

Step 5: Install Grub Customizer

Now we are prepared for installing Grub Customizer. Run the following command in Terminal to install Grub Customizer.

$ sudo make install

Step 6: Launch Grub Customizer

You can launch Grub Customizer right from your Terminal. For that, simply type the following command in Terminal:

$ grub-customizer

Alternatively, it Grub Customizer can also be launch through the application’s menu.for that hit the super key on your keyboard. this will open the search bar where you can search for the grub Customizer.

Once opened, you will see the following default view of Grub Customizer.

Uninstall Grub Customizer

In case you want to uninstall Grub Customizer, you can do so by running the following the below steps:

Navigate to the folder containing the Grub Customizer using the cd command. then run the following command to uninstall Grub Customizer:

$ cd grub-customizer-5.1.0/
$ sudo make uninstall

That is all you need in order to install Grub Customizer in your Debian OS. it is a simple but great tool for changing the default bootloader settings as well as making other modifications.

How to Install Grub Customizer on Debian 10

UEFI further reading

This article or section needs language, wiki syntax or style improvements. See Help:Style for reference.

Below is other relevant information regarding installing Arch via UEFI.

Alternative install method

This article or section needs expansion.

Usually, GRUB keeps all files, including configuration files, in , regardless of where the EFI System Partition is mounted.

If you want to keep these files inside the EFI System Partition itself, add to the grub-install command:

# grub-install --target=x86_64-efi --efi-directory=esp --bootloader-id=grub --boot-directory=esp --debug

This puts all GRUB files in , instead of in . When using this method, make sure you have grub-mkconfig put the configuration file in the same place:

# grub-mkconfig -o esp/grub/grub.cfg

Configuration is otherwise the same.

GRUB standalone

This section assumes you are creating a standalone GRUB for x86_64 systems (x86_64-efi). For 32-bit (IA32) EFI systems, replace with where appropriate.

It is possible to create a application which has all the modules embedded in a tar archive within the UEFI application, thus removing the need to have a separate directory populated with all of the GRUB UEFI modules and other related files. This is done using the command (included in ) as follows:

# echo 'configfile ${cmdpath}/grub.cfg' > /tmp/grub.cfg
# grub-mkstandalone -d /usr/lib/grub/x86_64-efi/ -O x86_64-efi --modules="part_gpt part_msdos" --locales="en@quot" --themes="" -o "esp/EFI/grub/grubx64_standalone.efi" "boot/grub/grub.cfg=/tmp/grub.cfg" -v

Then copy the GRUB config file to and create a UEFI Boot Manager entry for using .

Note: The option (with the quotes) is necessary for the feature to work properly.

Warning: You may find that the file is not loaded due to missing a slash (i.e. instead of ) and so you are dropped into a GRUB shell. If this happens determine what is set to () and then load the config file manually (e.g. ).

Technical information

The GRUB EFI file always expects its config file to be at . However in the standalone GRUB EFI file, the is located inside a tar archive and embedded inside the standalone GRUB EFI file itself (inside the GRUB environment, it is denoted by , without quotes). This tar archive contains all the files that would be stored normally at in case of a normal GRUB EFI install.

Due to this embedding of contents inside the standalone image itself, it does not rely on actual (external) for anything. Thus in case of standalone GRUB EFI file and the standalone GRUB EFI file reads expects the config file to be at .

Hence to make sure the standalone GRUB EFI file reads the external located in the same directory as the EFI file (inside the GRUB environment, it is denoted by ), we create a simple which instructs GRUB to use as its config ( command in ). We then instruct grub-mkstandalone to copy this file to (which is actually ) using the option .

This way, the standalone GRUB EFI file and actual can be stored in any directory inside the EFI System Partition (as long as they are in the same directory), thus making them portable.

How to Install Grub Customizer

Step 2: Add Grub Customizer PPA repository to your system

Enter the following command in order to add the Grub Customizer PPA repository to your system. This will help you in installing the required software, and also enable your system to fetch upgrades and updates from the added repository in the future.

$ sudo add-apt-repository ppa:danielrichter2007/grub-customizer

Tip: Instead of typing the command, you can copy it from here and paste in the Terminal by using the Ctrl+Shift+V, or by using the Paste option from the right-click menu.

Please note that only an authorized user can add, remove and configure software on Ubuntu. Enter the password for sudo, after which the PPA repository will be added to your system.

Step 3: Upgrade your system’s Repository Index

The next step is to update your system’s repository index through the following command:

$ sudo apt-get update

This helps you in installing the latest available version of a software from the Internet.

Step 4: Install Grub Customizer

Now that you are done with all the prerequisites required to install the Grub Customizer, use the following command as sudo in order to install it on your system:

$ sudo apt-get install grub-customizer

Advertisement

The system will prompt you with a Y/n option to proceed with the installation procedure. Enter Y to continue after which the software will be installed on your system.

Step 5: Verify Grub Customizer Installation

After you have installed the Grub Customizer, you can use one of the following two options to ensure that it is indeed installed on your system:

$ grub-customizer --version
$ grub-customizer -v

The above output shows that Grub Customizer version 5.1.0, which is the latest version of the software, is installed on my system.

To install Grub customizer on Linux Mint 18.3

Grub Customizer is a graphical tool for managing the Grub boot entries in Linux. Grub Customizer allows the user to edit the menu entries from the GRUB booting screen. The users can also add/remove entries, change the boot order, set a background image. It is so simple to install the Grub Customizer on Linux Mint 18.3

Installing Grub

First, make sure you add the necessary repository for the installation of Grub by making use of the following command.

linuxhelp ~ # add-apt-repository ppa:danielrichter2007/grub-customizer
You are about to add the following PPA:
 This PPA contains the latest release of Grub Customizer.

sudo add-apt-repository ppa:danielrichter2007/grub-customizer
sudo apt-get update
sudo apt-get install grub-customizer
 More info: https://launchpad.net/~danielrichter2007/+archive/ubuntu/grub-customizer
Press Enter to continue or Ctrl+C to cancel

Executing: /tmp/tmp.9DgkECciP9/gpg.1.sh --keyserver
hkp://keyserver.ubuntu.com:80
--recv-keys
3F055C03
gpg: requesting key 3F055C03 from hkp server keyserver.ubuntu.com
gpg: key 3F055C03: " Launchpad PPA for Daniel Richter"  not changed
gpg: Total number processed: 1
gpg:              unchanged: 1

After adding the repository you need to update the system repo as follows.

linuxhelp ~ # apt-get update 
Hit:1 http://security.ubuntu.com/ubuntu xenial-security InRelease
Hit:2 http://ppa.launchpad.net/danielrichter2007/grub-customizer/ubuntu xenial InRelease                            
Hit:3 http://archive.ubuntu.com/ubuntu xenial InRelease                                                                                        
Hit:4 http://archive.canonical.com/ubuntu xenial InRelease                                                                                     
Ign:5 http://packages.linuxmint.com sylvia InRelease                                                                
Hit:6 http://archive.ubuntu.com/ubuntu xenial-updates InRelease                                
Hit:7 http://ppa.launchpad.net/eugenesan/ppa/ubuntu xenial InRelease                           
Hit:8 http://packages.linuxmint.com sylvia Release                                            
Hit:9 http://archive.ubuntu.com/ubuntu xenial-backports InRelease        
Reading package lists... Done                      

Once the updating is completed install the grub-customizer directly using the following command.

linuxhelp ~ # apt install grub-customizer
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Recommended packages:
  hwinfo
The following NEW packages will be installed:
  grub-customizer
0 upgraded, 1 newly installed, 0 to remove and 287 not upgraded.
.
.
Processing triggers for mime-support (3.59ubuntu1) ...
Processing triggers for hicolor-icon-theme (0.15-0ubuntu1) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up grub-customizer (5.0.6-0ubuntu1~ppa1x) ...

Once you are through with the installation, you need to launch the application in the following manner. Go to the search field and find Grub Customizer.

With this, the method to install Grub customizer on Linux Mint 18.3.

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *

Adblock
detector