SATA Controller working on Pi OS but not on Ubuntu...
# │forum
d
Hola! I just got my Turing pi and I'm noticing that the SATA controller works on PI OS but not on Ubuntu. For example: Pi OS:
Copy code
pi@test-pi:~ $ lspci
00:00.0 PCI bridge: Broadcom Inc. and subsidiaries BCM2711 PCIe Bridge (rev 20)
01:00.0 IDE interface: ASMedia Technology Inc. ASM1061 SATA IDE Controller (rev 02)

pi@test-pi:~ $ lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda           8:0    0 931.5G  0 disk
mmcblk0     179:0    0  59.7G  0 disk
├─mmcblk0p1 179:1    0   256M  0 part /boot
└─mmcblk0p2 179:2    0  59.4G  0 part /
As you can see above, sda is found when running lsblk. Here is some information about the version:
Copy code
pi@test-pi:~ $ uname -a
Linux test-pi 5.15.84-v8+ #1613 SMP PREEMPT Thu Jan 5 12:03:08 GMT 2023 aarch64 GNU/Linux
pi@test-pi:~ $
However, when installing Ubuntu, it doesn't work:
Copy code
ubuntu@ubuntu-test:~$ lspci
00:00.0 PCI bridge: Broadcom Inc. and subsidiaries BCM2711 PCIe Bridge (rev 20)
01:00.0 IDE interface: ASMedia Technology Inc. ASM1061 SATA IDE Controller (rev 02)

