IMPORTANT: Per accedir als fitxer de subversion: http://acacha.org/svn (sense password). Poc a poc s'aniran migrant els enllaços. Encara però funciona el subversion de la farga però no se sap fins quan... (usuari: prova i la paraula de pas 123456)

Consulteu també l'article GRUB que fa referència a GRUb v1 però que conté també informació important i que és comuna a les dos versions.

La principal novetat de la versió 2 és que permet uns menús d'arrancada completament gràfics.

Paquets instal·lat en una Ubuntu Jaunty (9.04):

$ dpkg -l | grep grub
ii  grub                                       0.97-29ubuntu53                           GRand Unified Bootloader
ii  grub-common                                1.96+20080724-12ubuntu2                   GRand Unified Bootloader, version 2 (common 

Fases de grub 2

Les fases per les que passa el procés d'arrancada amb GRUB són:

  1. La BIOs llegeix el IPL (fase 1) del MBR.
    1. S'executa el codi IPL del bootloader (/boot/grub/boot.img) que en el cas de Grub 2 és la fase 1, fixeu-vos que ocupa 512 bytes, el mateix que el MBR.
  2. Això executa el primer sector de la imatge principal (/boot/grub/diskboot.img), la localització d'aquest fitxer es troba guardada a algun lloc del fitxer de la fase 1 (/boot/grub/boot.img) i normalment es troba a la regió de compatibilitat de dos, és a dir a la resta de la pista 1 que no és el MBR (En sistemes duals amb Windows 7 pot ser diferent ja que aquesta secció ja no es troba lliure.) Això és el que abans era la fase 1.5
  3. Finalment s'executa la fase 2 amb l'imatge /boot/grub/core.img
  4. normal.mod executa i interpreta el fitxer de configuració de grub (típicament mostra el menú de GRUB).
$ ls -la /boot/grub/*img
-rw-r--r-- 1 root root   512 2010-12-27 09:17 /boot/grub/boot.img
-rw-r--r-- 1 root root   512 2010-12-27 09:17 /boot/grub/cdboot.img 
-rw-r--r-- 1 root root 23817 2010-12-27 09:17 /boot/grub/core.img
-rw-r--r-- 1 root root   512 2010-12-27 09:17 /boot/grub/diskboot.img
-rw-r--r-- 1 root root 10240 2010-12-27 09:17 /boot/grub/grldr.img
-rw-r--r-- 1 root root 29028 2010-12-27 09:17 /boot/grub/kernel.img
-rw-r--r-- 1 root root  1024 2010-12-27 09:17 /boot/grub/lnxboot.img
-rw-r--r-- 1 root root  1024 2010-12-27 09:17 /boot/grub/pxeboot.img

El sistema és més flexible, si us fixeu per exemple es pot precarregar la imatge pxeboot.img abans de la core.img per tal de tenir suport per a xarxa.

Instal·lació

Karmic Koala (9.10) en endavant

Sembla que ja vindrà instal·lat per defecte

Jaunty Jackalope (9.04) o anteriors

Per instal·lar

$ sudo apt-get install grub2

Apareixerà el següent missatge:

Grub2.png

Que ens indica que GRUB 2 ha trobat fitxers antics de GRUB i ens recomanen que el GRUB 2 que instal·lem s'executi des de GRUB 1 mitjançant Chain Loading (és a dir tenir GRUB 1 i GRUB 2 al mateix temps conservant el GRUB 1 al MBR). Un cop comprovem que el GRUB 2 instal·lat és correcte se'ns indica que podrem passar GRUB 2 al MBR amb la comanda:

upgrade-from-grub-legacy

El Chain Loading el farà automàticament l'instal·lador.

Ara us mostrarà un missatge sobre les opcions del kernel. Accepteu:

Grub2 1.png

Ara podeu provar el nou GRUB tornant a iniciar la màquina:

$ sudo reboot

Durant la càrrega estigueu atents per entrar al menú de GRUB (amb ESC) i trobareu una nova entrada:

Grub2 2.png

Si us dona l'error:

Error 11: Unrecognized device String

Seguiu les passes deError 11: Unrecognized device String per solucionar el problema. El resultat serà quelcom similar a:

Grub2 3.png

Si voleu fer els canvis permanents, inicieu el sistema i executeu:

$ sudo upgrade-from-grub-legacy

Installing GRUB to Master Boot Record of your first hard drive ... 

Installation finished. No error reported.
This is the contents of the device map /boot/grub/device.map.
Check if this is correct or not. If any of the lines is incorrect,
fix it and re-run the script `grub-install'.

(hd0)	/dev/sda  

GRUB Legacy has been removed, but its configuration files have been preserved,
since this script cannot determine if they contain valuable information.  If
you would like to remove the configuration files as well, use the following
command: 

  rm -f /boot/grub/menu.lst*

Canvis respecte a la versió anterior de Grub (Grub Legacy)


Temes

A la versió 1.96 encara no esta suportat. Ho estarà per la Karmic?

Vegeu:

http://grub.gibibit.com/

Notació de Grub 2

Hi ha canvis respecte Grub 1...

  • La notació del dispositiu (típicament un disc dur) és igual que a GRUB legacy. hd0 és el primer dispositiu (per exemple sda), hd1 és el segon (p. ex sdb)
  • La notació de les particions és diferent. Ara es comença a comptar des de 1

Exemples:

  • (hd0,1): és la primera partició del primer disc dur.
  • (hd0,2): és la segona partició del primer disc dur.
  • (hd1,2): és la segona partició del segon disc dur.

Consulteu també la notació de Grub 1 (Grub legacy) Grub#Notaci.C3.B3_Grub

Mòduls de grub 2

Els trobareu a la carpeta /boot/grub. Com que el MBR és molt petit com per contenir tots els mòduls de Grub 2, només el menú i algunes comandes molt bàsiques es troben al MBR. La gran part de la funcionalitat de GRUB2 es troba a /boot/grub en forma de mòduls (fitxer amb l'extensió .mod) i són inserits a mesura que és necessiten amb l'ordre insmod.

$ ls
915resolution.mod  cpuid.mod                    gcry_crc.mod        help.mod       multiboot2.mod       raid5rec.mod        ufs2.mod
acpi.mod           crc.mod                      gcry_des.mod        hexdump.mod    multiboot.mod        raid6rec.mod        uhci.mod
affs.mod           crypto.lst                   gcry_md4.mod        hfs.mod        nilfs2.mod           raid.mod            usb_keyboard.mod
afs_be.mod         crypto.mod                   gcry_md5.mod        hfsplus.mod    normal.mod           read.mod            usb.mod
afs.mod            cs5536.mod                   gcry_rfc2268.mod    iorw.mod       ntfscomp.mod         reboot.mod          usbms.mod
aout.mod           datehook.mod                 gcry_rijndael.mod   iso9660.mod    ntfs.mod             regexp.mod          usbtest.mod
ata.mod            date.mod                     gcry_rmd160.mod     jfs.mod        ohci.mod             reiserfs.mod        vbeinfo.mod
ata_pthru.mod      datetime.mod                 gcry_seed.mod       jpeg.mod       part_acorn.mod       relocator.mod       vbe.mod
at_keyboard.mod    diskboot.img                 gcry_serpent.mod    kernel.img     part_amiga.mod       scsi.mod            vbetest.mod
befs_be.mod        dm_nv.mod                    gcry_sha1.mod       keystatus.mod  part_apple.mod       search_fs_file.mod  vga.mod
befs.mod           drivemap.mod                 gcry_sha256.mod     linux16.mod    part_bsd.mod         search_fs_uuid.mod  vga_text.mod
biosdisk.mod       echo.mod                     gcry_sha512.mod     linux.mod      part_gpt.mod         search_label.mod    video_bochs.mod
bitmap.mod         efiemu32.o                   gcry_tiger.mod      lnxboot.img    partmap.lst          search.mod          video_cirrus.mod
bitmap_scale.mod   efiemu64.o                   gcry_twofish.mod    loadenv.mod    part_msdos.mod       serial.mod          video_fb.mod
blocklist.mod      efiemu.mod                   gcry_whirlpool.mod  locale         part_sun.mod         setjmp.mod          video.lst
boot.img           elf.mod                      gettext.mod         loopback.mod   part_sunpc.mod       setpci.mod          video.mod
boot.mod           example_functional_test.mod  gfxmenu.mod         lsmmap.mod     parttool.lst         sfs.mod             videotest.mod
bsd.mod            ext2.mod                     gfxterm.mod         ls.mod         parttool.mod         sleep.mod           xfs.mod
bufio.mod          extcmd.mod                   gptsync.mod         lspci.mod      password.mod         tar.mod             xnu.mod
cat.mod            fat.mod                      grldr.img           lvm.mod        password_pbkdf2.mod  terminal.lst        xnu_uuid.mod
cdboot.img         font.mod                     grub.cfg            mdraid.mod     pbkdf2.mod           terminal.mod        zfsinfo.mod
chain.mod          fshelp.mod                   grubenv             memdisk.mod    pci.mod              terminfo.mod        zfs.mod
cmostest.mod       fs.lst                       gzio.mod            memrw.mod      play.mod             test.mod
cmp.mod            functional_test.mod          halt.mod            minicmd.mod    png.mod              tga.mod
command.lst        gcry_arcfour.mod             handler.lst         minix.mod      probe.mod            trig.mod
configfile.mod     gcry_blowfish.mod            hashsum.mod         mmap.mod       pxeboot.img          true.mod
core.img           gcry_camellia.mod            hdparm.mod          moddep.lst     pxecmd.mod           udf.mod
cpio.mod           gcry_cast5.mod               hello.mod           msdospart.mod  pxe.mod              ufs1.mod  


Un dels mòduls més importants és linux.mod que té el suport per a les ordres initrd i linux. Consulteu l'apartat Grub shell per a més informació.

Grub shell

http://www.linux.com/learn/tutorials/776643-how-to-rescue-a-non-booting-grub-2-on-linux/

Cal tenir en compte que respecte a Grub 1 (Grub legacy) moltes ordres han canviat de sintaxi.

Com que el MBR és molt petit com per contenir tots els mòduls de Grub 2, només el menú i algunes comandes molt bàsiques es troben al MBR. La gran part de la funcionalitat de GRUB2 es troba a /boot/grub en forma de mòduls (fitxer amb l'extensió .mod) i són inserits a mesura que és necessiten.

La consola de Grub (Grub shell) apareix quan hi ha problemes.

Hi ha diferents consoles de shell, per exemple si us surt:

grub rescue>

Amb l'ordre:

grub rescue> set

Podeu veure com estan configurades les variables.

És un conjunt restringit de la shell normal, per intentar activar la shell "normal" de Grub:

grub rescue> set prefix=(hdX,Y)/boot/grub
grub rescue> insmod (hdX,Y)/boot/grub/normal.mod

NOTA: Vigileu que no tots els casos són iguals! Per exemple si la partició boot està separada (Proxmox, Ubuntu Server, sistemes amb LVM, etc aleshores:)

 grub rescue> set prefix=(hdX,Y)/grub

Per saber les particions possibles escriviu ls i tabuleu dos cops

grub rescue> ls    TABULEU

Si no apareixen particions LVM cal activar el mòdul LVM

grub rescue> insmod lvm

Ara:

rescue:grub> normal

Amb normal passem a la següent fase de grub que seria mostra el menú de boot típic de GRUB.

sh:grub>

En aquest últim cas vegeu com ha canviat el PROMPT, aquest prompt és el prompt de shell normal.

Anem a veure ara com es pot fer una arrencada "normal" amb ordres de Grub:

Algunes de les ordres disponibles a GRUB rescue són:

"insmod", "ls", "set" i "unset"

L'ordre ls us mostrarà les particions detectades.

El primer que cal saber és on està la partició que conté la carpeta /boot

grub rescue> set prefix=(hdX,Y)/boot/grub

on X és el número de disc físic i Y és el número de partició. Tingueu en compte que la notació de Grub 2 (GRUB_2#Notaci.C3.B3_de_Grub_2) és diferent que la de Grub 1,

Per exemple:

grub rescue> set prefix=(hd0,0)/boot/grub

Correspon a la primera partició del primer disc dur. El següent pas és inserir el modul de linux per tenir més comandes disponibles:

grub rescue> insmod (hdX,Y)/boot/grub/linux.mod

o simplement

grub rescue> insmod linu
nota: Si /boot està a una partició a part cal ometre el prefix /boot: prefix=(hdX,Y)/grub i insmod (hdX,Y)/grub/linux.mod).

Ara teniu disponibles les ordres "linux" i "initrd" que són similars a les disponibles a Grub 1, per arrancar una sistema Linux:

set root=(hd0,5)
linux /boot/vmlinuz26 root=/dev/sda5
initrd /boot/kernel26.img
boot

IMPORTANT: Noteu com ara root no és un ordre sinó una variable que s'estableix amb l'ordre set

Suport de paginació

Per activar el suport de paginació:

sh:grub> set pager=1 

Podeu consultar també GRUB#GRUB_Shell.

Grub 2 commands

Resum dels canvis:

TODO:

find is replaced with search
geometry is gone and replaced by ls
kernel (in menu.lst) is replaced by linux (and other terms for different OSs)
title (in menu.lst) is replaced by menuentry (in grub.cfg)
root is still used but is now a variable
setup is gone; the work is done by grub-install
map is replaced by drivemap
device is replaced by loopback (makes a drive out of a file)
set is a GRUB 2 term used to set a variable

Splash images

Podeu instal·lar imatges splash amb:

$ sudo apt-get install grub2-splashimages

Ara les imatges es troben a:

/usr/share/images/grub/

Les podeu copiar a la carpeta de GRUB amb:

$ sudo cp /usr/share/images/grub/*.tga /boot/grub/

A:

http://members.iinet.net/~herman546/p20/GRUB2%20Splashimages.html

Trobareu thumbnails de les imatges.

Per utilitzar-les cal editar el fitxer

$ gksu gedit /etc/grub.d/05_debian_theme

Busqueu la línia:

for i in {/boot/grub,/usr/share/images/desktop-base}/moreblue-orbit-grub.{png,tga} ; do

I canvieu-la per

for i in {/boot/grub,/usr/share/images/desktop-base}/Windbuchencom.{png,tga} ; do

On Windbuchencom és la imatge escollida. Ara executeu:

$ sudo grub-mkconfig 
Updating /boot/grub/grub.cfg …
Found Debian background: Windbuchencom.tga
Found linux image: /boot/vmlinuz-2.6.27-7-generic
Found initrd image: /boot/initrd.img-2.6.27-7-generic
Found memtest86+ image: /boot/memtest86+.bin
done

A Karmic Koala o

$ sudo update-grub
Found Debian background: Windbuchencom.tga
Updating /boot/grub/grub.cfg ...
Found linux image: /boot/vmlinuz-2.6.28-11-generic
Found initrd image: /boot/initrd.img-2.6.28-11-generic
Found memtest86+ image: /boot/memtest86+.bin
done

En versions anteriors d'Ubuntu per tal d'escriure els canvis a la configuració de GRUB.

Recursos:

Resolució de problemes

Resinstal·lar Kernels esborrats del sistema

This expanded procedure accounts for most of the complications that could occur, including problems connecting to the Internet in the chroot, not knowing which kernel package to install (before Ubuntu 12.10, it will not always be linux-image-generic), not knowing at the outset which partition or even which physical drive contains the / filesystem, and having a separate /boot partition.

I have not written this with reference to any of the other procedures here, though you will notice some similarities. I did base it, loosely, on the procedure here (though those instructions are for something quite different, I have adapted them extensively, and only some commands, not prose, are copied).

You removed all the kernel packages, and Ubuntu cannot boot without a kernel installed. So the solution is to boot from a live CD/DVD/USB, chroot into the installed system, and install a kernel in it.

   Boot from an Ubuntu live CD/DVD or live USB flash drive.
   Select Try Ubuntu (not Install Ubuntu).
   When the desktop comes up, make sure you are connected to the Internet. If you are not, connect to the Internet. One way to see if you are connected to the Internet is to open a web browser. You can even follow the rest of the instructions by bringing this Ask Ubuntu answer up in your web browser, in the live CD/DVD/USB system. I strongly recommend doing that.
   Open a Terminal window with Ctrl+Alt+T.
   In the Terminal window, run this command to list your partitions:
    sudo parted -l
   You'll see something like this (but it won't be exactly like this):
   Model: VMware, VMware Virtual S (scsi)
   Disk /dev/sda: 21.5GB
   Sector size (logical/physical): 512B/512B
   Partition Table: msdos
   Number  Start   End     Size    Type      File system     Flags
    1      1049kB  20.4GB  20.4GB  primary   ext4            boot
    2      20.4GB  21.5GB  1072MB  extended
    5      20.4GB  21.5GB  1072MB  logical   linux-swap(v1)


   Warning: Unable to open /dev/sr0 read-write (Read-only file system).  /dev/sr0
   has been opened read-only.
   Error: Can't have a partition outside the disk!
   Examine the output you got, to determine the device name of the partition that contains the / filesystem of the Ubuntu system that is installed on the hard drive (that you are repairing).
       If you only have one ext4 partition, that's the one.
       If you have more than one ext4 partition, it's probably the first one. However, if the first one is very small--less than a gigabyte--then that might be a separate /boot partition (remember that one too).
       Please note that whether or not boot is listed under Flags has very little to do with whether or not a partition is a separate /boot partition. My system, whose information is listed above, does not have a separate /boot partition.
       The device name for the partition starts with the device name for the physical drive, stated immediately after Disk in the second line. Then just add the partition number to the end of that. So, the device name for the partition that contains my / filesystem is /dev/sda1. Here are the two lines where I found that information:
       Disk /dev/sda: 21.5GB
        1      1049kB  20.4GB  20.4GB  primary   ext4            boot
       If you have more than one physical drive, you'll get more than one listing like what is shown above. But unless you have another Unix-like system installed, you probably will only have one drive that contains ext4 partitions, at least without having created them intentionally on another drive. If you do have multiple drives with ext4 partitions, then the ext4 partition that contains your / filesystem is probably on a drive that also contains a linux-swap partition.
       It's possible that your Ubuntu system's / filesystem is on a partition of type other than ext4. When this happens, it's almost always ext3, and almost always on a quite old system. It's very uncommon for this to be the case, unless you intentionally set things up this way yourself.
   Remember the device name of the partition that contained your / filesystem (or write it down). If it's different from /dev/sda1, then you'll replace /dev/sda1 with it in the steps below.
   (If it looked like you have a separate /boot partition, remember the device name for that, too.)
   Mount the / filesystem to /mnt, and mount its /dev filesystem:
   sudo mount /dev/sda1 /mnt
   sudo mount --bind /dev /mnt/dev
   Check if the broken Ubuntu system you're repairing has a separate /boot partition which must be mounted separately. (If you are sure it does not, you can skip this.)
   To check, run:
   ls /mnt/boot
   If there is output (like grub memtest86+.bin memtest86+_multiboot.bin, but not necessarily exactly that), then the broken system's /boot is on the same partition as its / and you don't have to mount anything to access it.
   But if there is no output, then you will have to mount the /boot filesystem:
   sudo mount BOOT-PARTITION /mnt/boot
   Replace BOOT-PARTITION with the device name of the /boot partition (see step 6 above).
   chroot into the broken system, mount the remaining important virtual filesystems, and set some important environment variables:
   sudo chroot /mnt
   mount -t proc none /proc
   mount -t sysfs none /sys
   mount -t devpts none /dev/pts
   export HOME=/root
   export LC_ALL=C
   Determine if Internet access works from within the chroot by pinging some reliable host that is known to respond normally to pings:
   ping -c 5 www.google.com
   You should see something like this:
   PING www.l.google.com (74.125.131.147) 56(84) bytes of data.
   64 bytes from vc-in-f147.1e100.net (74.125.131.147): icmp_req=1 ttl=44 time=61.3 ms
   64 bytes from vc-in-f147.1e100.net (74.125.131.147): icmp_req=2 ttl=44 time=62.3 ms
   64 bytes from vc-in-f147.1e100.net (74.125.131.147): icmp_req=3 ttl=44 time=61.8 ms
   64 bytes from vc-in-f147.1e100.net (74.125.131.147): icmp_req=4 ttl=44 time=63.8 ms
   64 bytes from vc-in-f147.1e100.net (74.125.131.147): icmp_req=5 ttl=44 time=66.6 ms
   --- www.l.google.com ping statistics ---
   5 packets transmitted, 5 received, 0% packet loss, time 4006ms
   rtt min/avg/max/mdev = 61.367/63.212/66.608/1.897 ms
       If it looks mostly like that, and the number before % packet loss is less than 100, then the Internet connection in the chroot is working:
       5 packets transmitted, 5 received, 0% packet loss, time 4006ms
       It's working, so you can skip step 11.
       If it looks mostly like that, and the number before % packet loss is 100, the connection needs troubleshooting. Make sure the connection on the live CD system (for example, through a web browser, or by running the same command in a separate, non-chrooted Terminal tab/window) works. Make sure you're typing the command correctly. Use www.google.com if you haven't been.
       If the output doesn't look like the above at all, but instead says ping: unknown host www.google.com, then networking isn't working yet in the chroot.
   Set up networking in the chroot. Skip this step unless you got an unknown host error in step 10 above.
   To set up networking, back up the broken system's hosts file, and copy over the live CD system's hosts and resolv.conf files. (You don't have to back up the broken system's version of resolv.conf, as that file is automatically regenerated on-the-fly.)
   Open a new Terminal tab (Ctrl+Shift+T) or, if you prefer, a new Terminal window (Ctrl+Shift+N, or just Ctrl+Alt+T). Run these commands in it:
   sudo cp /mnt/etc/hosts /mnt/etc/hosts.old
   sudo cp /etc/hosts /mnt/etc/hosts
   sudo cp /etc/resolv.conf /mnt/etc/resolv.conf
   exit
   (The exit command at the end closes the new tab/window.)
   Repeat step 10 above to make sure Internet access works now from within the chroot. It should.
   Figure out which kernel package should be installed. Usually, this will be linux-image-generic. But not always.
   If you're not sure which to install, it will depend partly on which Ubuntu release you have installed, and partly on other information. If you are not sure which Ubuntu release you have installed, find out by running this command (in the chroot, not in a separate Terminal window/tab):
   lsb_release -r
       On Ubuntu 12.10 (the next Ubuntu release, currently in development), it always will be linux-image-generic. (See this, this, and this.)
       On Ubuntu 12.04 LTS, likely possibilities are linux-image-generic and linux-image-generic-pae. (Unlike previous versions, 12.04 no longer has separate server and desktop kernels.)
           If the installed Ubuntu system (that you are fixing) is the 64-bit version, use linux-image-generic. (linux-image-generic-pae only applies to 32-bit systems.)
           It's possible to have a 32-bit Ubuntu system installed on a 32-bit or 64-bit computer. Furthermore, you might be using a 32-bit or 64-bit live CD to fix a 32-bit installed system. So if you don't know whether the installed Ubuntu system is 32-bit or 64-bit, check by running this command (in the chroot, not in a separate Terminal window/tab):
           dpkg-architecture -qDEB_HOST_ARCH_BITS
           The output will be either 32 or 64.
           (Please note that uname -m is not a correct way to find this information, because even when run in the chroot, that will tell you the architecture of the running kernel, which is the live CD system's kernel and not the installed (broken) system's kernel.)
           If the installed Ubuntu system (that you are fixing) is the 32-bit version, the best kernel to use will depend on how much RAM you have. I recommend:
               linux-image-generic if you have less than 3 GB of RAM
               linux-image-generic-pae if you have 3 GB of RAM or more.
           (This is how Ubuntu's installer chooses which one to set up, ever since the installer gained the ability to install PAE kernels. See the resolution to this bug. If you want to learn what PAE is, see this Wikipedia article. If you want to learn about PAE in Ubuntu, see this Ubuntu wiki page.)
           If you don't know how much RAM you have, run this command to find out:
           grep MemTotal /proc/meminfo
           That is listed in kilobytes. To convert to gigabytes, divide by 1,048,576 (10242).
               3 gigs = 3,145,728 kB
       On Ubuntu releases before 12.04, likely possibilities are linux-image-generic, linux-image-generic-pae, and linux-image-server.
           If you're running an Ubuntu Server system, use linux-image-server.
           Otherwise, follow the advice above for 12.04 systems.
   This is the moment you've been waiting for! Install a kernel in the broken system.
   (Like before, except where explicitly indicated otherwise, these commands are run in the chroot, not in a separate Terminal window/tab.)
   apt-get update
   apt-get -y install linux-image-generic
   Replace linux-image-generic with whatever other kernel package you decided to install in step 12 above, if different.
   If you had to perform step 11 to set up networking in the chroot, restore the old hosts file. If you skipped step 11, skip this step too.
   To restore it, run this command:
   cp /etc/hosts.old /etc/hosts
   Unmount filesystems, exiting out of the chroot:
   umount /proc || umount -lf /proc
   umount /sys /dev/pts
   exit
   sudo umount /mnt/dev /mnt
   Shut down the live CD/DVD/USB system, removing the live CD/DVD or USB flash drive. Boot into the system installed on the hard drive, that you just repaired. You've installed a kernel package in it (and as part of the installation, the kernel it provides will be added back to the GRUB2 boot menu). If everything worked correctly, your system should boot without problems. (I think it's possible that it will take a little longer to boot than usual, this time.)

I did test the above procedure, of course. (And I have used essentially the same procedure in the past.) But I did not test it on every possible Ubuntu system, so it is possible there is a mistake in it that I have not identified. If you experience problems, please comment.

In the future, I recommend always trying to keep two kernels installed. It's good to have two in case one of them stops working for any reason (you can select the other in the GRUB2 boot menu). Plus, if you intend to keep two kernels and you accidentally uninstall one more than you meant to and reboot, you still have one left to boot from.


Recursos:

Es mostra el menú de grub sense timeout al apagar un servidor Ubuntu de forma bruta

La sol·lució temporal és posar el timeout a un valor positiu (a l'exemple 10) al fitxer /etc/grub.d/00_header:

make_timeout ()
{
    cat << EOF
if [ "\${recordfail}" = 1 ]; then
  set timeout=10
else
  set timeout=${2}
fi
EOF

A partir de la 12.10 es pot afegir el paràmetre:

GRUB_RECORDFAIL_TIMEOUT=0

Al fitxer /etc/default/grub

I cal executar:

$ sudo update-grub

Mostrar el menu de grub quan teniu un únic sistema operatiu (Ubuntu)

Cal modificar el fitxer:

$ sudo [joe]] /etc/default/grub

Cal comentar les línies:

GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true

Afegint un # al inici de la línia:

#GRUB_HIDDEN_TIMEOUT=0
#GRUB_HIDDEN_TIMEOUT_QUIET=true

Assegureu-vos també que teniu un valo de GRUB_TIMEOUT diferent de 0 (nombre de segons que teniu per escollir una opció del menú).

NO oblideu de fer:

$ sudo update-grub

Per tal d'aplicar els canvis.


No detecta correctament kopt del grub anterior?

Error 11: Unrecognized device String

Presioneu qualsevol tecla per tal de continuar. Seleccioneu la opció:

Chainload into GRUB 2

Pressioneu la tecla e per tal d'editar-la. Seleccioneu la opció:

root xxxxxxxxxxxxxxxxxxxx

On xxxxxxxxxxxxxxxxxxxx és el UUID del vostre disc dur. Torneu a editar premen la tecla e. Canvieu root per uuid:

uuid xxxxxxxxxxxxxxxxxx

I ara executeu b per iniciar amb els nous canvis. Per fer aquests canvis permanents cal editar el fitxer /boot/grub/menu.lst.

Recursos:

Vegeu també

Enllaços externs