Getting PS4 Linux Running on an Aeolia (Fat) Internal Drive
I recently went down a bit of a rabbit hole trying to install Linux onto the internal hard drive of an old Fat PS4 (one of the original Aeolia models) that had been sitting unused in a closet. The whole reason I started was that my youngest son really wanted to play Kerbal Space Program, while my eldest son is at that age where he hogs the computer. My youngest is still too young to have his own PC (and component prices are crazy right now), and since KSP actually ran on the PS4 early on (only in the US, if I’m not mistaken), I figured there was a good chance I could get it running under Linux on the same hardware.
Even jailbreaking the old PS4 turned out to be a bit harder than I expected. The WebKitty page kept failing to load: it would fail to cache, reload the page, and then try to cache again in an infinite loop. The fix turned out to be simple enough, I just initialized the PS4 back to a blank slate. Once it was freshly wiped, everything worked much better.
From there I followed the great PS4 Linux internal installation tutorial. In theory it’s pretty straightforward: drop a bzImage and initramfs.cpio.gz into /data/linux/boot/, copy your distro.tar.xz to /user/system/boot/, launch the Linux payload, and run install-linux-int.sh from the rescue shell. Things went great right up until I hit the rescue shell, where everything fell apart on my Aeolia PS4. Using the 7.3.4 Strawberry Slopmax kernel (Since it had max in the name I assumed that was the best one…) and the latest thebe-initramfs, I ran into three separate issues in a row, where each one hid the next. I was thinking of contributing some fixes to the thebe-initramfs I used, but it was marked as archived very recently. So instead of making my own fork or something I thought documenting what went wrong in hope that it would would be useful for people in the future.
Where’s the hard drive?
When I booted into the rescue shell and tried to open the internal drive, install-linux-int.sh (and calling ps4hdd_open directly) immediately failed:
No PS4 internal drive found (no /dev/sd?27).
Could not open the PS4 internal drive.
Running ps4_southbridge confirmed it was an Aeolia board, and /key/eap_hdd_key.bin was right where it was supposed to be. The problem was that /proc/partitions was completely empty and dmesg had no sd disk messages at all. Linux just wasn’t seeing the hard drive.
I checked the kernel config first, thinking a driver might be missing, but everything needed for PS4 storage, USB, dm-crypt, and UFS was compiled in. Turns out the problem is specific to how the Fat PS4 wires up its hard drive. Unlike later Slim and Pro models that use AHCI SATA directly, the original Aeolia PS4 hangs its internal drive off an internal USB-to-SATA bridge. When the bridge initializes at boot, it briefly drops off the USB bus, and Linux 7.3 had a regression in its xHCI USB driver where it never recovered from that disconnect. So /dev/sda just never appeared.
Linux already fixed this upstream with a couple of xHCI patches, they just hadn’t landed in the 7.3.4 Strawberry build yet. Fortunately the v1.5.0-beta.8 release of ps4-multiboot already includes a patched Strawberry 7.3.3 bzImage with those fixes backported. It has the same built-in PS4 drivers and firmware, so dropping it into /data/linux/boot/bzImage fixed drive detection right away. Looking at dmesg afterward, you can still see the USB bridge time out briefly during boot, except now the kernel recovers half a second later and /dev/sda27 shows up like it should.
Debugging over telnet instead of on the TV
Even with /dev/sda27 showing up, ps4hdd_open was still failing, and typing debugging commands on a keyboard connected to a TV gets annoying really fast. I noticed telnetd was in the rescue shell’s BusyBox, so I plugged in an Ethernet cable to debug it from my computer instead.
There are two little gotchas if you want BusyBox telnetd to work inside a minimal initramfs. First, /dev/pts isn’t mounted by default, so telnetd will accept your connection and immediately disconnect when it tries to allocate a pseudo-terminal. Second, you have to pass -l /bin/sh, otherwise it runs /bin/login, which always rejects root because there’s no /etc/passwd.
Bringing up a static IP and starting telnetd looks like this:
ifconfig eth0 192.168.1.50 netmask 255.255.255.0 up
mkdir -p /dev/pts && mount -t devpts devpts /dev/pts
telnetd -l /bin/sh
(Check ls /sys/class/net if your Ethernet interface isn’t eth0, and use an unused IP on your LAN.)
cryptsetup works, mounting UFS doesn’t
Now that /dev/sda27 was there, ps4hdd_open got past cryptsetup and failed on the UFS mount instead:
mount: mounting /dev/mapper/ps4hdd on /ps4hdd failed: Invalid argument
[!] UFS mount failed.
[!] Could not open the PS4 internal drive.
The decryption key was fine and ufs was in /proc/filesystems, but peeking at the decrypted /dev/mapper/ps4hdd device just showed random garbage instead of a UFS2 filesystem. So cryptsetup was unlocking it with the wrong parameters.
Looking at bin/functions/ps4.sh inside thebe-initramfs, ps4hdd_map() always passes an IV offset computed from the partition number:
skip=$(ps4_iv_offset $(ps4hdd_part))
cryptsetup -d /key/eap_hdd_key.bin \
--cipher aes-xts-plain64 -s 256 \
--offset 0 --skip "$skip" \
create ps4hdd "${part}"
That offset (111669149696 for partition 27) is for Belize and Baikal consoles. Aeolia doesn’t use an IV offset at all, it expects --skip 0.
Sure enough, running cryptsetup with --skip 0 let me mount the internal UFS2 partition on the first try:
cryptsetup remove ps4hdd 2>/dev/null
cryptsetup -d /key/eap_hdd_key.bin --cipher aes-xts-plain64 -s 256 \
--offset 0 --skip 0 create ps4hdd /dev/sda27
mount -t ufs -o ro,ufstype=ufs2 /dev/mapper/ps4hdd /ps4hdd
To fix it in bin/functions/ps4.sh, you just check the southbridge first:
local skip
if ps4_is_southbridge Aeolia; then
skip=0
else
skip=$(ps4_iv_offset "${part}")
fi
(If you want a safer fallback, ps4-multiboot tries 0 first on Aeolia and the partition offset first on Belize and Baikal, then tries the other one if mounting fails.)
One more bug in install.sh
While I had thebe-initramfs unpacked to fix ps4.sh, I noticed one more issue in bin/functions/install.sh inside mountInstall():
# Internal fallback
if [ -f /ps4hdd/app/linux.img ]; then
ps4hdd_open && mount -o loop /ps4hdd/app/linux.img /newroot && return 0
ewarn "Couldn't mount /ps4hdd/app/linux.img to /newroot"
else
ewarn "/ps4hdd/app/linux.img does not exist, can't mount it."
fi
Nothing else mounts /ps4hdd before that check runs, so [ -f /ps4hdd/app/linux.img ] is checked before ps4hdd_open is ever called. Even after a successful install, rebooting will always complain that /ps4hdd/app/linux.img doesn’t exist and drop you back into the rescue shell.
Calling ps4hdd_open first fixes auto-boot:
# Internal fallback
if ps4hdd_open; then
if [ -f /ps4hdd/app/linux.img ]; then
mount -o loop /ps4hdd/app/linux.img /newroot && return 0
ewarn "Couldn't mount /ps4hdd/app/linux.img to /newroot"
else
ewarn "/ps4hdd/app/linux.img does not exist, can't mount it."
fi
fi
Repacking the initramfs
Since thebe-initramfs doesn’t ship any static device files under /dev, you can unpack it, edit both scripts, and repack it on a regular Linux machine without needing root:
mkdir -p /tmp/initramfs-work && cd /tmp/initramfs-work
gzip -dc ~/Downloads/initramfs.cpio.gz | cpio -idmu
# edit bin/functions/ps4.sh and bin/functions/install.sh, then check syntax
sh -n bin/functions/ps4.sh bin/functions/install.sh
# repack with root ownership
find . -mindepth 1 -printf '%P\n' | sort | cpio -o -H newc --owner=0:0 | gzip -9 > ~/Downloads/initramfs-patched.cpio.gz
After replacing /data/linux/boot/initramfs.cpio.gz alongside the patched bzImage, ps4hdd_open mounted cleanly and install-linux-int.sh worked right away. After installing CachyOS and Steam, I actually did get Kerbal Space Program up and running on the PS4, so it all paid off in the end.
Hopefully this saves someone else with an old Fat PS4 some time. If you’re seeing no /dev/sd?27 on a 7.3 kernel, grab a kernel with the upstream xHCI fixes; if mount -t ufs fails with Invalid argument, try --skip 0; and if it drops back to the rescue shell after installing, check whether your initramfs actually opens /ps4hdd before looking for linux.img.