Posts Tagged ‘grub’

Kernel boot parametres option for Super Grub2 Disk mockup

noviembre 28, 2014

Yet another mockup :).

So once you have selected which Kernel you want to from you can choose between different set of Kernel boot parametres:

  • Knoppix cheatcodes. Just in case you want to boot your installed Knoppix with those options.

    super grub2 disk boot parametres mockup knoppix

    super grub2 disk boot parametres mockup based on knoppix boot cheatcodes

  • Blacklist modules. This is very useful when trying to debug which module is making your system to crash or reboot at boot time.

    SG2D mockup - Blacklist modules

    SG2D mockup – Blacklist modules

  • Systemd target. Choose an specific systemd ‘runlevel’.

    SG2D mockup Systemd targets

    SG2D mockup Systemd targets

  • Miscelanea. Any other Kernel boot parametre.

    SG2D Kernel boot parametres mockup miscelanea

    SG2D Kernel boot parametres mockup miscelanea

  • Choose root partition. Just in case you want to try to boot your Debian GNU/Linux but trying to use Ubuntu kernel. Usually it might not work 100%, but it’s worth a try in some special circumstances.

    SG2D Boot parametre Mockup - Choose root partition

    SG2D Boot parametre Mockup – Choose root partition

I’m not interested in implementing it because I think not so many few people would use when trying to boot into their distro from Super Grub2 Disk. Maybe the blacklist option is the most useful one.

But it’s something I would maintain if I ever implemented it. Not like the Kernel box idea.

Do you use often use an specific boot parametre? Why?

Anuncio publicitario

Cloning Debian system in extra partition before update

febrero 21, 2014

My system among others has a home partition, a main Debian system and an extra Debian system. My extra Debian system is for saving current Debian Unstable just before updates or upgrades. That’s what I’m going to describe here.

So my current partition is sda4. The Debian clone partition is /dev/sda6.

The overall process is:

  • Copy system data
  • Change fstab to reflect new partition as root partition
  • Update grub

I do not install grub from Debian clone partition because I’m updating the current system and not the clone one.

In order to copy system data I need to mount the current system in a special directory so that only the sda4 partition is seen and not all of the partitions mounted in it (we do not want to copy /home).

mkdir /mnt/origen ; mount -o bind / /mnt/origen

We also need to mount the destination partition

mkdir /mnt/destino ; mount -t ext4 /dev/sda6 /mnt/destino

Now we are going to do a live copy. I’m not stopping any services because I personally do not use any of them. If this was a production server you would need to run the commands twice making sure the last time you run it you stop all the services you want to preserve previously.

rsync -aHK --delete --delete-during /mnt/origen/ /mnt/destino/

This is the most efficient way of copying the files because if the files are the same ones they are not copied… although I think Rsync in local copies does not help too much because usually all the destination file has to be read to decide to overwrite it or not. But I’m not quite sure. Anyway… let’s continue.

Now we are going to edit fstab and reinstall grub

mount -o bind /dev /mnt/destino/dev
mount -o bind /proc /mnt/destino/proc
mount -o bind /sys /mnt/destino/sys
chroot /mnt/destino/
vim /etc/fstab

Now inside fstab I’m going to replace:

/dev/sda4 /               ext4    errors=remount-ro 0       1


/dev/sda6 /               ext4    errors=remount-ro 0       1

and save the file. You might probably want to use LABELs or UUIDs instead of me.

Once we have saved it we are going to update grub:


Now we just need to exit from chroot and umount all the partitions and folders.

umount /mnt/destino/proc
umount /mnt/destino/sys
umount /mnt/destino/dev
umount /mnt/destino
umount /mnt/origen

So that’s it! If you boot your system with Super Grub2 Disk or another tool you will be able to load your grub.cfg and boot this SDA6 system without too much effort.

Now I’m ready to upgrade or update my Debian Unstable system in sda4 without fear for loosing my daily functionality because it has been cloned in sda6.

