- Как восстановить загрузчик Windows в главной загрузочной записи (MBR) из Ubuntu
- Требования
- Загрузка в Ubuntu live USB
- Способ первый: утилита Boot Repair
- Метод второй: Syslinux
- Метод третий: LILO
- Заключение
- How to Fix Windows MBR from Ubuntu
- Requirements
- Booting into Ubuntu live USB
- Method One: Boot Repair Utility
- Method Two: Syslinux
- Method Three: LILO
- Conclusion
- 6 comments
- Popular Posts
- FIX: Windows 10 Bootloader from Linux [Quick Guide]
- How to repair Windows 10 bootloader errors from Linux
- 1. Use the Boot Repair utility on Ubuntu
- 2. Fix Windows 10 bootloader within the Terminal
- 3. Try fixing it with LILO
Как восстановить загрузчик Windows в главной загрузочной записи (MBR) из Ubuntu
Оригинал: How to Fix Windows MBR from Ubuntu
Автор: Matthew Muller
Дата публикации: 21 августа 2018 года
Перевод: А. Кривошей
Дата перевода: март 2019 г.
Если вы пытались настроить двойную загрузку Windows с Linux, то вы, вероятно, столкнулись с некоторыми изменениями, которые могут вами не приветствоваться. При установке Linux в такой среде загрузчик GRUB перезаписывает загрузчик Windows в основной загрузочной записи (MBR).
Это также верно в обратном направлении: если вы сначала установили Linux, а затем решили установить Windows, загрузчик Windows перезапишет GRUB, и вы обнаружите, что невозможно загрузить вашу систему Linux. Или, возможно, вы решили, что Linux не для вас, и хотите полностью удалить его, оставив только Windows.
Любой из этих сценариев может быть проблематичным для нового пользователя, но, к счастью есть способы восстановить загрузчик и MBR.
Примечание. В качестве дополнительной информации, который затронет многих пользователей, похоже, что Windows 10 Anniversary Update перезаписывает загрузчик как само собой разумеющееся.
Требования
Первым шагом будет скачивание и создание вашего Linux live CD или USB. Ubuntu — безусловно, самый простой и доступный дистрибутив, хотя для наших целей могут использоваться большинство дистрибутивов Linux. Используя другой компьютер, перейдите на веб-сайт Ubuntu и загрузите версию, подходящую для вашей архитектуры. Если вы сомневаетесь, возьмите 32-битную версию, так как она будет загружаться на любой машине.
Следуйте этому руководству , чтобы создать Linux live USB в Windows.
Загрузка в Ubuntu live USB
Создав свой live-носитель, необходимо загрузить компьютер с вашего носителя с Ubuntu и выбрать в загрузочном меню пункт «Try Ubuntu without installing». Если это не удается, убедитесь, что в BIOS отключена secure boot, иначе ваша система никогда не загрузится с диска Linux.
После запуска рабочего стола вам нужно будет открыть терминал, который можно найти в меню «Приложения».
Примечание: на этом этапе имейте в виду, что вы имеете дело напрямую с жестким диском, и полностью прочитайте руководство, прежде чем вносить какие-либо изменения, в противном случае вся ваша система может стать нестабильной или неработоспособной.
Безусловно, самый простой способ восстановить MBR — использовать небольшую утилиту под названием «boot-repair», а не работать непосредственно в терминале.
Способ первый: утилита Boot Repair
Во-первых, вам нужно добавить репозиторий. Введите:
После установки найдите приложение в меню «Приложения» и кликните, чтобы запустить.
После запуска утилиты выберите тип восстановления. Для большинства случаев это будет рекомендуемое восстановление.
Когда утилита завершит работу, вы сможете загрузить свою систему и выбрать либо Windows, либо Linux из меню GRUB. Запуск утилиты также позволит вам изменить или изучить некоторые другие опции, если вам требуется более сложное восстановление загрузки. Кликнув «Restore MBR», вы сможете использовать вкладку MBR.
Если вы застряли, у Ubuntu есть руководство на их сайте.
Метод второй: Syslinux
Это немного сложнее и требует от вас работы с терминалом. Если вы не уверены, то, пожалуйста, придерживайтесь первого метода.
Откройте терминал, как и раньше, и введите:
По завершении установки введите следующую команду, не забывая изменить имя диска «sda» на свое:
Кроме того, вы можете восстановить MBR, введя:
Метод третий: LILO
Загрузитесь с live CD или USB, и в терминале введите:
где «/dev/sda» — это имя вашего диска. Это должно исправить вашу MBR.
Заключение
Если вы используете двойную загрузку Windows и Linux, очень легко перезаписать MBR. Описанные выше действия должны помочь вам восстановить MBR.
How to Fix Windows MBR from Ubuntu
If you have tried to dual boot your Windows system with Linux, then you have probably encountered some changes that may not be welcome. When installing Linux in this environment, the GRUB bootloader will overwrite the Windows bootloader within the Master Boot Record (MBR).
This is also true in the reverse: If you installed Linux first and then decide to install Windows, the Windows bootloader will overwrite GRUB, and you will find there is no way to boot into your Linux Desktop. Or perhaps you have decided Linux is not for you and want to remove it entirely, leaving just Windows.
Any of these scenarios can be problematic for the new user, but thankfully with a little patience and care, there are ways to restore the bootloader, and in the process, repair the MBR.
Note: As an additional scenario that will affect a lot of users, it appears the Windows 10 Anniversary Update overwrites the bootloader as a matter of course.
Requirements
The first step will be to download and create your Linux live CD or USB. Ubuntu is by far the easiest and most accessible distribution to use, although most Linux distributions can be used for this. Using another computer, browse to the Ubuntu website and download the copy that is right for your architecture. If in doubt, grab the 32-bit version, as this will boot on any machine.
Booting into Ubuntu live USB
With your live media created, the next step is to boot your machine into Ubuntu via the BIOS and select, “Try Ubuntu without installing” from the menu. If this fails, ensure that secure boot is DISABLED in BIOS, or your system will never boot into the GRUB loader to allow a Linux selection.
Once the desktop has launched, you will need to open the Terminal which can be found within the Applications menu.
Note: at this point, be aware you are dealing with your hard disk directly, and read through the guide fully before making any changes, otherwise your entire system may become unstable or corrupted.
By far the easiest way to repair the MBR is by using a small utility called “boot-repair” as opposed to working directly in the Terminal.
Method One: Boot Repair Utility
First, you’ll need to add the repository. Type:
Once it has installed, find the application within your Applications menu and click to start.
Once the utility starts, select the repair type. For most people this will be the recommended repair.
When the utility finishes, you should be able to boot your system and select either Windows or Linux from the GRUB menu. Running the utility will also let you change or investigate some of the other options above if you require a more complex boot repair. Clicking “Restore MBR” will enable you to use the MBR tab.
If you get stuck, Ubuntu has a guide on their website.
Method Two: Syslinux
This is slightly more advanced and requires you to work with the Terminal. If you are not confident, then please stick to the first method.
Open a terminal as before and type:
Once it has finished, type the following, remembering to change the drive name “sda” as appropriate:
Alternatively, you can restore the MBR by typing:
Method Three: LILO
Boot into the live CD or USB, and within the Terminal type:
where “/dev/sda” is your drive name. This should fix your MBR.
Conclusion
If you are dual-booting Windows and Linux, it is very easy to overwrite the MBR. The above steps should help you restore your MBR. Hopefully you now have a working bootable Windows system.
Matt has worked in the tech industry for many years and is now a freelance writer. His experience is within Windows, Linux, Privacy and Android.
6 comments
“When installing Linux in this environment, the GRUB bootloader will overwrite the Windows bootloader within the Master Boot Record (MBR).
This is also true in the reverse:”
The one BIG difference is that the Linux bootloader will boot other O/Ss , including Windows while Windows bootloader will only boot Windows. Windows is very territorial and exclusive. It has always been so.
The accepted/recommended way to dual boot Windows and Linux is to install Windows first and then Linux.
Unfortunately, the instruction to install is fatally flawed.
The incorrect instruction is: sudo apt install boot-loader
The correct instruction is: sudo apt install boot-repair
I had to replace the command sudo dd if=/usr/lib/syslinux/mbr.bin of=/dev/sda
by
sudo dd if=/usr/lib/syslinux/mbr/mbr.bin of=/dev/sda
I had to replace sudo apt install boot-loader
by sudo apt install boot-repair
My problem seems that Linux overwrites
my window boot, because even I selected window in my bios, it still brings me to Ubuntu, so I can’t boot window now
Should I still stick to onethe method that run the boot repair tool in Ubuntu and restore MBR?
Thanks, note that Ubuntu 19 has syslinux directory as SYSLINUX, I made that correction and the command worked.
Comments are closed.
Popular Posts
Wi-Fi Not Working in Linux? Here’s How to Fix it
7 of the Best Linux System Cleaning Tools
How to Fix «No Route to Host» Connection Error on Linux
The Best Desktop Environments of 2021
10 of the Best Linux Debuggers for Software Engineers
How to Repair a Corrupted USB Drive in Linux
Tmux vs. Screen: Which Is the Best Terminal Multiplexer?
How to Fix the «No Space Left on Device» Error on Linux
12 of the Best Image Editors for Linux
How to Set Up and Use SSH in Linux
Affiliate Disclosure: Make Tech Easier may earn commission on products purchased through our links, which supports the work we do for our readers.
FIX: Windows 10 Bootloader from Linux [Quick Guide]
- You can quickly fix the Windows bootloader from Linux if it doesn’t work due to Windows updates.
- Use the boot repair utility which comes with Ubuntu to repair Windows boot from Linux.
- If you’re looking for a fast U buntu boot repair on Windows 10, you can do it within the terminal.
- The Linux loader is also a great way to fix the Windows boot from Linux in no time.
- Download Restoro PC Repair Tool that comes with Patented Technologies (patent available here).
- Click Start Scan to find Windows issues that could be causing PC problems.
- Click Repair All to fix issues affecting your computer’s security and performance
- Restoro has been downloaded by 0 readers this month.
Due to the aggressive and territorial nature of Windows 10, problems like this will emerge quite often. That’s why it’s advised to install Windows 10 first before installing Linux in a dual-boot mode.
Linux is much less intrusive and won’t damage Windows 10 bootloader. Despite that, things still can go wrong after major updates. If that happens, you can fix it with Linux (Ubuntu) and we offered 3 methods below.
How to repair Windows 10 bootloader errors from Linux
- Use the Boot Repair utility on Ubuntu
- Fix Windows 10 bootloader within the Terminal
- Try with LILO
1. Use the Boot Repair utility on Ubuntu
- Download Ubuntu live distro version.
- Mount it to your USB.
- You can do it with the Universal USB Installer (preferably) tool. It’s important to use this application or the drive won’t be bootable.
- Plug-in the drive and boot from it.
- Go for the Try Ubuntu without installing option.
- In case this fails, open BIOS/UEFI settings, disable Secure Boot option, and try again.
- Once Ubuntu boots, press Ctrl+Alt+T to open the Terminal.
- In the command line, run the following string and press Enter after each:
- sudo add-apt-repository ppa:yannubuntu/boot-repair
- sudo apt update
- sudo apt install boot-loader
- This should install Boot Repair application and you can now find it among the Application menu.
- Open it and choose Recommended repair and wait until it’s done.
Let’s start with the simplest method. Probably knowingly, Ubuntu comes with the small utility called Boot Repair which fixes Windows 10 bootloader corruption upon running.
What you’ll need to have is the latest version of bootable Ubuntu mounted on your USB drive. After that, you’ll need to install the utility and, without the meddling in the Terminal, repair the Windows 10 bootloader.
2. Fix Windows 10 bootloader within the Terminal
- Boot again with the bootable USB drive.
- Open Terminal.
- In the command line, type the following string and press Enter after each:
- sudo apt-get install syslinux
- sudo dd if=/usr/lib/syslinux/mbr.bin of=/dev/sda
- sudo apt-get install mbr
- sudo install-mbr -i n -p D -t 0 /dev/sda
- Don’t forget to replace sda with the Windows 10 system drive.
- Reboot after that and Windows 10 should boot without any issues.
The second method relies on the Syslinux run through the Terminal. There’s a batch of commands you’ll need to run in order to install and utilize Syslinux to fix the Windows 10 bootloader.
If you’re not familiar with the way these work, we advise you to stick to the first method. Otherwise, the steps are rather easy and you just need to replace the sda input to your Windows 10 system drive letter.
3. Try fixing it with LILO
- Boot again with the bootable USB drive.
- Open Terminal.
- In the command line, type the following string and press Enter after each:
- sudo apt-get install lilo
- sudo lilo — M/dev/sda mbr
- Reboot and you’re good to go. The Windows 10 bootloader is fixed.
The final method utilizes LILO (Linux Loader) which is a small program responsible for managing dual boot. The procedure is similar to the previous one, at least for the unaccustomed eye.
Either way, if the previous two steps weren’t working for you (the first one should resolve bootloader issues), LILO is certainly a handy alternative.
If you’re still having trouble after going through all of the solutions above, we recommend using a third-party tool that can repair your PC and keep it healthy.
With that said, we can conclude this article. Hopefully, you managed to resolve the issue with the Windows 10 bootloader. We encourage you to tell us in the comment section below.