Skip to content

Commit 2105211

Browse files
ahoneybunbrandonbaez7
and
brandonbaez7
authored
Redo bootloader (#1198)
* Reorder article and update sections * Update notes about BIOS installs * Fix header for encrypted disk * Add Pop!_OS GRUB steps and fix lint issue * Address feedback * Update bootloader.md Removed > on line 85 to (hopefully) fix markdown failure. --------- Co-authored-by: brandonbaez7 <[email protected]>
1 parent 64fccef commit 2105211

File tree

1 file changed

+121
-67
lines changed

1 file changed

+121
-67
lines changed

content/bootloader.md

+121-67
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ A bootloader takes care of getting the operating system started up. It is also r
2121

2222
### Important Note
2323

24-
If you need to configure grub-pc (for example, after an update), installing GRUB to all devices will break GRUB. You will need to install to `/dev/sda` _not_ `/dev/sda1`.
24+
If you need to configure grub-pc (for example, after an update), installing GRUB to all devices will break GRUB. You will need to install to `/dev/sda` or `/dev/nvme0n1` _not_ `/dev/sda1` or `/dev/nvme0n1p1`.
2525

2626
On a fresh install of Pop!_OS 18.04 and newer, <u>systemd-boot</u> is used rather than the <u>GRUB</u> bootloader. The following instructions only apply to systems using the GRUB bootloader, otherwise refer to the <u>systemd-boot</u> section of this article.
2727

@@ -33,11 +33,7 @@ Please see our instructions for making a live disk of Pop!_OS [here](/articles/l
3333
3434
### Boot from Live Disk
3535

36-
Once you have the disk made, reboot your system. You'll need to tell the computer to boot from the live disk. When you see the System76 logo on the screen, press and hold the appropriate key for your system:
37-
38-
Laptops | Desktops
39-
-------- | --------
40-
Hold <kbd>Esc</kbd>, <kbd>F7</kbd>, or <kbd>F1</kbd> | Hold <kbd>F8</kbd>, <kbd>F10</kbd>, or <kbd>F12</kbd>
36+
Once you have the disk made, reboot your system. You'll need to tell the computer to boot from the live disk. When you see the System76 logo on the screen, press and hold the appropriate key for your system based on this [article](/articles/boot-menu).
4137

4238
Use the arrow keys and Enter key to select the live disk from the boot menu.
4339

@@ -68,13 +64,29 @@ Pop!_OS 20.04 LTS
6864
4 496GB 500GB 4295MB linux-swap(v1) swap
6965
```
7066

71-
---
67+
Ubuntu 22.04 LTS
7268

73-
## How to tell if your system is EFI-based or legacy boot
69+
```
70+
Number Start End Size File system Name Flags
71+
1 1047kB 538MB 537MB fat32 EFI System Partition boot, esp
72+
2 538MB 496GB 491GB ext4
73+
```
74+
75+
Pop!_OS 22.04 LTS
7476

75-
## systemd-boot
77+
```
78+
Number Start End Size File system Name Flags
79+
1 2097kB 524MB 522MB fat32 boot, esp
80+
2 524MB 4819MB 4295MB fat32 recovery msftdata
81+
3 4819MB 496GB 491GB ext4 root
82+
4 496GB 500GB 4295MB linux-swap(v1) swap
83+
```
7684

77-
### EFI Boot
85+
**NOTE:** A BIOS install of Pop!\_OS will not have a Recovery Partition and the Flags for the Boot Partition will not note esp.
86+
87+
---
88+
89+
## How to tell if your system is EFI-based or legacy boot
7890

7991
Most computers sold after 2014 use UEFI mode. If `boot, esp` is listed under `flags` in the earlier `parted` output, then the system is installed in UEFI mode. You can also use this command to verify that your OS is installed in UEFI mode:
8092

@@ -90,11 +102,29 @@ Installed in UEFI mode
90102
support@pop-os:~$
91103
```
92104

93-
Additionally, if `bios_grub` is listed under `flags`, the system is installed in legacy BIOS mode.
105+
Additionally, if `esp` is not listed under `flags` for the Boot Partition, the system is installed in legacy BIOS mode.
94106

95107
### EFI Boot - Pop!_OS (systemd-boot)
96108

97-
If the echo command at the beginning of this page says that the OS is installed in EFI mode **and** you are using Pop!_OS, follow this section. Please note that if you have an encrypted disk, you will need to first unlock it as described below.
109+
If the echo command at the beginning of this page says that the OS is installed in EFI mode **and** you are using Pop!_OS, follow this section. Please note that if you have an encrypted disk, you will need to first unlock it as described below. Running the command below will let us know if the drive is encrypted:
110+
111+
```bash
112+
sudo cryptsetup luksDump /dev/nvme0n1p3
113+
```
114+
115+
or
116+
117+
```bash
118+
sudo cryptsetup luksDump /dev/sda3
119+
```
120+
121+
If you get the output below then you do not need to decrypt the drive first:
122+
123+
```
124+
Device /dev/nvme0n1p3 or /dev/sda3 is not a valid LUKS device.
125+
```
126+
127+
If it is a valid LUKS device then follow these [steps](/articles/bootloader#encrypted-disk) to decrypt the drive first.
98128

99129
First, we need to mount the OS partitions. Run these commands based on what type of disk you have:
100130

@@ -103,7 +133,7 @@ First, we need to mount the OS partitions. Run these commands based on what type
103133
| `sudo mount /dev/nvme0n1p3 /mnt` | `sudo mount /dev/sda3 /mnt` |
104134
| `sudo mount /dev/nvme0n1p1 /mnt/boot/efi` | `sudo mount /dev/sda1 /mnt/boot/efi` |
105135

106-
If you are using a non-default partitioning scheme (such as a dual boot), replace `nvme0n1p3` or `sda3` with the Pop!_OS root partition and `nvme0n1p1` or `sda1` with the EFI system partition (ESP).
136+
>**NOTE:** If you are using a non-default partitioning scheme (such as a dual boot), replace `nvme0n1p3` or `sda3` with the Pop!_OS root partition and `nvme0n1p1` or `sda1` with the EFI system partition (ESP).
107137
108138
Then continue with the following commands for either disk type:
109139

@@ -116,46 +146,76 @@ exit
116146
sudo bootctl --path=/mnt/boot/efi install
117147
```
118148

119-
## GRUB EFI Boot
149+
### EFI Boot - Ubuntu (GRUB)
120150

121-
Most computers sold after 2014 use UEFI mode. If `boot, esp` is listed under `flags` in the `parted` output from earlier, then the system is installed in UEFI mode. You can also use this command to see if the OS is installed in UEFI mode:
151+
If the echo command at the beginning of this page says that the OS is installed in EFI mode **and** you are using Ubuntu, follow this section. Please note that if you have an encrypted disk, you will need to first unlock it as described below. Running the command below will let us know if the drive is encrypted:
122152

123153
```bash
124-
[ -d /sys/firmware/efi ] && echo "Installed in UEFI mode" || echo "Installed in Legacy mode"
154+
sudo cryptsetup luksDump /dev/nvme0n1p2
125155
```
126156

127-
Run these commands based on what type of disk you have:
157+
or
158+
159+
```bash
160+
sudo cryptsetup luksDump /dev/sda2
161+
```
162+
163+
If you get the output below then you do not need to decrypt the drive first:
164+
165+
```
166+
Device /dev/nvme0n1p2 or /dev/sda2 is not a valid LUKS device.
167+
```
168+
169+
If it is a valid LUKS device then follow these [steps](/articles/bootloader#encrypted-disk) to decrypt the drive first.
170+
171+
First, we need to mount the OS partitions. Run these commands based on what type of disk you have:
128172

129-
| NVMe Drives | SATA Drives |
130-
| :---------------------------------------- | :------------------------------------|
173+
| NVMe Drive | SATA Drive |
174+
| :---------------------------------------- | :----------------------------------- |
131175
| `sudo mount /dev/nvme0n1p2 /mnt` | `sudo mount /dev/sda2 /mnt` |
132176
| `sudo mount /dev/nvme0n1p1 /mnt/boot/efi` | `sudo mount /dev/sda1 /mnt/boot/efi` |
133177

134-
If you are using a non-default partitioning scheme (such as a dual boot), replace `nvme0n1p2` or `sda2` with the Pop!_OS root partition and `nvme0n1p1` or `sda1` with the boot partition.
178+
If you are using a non-default partitioning scheme (such as a dual boot), replace `nvme0n1p2` or `sda2` with the Ubuntu root partition and `nvme0n1p1` or `sda1` with the EFI system partition (ESP).
135179

136180
Then continue with the following commands for either disk type:
137181

138182
```bash
139183
for i in dev dev/pts proc sys run; do sudo mount -B /$i /mnt/$i; done
140184
sudo chroot /mnt
141-
apt install --reinstall grub-efi-amd64 linux-generic linux-headers-generic
185+
apt install --reinstall linux-image-generic linux-headers-generic
142186
update-initramfs -c -k all
143-
update-grub
187+
exit
188+
sudo update-grub
144189
```
145190

146-
## GRUB Legacy BIOS Boot
191+
### Legacy EFI Boot - Pop!_OS (GRUB)
147192

148-
If `bios_grub` is listed under `flags`, the system is installed in BIOS mode. You can also use this command to see if the OS is installed in BIOS mode:
193+
If the echo command at the beginning of this page says that the OS is installed in Legacy mode **and** you are using Ubuntu, follow this section. Please note that if you have an encrypted disk, you will need to first unlock it as described below. Running the command below will let us know if the drive is encrypted:
149194

150195
```bash
151-
[ -d /sys/firmware/efi ] && echo "Installed in UEFI mode" || echo "Installed in Legacy mode"
196+
sudo cryptsetup luksDump /dev/nvme0n1p3
197+
```
198+
199+
or
200+
201+
```bash
202+
sudo cryptsetup luksDump /dev/sda3
152203
```
153204

205+
If you get the output below then you do not need to decrypt the drive first:
206+
207+
```
208+
Device /dev/nvme0n1p3 or /dev/sda3 is not a valid LUKS device.
209+
```
210+
211+
If it is a valid LUKS device then follow these [steps](/articles/bootloader#encrypted-disk) to decrypt the drive first.
212+
154213
Run these commands based on what type of disk you have:
155214

156215
| NVMe Drive | SATA Drive |
157216
| :------------------------------- | :-------------------------- |
158217
| `sudo mount /dev/nvme0n1p2 /mnt` | `sudo mount /dev/sda2 /mnt` |
218+
| `sudo mount /dev/nvme0n1p1 /mnt/boot/` | `sudo mount /dev/sda1 /mnt/boot/` |
159219

160220
If you are using a non-default partitioning scheme (such as a dual boot), replace `nvme0n1p2` or `sda2` with the Pop!_OS root partition.
161221

@@ -171,80 +231,74 @@ update-initramfs -c -k all
171231
sudo update-grub
172232
```
173233

174-
### Encrypted Disk
234+
### Legacy BIOS Boot - Ubuntu (GRUB)
175235

176-
Pop!_OS supports full-disk encryption as an option by default, whereas, Ubuntu does not. If you are on Ubuntu, you likely don't need to follow this section.
177-
178-
To get access to an encrypted disk, these additional commands need to be run in order to unlock the disk. Please use the `parted` command described above to determine the correct drive and partition. The encrypted partition will typically be the largest one on the main drive.
179-
180-
| NVMe Drive | SATA Drive |
181-
| :-------------------------------------------------- | :--------------------------------------------- |
182-
| `sudo cryptsetup luksOpen /dev/nvme0n1p3 cryptdata` | `sudo cryptsetup luksOpen /dev/sda3 cryptdata` |
236+
If the echo command at the beginning of this page says that the OS is installed in Legacy mode **and** you are using Ubuntu, follow this section. Please note that if you have an encrypted disk, you will need to first unlock it as described below. Running the command below will let us know if the drive is encrypted:
183237

184238
```bash
185-
sudo lvscan
186-
sudo vgchange -ay
239+
sudo cryptsetup luksDump /dev/nvme0n1p2
187240
```
188241

189-
Take note as to what the volume group is called. Substitute the correct info into this next command. Make sure that `-root` is on the end.
190-
191-
After running the `vgchange` command, take note of what the volume group is called. Substitute the correct info into this next command. Make sure that `-root` is added to the end of the volume group name:
242+
or
192243

193244
```bash
194-
sudo mount /dev/mapper/data-root /mnt
245+
sudo cryptsetup luksDump /dev/sda2
195246
```
196247

197-
Now the existing hard drive can be accessed by going to the `/mnt` folder. To use the <u>Files</u> program, go to `+ Other Locations` -> `Computer` and then click on the `/mnt` folder.
248+
If you get the output below then you do not need to decrypt the drive first:
198249

199-
### EFI Boot - Ubuntu
250+
```
251+
Device /dev/nvme0n1p2 or /dev/sda2 is not a valid LUKS device.
252+
```
200253

201-
If the echo command above says the system is installed in EFI mode **and** you are using Ubuntu, follow this section.
254+
If it is a valid LUKS device then follow these [steps](/articles/bootloader#encrypted-disk) to decrypt the drive first.
202255

203-
First, we need to mount the OS partitions. Run these commands based on what type of disk you have (based on the ```parted``` output from your system):
256+
Run these commands based on what type of disk you have:
204257

205-
| NVMe Drives | SATA Drives |
206-
| :------------------------------------------- | :------------------------------------- |
207-
| ```sudo mount /dev/nvme0n1p2 /mnt``` | ```sudo mount /dev/sda2 /mnt``` |
208-
|```sudo mount /dev/nvme0n1p1 /mnt/boot/efi``` |```sudo mount /dev/sda1 /mnt/boot/efi```|
258+
| NVMe Drive | SATA Drive |
259+
| :------------------------------- | :-------------------------- |
260+
| `sudo mount /dev/nvme0n1p2 /mnt` | `sudo mount /dev/sda2 /mnt` |
261+
| `sudo mount /dev/nvme0n1p1 /mnt/boot/` | `sudo mount /dev/sda1 /mnt/boot/` |
209262

210-
<u>chroot</u> is a way to run commands as if the existing operating system had been booted. Once the chroot commands have been run, then package manager (<u>apt</u>) and other system level commands can be run.
263+
If you are using a non-default partitioning scheme (such as a dual boot), replace `nvme0n1p2` or `sda2` with the Pop!_OS root partition.
211264

212-
The EFI partition is usually around 512MB, and that is the partition to substitute into the next command. The Recovery partition is around 4GB.
265+
Then continue with the following commands for either disk type:
213266

214-
| NVMe Drive | SATA Drive |
215-
| :---------------------------------------- | :----------------------------------- |
216-
| `sudo mount /dev/nvme0n1p1 /mnt/boot/efi` | `sudo mount /dev/sda1 /mnt/boot/efi` |
267+
After the partitions are mounted, we'll ensure the internet settings from the OS are coped over, as well as reinstall the kernel and the bootloader.
217268

218269
```bash
219270
for i in dev dev/pts proc sys run; do sudo mount -B /$i /mnt/$i; done
220-
sudo cp -n /etc/resolv.conf /mnt/etc/
221271
sudo chroot /mnt
222272
apt install --reinstall grub-efi-amd64 linux-generic linux-headers-generic
223273
update-initramfs -c -k all
224-
update-grub
274+
sudo update-grub
225275
```
226276

227-
### Legacy BIOS Boot
277+
## Encrypted Disk
228278

229-
As mentioned above, if `bios_grub` is listed under `flags`, the system is installed in legacy BIOS mode. If this is the case, you need to follow this section to repair your bootloader.
279+
Pop!_OS supports full-disk encryption as an option by default, whereas, Ubuntu does not. If you are on Ubuntu, you likely don't need to follow this section.
230280

231-
Run these commands based on what type of disk you have:
281+
To get access to an encrypted disk, these additional commands need to be run in order to unlock the disk. Please use the `parted` command described above to determine the correct drive and partition. The encrypted partition will typically be the largest one on the main drive.
282+
283+
| NVMe Drive | SATA Drive |
284+
| :-------------------------------------------------- | :--------------------------------------------- |
285+
| `sudo cryptsetup luksOpen /dev/nvme0n1p3 cryptdata` | `sudo cryptsetup luksOpen /dev/sda3 cryptdata` |
286+
287+
```bash
288+
sudo lvscan
289+
sudo vgchange -ay
290+
```
232291

233-
| NVMe Drive | SATA Drive |
234-
| :----------------------------------- | :------------------------------ |
235-
| ```sudo mount /dev/nvme0n1p2 /mnt``` | ```sudo mount /dev/sda2 /mnt``` |
292+
Take note as to what the volume group is called. Substitute the correct info into this next command. Make sure that `-root` is on the end.
236293

237-
You now have root administrator access to your installed OS. If you are trying to either fix or undo changes that you made to the system, you now have the access to do so. Once you are done, to exit from the <u>chroot</u> and reboot the computer, run these commands:
294+
After running the `vgchange` command, take note of what the volume group is called. Substitute the correct info into this next command. Make sure that `-root` is added to the end of the volume group name:
238295

239296
```bash
240-
for i in dev dev/pts proc sys run; do sudo mount -B /$i /mnt/$i; done
241-
sudo cp -n /etc/resolv.conf /mnt/etc/
242-
sudo chroot /mnt
243-
apt install --reinstall grub-amd64 linux-generic linux-headers-generic
244-
update-initramfs -c -k all
245-
sudo update-grub
297+
sudo mount /dev/mapper/data-root /mnt
246298
```
247299

300+
Now the existing hard drive can be accessed by going to the `/mnt` folder. To use the <u>Files</u> program, go to `+ Other Locations` -> `Computer` and then click on the `/mnt` folder.
301+
248302
As your system reboots, remove the disk when prompted. The computer should now boot normally.
249303

250304
## Troubleshooting

0 commit comments

Comments
 (0)