How to update grub

How to update grub

How to update grub on a dual boot machine?

I have a machine which installed a ubuntu 16.04 on one partition and a ubuntu 16.10 on another. I have a 200m partition which mounts /boot/efi.

Basically I use 16.04 and use the grub installed by 16.04.

Sometimes I get on 16.10 and update the kernel. However, I cannot update the grub of my 16.04 without entering it. So I have to do grub-install on 16.10 in order to boot the new kernel. Then when I come back to 16.04, I update-grub and grub-install, which is stupid I think.

How can I update the grub of 16.04 without entering it, is there a good solution?

Can I do something like updating the grub config file or using another partition as /boot? Is this kind of operation dangerous?

How to update grub. Смотреть фото How to update grub. Смотреть картинку How to update grub. Картинка про How to update grub. Фото How to update grub

3 Answers 3

You can directly boot a partition, not a specific kernel. Debian based (not sure about others distributions) add a link in / to newest kernel and second newest also. So you boot link to newest kernel. Turn off os-prober, copy boot stanza for your drive & partition into 40_custom.

Backup current grub.cfg and then edit 40_custom

Add an entry like this to 40_custom, use your drive & partition in place of (hd1,1) & sdb1:

Edit grub to turn off os-prober:

Add this line to grub so it does not add its entries and update grub:

And update grub with all the changes:

Older similar entry, also has UUID version:

Details: How to: Create a Customized GRUB2 Screen that is Maintenance Free.- Cavsfan

You’ve described a fundamental limitation of GRUB: It relies on configuration files that can be generated only within Ubuntu (or some other OS that supports GRUB). Normally, running sudo update-grub within the OS/distribution that controls GRUB should do the trick. In some cases (but probably not yours), there may be issues that would make this fail, in which case even more awkward hoop-jumping would be required.

There are several alternative approaches:

I’m biased, of course, but IMHO right now rEFInd is the best way around the problem you’re experiencing. OTOH, rEFInd is not yet an official Ubuntu package (although it should be in the future; it’s now in Debian testing, and so should make it into Ubuntu eventually). It also requires some extra hoop-jumping if you want to use Secure Boot.

How to update Grub in Arch Linux

Updating Grub

The entire process of updating grub in your Arch Linux requires four ruling steps. The primary steps are 1 st two, and the last two steps support the first two steps by implanting the change. These steps encompass:

Prerequisites

The element of chief importance is the user login through the sudo user. Most of the Linux operations require you to login sudo on your server as a root user. The second requirement for the updating process of GRUB is the availability of a package manager known by the name of Pacman. It’s common to have a sudo user and Pacman in your Arch Linux server, so you don’t need some extra procedures to fulfill the requirements. It’s always better to check the prerequisites before operating on any software or update on Arch Linux.

Updating GRUB packages

You need to update the system for the latest packages that are available for your applications and software on Arch Linux. Updating GRUB packages can provide you its latest version that is available in the official repository of the Arch Linux database. Run the command of Arch Linux to sync, update and refresh the system packages through Pacman.

How to update grub. Смотреть фото How to update grub. Смотреть картинку How to update grub. Картинка про How to update grub. Фото How to update grub

To manually check the latest version of GRUB available in the repository, input the following command.

How to update grub. Смотреть фото How to update grub. Смотреть картинку How to update grub. Картинка про How to update grub. Фото How to update grub

Pacman, in this command, will reinstall the latest version of GRUB for your server. This way, you can rest assured that the package of GRUB you are going to update exists in its modified form. With this, you can conveniently proceed to edit the configuration of GRUB.

GRUB configuration

The editing in the configuration of GRUB presents various customize options to set your package as per your preferences. If you are working with more than one operating system, then use GRUB to establish the setting of your default operating system. Other customize options encompass menu timeout, background image setting, and the setting of the script for GRUB. For the operation of all these activities, GRUB has its file that needs editing to perform these operations. You can input this command with the editor to make changes in the configure file of GRUB.

