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
1=== modified file 'debian/changelog'
2--- debian/changelog 2013-04-17 12:52:58 +0000
3+++ debian/changelog 2013-04-23 19:15:33 +0000
4@@ -1,3 +1,9 @@
5+wubi (12.04.2) precise; urgency=low
6+
7+ * Prevent installation on EFI systems (LP: #694242)
8+
9+ -- bcbc <openbcbc@gmail.com> Tue, 23 Apr 2013 11:44:12 -0700
10+
11 wubi (12.04.1) UNRELEASED; urgency=low
12
13 * Set kernel to vmlinuz.efi for amd64 architecture (LP: #1134770)
14
15=== modified file 'src/wubi/application.py'
16--- src/wubi/application.py 2011-10-06 14:59:42 +0000
17+++ src/wubi/application.py 2013-04-23 19:15:33 +0000
18@@ -151,6 +151,11 @@
19 log.error(message)
20 self.get_frontend().show_error_message(message)
21 self.quit()
22+ if self.info.efi:
23+ message = "Wubi does not currently support EFI"
24+ log.error(message)
25+ self.get_frontend().show_error_message(message)
26+ self.quit()
27 log.info("Running the installer...")
28 self.frontend = self.get_frontend()
29 self.frontend.show_installation_settings()
30
31=== modified file 'src/wubi/backends/win32/backend.py'
32--- src/wubi/backends/win32/backend.py 2012-02-24 07:44:21 +0000
33+++ src/wubi/backends/win32/backend.py 2013-04-23 19:15:33 +0000
34@@ -72,6 +72,7 @@
35 self.info.drives = self.get_drives()
36 drives = [(d.path[:2].lower(), d) for d in self.info.drives]
37 self.info.drives_dict = dict(drives)
38+ self.info.efi = self.check_EFI()
39
40 def select_target_dir(self):
41 target_dir = join_path(self.info.target_drive.path, self.info.distro.installation_dir)
42@@ -548,6 +549,27 @@
43 'HKEY_LOCAL_MACHINE',
44 self.info.registry_key)
45
46+ def check_EFI(self):
47+ efi = False
48+ if self.info.bootloader == 'vista':
49+ bcdedit = join_path(os.getenv('SystemDrive'), 'bcdedit.exe')
50+ if not os.path.isfile(bcdedit):
51+ bcdedit = join_path(os.environ['systemroot'], 'sysnative', 'bcdedit.exe')
52+ if not os.path.isfile(bcdedit):
53+ bcdedit = join_path(os.environ['systemroot'], 'System32', 'bcdedit.exe')
54+ if not os.path.isfile(bcdedit):
55+ log.error("Cannot find bcdedit")
56+ return False
57+ command = [bcdedit, '/enum']
58+ result = run_command(command)
59+ result = result.lower()
60+ if "bootmgfw.efi" in result:
61+ efi = True
62+ if "winload.efi" in result:
63+ efi = True
64+ log.debug('EFI boot = %s' % efi)
65+ return efi
66+
67 def modify_bootloader(self, associated_task):
68 for drive in self.info.drives:
69 if drive.type not in ('removable', 'hd'):

Subscribers

People subscribed via source and target branches

to all changes: