Project

General

Profile

RecoveryInstallationWithHeimdall » History » Version 82

Denis 'GNUtoo' Carikli, 10/21/2020 09:21 PM
Heimdall failing when Secure Download is Enabled: convert flashing to install

1 58 Mark Matney
h1. Recovery image installation or update with Heimdall
2 1 Denis 'GNUtoo' Carikli
3 59 Mark Matney
These instructions explain how to install the [[RecoveryImage|Replicant recovery image]] to your device. This procedure is part of [[ReplicantInstallation|the larger procedure of installing Replicant]].
4 1 Denis 'GNUtoo' Carikli
5 59 Mark Matney
{{TOC}}
6 1 Denis 'GNUtoo' Carikli
7 59 Mark Matney
h2. Prerequisites
8
9
h3. Applicable devices
10
11 1 Denis 'GNUtoo' Carikli
This guide applies only to the following devices:
12 74 Denis 'GNUtoo' Carikli
* [[GalaxyS2I9100|Galaxy S II (GT-I9100)]]
13
* [[GalaxyS3I9300|Galaxy S III (GT-I9300)]]
14
* [[GalaxyS3I9305|Galaxy S III 4G (GT-I9305)]]
15
* [[GalaxyNexusI9250|Galaxy Nexus (GT-I9250)]]
16
* [[GalaxyNoteN7000|Galaxy Note (GT-N7000)]]
17
* [[GalaxyNote2N7100|Galaxy Note 2 (GT-N7100)]]
18
* [[GalaxyTab270P31xx|Galaxy Tab 2 7.0 (GT-P3100)]]
19
* [[GalaxyTab270P31xx|Galaxy Tab 2 7.0 Wi-Fi (GT-P3110)]]
20
* [[GalaxyTab2101P51xx|Galaxy Tab 2 10.1 (GT-P5100)]]
21
* [[GalaxyTab2101P51xx|Galaxy Tab 2 10.1 Wi-Fi (GT-P5110)]]
22
* [[GalaxyNote80N51xx|Galaxy Note 8.0 (GT-N5100)]]
23
* [[GalaxyNote80N51xx|Galaxy Note 8.0 Wi-Fi (GT-N5110)]]
24 1 Denis 'GNUtoo' Carikli
25 79 Denis 'GNUtoo' Carikli
If you use these instructions with a device not listed above, there is a significant risk of breaking your device up to a point where it's way too complicated to repair it. This is often refered as ""bricking" your device":https://en.wikipedia.org/wiki/Brick_(electronics) in computer Jargon.
26 1 Denis 'GNUtoo' Carikli
27 59 Mark Matney
h3. Personal computer
28
29
In order to install the recovery image on your device, it is assumed that you have a computer running a GNU/Linux operating system and everything necessary to connect your device to the computer through USB.
30
31
Moreover, it is assumed that anyone performing the installation knows how to use the command line in a terminal and has basic knowledge about it.
32 1 Denis 'GNUtoo' Carikli
33 67 Mark Matney
h2. Install heimdall
34 63 Mark Matney
35 80 Denis 'GNUtoo' Carikli
Heimdall is a free software program that is required to install the recovery image to your device.
36 71 Denis 'GNUtoo' Carikli
37 72 Denis 'GNUtoo' Carikli
If you don't already have heimdall you can use the instructions on the [[ToolsInstallation]] page to install all the required tools.
38 63 Mark Matney
39 67 Mark Matney
h2. Download the files
40 1 Denis 'GNUtoo' Carikli
41 73 Denis 'GNUtoo' Carikli
First find the section for the Replicant version you want to install. 
42 1 Denis 'GNUtoo' Carikli
43 73 Denis 'GNUtoo' Carikli
For instance if you want to install Replicant 6.0 0003, go in the [[Images#Replicant-60-0003-images|Replicant 6.0 0003 section]].
44
45
Then find the @Security@ subsection and download the GPG signing key for that release.
46
47 78 Denis 'GNUtoo' Carikli
Depending on your browser and the format of the GPG key, the GPG signing key can appear as a web page with some text that begin with "-----BEGIN PGP PUBLIC KEY BLOCK-----".
48
This is because one of the popular key format actually stores the key as encoded text as this gives various advantages.
49
In that case, you simply need to save that web page with "File"->"Save Page As".
50
51
Once the GPG signing key has been downloaded, you need to find the @Images@ subsection, and, inside it find the in the row that corresponds to your device.
52 73 Denis 'GNUtoo' Carikli
53
Inside that row, there are links to the recovery image and the corresponding signature, which are in that row under the column *Bootable/recovery*.
54
55
You need to download both files to your PC.
56
57
For example, if you want to install Replicant to a [[GalaxyS2I9100|Galaxy S II (GT-I9100)]], you will download *recovery-i9100.img* and *recovery-i9100.img.asc*.
58 61 Mark Matney
59 67 Mark Matney
h2. Check the signature of the recovery image
60 1 Denis 'GNUtoo' Carikli
61 62 Mark Matney
First, [[ReplicantReleaseKey#Retrieving-the-Replicant-release-key|add the Replicant release key to your GPG keyring]].
62
63
Then, from the command line:
64
65
# Change directories to the location of the recovery image and its signature (the location of the files may differ depending on your system setup):
66 1 Denis 'GNUtoo' Carikli
<pre>
67
cd "${HOME}/Downloads/"
68 56 Mark Matney
</pre>
69 62 Mark Matney
# Check the signature of the recovery with the following command, substituting "<yourdevice>" with your device's identifier:
70 1 Denis 'GNUtoo' Carikli
<pre>
71
gpg --verify recovery-<yourdevice>.img.asc
72
</pre>
73
74
Unless GPG reports something to the effect of a "good signature" from [[ReplicantReleaseKey#Which-key-for-which-Replicant-version|the expected key]], *do not continue*! Your downloaded files may be corrupted or compromised.
75
76 67 Mark Matney
h2. Prepare the device
77 1 Denis 'GNUtoo' Carikli
78
The next step in the installation process is to prepare the device for heimdall mode.
79
80 56 Mark Matney
# Make sure the device is completely turned off and the USB cable is disconnected from the device
81
# Remove the device's "external case":https://en.wikipedia.org/wiki/Mobile_phone_accessories#Cases or protection if it has one.
82 1 Denis 'GNUtoo' Carikli
83 68 Mark Matney
There are a few additional steps to follow, depending on which device you have.
84
85 75 Denis 'GNUtoo' Carikli
h3. Galaxy Nexus (GT-I9250)
86 1 Denis 'GNUtoo' Carikli
87 75 Denis 'GNUtoo' Carikli
If your device is the Galaxy Nexus (GT-I9250):
88 56 Mark Matney
89
# Start the device by holding the following key combination:  *Volume down, Power*.
90
# Hold the key combination until the device shows a green "Start".
91
92 76 Denis 'GNUtoo' Carikli
h3. Galaxy Tab 2
93
94
If your device is one of the following devices:
95
* Galaxy Tab 2 7.0 (GT-P3100)
96
* Galaxy Tab 2 7.0 Wi-Fi (GT-P3110)
97
* Galaxy Tab 2 10.1 (GT-P5100)
98
* Galaxy Tab 2 10.1 Wi-Fi (GT-P5110)
99
100
# Start the device by holding the following key combination:  *Volume down, Power*.
101
# Hold the key combination until the device shows a *Warning* message.
102
# Confirm that you want to download a custom OS using volume up
103
# Make sure the device is in *Downloading* mode
104
105
You can then connect the USB cable to both the computer and the device
106
107 56 Mark Matney
h3. All other devices
108
109
For all other devices:
110
111
# Start the device by holding the following key combination: *Volume down, Select, Power*,
112
# Hold the key combination until the device shows a *Warning* message.
113
# Confirm that you want to download a custom OS using volume up
114
# Make sure the device is in *Downloading* mode
115 33 Denis 'GNUtoo' Carikli
116 39 Denis 'GNUtoo' Carikli
You can then connect the USB cable to both the computer and the device
117
118 81 Denis 'GNUtoo' Carikli
h2. Install the recovery image
119 1 Denis 'GNUtoo' Carikli
120 69 Mark Matney
For instructions on installing the recovery image on your device for the first time, proceed to the section on [[RecoveryInstallationWithHeimdall#Install-the-recovery-image|installing the recovery]].
121 1 Denis 'GNUtoo' Carikli
122 69 Mark Matney
Otherwise, for instructions on updating the recovery image on your device, proceed to the section on [[RecoveryInstallationWithHeimdall#Upgrade-the-recovery-image|upgrading the recovery]].
123 1 Denis 'GNUtoo' Carikli
124 67 Mark Matney
h3. Install the recovery image
125 1 Denis 'GNUtoo' Carikli
126
When installing or upgrading Replicant, use the commands in the table below. This will make sure that the device is rebooted right into the recovery. It does that by also installing the recovery in the boot partition.
127
128 69 Mark Matney
If instead you only want to upgrade an existing recovery, use the commands in the section on [[RecoveryInstallationWithHeimdall#Upgrade-the-recovery-image|upgrading the recovery]].
129 1 Denis 'GNUtoo' Carikli
130 65 Mark Matney
Once in the recovery you can then proceed to the installation or s.
131 1 Denis 'GNUtoo' Carikli
132 65 Mark Matney
|_. Devices |_. Command for installing the recovery image |
133 1 Denis 'GNUtoo' Carikli
|_. Galaxy Nexus (I9250) |  <pre>heimdall flash --boot path/to/recovery-<yourdevice>.img --recovery path/to/recovery-<yourdevice>.img</pre> |
134
|_. Galaxy S 3 (I9300) |/5. <pre>heimdall flash --BOOT path/to/recovery-<yourdevice>.img --RECOVERY path/to/recovery-<yourdevice>.img</pre> |
135
|_. Galaxy S 3 4G (I9305) |
136
|_. Galaxy Note 2 (N7100) |
137
|_. Galaxy Note 8.0 (N5100) |
138
|_. Galaxy Note 8.0 Wi-Fi (N5110) |
139
|_. Galaxy S 2 (I9100) |/6. <pre>heimdall flash --KERNEL path/to/recovery-<yourdevice>.img --RECOVERY path/to/recovery-<yourdevice>.img</pre> |
140
|_. Galaxy Note (N7000) |
141
|_. Galaxy Tab 2 7.0 (P3100) |
142
|_. Galaxy Tab 2 7.0 Wi-Fi (P3110) |
143
|_. Galaxy Tab 2 10.1 (P5100) |
144
|_. Galaxy Tab 2 10.1 Wi-Fi (P5110) |
145 65 Mark Matney
146
If your device reboots into the recovery OS, *you have successfully installed the Replicant recovery*. Proceed with the remaining [[ReplicantInstallation|installation instructions]], or with the [[MinorVersionUpgrade|minor version upgrade instructions]] if you are upgrading an existing Replicant installation.
147
148
Otherwise, see the section on [[RecoveryInstallationWithHeimdall#Troubleshooting|troubleshooting]].
149
150 67 Mark Matney
h3. Upgrade the recovery image
151 65 Mark Matney
152
If you only want to update the recovery, without updating or installing Replicant, use the commands in the this section. This will make sure that your Replicant installation is not modified.
153
154 69 Mark Matney
If instead you are installing Replicant for the first time, use the commands in the section on [[RecoveryInstallationWithHeimdall#Install-the-recovery-image|installing the recovery]].
155 65 Mark Matney
156
The command to update the recovery depends on which device you have. See below.
157
158
h4. Galaxy Nexus (I9250)
159
160
If your device is the Galaxy Nexus (I9250):
161
162
<pre>heimdall flash --recovery path/to/recovery-<yourdevice>.img</pre>
163
164
h4. All other devices
165
166
For all other devices:
167
168
 <pre>heimdall flash --RECOVERY path/to/recovery-<yourdevice>.img</pre>
169 34 Denis 'GNUtoo' Carikli
170
h2. Troubleshooting
171
172
h3. Making sure that the device is connected in download mode
173 35 Denis 'GNUtoo' Carikli
174 34 Denis 'GNUtoo' Carikli
You can run the following command to verify if the device is in download mode:
175
<pre>
176 38 Denis 'GNUtoo' Carikli
lsusb
177 34 Denis 'GNUtoo' Carikli
</pre>
178
179
If it is you will then have one line that will be somewhat similar to that one:
180
<pre>
181
Bus 004 Device 002: ID 04e8:685d Samsung Electronics Co., Ltd GT-I9100 Phone [Galaxy S II] (Download mode)
182
</pre>
183 36 Denis 'GNUtoo' Carikli
184 37 Denis 'GNUtoo' Carikli
h3. Heimdall failing with "ERROR: Protocol initialisation failed!"
185 36 Denis 'GNUtoo' Carikli
186 77 dl lud
It is pretty easy to end up with heimdall failing like that:
187 36 Denis 'GNUtoo' Carikli
<pre>
188
Heimdall v1.4.2
189
190
Copyright (c) 2010-2017 Benjamin Dobell, Glass Echidna
191
http://www.glassechidna.com.au/
192
193
This software is provided free of charge. Copying and redistribution is
194
encouraged.
195
196
If you appreciate this software and you would like to support future
197
development please consider donating:
198
http://www.glassechidna.com.au/donate/
199
200
Initialising connection...
201
Detecting device...
202
Claiming interface...
203
Setting up interface...
204
205
Initialising protocol...
206
ERROR: Protocol initialisation failed!
207
208
Releasing device interface...
209
</pre>
210
211
In that case disconnect and reconnect the USB cable from the computer and try again.
212 54 Denis 'GNUtoo' Carikli
213
If it still fails, make sure that your computer isn't doing resource intensive tasks:
214
* Doing tasks that uses a lot your storage device (HDD, SSD, etc) can easily make the installation of the images fail.
215
216
If it still fails:
217
* Verify if your USB cable is not damaged by trying with another cable if you have one
218 1 Denis 'GNUtoo' Carikli
* Verify if your USB port is not damaged by trying with another port if you have one
219 77 dl lud
220
h3. Heimdall failing when Secure Download is Enabled
221
222
The download mode for more recent devices, like the Galaxy S III GT-I9305, may show the following message in blue:
223
<pre>
224
Secure Download : Enabled
225
</pre>
226
227 82 Denis 'GNUtoo' Carikli
This is usually not an issue, but in devices where users didn't install (yet) another recovery or distribution before, it may prevent the installation of the recovery. Heimdall will fail with errors like:
228 77 dl lud
<pre>
229
Initialising connection...
230
Detecting device...
231
libusb: error [_get_usbfs_fd] libusb couldn't open USB device /dev/bus/usb/001/028: Input/output error
232
ERROR: Failed to access device. libusb error: -1
233
</pre>
234 82 Denis 'GNUtoo' Carikli
or block during the image upload, or even appear to successfully install the recovery with no actual modification taking place.
235 77 dl lud
236
This can usually be solved with the following adb command:
237
<pre>
238
adb reboot booloader
239
</pre>
240
This command must be issued when running the installed Android system. In order to use adb you'll have to enable @Android debugging@ in the @Developer settings@.
241
242 82 Denis 'GNUtoo' Carikli
Unlike what's expected (a reboot to Download mode), this command will rather trigger a normal reboot, with the device going back to the installed Android system. After this you should power off your phone and use the key combination to enter Download mode. After that, installing images with Heimdall should work from then on.