How to update grub. Смотреть фото How to update grub. Смотреть картинку How to update grub. Картинка про How to update grub. Фото How to update grub

The output window displays the 54 liner details of the GRUB configuration file. You can change the background, color, GRUB timeout, and the default OS of your server by altering the values of the respective category. It’s preferable to change the value of timeout to some negative number so that you can get the unlimited menu from the package of GRUB. Once you have completed all the editing on this file, save the alterations. You can also see the details of the GRUB script in its respective repository.

GRUB customization

To customize the settings of GRUB, deploy the GRUB customizer from the official database of Arch Linux. This tool is based on the graphical interface and eases the customization activities on GRUB. Input the command to get the customizer from the Arch Linux depository.

How to update grub. Смотреть фото How to update grub. Смотреть картинку How to update grub. Картинка про How to update grub. Фото How to update grub

Now, select the customizer by searching it from the menu bar, select it, and input the root password to proceed further. You can conveniently access and customize the operationality of GRUB for list configuration, general, and appearance setting.

GRUB reloading

It is a compulsory process to update the depository of GRUB named under /boot/grub after your edition is complete. Input the following command on the terminal to reload the configuration file of GRUB after the changes.

How to update grub. Смотреть фото How to update grub. Смотреть картинку How to update grub. Картинка про How to update grub. Фото How to update grub

You can also opt for the following command to update and reload the changes previously made in the configuration file of GRUB.

How to update grub. Смотреть фото How to update grub. Смотреть картинку How to update grub. Картинка про How to update grub. Фото How to update grub

You won’t find this command on the official depository of Arch Linux, so grab it from the AUR using the server of Arch Linux. Put these commands to get the update-grub feature from AUR.

How to update grub. Смотреть фото How to update grub. Смотреть картинку How to update grub. Картинка про How to update grub. Фото How to update grub

How to update grub. Смотреть фото How to update grub. Смотреть картинку How to update grub. Картинка про How to update grub. Фото How to update grub

The first command set up the AUR installation features, and the second command deploys the update-grub package from AUR. You can apply the yay command to build the update-grub package on your Arch Linux.

How to update grub. Смотреть фото How to update grub. Смотреть картинку How to update grub. Картинка про How to update grub. Фото How to update grub

The last thing for you to perform is to input the following command to utilize the feature of update-grub.

How to update grub. Смотреть фото How to update grub. Смотреть картинку How to update grub. Картинка про How to update grub. Фото How to update grub

With this command, your GRUB will get updated on Arch Linux.

Conclusion

It’s the best choice to use the package of GRUB in the operating system of Arch Linux for system boot. Once you have complied with the steps and commands mentioned in this guide, you can rest assured about your system boot. GRUB will perform the automated function to boot the system every time you enter in your server. If you are not using GRUB, then you might face issues to boot your server. The server will send you a recommendation to boot the system using the GRUB. It can happen every time you deal with the installation of a new application.

About the author

How to update grub. Смотреть фото How to update grub. Смотреть картинку How to update grub. Картинка про How to update grub. Фото How to update grub

Younis Said

I am a freelancing software project developer, a software engineering graduate and a content writer. I love working with Linux and open-source software.

How to Update GRUB on Arch Linux

Updating GRUB package

The very first thing to do is make sure that GRUB is up-to-date. When you update the system, pacman will take care of updating GRUB to the latest version.

How to update grub. Смотреть фото How to update grub. Смотреть картинку How to update grub. Картинка про How to update grub. Фото How to update grub

If you want to manually make sure that the system has the latest version of GRUB, use the following command.

How to update grub. Смотреть фото How to update grub. Смотреть картинку How to update grub. Картинка про How to update grub. Фото How to update grub

This command will reinstall GRUB, of course. However, pacman will check for the latest version from the server and if there’s an update available, will grab and install it.

Editing GRUB configuration

GRUB allows custom configuration. You can perform a number of actions using this opportunity, for example, setting the default OS (if multiple OS is installed), GRUB menu timeout, custom background image and much more. It’s also possible to set custom scripts for GRUB.

