Remova o segundo sistema operacional de disco rígido do grub

2

Anos atrás eu instalei o Ubuntu em um disco rígido no meu computador. Alguns dias atrás, após o lançamento do 18.04, comprei um ssd e reinstalei tudo nele. O disco rígido antigo ainda está vinculado ao computador - apenas para procurar coisas.

O GRUB indexa o antigo disco rígido como a opção de inicialização secundária. Mas eu nunca mais vou inicializar o sistema antigo novamente. Então, existe alguma maneira de remover o disco rígido antigo das opções do grub?

    
por chris.ribal 31.05.2018 / 07:09

3 respostas

2

Resposta curta

Se você não quer utilitários de terceiros, pode fazê-lo com um comando de movimento:

sudo mv /mnt/extra_distro/boot /mnt/extra_distro/boot.old

Então, sudo update-grub , claro.

Resposta longa

OS_Prober do Grub verifica cada unidade montada quanto à presença de /boot/* entradas de vmlinuz* e initrd.img* . Em seguida, adiciona essas opções à sua instância inicializada de grub . No meu sistema, por exemplo:

$ sudo mount-menu.sh
Mount Partition


      ┌───────────┤ Use arrow, page, home & end keys. Tab toggle option ├────────────┐
      │ NAME        FSTYPE  LABEL                    SIZE MOUNTPOINT                 │ 
      │                                                                              │ 
      │ sda                                        931.5G                           ↑│ 
      │ ├─sda4      ntfs    WINRETOOLS               450M                           ▒│ 
      │ ├─sda2                                       128M                           ▒│ 
      │ ├─sda5      ntfs    Image                   11.4G                           ▒│ 
      │ ├─sda3      ntfs    HGST_Win10               919G /mnt/d                    ▒│ 
      │ └─sda1      vfat    ESP                      500M                           ▒│ 
      │ nvme0n1                                      477G                           ▒│ 
      │ ├─nvme0n1p5 ntfs                             858M                           ▒│ 
      │ ├─nvme0n1p3                                   16M                           ▒│ 
      │ ├─nvme0n1p1 ntfs                             450M                           ▒│ 
      │ ├─nvme0n1p8 ntfs    Shared_WSL+Linux           9G /mnt/e                    ▒│ 
      │ ├─nvme0n1p6 ext4    Ubuntu18.04             23.7G                           ▮│ 
      │ ├─nvme0n1p4 ntfs    NVMe_Win10             390.4G /mnt/c                    ▒│ 
      │ ├─nvme0n1p2 vfat                              99M /boot/efi                 ▒│ 
      │ ├─nvme0n1p9 swap    Linux Swap               7.9G [SWAP]                    ▒│ 
      │ └─nvme0n1p7 ext4    NVMe_Ubuntu_16.0        44.6G /                         ↓│ 
      │                                                                              │ 
      │                                                                              │ 
      │                     <Select unmounted partition> <Exit>                      │ 
      │                                                                              │ 
      └──────────────────────────────────────────────────────────────────────────────┘ 

Eu montarei a partição do Ubuntu 18.04:

=====================================================================
Mount Device:  /dev/nvme0n1p6
Mount Name:    /mnt/mount-menu.BkLzA
File System:   ext4
ID:            Ubuntu
RELEASE:       18.04
CODENAME:      bionic
DESCRIPTION:   Ubuntu 18.04 LTS
 Size  Used Avail Use%
  24G   18G  4.7G  79%

Atualize agora grub e observe o menu:

$ sudo update-grub
$ grub-menu.sh
Grub Version: 2.02~beta2-36ubuntu3.18


        ┌─────────┤ Use arrow, page, home & end keys. Tab toggle option ├──────────┐
        │ Menu No. --------------- Menu Name ---------------                         
        │                                                                            
        │1>41 Ubuntu, with Linux 4.4.0-127-generic (recovery mode)                 ↑ 
        │1>42 Ubuntu, with Linux 3.16.53-031653-generic                            ▒ 
        │1>43 Ubuntu, with Linux 3.16.53-031653-generic (upstart)                  ▒ 
        │1>44 Ubuntu, with Linux 3.16.53-031653-generic (recovery mode)            ▒ 
        │1>44 Ubuntu, with Linux 3.16.53-031653-generic (recovery mode)            ▒ 
        │2    Windows Boot Manager (on /dev/nvme0n1p2)                             ▒ 
        │3    Ubuntu 18.04 LTS (18.04) (on /dev/nvme0n1p6)                         ▒ 
        │4    Advanced options for Ubuntu 18.04 LTS (18.04) (on /dev/nvme0n1p6)    ▒ 
        │4>0  Ubuntu (on /dev/nvme0n1p6)                                           ▒ 
        │4>1  Ubuntu, with Linux 4.15.0-22-generic (on /dev/nvme0n1p6)             ▮ 
        │4>2  Ubuntu, with Linux 4.15.0-22-generic (recovery mode) (on /dev/nvme0  ▒ 
        │4>3  Ubuntu, with Linux 4.15.0-20-generic (on /dev/nvme0n1p6)             ▒ 
        │4>4  Ubuntu, with Linux 4.15.0-20-generic (recovery mode) (on /dev/nvme0  ▒ 
        │4>5  Ubuntu, with Linux 4.14.34-041434-generic (on /dev/nvme0n1p6)        ▒ 
        │4>6  Ubuntu, with Linux 4.14.34-041434-generic (recovery mode) (on /dev/  ▒ 
        │4>7  Ubuntu, with Linux 4.14.31-041431-generic (on /dev/nvme0n1p6)        ↓ 
        │                                                                            
        │                                                                            
        │                   <Display Grub Boot>        <Exit>                        
        │                                                                          │ 
        └──────────────────────────────────────────────────────────────────────────┘ 

Observe as opções do grub:

  • 2 Gerenciador de inicialização do Windows (em / dev / nvme0n1p2)
  • 3 Ubuntu 18.04 LTS (18.04) (em / dev / nvme0n1p6)
  • 4 Opções avançadas para o Ubuntu 18.04 LTS (18.04) (em / dev / nvme0n1p6)

opção 2 queremos manter, as opções 3 e 4 que queremos desaparecer.

Então, no uso do meu sistema:

$ sudo mv /mnt/mount-menu.BkLzA/boot /mnt/mount-menu.BkLzA/boot.old
$ sudo update-grub
$ grub-menu.sh
Grub Version: 2.02~beta2-36ubuntu3.18


        ┌─────────┤ Use arrow, page, home & end keys. Tab toggle option ├──────────┐
        │ Menu No. --------------- Menu Name ---------------                       │ 
        │                                                                          │ 
        │     1>33 Ubuntu, with Linux 4.13.0-43-generic                       ↑    │ 
        │     1>34 Ubuntu, with Linux 4.13.0-43-generic (upstart)             ▒    │ 
        │     1>35 Ubuntu, with Linux 4.13.0-43-generic (recovery mode)       ▒    │ 
        │     1>36 Ubuntu, with Linux 4.9.77-040977-generic                   ▒    │ 
        │     1>37 Ubuntu, with Linux 4.9.77-040977-generic (upstart)         ▒    │ 
        │     1>38 Ubuntu, with Linux 4.9.77-040977-generic (recovery mode)   ▒    │ 
        │     1>39 Ubuntu, with Linux 4.4.0-127-generic                       ▒    │ 
        │     1>40 Ubuntu, with Linux 4.4.0-127-generic (upstart)             ▒    │ 
        │     1>41 Ubuntu, with Linux 4.4.0-127-generic (recovery mode)       ▒    │ 
        │     1>42 Ubuntu, with Linux 3.16.53-031653-generic                  ▒    │ 
        │     1>43 Ubuntu, with Linux 3.16.53-031653-generic (upstart)        ▒    │ 
        │     1>44 Ubuntu, with Linux 3.16.53-031653-generic (recovery mode)  ▒    │ 
        │     1>44 Ubuntu, with Linux 3.16.53-031653-generic (recovery mode)  ▒    │ 
        │     2    Windows Boot Manager (on /dev/nvme0n1p2)                   ▒    │ 
        │     3    Windows Boot Manager (on /dev/sda1)                        ▮    │ 
        │     4    System setup                                               ↓    │ 
        │                                                                          │ 
        │                                                                          │ 
        │                   <Display Grub Boot>        <Exit>                      │ 
        │                                                                          │ 
        └──────────────────────────────────────────────────────────────────────────┘ 

VOILA A distribuição indesejada extra não aparece mais. Note, eu li uma vez que simplesmente renomear o arquivo /mnt/extra_distro/grub/grub.cfg resolveria o problema, mas testar isso agora parece não funcionar.

    
por WinEunuuchs2Unix 01.06.2018 / 11:06
4

Eu encontrei minhas anotações sobre isso.

Edite /etc/default/grub e adicione a linha

GRUB_DISABLE_OS_PROBER=true

Saia, salve as alterações e execute

sudo update-grub

Do grub wiki (item 16)

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. This will keep grub from looking for other OS'es.

    
por Organic Marble 31.05.2018 / 16:39
0

A maneira mais fácil (GUI) é executar o grub-customizer

$ sudo add-apt-repository ppa:danielrichter2007/grub-customizer
$ sudo apt-get update
$ sudo apt-get install grub-customizer
    
por L. D. James 01.06.2018 / 07:23