"$d_SysMaint""Linux/grub rescue notes.txt" www.BillHowell.ca 07Feb2020 initial ********** 10Feb2020 search 'FlexNet' on the internet - kill it!! (MS-Windows shit) NYET! MatlLab might be using it! I could wipe Sector 32, and re-install later if MatLab won't work (dangerous) https://ubuntuforums.org/showthread.php?t=1661254 January 6th, 2011 #1 Virchanza, Join Date : Nov 2008 Sector 32 FlexNet Problem -- Grub A few months ago, a friend of mine had an MS-Windows PC that was riddled with viruses, and he asked me to help him out with it. So I shrunk his main MS-Windows partition and I created a partition for Ubuntu. When Grub was installing to the MBR, it said something about Sector 32 being in use by FlexNet, but it didn't say that this was a fatal error. After I installed Grub, I rebooted the PC, but I wasn't able to get Ubuntu to boot up. I eventually decided to explore the Sector 32 problem to see if that was the cause. It seems a lot of people encounter this problem but I haven't seen one solution for it on the web other than to "wipe your hard disk". Total nonsense. So I'm gonna try put together a solution in this thread. Let's take a look at the problem: A hard disk is made up of sectors. A sector on a modern hard disk is 512 bytes. The first sector is called Sector 0, and it stores the Master Boot Record. The MBR consists of: * 440 bytes for bootable code (such as Grub) * 4 bytes for the disk signature * 2 bytes of nulls * 64 bytes for the partition table * 2 bytes for the MBR signature The partition table contains the list of partitions, saying what sector they start at and what sector they finish on. You might expect the 1st partition to start at Sector 1, but actually it tends to start at Sector 63 on a lot of computers. (The 1st partition tends to start at Sector 63 because there's 63 sectors in a cylinder, and MS-DOS wanted every partition to start at a cylinder boundary). So that means there's 62 unused sectors between the MBR and the 1st partition. (To find out where your own first partition starts, do fdisk -lu /dev/sda. On modern PC's this could be all sorts of numbers because of the way recovery partitions are laid out. By the way make sure that fdisk says that the sector size is "512 bytes"... because emm... I don't know what to say if it doesn't!). It so happens that more than one program likes to make use of those 62 free sectors between the MBR and the 1st partition. Grub has 440 bytes available to it in the MBR to store its bootable code, but it wants more space than that, so it uses the space between the MBR and the 1st partition. But Grub isn't the only program that wants to use that space, a thing called FlexNet does too. FlexNet is some sort of software license manager, and according to the warning issued by Grub, it likes to store data in Sector 32. When you try to install Grub over FlexNet, Grub refuses to overwrite Sector 32 if it sees FlexNet data in it. It would be great if you could just tell Grub to overwrite Sector 32, but it provides no such facility. For me, this caused a problem and Ubuntu wouldn't boot up for me. So what's the solution to get Grub working? You don't need to go wiping your entire hard disk, you just need to wipe the area between the MBR and the 1st partition. EXTREME CAUTION ADVISED: Wiping the storage area between your MBR and the 1st partition is an inherently dangerous activity. Doing so may result in serious injury and even death. Programs which make use of this storage area, such as FlexNet, may cease to function. You willingly accept the serious risks involved. You accept as your own responsiblity any harm that comes about as a result of following this guide, even if the guide contains errors or oversights. First, make a backup of the first 63 sectors of your hard disk (i.e. the MBR along with the 62 free sectors): Code: sudo dd if=/dev/sda of=~/first_63_sectors bs=512 count=63 Trust me, back this up. No really. Do. Back it up. Seriously. You don't want to lose your partition table. Plus it's handy to have it backed up just in case you actually need that FlexNet data in future for whatever reason. Next, erase Sector 1 through Sector 62 (i.e the 62 free sectors): Code: sudo dd if=/dev/zero of=/dev/sda bs=512 count=62 seek=1 That should do it, now Sector 1 through Sector 62 should be full of zeroes. Do "grub-install" again and see what happens. I'm not sure if FlexNet stores data in sectors other than Sector 32, but that's not a problem since we've just wiped everything between the MBR and the 1st partition. If you want to target one individual sector to erase, then you can erase Sector 32 as follows: Code: sudo dd if=/dev/zero of=/dev/sda bs=512 count=1 seek=32 After I erased the FlexNet data and re-installed Grub, the PC booted up fine. If anyone sees any error in this post then please post here ASAP -- I'd hate for someone to lose data because of an error made in this guide. Last edited by Virchanza; January 6th, 2011 at 07:24 PM. +-----+ YIKES! MATLAB MIGHT USE IT! ??? same web-page : January 6th, 2011 #2, Super Master Roaster, Join Date Jun 2009, Location SW Forida, Distro Ubuntu Re: Sector 32 FlexNet Problem -- Grub It is not just Flexnet which may be part of many different windows programs. Colin Watson from the grub2 team was looking for disk signatures as the windows software kept overwriting grub2. They obviously now have a workaround for flexnet, but may not for all software. Just be aware of other windows programs also. http://linux.slashdot.org/story/10/0...B-2-Unbootable http://www.chiark.greenend.org.uk/ucgi/~cjwatson/blosxom/debian/2010-08-28-windows-applications-making-grub2-unbootable.html In Windows 7, had to remove Windows 7 DataSafe. HP ProtectTools, Dell Recovery, flexnet and a few others write into MBR meierfra. https://bugs.launchpad.net/ubuntu/+s...b2/+bug/441941 https://bugs.edge.launchpad.net/ubun...1?comments=all Some software that may use Flexnet, just so you do not lose it unless you have no need anymore for it. Adobe Photoshop, CAD/CAM, Rosetta Stone, Matlab others Last edited by oldfred; January 6th, 2011 at 08:16 PM. Reason: Some software using flexnet in windows For more info on UEFI boot install & repair - Regularly Updated : http://ubuntuforums.org/showthread.php?t=2147295 Please use Thread Tools above first post to change to [Solved] when/if answered completely. >> don't do it until I can confirm that Linux Matlab doesn't use the boot sector! ********** 07Feb2020 grub rescue after I moved partitions +-----+ https://www.linux.com/tutorials/how-rescue-non-booting-grub-2-linux/ How to Rescue a Non-booting GRUB 2 on Linux Carla Schroder, June 12, 2014 +---+ GRUB 2 Command Shell The next few commands work with both grub> and grub rescue>. The first command you should run invokes the pager, for paging long command outputs: grub> set pager=1 There must be no spaces on either side of the equals sign. Now let’s do a little exploring. Type ls to list all partitions that GRUB sees: grub> ls (hd0) (hd0,msdos2) (hd0,msdos1) What’s all this msdos stuff? That means this system has the old-style MS-DOS partition table, rather than the shiny new Globally Unique Identifiers partition table (GPT). (See Using the New GUID Partition Table in Linux (Goodbye Ancient MBR). If you’re running GPT it will say (hd0,gpt1). Now let’s snoop. Use the ls command to see what files are on your system: grub> ls (hd0,1)/ lost+found/ bin/ boot/ cdrom/ dev/ etc/ home/ lib/ lib64/ media/ mnt/ opt/ proc/ root/ run/ sbin/ srv/ sys/ tmp/ usr/ var/ vmlinuz vmlinuz.old initrd.img initrd.img.old Hurrah, we have found the root filesystem. You can omit the msdos and gpt labels. If you leave off the slash it will print information about the partition. You can read any file on the system with the cat command: grub> cat (hd0,1)/etc/issue Ubuntu 14.04 LTS n l +---+ >> Howell : grub rescue> ls (hd0) (hd0,msdos2) (hd0,msdos1) (hd1) (hd2) (fd0) grub rescue> ls (hd0,1)/ ./ ../ lost+found/ bin/ boot/ dev/ etc/ home/ lib/ lib64/ media/ mnt/ opt/ proc/ root/ run/ sbin/ srv/ sys/ tmp/ usr/ var/ initrd.img vmlinuz .config/ timeshift/ vmlinuz.old initrd.img.old grub rescue> ls (hd0,2)/ (hd0,2): Filesystem is unknown. +---+ Booting From grub-rescue> If you’re in the GRUB rescue shell the commands are different, and you have to load the normal.mod andlinux.mod modules: grub rescue> set prefix=(hd0,1)/boot/grub grub rescue> set root=(hd0,1) grub rescue> insmod normal grub rescue> normal >> I did the above, then grub automatically booted!! This was really easy. Howell didn't need the rest: +-----+ WRONG!! don't do this, just boot to linux then goto "Making Permanent Repairs" below : >> 10Feb2020 - oops, I did need it. Get grub rescue on cold boot again! I redid the above, now to continue... >> must stop LMDE boot, but what do I select to stay in grub rescue? >> skip "normal, just go to insmod linux grub rescue> insmod linux grub rescue> linux /boot/vmlinuz-3.13.0-29-generic root=/dev/sda1 >> hereI had to pick the right vmlinuz : grub rescue> ls (hd0,1)/boot >> latest version : vmlinuz-4.9.0-11-amd64 >> So I did : grub rescue> linux /boot/vmlinuz-4.9.0-11-amd64 root=/dev/sda1 >> OK grub rescue> initrd /boot/initrd.img-3.13.0-29-generic grub rescue> initrd /boot/initrd.img-4.9.0-11-amd64 >> OK Now to boot : grub rescue> normal >> Oops - it all hung up & didn't boot LMDE!! ??? Tab-completion should start working after you load both modules. +-----+ Try again, just to the "normal point". >> OK, LMDE boots Making Permanent Repairs When you have successfully booted your system, run these commands to fix GRUB permanently: # update-grub Generating grub configuration file ... Found background: /usr/share/images/grub/Apollo_17_The_Last_Moon_Shot_Edit1.tga Found background image: /usr/share/images/grub/Apollo_17_The_Last_Moon_Shot_Edit1.tga Found linux image: /boot/vmlinuz-3.13.0-29-generic Found initrd image: /boot/initrd.img-3.13.0-29-generic Found linux image: /boot/vmlinuz-3.13.0-27-generic Found initrd image: /boot/initrd.img-3.13.0-27-generic Found linux image: /boot/vmlinuz-3.13.0-24-generic Found initrd image: /boot/initrd.img-3.13.0-24-generic Found memtest86+ image: /boot/memtest86+.elf Found memtest86+ image: /boot/memtest86+.bin done >> I got similar results, just different versions, as in my attempt that got stuck above # grub-install /dev/sda Installing for i386-pc platform. Installation finished. No error reported. >> I got the warning : grub-install: warning: Sector 32 is already in use by the program 'FlexNet'; avoiding it. This software may cause boot or other problems in future. Please ask its authors not to store data in the boot track. When you run grub-install remember you’re installing it to the boot sector of your hard drive and not to a partition, so do not use a partition number like /dev/sda1. +-----+ OK, now I will cold boot to see what happens. "Close thei terminal? There is still a process running in this terminal. Closing the terminal will kill it. >> I closed the terminal anyways, and it cold booted fine th9s time. # enddoc