Recover Grub

I installed Windows 7 on my old laptop, which already had Ubuntu installed. As expected, I lost the boot manager (Grub2).
Boot from an Ubuntu live CD. In a previous post I explained how to create a live USB.
Find out the
/bootpartition (here it is/dev/sda6):ubuntu@ubuntu:~$ sudo fdisk -l /dev/sda6 3984 3996 96256 83 LinuxMount this partition
ubuntu@ubuntu:~$ sudo mkdir /media/boot ubuntu@ubuntu:~$ sudo mount /dev/sda6 /media/bootReinstall
Grububuntu@ubuntu:~$ sudo grub-install --boot-directory=/media/boot /dev/sdaRestart the computer and log in to Ubuntu.
Add Windows and all other operating systems to the grub menu
julio@julio-acer ~> sudo update-grub2 [sudo] password for julio: Generating grub.cfg … Found linux image: /boot/vmlinuz-2.6.38-8-generic-pae Found initrd image: /boot/initrd.img-2.6.38-8-generic-pae Found memtest86+ image: /memtest86+.bin Found Windows 7 (loader) on /dev/sda1 done
Links

I’m a Brazilian computer engineer based in Germany, passionate about tech, science, photography, and languages.
I’ve been programming for about two decades already, exploring everything from mobile apps and web development to machine learning. These days I focus on cloud SRE and data engineering.
I volunteer in the open source and Python communities, helping organize PyCon DE and PyData Berlin, mentoring, and contributing with code and translations.
On my blog, I share Linux tips, setup guides, and personal notes I’ve written for future reference. I hope others find them helpful as well. The content is available in multiple languages.
Browse my gallery for some of my photography.
Away from the keyboard, you’ll find me at concerts, playing clarinet, cycling, scuba diving, or exploring new places, cultures, and cuisines.
Always happy to connect! 🙂