Rescatux Development: Detecting LUKS encrypted partitions

noviembre 30, 2013

I have been chatting in the rescatux irc channel with someone trying to recover its Grub. The special thing about his setup is that its root partition was a LUKS encrypted partition. I think he finally managed to recover his grub but we needed to fix a hard disk parse problem (to be fixed in Rescatux 0.31b5) and he needed to perform some commands in the command line interface.

These are some of the things you need in order to be able to access the LUKS encrypted partition as a non-encrypted partition. After these steps Rescapp script detects it ok and can do useful things with it like recovering Grub.

First of all we need cryptsetup package (Already added for inclusion in Rescatux 0.31b5).

Then I need to detect all the possible encrypted partitions. I have not managed to solve that one but I suppose that there would some cryptsomething command to so.

Then you need to lucksOpen it so that it can be seen unencrypted.

That’s made with something like:

cryptsetup luksOpen /dev/sda5 sda5_crypt

If you want to ask the passphrase to the user without using a CLI you can use zenity such as in:

zenity --entry --hide-text --text="Enter your passphrase:" \
| cryptsetup luksOpen /dev/sda5 sda5_crypt

Optionally if the partition is a VG member you need to activate it with:

vgchange -ay

And that’s it. You have probably:


ready to be used so that Rescapp uses it.

I have some questions:

  • If the Rescatux live cd has cryptsetup package installed by default would it try to luksopen it and ask the final user the passphrase at boot time?
  • How to detect which partitions are encrypted

It seems you can use:

cryptsetup luksDump /dev/sda5

and exit value gives you a clue if it’s a luks part or not.

  • Should I ask the user to decypher their partition when Rescapp starts or when a Gnu/Linux based option is used?

This encryption support will probably be implemented in Rescatux 0.32 or 0.33. In the meantime you can help me by answering these questions. 🙂


Update. Final thoughts about talking again with Anonymous semicolon: When Rescapp starts we loop in every partition doing a luksDump. If someone of them has a luks partition then luksDump is going to exit 0. If one of them is luks then ask the user if he wants to uncypher on the fly their LUKS partitions so that Rescapp can use it.

So let’s suppose that the user answer Yes. If the user click on Cancel he is saying that he skips partition uncyphering on that specific partition. If it puts the password and command exits wrong … ask again for password … till all the partition are uncyphered. Then we run vgchange -ay just in case someone has LVM partitions on it (Check later if this is a good idea if we have LVM rescue tasks).

Finally we can add a button in a new Advanced menu (or something similar) in order to «Uncypher LUKS partitions on the fly» if the user decided to decypher them later.

The problem is if the user tries to decypher partitions twice. That might pose a problem so… maybe we should check for the uncyphered device first or maybe it’s not worth coding that corner use case code.

Grub efi arrancando por defecto en REFIT

mayo 27, 2012

Desde Mac OS X editamos el fichero:

sudo nano /efi/refit/refit.conf

y modificamos para que aparezca:

default_selection 3

puesto que el arranque de BOOTX64 (Grub Efi 64 bit) a mi me aparecía en tercer lugar.

Guardamos el fichero y al reiniciar ya tendremos esa entrada por defecto.

Debuggeando el grub de Ubuntu. Enlace directo a stage2

mayo 5, 2009

Ahora me ha dado por arreglar los errores del grub de Ubuntu.

Uno de estos errores es la problemática que pasa con algunos antivirus que imposibilitan la existencia de un stage1_5 en el lugar que hay entre el final del MBR y el principio de la primera partición.

Se puede forzar el grub para que enlace del stage1 al stage2 directamente sin pasar por el stage1_5 pero para eso hay que modificar el codigo fuente.

Este el  parche para enlazar del stage1 al stage2 con el que he contribuido en

Como bien digo no lo he probado y además no es perfecto porque entre otras cosas no tiene la documentación actualizada.

Estáis invitados a probarlo :).