ubuntu@ubuntu-test:~$ lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
loop0         7:0    0  59.1M  1 loop /snap/core20/1826
loop1         7:1    0  43.2M  1 loop /snap/snapd/18363
loop2         7:2    0 109.6M  1 loop /snap/lxd/24326
loop3         7:3    0  43.2M  1 loop /snap/snapd/18600
loop4         7:4    0  59.1M  1 loop /snap/core20/1856
mmcblk0     179:0    0  59.7G  0 disk
├─mmcblk0p1 179:1    0   256M  0 part /boot/firmware
└─mmcblk0p2 179:2    0  59.4G  0 part /
/dev/sda is not found in lsblk. I'm running Ubuntu 22.04 64 bit
Copy code
ubuntu@ubuntu-test:~$ uname -a
Linux ubuntu-test 5.15.0-1024-raspi #26-Ubuntu SMP PREEMPT Wed Jan 18 15:29:53 UTC 2023 aarch64 aarch64 aarch64 GNU/Linux
In dmesg I find
BAR 4: no space for [io  size 0x0020]
errors: I saw mentions that the SATA controller should work in Both OS's. Has anyone been able to get Ubuntu to work?
d
I did - it works fine for me in Ubuntu Server, the minimal installation, or however it's called in the RPi Imager
Sounds odd that it does not work for you on Ubuntu
d
Weird thats exactly what I'm using now too. I'm trying the 64 bit 20.10 version now. Do you know which version you tried?
d
22.04 LTS
d
64bit or 32bit? 64 bit wasn't working and I just tried 64bit 22.10 and it also doesn't work:
Copy code
ubuntu@ubuntu-test-10:~$ lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
loop0         7:0    0    59M  1 loop /snap/core20/1627
loop1         7:1    0 131.3M  1 loop /snap/lxd/23687
loop2         7:2    0  41.5M  1 loop /snap/snapd/17339
mmcblk0     179:0    0  59.7G  0 disk
├─mmcblk0p1 179:1    0   256M  0 part /boot/firmware
└─mmcblk0p2 179:2    0  59.4G  0 part /
ubuntu@ubuntu-test-10:~$ lspci
00:00.0 PCI bridge: Broadcom Inc. and subsidiaries BCM2711 PCIe Bridge (rev 20)
01:00.0 IDE interface: ASMedia Technology Inc. ASM1061 SATA IDE Controller (rev 02)
ubuntu@ubuntu-test-10:~$ cat /etc/os-release
PRETTY_NAME="Ubuntu 22.10"
I'm going to try 32bit now
d
64-bit, sorry, I should have mention this
d
Wat??? That is exactly what I'm doing and it's not working for me. Hmmmm I'm going to try that again
By default I still can't get it to work:
Copy code
ubuntu@ubuntu-test-10:~$ lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
loop0         7:0    0 109.6M  1 loop /snap/lxd/24326
loop1         7:1    0  59.1M  1 loop /snap/core20/1826
loop2         7:2    0  43.2M  1 loop /snap/snapd/18363
mmcblk0     179:0    0  59.7G  0 disk
├─mmcblk0p1 179:1    0   256M  0 part /boot/firmware
└─mmcblk0p2 179:2    0  59.4G  0 part /
But I'm trying to update and upgrade to see if that fixes anything. If not, I might just stick with pi os instead of ubuntu.
Yeah even after the update I'm still having the same issues in dmesg:
Copy code
ubuntu@ubuntu-test-10:~$ sudo dmesg | grep BAR
[    0.455281] pci 0000:00:00.0: BAR 14: assigned [mem 0x600000000-0x6000fffff]
[    0.455309] pci 0000:01:00.0: BAR 6: assigned [mem 0x600000000-0x60000ffff pref]
[    0.455327] pci 0000:01:00.0: BAR 5: assigned [mem 0x600010000-0x6000101ff]
[    0.455348] pci 0000:01:00.0: BAR 4: no space for [io  size 0x0010]
[    0.455363] pci 0000:01:00.0: BAR 4: failed to assign [io  size 0x0010]
[    0.455377] pci 0000:01:00.0: BAR 0: no space for [io  size 0x0008]
[    0.455390] pci 0000:01:00.0: BAR 0: failed to assign [io  size 0x0008]
[    0.455403] pci 0000:01:00.0: BAR 2: no space for [io  size 0x0008]
[    0.455416] pci 0000:01:00.0: BAR 2: failed to assign [io  size 0x0008]
[    0.455429] pci 0000:01:00.0: BAR 1: no space for [io  size 0x0004]
[    0.455442] pci 0000:01:00.0: BAR 1: failed to assign [io  size 0x0004]
[    0.455455] pci 0000:01:00.0: BAR 3: no space for [io  size 0x0004]
[    0.455468] pci 0000:01:00.0: BAR 3: failed to assign [io  size 0x0004]
@DhanOS (Daniel Kukiela) If you get a chance, can you try again and check if you're able to find the drive when running
lsblk
? If you're not able to, not worries. I'm just going to use pi os in the mean time
Thanks for your help so far btw!
d
I'll try to check this for you this weekend
Which modules do you have, btw? How much RAM?
d
I have 8GB CM4. I have some with 32GB emmc and some without emmc. Both have the same issue
w
I have the same issue. Running Ubuntu 20.10 and cannot get the ASM1061 based SATA controllers to work. Any suggestions are highly appreciated.
d
@wbvreeuwijk does the sata Control let show up in lspci for you too but the disk doesnt show in lsblk?
w
@dejandayoff Yes. Exactly the same:
Copy code
pi@pi-node-2:~$ sudo lspci
00:00.0 PCI bridge: Broadcom Inc. and subsidiaries BCM2711 PCIe Bridge (rev 20)
01:00.0 SATA controller: ASMedia Technology Inc. ASM1062 Serial ATA Controller (rev 02)
pi@pi-node-2:~$ sudo lsblk
NAME         MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
loop0          7:0    0    59M  1 loop /snap/core20/1627
loop1          7:1    0  59.1M  1 loop /snap/core20/1856
loop2          7:2    0  67.6M  1 loop /snap/core22/611
loop3          7:3    0 131.3M  1 loop /snap/lxd/23687
loop4          7:4    0   155M  1 loop /snap/lxd/24646
loop5          7:5    0  43.2M  1 loop /snap/snapd/18600
mmcblk0      179:0    0  29.1G  0 disk
├─mmcblk0p1  179:1    0   256M  0 part /boot/firmware
└─mmcblk0p2  179:2    0  28.9G  0 part /
mmcblk0boot0 179:32   0     4M  1 disk
mmcblk0boot1 179:64   0     4M  1 disk
pi@pi-node-2:~$
d
Ok, this is interesting
I flashed Ubuntu 22.04 on one of my CM4s, and indeed it does not work
I'm not sure why I thought it does, maybe I just checked lspci but ran disks on Raspberry Pi OS only, hard to say now, I'm testing so many things
I started looking around and indeed there seems to be the BAR size issue with teh controller:
Copy code
Feb 17 17:36:49 cm4-test2 kernel: [    0.430949] pci 0000:01:00.0: [1b21:0611] type 00 class 0x010185
Feb 17 17:36:49 cm4-test2 kernel: [    0.431009] pci 0000:01:00.0: reg 0x10: [io  0x0000-0x0007]
Feb 17 17:36:49 cm4-test2 kernel: [    0.431042] pci 0000:01:00.0: reg 0x14: [io  0x0000-0x0003]
Feb 17 17:36:49 cm4-test2 kernel: [    0.431072] pci 0000:01:00.0: reg 0x18: [io  0x0000-0x0007]
Feb 17 17:36:49 cm4-test2 kernel: [    0.431100] pci 0000:01:00.0: reg 0x1c: [io  0x0000-0x0003]
Feb 17 17:36:49 cm4-test2 kernel: [    0.431128] pci 0000:01:00.0: reg 0x20: [io  0x0000-0x000f]
Feb 17 17:36:49 cm4-test2 kernel: [    0.431156] pci 0000:01:00.0: reg 0x24: [mem 0x00000000-0x000001ff]
Feb 17 17:36:49 cm4-test2 kernel: [    0.431185] pci 0000:01:00.0: reg 0x30: [mem 0x00000000-0x0000ffff pref]
Feb 17 17:36:49 cm4-test2 kernel: [    0.443161] pci_bus 0000:01: busn_res: [bus 01-ff] end is updated to 01
Feb 17 17:36:49 cm4-test2 kernel: [    0.443232] pci 0000:00:00.0: BAR 14: assigned [mem 0x600000000-0x6000fffff]
Feb 17 17:36:49 cm4-test2 cloud-init[583]: |o.. = O S        |
Feb 17 17:36:49 cm4-test2 kernel: [    0.443257] pci 0000:01:00.0: BAR 6: assigned [mem 0x600000000-0x60000ffff pref]
Feb 17 17:36:49 cm4-test2 kernel: [    0.443275] pci 0000:01:00.0: BAR 5: assigned [mem 0x600010000-0x6000101ff]
Feb 17 17:36:49 cm4-test2 kernel: [    0.443296] pci 0000:01:00.0: BAR 4: no space for [io  size 0x0010]
Feb 17 17:36:49 cm4-test2 kernel: [    0.443311] pci 0000:01:00.0: BAR 4: failed to assign [io  size 0x0010]
Feb 17 17:36:49 cm4-test2 kernel: [    0.443325] pci 0000:01:00.0: BAR 0: no space for [io  size 0x0008]
Feb 17 17:36:49 cm4-test2 kernel: [    0.443338] pci 0000:01:00.0: BAR 0: failed to assign [io  size 0x0008]
Feb 17 17:36:49 cm4-test2 kernel: [    0.443351] pci 0000:01:00.0: BAR 2: no space for [io  size 0x0008]
Feb 17 17:36:49 cm4-test2 kernel: [    0.443363] pci 0000:01:00.0: BAR 2: failed to assign [io  size 0x0008]
Feb 17 17:36:49 cm4-test2 kernel: [    0.443376] pci 0000:01:00.0: BAR 1: no space for [io  size 0x0004]
Feb 17 17:36:49 cm4-test2 kernel: [    0.443389] pci 0000:01:00.0: BAR 1: failed to assign [io  size 0x0004]
Feb 17 17:36:49 cm4-test2 kernel: [    0.443403] pci 0000:01:00.0: BAR 3: no space for [io  size 0x0004]
Feb 17 17:36:49 cm4-test2 kernel: [    0.443415] pci 0000:01:00.0: BAR 3: failed to assign [io  size 0x0004]
So I compared the memory range assigned to the PCI between Raspberry Pi OS and Ubuntu 22.04 (from decompiled device tree) and they seem to be the same:
So this is a little bit confusing to me currently and I'm not sure why does it error
Ok, I definitively couldn't have SATA working on Ubuntu. I must have mistaken this with something else
Turns out the kernel on Ubuntu for Raspberry Pi does not contain SATA kernel module
For the Raspberry Pi OS, this commit added SATA AHCI: https://github.com/raspberrypi/linux/pull/4256/files
For Ubuntu, we'll have to reconfigure and recompile the kernel, which can be done, but will require a bit of time
Added to this to my TODO list 🙂
w
It's been a while since I built my own kernel (probably some 20 years). I found some practical instructions here: https://askubuntu.com/questions/1238261/customizing-the-kernel-arm64-using-ubuntu-20-04-lts-on-a-raspberry-pi-4 The strange thing is that upon checking the configuration SATA AHCI is set to m already, so I'm now building a new kernel and see if this fixes the issue.
d
Ahhh that would make sense. Thanks for checking!
w
I built the install packages for the new kernel, and it seems to install ok; however, when I reboot, it is still on the version it had before I installed it. So it is not booting into the kernel that I built. Very vague.
Update: I re-compiled the kernel using source from
apt-get source linux-image-$(uname -r)
and now have a working SATA controller. I changed
CONFIG_ATA=y
to
CONFIG_ATA=m
in
~/kbuild/kinetic/debian.raspi/config/config.common.ubuntu
and compiled following the instructions in my earlier post. The build took very long (more than 6 hours) on a CM4 with 8Gb and 32Gb eMMC. I´m providing them for others to use here (Ubuntu 22.10 5.19.1015-22_arm64): https://drive.google.com/drive/folders/1ryg7y2DEHXbM9TTnSzbWOWntBX-MYo1c?usp=share_link
d
Wow nice thanks @wbvreeuwijk !
w
Works totally fine for me.
Copy code
shamrock% uname -a
Linux shamrock 5.15.0-1027-raspi #29-Ubuntu SMP PREEMPT Mon Apr 3 10:12:21 UTC 2023 aarch64 aarch64 aarch64 GNU/Linux
shamrock% cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=22.04
DISTRIB_CODENAME=jammyDISTRIB_DESCRIPTION="Ubuntu 22.04.2 LTS"
Only thing I can think of is that I have
linux-modules-raspi-extra
installed for iSCSI support
d
Would you connect any disk and then run
lsblk
, please?
w
Copy code
shamrock% lsblk /dev/sdaNAME MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTSsda    8:0    0 465.8G  0 disk └─sda1       8:1    0 465.8G  0 part /var/lib/kubelet/pods/871a5b24-295b-410e-9298-da11d8f8a795/volumes/kubernetes.io~local-volume/pvc-850dd3aa-f9fb-4083-81fc-c047c8eb378b
                               /var/lib/kubelet/pods/4f4439c0-798a-4f65-b676-eb2cb075e01e/volumes/kubernetes.io~local-volume/pvc-a4824314-672b-4233-a5d7-fff748fdc4fd
                               /data/ssd
d
Ok, maybe
linux-modules-raspi-extra
is the answer then. I'll definitely check that out. If this is a solution - great find!
w
Highly likely. That package has all the good stuff in it. Zram as well. Ubuntu broke a bunch of shit when they started shipping a ton of modules in that package instead of stock
n
Just for others (like me) the package is actually called linux-modules-extra-raspi
Can confirm it also resolved missing sata module issue. I can see my SATA device on ubuntu OS now
7 Views