GRUB uses its own configuration file for performing all the actions. The file is located at “/etc/default/grub”. For GRUB scripts, “/etc/grub.d” directory is used.

Edit the GRUB configuration file.

How to update grub. Смотреть фото How to update grub. Смотреть картинку How to update grub. Картинка про How to update grub. Фото How to update grub

How to update grub. Смотреть фото How to update grub. Смотреть картинку How to update grub. Картинка про How to update grub. Фото How to update grub

For example, to change the GRUB wallpaper, change the value of “GRUB_BACKGROUND” variable.

How to update grub. Смотреть фото How to update grub. Смотреть картинку How to update grub. Картинка про How to update grub. Фото How to update grub

GRUB also allows coloring the texts for easier reading.

How to update grub. Смотреть фото How to update grub. Смотреть картинку How to update grub. Картинка про How to update grub. Фото How to update grub

At the start of the file, you’ll notice “GRUB_DEFAUTL” variable. It’s used to define which OS is the default one in the bootloader.

How to update grub. Смотреть фото How to update grub. Смотреть картинку How to update grub. Картинка про How to update grub. Фото How to update grub

The next entry “GRUB_TIMEOUT” will decide how long the GRUB menu should remain open. By default, the value is 5 (seconds). If you want to unlimited GRUB menu show, set the value to any negative integer.

How to update grub. Смотреть фото How to update grub. Смотреть картинку How to update grub. Картинка про How to update grub. Фото How to update grub

Once editing is complete, save the file.

How to update grub. Смотреть фото How to update grub. Смотреть картинку How to update grub. Картинка про How to update grub. Фото How to update grub

Let’s check out the GRUB script directory.

How to update grub. Смотреть фото How to update grub. Смотреть картинку How to update grub. Картинка про How to update grub. Фото How to update grub

GRUB customizer

This is a very helpful tool that allows easier customization of various GRUB settings. It’s a graphical tool and available directly from the Arch Linux repository.

How to update grub. Смотреть фото How to update grub. Смотреть картинку How to update grub. Картинка про How to update grub. Фото How to update grub

Start “grub-customizer” from the menu.

How to update grub. Смотреть фото How to update grub. Смотреть картинку How to update grub. Картинка про How to update grub. Фото How to update grub

It’ll require the root password to start. After all, you’re calling a tool to perform system-level changes.

How to update grub. Смотреть фото How to update grub. Смотреть картинку How to update grub. Картинка про How to update grub. Фото How to update grub

Every single option of the tool is simple and self-explanatory.

How to update grub. Смотреть фото How to update grub. Смотреть картинку How to update grub. Картинка про How to update grub. Фото How to update grub

How to update grub. Смотреть фото How to update grub. Смотреть картинку How to update grub. Картинка про How to update grub. Фото How to update grub

How to update grub. Смотреть фото How to update grub. Смотреть картинку How to update grub. Картинка про How to update grub. Фото How to update grub

Reload GRUB

After making all the changes, it’s necessary to update the GRUB cfg file at the “/boot/grub” directory. Run the following command after making any change to GRUB’s configuration file.

How to update grub. Смотреть фото How to update grub. Смотреть картинку How to update grub. Картинка про How to update grub. Фото How to update grub

If you’re not interested in running this lengthy command, you can use the “update-grub”. It’s a script that runs the previously mentioned command. However, it’s not available on the Arch Linux official directory. “update-grub” has to be grabbed from AUR.

How to update grub. Смотреть фото How to update grub. Смотреть картинку How to update grub. Картинка про How to update grub. Фото How to update grub

Prepare your system for building and installing AUR packages.

How to update grub. Смотреть фото How to update grub. Смотреть картинку How to update grub. Картинка про How to update grub. Фото How to update grub

Grab “update-grub” from AUR.

How to update grub. Смотреть фото How to update grub. Смотреть картинку How to update grub. Картинка про How to update grub. Фото How to update grub

