Merge lp:~bcbc/wubi/lp694242 into lp:wubi

Proposed by bcbc
Status: Merged
Merged at revision: 288
Proposed branch: lp:~bcbc/wubi/lp694242
Merge into: lp:wubi
Diff against target: 67 lines (+28/-0)
3 files modified
debian/changelog (+1/-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
Reviewer Review Type Date Requested Status
Dimitri John Ledkov Pending
Review via email: mp+160268@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 XP and Windows 8).
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-r280.exe and then make a call for some community testing to confirm positive tests.

The wubi-13.04-rev280.log file contains the additional line if not using EFI:
04-22 21:51 DEBUG WindowsBackend: EFI boot = False

or if using EFI the following lines:
04-22 21:51 DEBUG WindowsBackend: EFI boot = True
...
04-22 21:51 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.

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

Subscribers

People subscribed via source and target branches

to status/vote changes: