Merge lp:~bcbc/wubi/lp694242-precise into lp:~ubuntu-installer/wubi/precise

Proposed by bcbc
Status: Needs review
Proposed branch: lp:~bcbc/wubi/lp694242-precise
Merge into: lp:~ubuntu-installer/wubi/precise
Diff against target: 69 lines (+33/-0)
3 files modified
debian/changelog (+6/-0)
src/wubi/application.py (+5/-0)
src/wubi/backends/win32/backend.py (+22/-0)
To merge this branch: bzr merge lp:~bcbc/wubi/lp694242-precise
Reviewer Review Type Date Requested Status
Dimitri John Ledkov Pending
Review via email: mp+160475@code.launchpad.net

Description of the change

This patch lets Wubi check whether Windows boots using EFI and, if so, prevents further processing.

The technique used is to examine the output of BCDEDIT for the presence of either bootmgfw.efi or winload.efi. I'm not entirely happy with this technique: ideally there would be a registry entry that is conclusive, but it works on BCDEDIT output I've seen from EFI systems ( http://ubuntuforums.org/showthread.php?t=2070760&p=12296995&viewfull=1#post12296995 )

The check is performed prior to making any changes, so there is no need to download anything or uninstall once it has been determined that Windows boots in is in EFI mode.

I have tested this patch to confirm that it installs as usual on BIOS firmware (tested on Windows 8). The same patch on 13.04 has been tested on Windows XP as well.

I haven't tested it on an EFI computer as I don't own one, but I created a test version that was identical except it searched for a string that happened to exist in my BCDEDIT output.
Ideally, we could build the wubi-r274.exe and then make a call for some community testing to confirm positive tests.

The wubi-12.04-rev274.log file contains the additional line if not using EFI:
04-23 12:10 DEBUG WindowsBackend: EFI boot = False

or if using EFI the following lines:
04-23 12:07 DEBUG WindowsBackend: EFI boot = True
...
04-23 12:08 ERROR root: Wubi does not currently support EFI

There is also a Windows popup with the message: Wubi does not currently support EFI

To post a comment you must log in.
Revision history for this message
bcbc (bcbc) wrote :

I've tested this in VMWare Player with Windows installed in EFI mode and it works as expected.

There's no cleanup, downloading, etc. It detects EFI, gives a message and quits.

Unmerged revisions

274. By bcbc

Prevent installation on EFI systems (LP: #694242)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/changelog'
--- debian/changelog 2013-04-17 12:52:58 +0000
+++ debian/changelog 2013-04-23 19:15:33 +0000
@@ -1,3 +1,9 @@
1wubi (12.04.2) precise; urgency=low
2
3 * Prevent installation on EFI systems (LP: #694242)
4
5 -- bcbc <openbcbc@gmail.com> Tue, 23 Apr 2013 11:44:12 -0700
6
1wubi (12.04.1) UNRELEASED; urgency=low7wubi (12.04.1) UNRELEASED; urgency=low
28
3 * Set kernel to vmlinuz.efi for amd64 architecture (LP: #1134770) 9 * Set kernel to vmlinuz.efi for amd64 architecture (LP: #1134770)
410
=== modified file 'src/wubi/application.py'
--- src/wubi/application.py 2011-10-06 14:59:42 +0000
+++ src/wubi/application.py 2013-04-23 19:15:33 +0000
@@ -151,6 +151,11 @@
151 log.error(message)151 log.error(message)
152 self.get_frontend().show_error_message(message)152 self.get_frontend().show_error_message(message)
153 self.quit()153 self.quit()
154 if self.info.efi:
155 message = "Wubi does not currently support EFI"
156 log.error(message)
157 self.get_frontend().show_error_message(message)
158 self.quit()
154 log.info("Running the installer...")159 log.info("Running the installer...")
155 self.frontend = self.get_frontend()160 self.frontend = self.get_frontend()
156 self.frontend.show_installation_settings()161 self.frontend.show_installation_settings()
157162
=== modified file 'src/wubi/backends/win32/backend.py'
--- src/wubi/backends/win32/backend.py 2012-02-24 07:44:21 +0000
+++ src/wubi/backends/win32/backend.py 2013-04-23 19:15:33 +0000
@@ -72,6 +72,7 @@
72 self.info.drives = self.get_drives()72 self.info.drives = self.get_drives()
73 drives = [(d.path[:2].lower(), d) for d in self.info.drives]73 drives = [(d.path[:2].lower(), d) for d in self.info.drives]
74 self.info.drives_dict = dict(drives)74 self.info.drives_dict = dict(drives)
75 self.info.efi = self.check_EFI()
7576
76 def select_target_dir(self):77 def select_target_dir(self):
77 target_dir = join_path(self.info.target_drive.path, self.info.distro.installation_dir)78 target_dir = join_path(self.info.target_drive.path, self.info.distro.installation_dir)
@@ -548,6 +549,27 @@
548 'HKEY_LOCAL_MACHINE',549 'HKEY_LOCAL_MACHINE',
549 self.info.registry_key)550 self.info.registry_key)
550551
552 def check_EFI(self):
553 efi = False
554 if self.info.bootloader == 'vista':
555 bcdedit = join_path(os.getenv('SystemDrive'), 'bcdedit.exe')
556 if not os.path.isfile(bcdedit):
557 bcdedit = join_path(os.environ['systemroot'], 'sysnative', 'bcdedit.exe')
558 if not os.path.isfile(bcdedit):
559 bcdedit = join_path(os.environ['systemroot'], 'System32', 'bcdedit.exe')
560 if not os.path.isfile(bcdedit):
561 log.error("Cannot find bcdedit")
562 return False
563 command = [bcdedit, '/enum']
564 result = run_command(command)
565 result = result.lower()
566 if "bootmgfw.efi" in result:
567 efi = True
568 if "winload.efi" in result:
569 efi = True
570 log.debug('EFI boot = %s' % efi)
571 return efi
572
551 def modify_bootloader(self, associated_task):573 def modify_bootloader(self, associated_task):
552 for drive in self.info.drives:574 for drive in self.info.drives:
553 if drive.type not in ('removable', 'hd'):575 if drive.type not in ('removable', 'hd'):

Subscribers

People subscribed via source and target branches

to all changes: