Skip to content

Commit 9e6433b

Browse files
committed
Add update to hfs article
1 parent 4c713e7 commit 9e6433b

1 file changed

Lines changed: 143 additions & 3 deletions

File tree

_posts/2022-11-28-mac-hfsplus-boot-partition-read-only.md

Lines changed: 143 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ categories: mac arch boot
99

1010
A few weeks ago I set up a local server to manage my 3d printer and home assistant instance with an old mac system. In order for the mac to boot properly, I needed to use HFS+ for the /boot partition. I used this excellent tutorial to do that: https://heeris.id.au/2014/ubuntu-plus-mac-pure-efi-boot/.
1111

12-
However today, after upgrading the kernel (this will matter later) and rebooting, I was left with this rather cryptic message:
12+
However today, after upgrading the kernel (this will matter later) and rebooting, I was left with this rather cryptic message:
1313

1414
```
1515
Starting systend-udevd version 252.1-2-arch
@@ -28,7 +28,7 @@ My USB keyboard wasn't recognized as well so I couldn't investigate just from th
2828
So I mount `/` and `/boot` and chroot inside. Initially everything seemed fine, but trying to run `mkinitcpio` was outputing errors that seemed to tell that something was off with the `/boot` partition. Some forum posts were telling "your boot partition isn't mounted", and I was like "but I just did". More investigation was needed. Maybe I was just using `mkinitcpio` wrong. Let's just try `pacman -S linux` because the hooks should run everything again anyway.
2929

3030
```
31-
# sudo pacman -S linux
31+
# sudo pacman -S linux
3232
warning: linux-6.0.10.arch2-1 is up to date -- reinstalling
3333
resolving dependencies...
3434
looking for conflicting packages...
@@ -38,7 +38,7 @@ Packages (1) linux-6.0.10.arch2-1
3838
Total Installed Size: 163.63 MiB
3939
Net Upgrade Size: 0.00 MiB
4040
41-
:: Proceed with installation? [Y/n]
41+
:: Proceed with installation? [Y/n]
4242
(1/1) checking keys in keyring [##################] 100%
4343
(1/1) checking package integrity [##################] 100%
4444
(1/1) loading package files [##################] 100%
@@ -73,3 +73,143 @@ Hopefully, we should be able to prevent that by running `fsck` on each boot. Tha
7373
We can do this by adding the `fsck.mode=force` kernel parameter.
7474

7575
Also, next time, actually checking the update ran successfully before rebooting will help ;)
76+
77+
# Update 2025-08-31: It happened again!
78+
79+
Three years later, and I hit the same issue during a system update. This time I saw the update fail, and thought I could fix it by running `fsck.hfsplus` and remounting the partition. Let me walk you through what happened:
80+
81+
```
82+
:: Running pre-transaction hooks...
83+
(1/3) etckeeper: pre-transaction commit
84+
[master af46571] saving uncommitted changes in /etc prior to pacman run
85+
5 files changed, 3 insertions(+), 1 deletion(-)
86+
(2/3) Removing linux initcpios...
87+
rm: cannot remove '/boot/initramfs-linux-fallback.img': Read-only file system
88+
rm: cannot remove '/boot/initramfs-linux.img': Read-only file system
89+
rm: cannot remove '/boot/vmlinuz-linux': Read-only file system
90+
error: command failed to execute correctly
91+
(3/3) Remove DKMS modules
92+
==> dkms remove --no-depmod broadcom-wl/6.30.223.271 -k 6.15.6-zen1-1-zen
93+
==> dkms remove --no-depmod broadcom-wl/6.30.223.271 -k 6.15.6-arch1-1
94+
==> depmod 6.15.6-zen1-1-zen
95+
==> depmod 6.15.6-arch1-1
96+
```
97+
98+
Let's check:
99+
100+
```
101+
❯ grep "[[:space:]]ro[[:space:],]" /proc/mounts
102+
/dev/sda1 /boot hfsplus ro,relatime,umask=22,uid=0,gid=0,nls=utf8 0 0
103+
```
104+
105+
Indeed, `/boot` is read-only. Let's try remounting it read-write:
106+
107+
```
108+
❯ sudo mount -o remount,rw /boot
109+
❯ grep "[[:space:]]ro[[:space:],]" /proc/mounts
110+
/dev/sda1 /boot hfsplus ro,relatime,umask=22,uid=0,gid=0,nls=utf8 0 0
111+
```
112+
113+
Still read-only? Indeed we can see this in the dmesg output (which didn't contain anything related to hfs prior to the mount command):
114+
115+
```
116+
❯ sudo dmesg | grep hfs
117+
[2686028.481168] hfsplus: filesystem was not cleanly unmounted, running fsck.hfsplus is recommended. leaving read-only.
118+
```
119+
120+
Seems like the same issue as last time. Let's run `fsck.hfsplus`:
121+
```
122+
❯ sudo fsck.hfsplus /dev/sda1
123+
** /dev/sda1
124+
Executing fsck_hfs (version 540.1-Linux).
125+
** Checking non-journaled HFS Plus Volume.
126+
The volume name is Arch Linux
127+
** Checking extents overflow file.
128+
** Checking catalog file.
129+
** Checking multi-linked files.
130+
** Checking catalog hierarchy.
131+
** Checking extended attributes file.
132+
** Checking volume bitmap.
133+
** Checking volume information.
134+
** The volume Arch Linux appears to be OK.
135+
```
136+
137+
Now let's try remounting again:
138+
139+
```
140+
❯ sudo mount -o remount,rw /boot
141+
❯ grep "[[:space:]]ro[[:space:],]" /proc/mounts
142+
/dev/sda1 /boot hfsplus ro,relatime,umask=22,uid=0,gid=0,nls=utf8 0 0
143+
```
144+
145+
Still read-only! And the kernel log keeps saying the same thing:
146+
147+
```
148+
❯ sudo dmesg | grep hfs
149+
[2686028.481168] hfsplus: filesystem was not cleanly unmounted, running fsck.hfsplus is recommended. leaving read-only.
150+
[2686273.749134] hfsplus: filesystem was not cleanly unmounted, running fsck.hfsplus is recommended. leaving read-only.
151+
```
152+
153+
At this point I tried the force flag too but it didn't find any issues either. I found [a thread on the Arch forums](https://bbs.archlinux.org/viewtopic.php?id=227493) that unmounts first, then remounts:
154+
155+
```
156+
❯ sudo umount /boot
157+
❯ sudo mount -t hfsplus -o force,rw /dev/sda1 /boot
158+
mount: /boot: WARNING: source write-protected, mounted read-only.
159+
```
160+
161+
Still no luck!
162+
163+
I'm running out of options, so I decided to try downgrading to the old kernel I had in the cache to be able to reboot:
164+
165+
```
166+
❯ sudo pacman -U /var/cache/pacman/pkg/linux-6.15.6.arch1-1-x86_64.pkg.tar.zst
167+
loading packages...
168+
warning: downgrading package linux (6.16.4.arch1-1 => 6.15.6.arch1-1)
169+
resolving dependencies...
170+
looking for conflicting packages...
171+
172+
Packages (1) linux-6.15.6.arch1-1
173+
174+
Total Installed Size: 141.35 MiB
175+
Net Upgrade Size: -1.28 MiB
176+
177+
:: Proceed with installation? [Y/n]
178+
(1/1) checking keys in keyring [#########################] 100%
179+
(1/1) checking package integrity [#########################] 100%
180+
(1/1) loading package files [#########################] 100%
181+
(1/1) checking for file conflicts [#########################] 100%
182+
(1/1) checking available disk space [#########################] 100%
183+
:: Running pre-transaction hooks...
184+
(1/2) Removing linux initcpios...
185+
rm: cannot remove '/boot/initramfs-linux-fallback.img': Read-only file system
186+
rm: cannot remove '/boot/initramfs-linux.img': Read-only file system
187+
rm: cannot remove '/boot/vmlinuz-linux': Read-only file system
188+
error: command failed to execute correctly
189+
```
190+
191+
Still hitting the read-only issue but at this point the initramfs should match.
192+
193+
Sadly after rebooting, the Mac wasn't showing up on the network. I connected a screen (after grumbling my way to the office) and sadly took notice that it's actually booting with `linux-zen` by default, not the regular `linux` kernel!
194+
195+
I selected the regular `linux` kernel from GRUB's advanced boot menu, and the system booted properly. And to my surprise, when I checked the file system:
196+
197+
```
198+
❯ grep "[[:space:]]ro[[:space:],]" /proc/mounts
199+
```
200+
201+
No more read-only `/boot`! It was now mounted read-write. I'm not sure why a simple reboot fixed it when `fsck` didn't, but I'll take it.
202+
203+
I completed the upgrade by reinstalling `linux-zen` and `linux` (which I downgraded earlier):
204+
205+
```
206+
❯ sudo pacman -S linux-zen linux
207+
warning: linux-zen-6.16.4.zen1-1 is up to date -- reinstalling
208+
```
209+
210+
After the reinstall completed successfully and all the initramfs files were correctly generated, another reboot got me back to the usual `linux-zen` kernel.
211+
212+
So, a few takeaways:
213+
1. The `fsck.mode=force` kernel parameter I added earlier clearly didn't fully solve the issue, and I have no logs to explain why.
214+
2. Sometimes a reboot is still needed, even after running fsck manually
215+
3. Having multiple kernels installed is a lifesaver if they're not updated at the same time (but you still need a keyboard/screen to select it)

0 commit comments

Comments
 (0)