Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have attempted to load Debian 7.7 onto my laptop, which is already running Windows 7. The installation seemed to going smoothly, except for notifications of some non-free firmware I would need. I'd finished partitioning the disc and the base system was installed. It then came to the part where I needed to load the boot loader onto the MBR. I couldn't load either lilo or grub onto the MBR. I think the notice both time was that the package had failed. I didn't know what to do next and aborted the installation. I was able to recover Windows, which wouldn't boot after the failed Debian install.
I obviously can't boot my Debian and don't know what to do next. Any help would be greatly appreciated.
You can boot into LiveCD (e.g. LinuxMint, Ubuntu or whatever else) and install grub from there.
1. mount your Debian partition somewhere ( e.g. /mnt)
2. run "grub-install --root-directory=/mnt/ /dev/sdX" where sdX is the disk that contains your Debian partition. sdX without a number at the end.
3. run "update-grub" or "grub-install -o /boot/grub/grub.cfg" (depends on what LiveCD you use)
Do not forget to create a copy of MBR. If something will go wrong, you can easily restore your current Windows boot.
dd if=/dev/sdX of=/some/safe/place/sdX.mbr bs=512 count=1
Thanks to everyone for your help. I've been able to back up my mbr to a usb, but I cannot load grub.
I tried to install GRUB with the line recommended above:
#grub-install --root-directory=/mnt/ /dev/sda
I received the following message:
Path 'mnt/boot/grub' is not readable by GRUB on boot. Installation is impossible. Aborting.
I was running a live artistX CD and was logged is as superuser at the time.
Do not forget to create a copy of MBR. If something will go wrong, you can easily restore your current Windows boot.
dd if=/dev/sdX of=/some/safe/place/sdX.mbr bs=512 count=1
FYI the MBR contains both the boot loader and the partition table which is a total of 512 bytes. The boot code is the first 446 bytes and the partition table the rest. If you are not careful you can overwrite the partition table and you could potentially lose data.
There is a known bug for your problem assuming you have more then one disk. You can also use the rescue mode of the installer. As stated you need to chroot into your root file system.
FYI the MBR contains both the boot loader and the partition table which is a total of 512 bytes. The boot code is the first 446 bytes and the partition table the rest. If you are not careful you can overwrite the partition table and you could potentially lose data.
Yes, I am aware of 446 bytes of boot code as well as of following partitions table.
When you are going to manipulate mbr, its a good idea to save partitions layout as well, just to be on the safe side, isn't it?
BTW, it is absolutely safe to put saved partitions table back to hdd unless you made changes on partitions layout.
Of course, if you made re-partitioning/resizing, you have to use only first 446 bytes.
You can find many threads where the OP has wanted to repair the boot loader via dd and screwed up the partition table.
I did it at least ten times in order to restore mbr after windows installation. It is absolutely safe, if you didn't re-partitioning on your hdd.
If someone screwed up partition table - it isn't dd issue, as well as not a 446 vs 512 bytes issue. You must think what are you doing and not stupidly copypaste suggested code.
Thanks everyone, especially Teufel. I've been able to load Grub. I couldn't load the .cfg, but after a bit of research on the net, I was able to boot both Windows and Debian from the Grub command line.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.