Start building “update-grub”.

How to update grub. Смотреть фото How to update grub. Смотреть картинку How to update grub. Картинка про How to update grub. Фото How to update grub

How to update grub. Смотреть фото How to update grub. Смотреть картинку How to update grub. Картинка про How to update grub. Фото How to update grub

Note: For easier AUR access, it’s recommended to use a suitable AUR helper. AUR helpers can automate the entire task. Learn how to use AUR.

How to update grub. Смотреть фото How to update grub. Смотреть картинку How to update grub. Картинка про How to update grub. Фото How to update grub

Once the installation is complete, you can directly call “update-grub” to do the job.

Final thoughts

GRUB is the most popular bootloader for all the Linux distros. It can work with other OS as well. For taking full control over the boot process, it’s necessary to have knowledge on manipulating GRUB configurations and updating GRUB properly.

About the author

How to update grub. Смотреть фото How to update grub. Смотреть картинку How to update grub. Картинка про How to update grub. Фото How to update grub

Sidratul Muntaha

Student of CSE. I love Linux and playing with tech and gadgets. I use both Ubuntu and Linux Mint.

Ubuntu Documentation

GRUB 2 is the default boot loader for Ubuntu. GRUB 2’s method of building the GRUB menu is vastly different from GRUB 0.97. This page describes the new file structure and details how to the user can change the default settings used to create the boot menu.

Introduction

File Structure

GRUB 2 incorporates a totally revised directory and file hierarchy. The menu.lst of GRUB legacy is no longer used.

To find out where GRUB 2 is installed, the user can run the following commands:

    From the GRUB 2 menu at boot, the user can also determine which Ubuntu is controlling the boot on a multi-OS system. By default, the first menuentry always lists an option from the installation which is in charge of GRUB 2. For example, if the first menuentry contains «on sda5, then the GRUB installed on sda5 OS is controlling the menu/boot.

    Main Directories & Files

    The Menu: /boot/grub/grub.cfg

    grub.cfg is the file which replaced GRUB 0.97’s menu.lst. This file contains the GRUB 2 menu information but unlike GRUB’s menu.lst the grub.cfg file is not normally edited directly. The file is the result of various scripts which build the menu in sections, with each script responsible for a specific part of the menu.

      grub.cfg is updated by running the update-grub command as root.

        The update-grub command is a stub for

          If the user wishes to create a boot menu with a different name or path, use the full command with the -o switch.

          grub.cfg is automatically rebuilt with kernel installations/removals, updates to some GRUB 2 packages, when update-grub is executed, or when other operations would affect the boot process.

          The grub.cfg file is not created or updated when the grub-install command is run.

          File Layout

          Each section is clearly delineated with «(### BEGIN)» and references the script in the /etc/grub.d directory from which the information was generated. These sections are more fully explained in the Scripts section.

          Editing grub.cfg directly

          In the earliest versions of GRUB 2, not only was editing this file discouraged, it was made read-only even for «root». This changed and now the developers acknowledge that sometimes the user may wish to simply edit the file manually. Because of the automatic changes induced by update-grub however, manual edits are subject to being overwritten by the system.

          If grub.cfg is manually edited, here are some considerations:

            The user will need to edit the file after each running of update-grub, updates of some GRUB 2 packages, and addition or removal of the main Ubuntu’s system kernels.

            It is possible to «freeze» the current grub.cfg file by redirecting the update-grub command so that it doesn’t actually run. The versatility of GRUB 2 probably makes this option the least desirable.

            The parts of grub.cfg which the user actually sees are generated by the /etc/grub.d scripts. The user can make one or more of those scripts non-executable and substitute a custom entry or edit the actual script. Either method allows menu customization while still permitting the system to update GRUB 2.

            User Settings: /etc/default/grub

            The entries in this file can be edited by a user with administrator (root) privileges and are incorporated into grub.cfg when it is updated. This configuration file contains information formerly contained in the upper section of GRUB Legacy’s menu.lst and items contained on the end of the kernel line.

            While the most common settings are present in the default file, additional environmental settings are available for inclusion in this file. These include items such as backgrounds and themes. The pre-defined variables are contained in /usr/sbin/grub-mkconfig and can be listed using the following command:

            Common settings are detailed in the Configuring GRUB 2 section.

            Scripts: /etc/grub.d/

            The scripts in this directory are read during execution of the update-grub command and their instructions are incorporated into /boot/grub/grub.cfg.

              The placement of the menu items in the grub.cfg menu is determined by the order in which the files in this directory are run. Files with a leading numeral are executed first, beginning with the lowest number. 10_linux is run before 20_memtest, which would run before 40_custom. If files with alphabetic names exist, they are run after the numerically-named files.

              Custom menu entries can be added to the 40_custom file or in a newly created file. Based on its name, 40_custom entries by default appear at the bottom of the menu. A custom file beginning with 06_ would appear at the top of the menu since its alphanumeric sorting would place it ahead of 10_ through 40_ files.

              Only executable files generate output to grub.cfg during execution of update-grub. By default the files in the /etc/grub.d folder are executable.

              Script Descriptions

              00_header Sets environmental variables such system file locations, video settings, and previously saved entries. It also imports preferences stored in /etc/default/grub. Users normally do not need to make changes to this file.

              05_debian_theme The settings in this file set the GRUB 2 background image, text colors, selection highlighting and themes. In the absence of a splash image, this file sets a monochromatic theme for the initial menu display. Information on how to set font renderings and splash images are discussed in the Grub2/Displays community documentation page.

              10_linux Identifies kernels on the root device for the operating system in use and creates menu entries for these items. This includes the associated recovery mode option if enabled. In GRUB 1.99 and later, only the latest kernel is displayed on the main menu page, with additional kernels included in a submenu. See the Grub2/Submenus page for information on this feature.

              Note: For earlier versions of GRUB 2, all kernels residing in the boot folder are included on the main menu. To reduce the number of displayed kernels, remove the older kernels from the /boot folder or use one of the available GRUB 2 customization applications.

              20_memtest86+ Searches for /boot/memtest86+.bin and includes it as an option on the GRUB 2 boot menu. There is currently no line option to remove this entry from the menu. The display of memtest86+ can be inhibited by removing the executable bit from this file and running update-grub.

              Variables in this file determine the format of the displayed names in /boot/grub/grub.cfg and on the GRUB 2 menu. Users familiar with basic scripting can alter these variables to change the format of the displayed menu entries.

              The user can insert an entry into /etc/default/grub which disables this script (see Configuring GRUB 2). Removing the executable bit from the file will also prevent it from searching for other operating systems.

              If the script finds another Ubuntu/Linux operating system, it will attempt to use the titles contained in the 10_linux section of that installation’s grub.cfg file. If not found, the script will construct a menuentry from the actual boot information it locates.

              40_custom A template for adding custom menu entries which will be inserted into grub.cfg upon execution of the update-grub command.

                As mentioned in the introduction of this section, the name of the file determines the location of its contents in the GRUB 2 menu. As a general rule, if using numerals at the start it is advisable to allow the 00_header and 05_debian_theme scripts to be run before the first custom menu. These files contain no menuentries and thus will not interfere with a menuentry from a custom script with a lower priority.

                Configuring GRUB 2

                Configuration changes are normally made to /etc/default/grub and to the custom files located in /etc/grub.d. Any changes made directly to the /boot/grub/grub.cfg are overwritten whenever update-grub is executed either by the user or when called automatically by various system functions.

                After editing /etc/default/grub or the scripts in the /etc/grub.d folder the user should run sudo update-grub to incorporate the changes into the GRUB 2 menu.

                How to update grub. Смотреть фото How to update grub. Смотреть картинку How to update grub. Картинка про How to update grub. Фото How to update grubSome of the most common changes, such as the default OS/kernel and menu timeout, can be changed from within a GUI applications such as Grub Customizer.

                /etc/default/grub

                This file contains basic settings which would be considered normal for the user to configure. Options include the time the menu is displayed, the default OS to boot, etc. The default options included in file upon installation are only a small number of the variables which GRUB 2 can recognize. The GRUB 2 defined variables can be identified using the command previously documented in the GRUB 2 Settings section or at the end of this section.

                In addition to the defined variables, the user may introduce self-created variable(s) and use them in the scripts contained in the /etc/grub.d folder.

                Editing the File

                The grub file is a system file, therefore any editing must be done by a user with ‘Administrator/root’ privileges. The file is a simple text file and can be edited by any text editor. In Ubuntu the default text mode editor is nano and the graphical mode editor is gedit, and the file can be edited with one of the following commands. The «&» allows the terminal to be used to update GRUB 2 once the user saves the file.

                or in graphical mode

                After making changes and saving the file, the GRUB 2 menu must be updated to include the changes by running:

                Specific Entries

                This section details some of the entries available in the /etc/default/grub file. Much of this information can also be found by referring the the Gnu GRUB manual or on the system itself by running the following command:

                  GRUB_DEFAULT=0 Sets the default menu entry by menu position. The first «menuentry» in grub.cfg is 0, the second is 1, etc.

                    Note: Grub 1.99 introduces a submenu menu structure. For a menu item in a submenu, the entry becomes a two-digit entry. The first entry is the position of the submenu title in the main menu. The second entry is the position within the submenu. If the submenu is the 3rd entry in the main entry, and the user wishes to boot the first entry in the submenu, it would be designated as «2>0». See the community documentation for a fuller explanation: Grub2/Submenus.

                    GRUB_DEFAULT=»xxxx» An exact menu entry, including the quotation symbols, may also be used. In this case, location in the menu will not matter.

                      Example: GRUB_DEFAULT=»Ubuntu, Linux 2.6.31-9-generic»

                      Example (Submenu Entry): GRUB_DEFAULT=»2>Ubuntu, Linux 2.6.38-8-generic»

                      GRUB_DEFAULT=saved The information in this section applies to GRUB 1.98 and later. The «saved» entry enables the «grub-reboot» and «grub-set-default» commands to set the default OS for future boots.

                        The default OS for future boots will not be set merely by selecting an OS when booting.

                          grub-set-default Sets the default boot entry until changed.

                            The format is sudo grub-set-default X, with X being the menu entry position (starting with 0 as the first entry) or the exact menu string.

                              Example: sudo grub-set-default 3

                              grep menuentry /boot/grub/grub.cfg

                              grub-reboot This command sets the default boot entry for the next boot only. The format of the command is the same as for grub-set-default (see above).

                              GRUB_SAVEDEFAULT=

                                For this to work you must also set GRUB_DEFAULT=saved.

                                Note: Ubuntu’s version of Grub 1.99 introduced the submenu feature. Designating a default boot option located in the Previous Linux versions submenu requires special formatting. For information regarding the submenu feature, please refer to Grub2/Submenus

                                To display the menu under this condition, place a # symbol at the start of the line and ensure the GRUB_TIMEOUT setting is a positive integer.

                                If the value is set to 0, a keystatus check is performed to determine if the SHIFT key is depressed. If GRUB 2 determines the SHIFT key is depressed during the boot process, the menu will be displayed. This gives the user a method of interrupting an automatic boot which would normally not display the menu.

                                X is a positive integer (e.g. 1, 5, 10, etc)

                                GRUB_HIDDEN_TIMEOUT_QUIET=true

                                  Determines whether a countdown timer is displayed on a blank screen when using the GRUB_HIDDEN_TIMEOUT feature.

                                    true No countdown is displayed. The screen will be blank.

                                    false A counter will display on a blank screen for the duration of the GRUB_HIDDEN_TIMEOUT value.

                                    Note: There is a longstanding confirmed bug on the hidden menu feature in GRUB 1.97 to GRUB 1.99. The menu may not hide as specified in the description on this page. While editing the 30_os-prober script can fix this issue, it is beyond the scope of this page.

                                    The search line will still use UUIDs. The linux line will use the /dev/sdXY convention when this option is enabled.

                                    If using an entry that produces a «not found» message when running update-grub, try adding or changing the color bitdepth.

                                    Resolutions available to GRUB 2 can be displayed by typing videoinfo in the GRUB 2 command line. The command line is accessed by typing «c» when the main GRUB 2 menu screen is displayed.

                                    GRUB_INIT_TUNE=»480 440 1″

                                      Removing the comment symbol (#) allows GRUB 2 to play a single beep just prior to the Grub 2 menu display. More complex tunes can be designed by expanding the pitch/duration values.

                                        tempo is set once and applies to all duration settings.

                                        GRUB_DISABLE_OS_PROBER=true

                                          This entry is used to prevent GRUB from adding the results of os-prober to the menu. A value of «true» disables the os-prober check of other partitions for operating systems, including Windows, Linux, OSX and Hurd, during execution of the update-grub command. Using this option rather than removing the executable bit from the /etc/grub.d/30_os-prober file has several advantages:

                                            The setting can be easily changed while making other changes to the grub file.

                                            While both methods prevent os-prober from running and placing items in the menu display, using this setting allows the 30_os-prober script, but not the os-prober command, to run. This script enables the GRUB_HIDDEN_TIMEOUT setting and/or the ability to display a hidden menu by pressing the ESC key (depending on other settings). This functionality is lost if the 30_os-prober script is disabled by making it unexecutable.

                                            User-Assigned Variables

                                            Variables in the /etc/default/grub file are read and acted upon as needed. This allows users to add their own variables in a central location and then alter the GRUB 2 scripts to meet their needs. Keeping the user-defined variables within this file allows easier management of, and change to, those variables when desired. To add a variable, use the following format:

                                              Define and export the variable in /etc/default/grub :

                                                Establish the conditional in /etc/grub.d/30_os-prober in the 10_linux section:

                                                  Save the files and run sudo update-grub to incorporate the changes into the GRUB 2 menu.

                                                  How do I run update-grub from a LiveCD?

                                                  Okay, so I did something stupid. I was trying to clean up my Grub entries, and accidentally removed all of my Linux kernels from Grub (they’re still on the hard drive). So now, obviously, Grub doesn’t give me any way to boot into Ubuntu; I can boot into Windows just fine, but Ubuntu isn’t even listed.

                                                  So I just want to run «sudo upgrade-grub» somehow to restore Ubuntu to the list. I can boot from a LiveCD, but once there how do I run that command? (My Ubuntu installation is on sda5, by the way.)

                                                  7 Answers 7

                                                  Since you say your grub bootloader appears, but the menu is empty, I think you don’t need to reinstall grub, but rather, as you ask, run update-grub. To achieve this, you can use a Live CD, mount the relevant partitions from your hard disk, chroot into the mounted directory, and run update-grub, which should work as if you were operating on the actual hard disk.

                                                  Boot with your Live CD, selecting «Try Ubuntu without installing».

                                                  Once it boots, open a terminal (ctrl-alt-t) and mount your Ubuntu partition on /mnt. I’m assuming the Ubuntu partition is /dev/sda5, but you should determine this yourself. Let me know if you need help to do this:

                                                  Then mount a few more directories that are needed:

                                                  Also, if you have a separate Ubuntu boot partition (pretty uncommon these days, but it may be the case):

                                                  How can you tell if you have a boot partition?

                                                  Once these are mounted, do chroot to start using the mounted directory as the root partition:

                                                  Once you’ve confirmed that /boot/ contains the correct files, meaning that it is the correct location, type:

                                                  This should rebuild your /boot/grub/grub.cfg file with the menu entries.

                                                  Then exit the chroot:

                                                  Unmount the filesystems:

                                                  And then reboot, hopefully your Grub menu will be restored.

                                                  Источники информации:

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

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