# Installing Ubuntu 21.04 on the HiFive Unmatched

**URL:** <https://forums.sifive.com/t/installing-ubuntu-21-04-on-the-hifive-unmatched/4710>\
**Category:** HiFive Unmatched\
**Created:** [May 24, 2021, 11:28pm UTC](https://forums.sifive.com/t/installing-ubuntu-21-04-on-the-hifive-unmatched/4710 "2021-05-24T23:28:26Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![JawnSmith](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.sifive.com/jawnsmith/32/1300_2.png) [@JawnSmith](https://forums.sifive.com/u/JawnSmith)\
**Post date:** [May 24, 2021, 11:28pm UTC](https://forums.sifive.com/t/installing-ubuntu-21-04-on-the-hifive-unmatched/4710/1 "2021-05-24T23:28:26Z")

</div>

I wrote a guide to installing Ubuntu 21.04 on the Unmatched. It can be found at [https://blogjawn.stufftoread.com/install-ubuntu-on-hifive-unmatched.html](https://blogjawn.stufftoread.com/install-ubuntu-on-hifive-unmatched.html)

It covers flashing the image to an SD, booting from an NVMe drive, and setting up a very basic desktop environment. I’ve also designed a case for it, though it’s untested so it isn’t included in the post yet. I will update the post once the case has been tested.

---

<div class="post-metadata">

**Author:** ![enthusi](https://avatars.discourse-cdn.com/v4/letter/e/48db29/32.png) [@enthusi](https://forums.sifive.com/u/enthusi)\
**Post date:** [May 25, 2021, 8:34am UTC](https://forums.sifive.com/t/installing-ubuntu-21-04-on-the-hifive-unmatched/4710/2 "2021-05-25T08:34:11Z")

</div>

Thanks alot! That will (hopefully very soon) be quite helpful.

---

<div class="post-metadata">

**Author:** ![kallisti5](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.sifive.com/kallisti5/32/1211_2.png) [@kallisti5](https://forums.sifive.com/u/kallisti5)\
**Post date:** [May 25, 2021, 2:30pm UTC](https://forums.sifive.com/t/installing-ubuntu-21-04-on-the-hifive-unmatched/4710/3 "2021-05-25T14:30:28Z")

</div>

Hopefully, Haiku will support the Unmatched board once mine comes in 😃

> **[My Haiku RISC-V port progress](https://discuss.haiku-os.org/t/my-haiku-risc-v-port-progress/10663/187)**
>
> This is great progress! In case you want to test this in tinyemu on a recent macOS, the emulator is unable to display the graphics window due to an incompatibility of SDL1.2 with recent macOS versions. Replacing the sdl.c source file in tinyemu...

---

<div class="post-metadata">

**Author:** ![x56](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.sifive.com/x56/32/1291_2.png) [@x56](https://forums.sifive.com/u/x56)\
**Post date:** [May 29, 2021, 1:51am UTC](https://forums.sifive.com/t/installing-ubuntu-21-04-on-the-hifive-unmatched/4710/4 "2021-05-29T01:51:18Z")

</div>

Thank you @JawnSmith! This setup worked almost perfectly for me. The one thing I had to change: on the login screen, there’s a gear icon, I had to select “Ubuntu on Xorg”

My problem: using the default options I was able to log in, and the OS accepted keyboard input, but application windows would not. I found an [article](https://www.raspberrypi.org/forums/viewtopic.php?t=310293) suggesting Wayland could be a problem, and switching back to Xorg seems to have worked around it.

---

<div class="post-metadata">

**Author:** ![JawnSmith](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.sifive.com/jawnsmith/32/1300_2.png) [@JawnSmith](https://forums.sifive.com/u/JawnSmith)\
**Post date:** [May 29, 2021, 2:24am UTC](https://forums.sifive.com/t/installing-ubuntu-21-04-on-the-hifive-unmatched/4710/5 "2021-05-29T02:24:15Z")

</div>

Thanks for the feedback @x56 ! I can add a note to the post. May I ask what GPU you’re using? Wayland is known to be weird with nVidia graphics cards.

---

<div class="post-metadata">

**Author:** ![x56](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.sifive.com/x56/32/1291_2.png) [@x56](https://forums.sifive.com/u/x56)\
**Post date:** [May 29, 2021, 2:42am UTC](https://forums.sifive.com/t/installing-ubuntu-21-04-on-the-hifive-unmatched/4710/6 "2021-05-29T02:42:01Z")

</div>

ah ok, I’m using a 1080Ti, so that’s probably it (understood that AMD is recommended, this is what I have on hand at least until prices come down…)

---

<div class="post-metadata">

**Author:** ![JawnSmith](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.sifive.com/jawnsmith/32/1300_2.png) [@JawnSmith](https://forums.sifive.com/u/JawnSmith)\
**Post date:** [May 29, 2021, 4:29am UTC](https://forums.sifive.com/t/installing-ubuntu-21-04-on-the-hifive-unmatched/4710/7 "2021-05-29T04:29:16Z")

</div>

Yeah prices are ridiculous right now… Great to know that the nVidia cards work with xorg though! I didn’t have any extra nVidia cards on hand and honestly didn’t know if that would work. I’ll add a note to the blog post. Thanks for linking me in your DOOM post 😆

---

<div class="post-metadata">

**Author:** ![bruce](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.sifive.com/bruce/32/452_2.png) [@bruce](https://forums.sifive.com/u/bruce)\
**Post date:** [June 1, 2021, 4:01am UTC](https://forums.sifive.com/t/installing-ubuntu-21-04-on-the-hifive-unmatched/4710/8 "2021-06-01T04:01:26Z")

</div>

I’ve already put some work into setting up my Ubuntu environment on an SD card (I’m using xfce for now as I wasn’t sure how gnome would run).

What do you think about getting the system quiet, doing a sync, and then using dd to copy the SD card to the SSD, rather than expanding a fresh copy?

Also, how do we experiment with changing the clock speed? At _least_ to get the advertised 1.2 GHz, as it’s currently running at 1.0.

---

<div class="post-metadata">

**Author:** ![jimw](https://avatars.discourse-cdn.com/v4/letter/j/f14d63/32.png) [@jimw](https://forums.sifive.com/u/jimw)\
**Post date:** [June 1, 2021, 2:33pm UTC](https://forums.sifive.com/t/installing-ubuntu-21-04-on-the-hifive-unmatched/4710/9 "2021-06-01T14:33:49Z")

</div>

The cpupower frequency driver hasn’t been ported to unmatched yet. The clock frequency is set in the fsbl. The original fsbl (fusdk 2021.03) set the frequency to 1.0GHz. The current one (fusdk 2021.03.01 and later) sets the frequency to 1.2GHz. Maybe this image is using the older one? I believe that we are planning to publish a software guide that explains how to configure the clock. You would have to use that info to modify the fsbl if you want to try different frequencies. The same info in a less convenient form is probably also in the fu740 hardware docs.

---

<div class="post-metadata">

**Author:** ![JawnSmith](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.sifive.com/jawnsmith/32/1300_2.png) [@JawnSmith](https://forums.sifive.com/u/JawnSmith)\
**Post date:** [June 1, 2021, 3:39pm UTC](https://forums.sifive.com/t/installing-ubuntu-21-04-on-the-hifive-unmatched/4710/10 "2021-06-01T15:39:41Z")

</div>

I suspect that copying the SD card to the SSD may work, but there may be some headaches along the way, considering you’d be copying things from /proc, /dev on a booted system. If you try it can you post your results here along with any special steps you had to take to get it working?

---

<div class="post-metadata">

**Author:** ![forksand](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.sifive.com/forksand/32/469_2.png) [@forksand](https://forums.sifive.com/u/forksand)\
**Post date:** [June 1, 2021, 3:45pm UTC](https://forums.sifive.com/t/installing-ubuntu-21-04-on-the-hifive-unmatched/4710/11 "2021-06-01T15:45:41Z")

</div>

> [@bruce](#):
>
> the advertised 1.2 GHz, as it’s currently running at 1.0.

How are you measuring the speed? Running `perf stat /bin/ls` says my Unmatched is running at 1.194 GHz.

---

<div class="post-metadata">

**Author:** ![bruce](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.sifive.com/bruce/32/452_2.png) [@bruce](https://forums.sifive.com/u/bruce)\
**Post date:** [June 1, 2021, 9:15pm UTC](https://forums.sifive.com/t/installing-ubuntu-21-04-on-the-hifive-unmatched/4710/12 "2021-06-01T21:15:06Z")

</div>

The same way

```auto
ubuntu@ubuntu:~$ perf stat /bin/ls
Desktop hello.c
Documents hello.hex
Downloads mnt
Music primes.c
Pictures stairway.mp3
Public test_memcpy
Templates test_memcpy.c
Videos trv
hello

 Performance counter stats for '/bin/ls':

              5.83 msec task-clock # 0.721 CPUs utilized          
                 2 context-switches # 0.343 K/sec                  
                 0 cpu-migrations # 0.000 K/sec                  
                90 page-faults # 0.015 M/sec                  
           5829610 cycles # 1.000 GHz                    
           2434105 instructions # 0.42 insn per cycle         
   <not supported> branches                                                    
   <not supported> branch-misses                                               

       0.008083000 seconds time elapsed

       0.000000000 seconds user
       0.007223000 seconds sys

ubuntu@ubuntu:~$

```

---

<div class="post-metadata">

**Author:** ![jimw](https://avatars.discourse-cdn.com/v4/letter/j/f14d63/32.png) [@jimw](https://forums.sifive.com/u/jimw)\
**Post date:** [June 2, 2021, 10:18pm UTC](https://forums.sifive.com/t/installing-ubuntu-21-04-on-the-hifive-unmatched/4710/13 "2021-06-02T22:18:13Z")

</div>

On the SiFive HiFive Unmatched web page  
[https://www.sifive.com/boards/hifive-unmatched](https://www.sifive.com/boards/hifive-unmatched)  
see the link at the bottom for the “HiFive Unmatched SW Reference Manual” document dated May 17, 2021. On page 39 (pdf page 41) it explains how to read the clock info with devmem2 and decode the value. Then looking at the FU740 manual I see that the final frequency is ((26MHz / (R+1)) \* 2 \* (F+1)) / (1\<\<Q).

Anyways, as I mentioned before, I think this image has the wrong version of the bootloader, as the old one did set the clock to 1GHz.

---

<div class="post-metadata">

**Author:** ![forksand](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.sifive.com/forksand/32/469_2.png) [@forksand](https://forums.sifive.com/u/forksand)\
**Post date:** [June 2, 2021, 11:37pm UTC](https://forums.sifive.com/t/installing-ubuntu-21-04-on-the-hifive-unmatched/4710/14 "2021-06-02T23:37:50Z")

</div>

I still need a decoder ring:

```auto
# devmem2 0x10000004 w 0x820544C2
/dev/mem opened.
Memory mapped at address 0x3fe3560000.
Read at address 0x10000004 (0x3fe3560004): 0x820544C2
Write at address 0x10000004 (0x3fe3560004): 0x820544C2, readback 0x820544C2

# devmem2 0x1000000c w 0x820D1180
/dev/mem opened.
Memory mapped at address 0x3ff4985000.
Read at address 0x1000000C (0x3ff498500c): 0x820D1180
Write at address 0x1000000C (0x3ff498500c): 0x820D1180, readback 0x820D1180

```

```auto
# perf_5.10 stat /bin/ls
bin boot dev	etc home lib	lost+found media mnt	proc run sbin share	srv sys tmp usr var

 Performance counter stats for '/bin/ls':

              2.43 msec task-clock # 0.731 CPUs utilized          
                 0 context-switches # 0.000 K/sec                  
                 0 cpu-migrations # 0.000 K/sec                  
                64 page-faults # 0.026 M/sec                  
           2900803 cycles # 1.194 GHz                    
            993730 instructions # 0.34 insn per cycle         
   <not supported> branches                                                    
   <not supported> branch-misses                                               

       0.003322999 seconds time elapsed

       0.003561000 seconds user
       0.000000000 seconds sys

```

---

<div class="post-metadata">

**Author:** ![jimw](https://avatars.discourse-cdn.com/v4/letter/j/f14d63/32.png) [@jimw](https://forums.sifive.com/u/jimw)\
**Post date:** [June 3, 2021, 12:24am UTC](https://forums.sifive.com/t/installing-ubuntu-21-04-on-the-hifive-unmatched/4710/15 "2021-06-03T00:24:31Z")

</div>

The SW Reference Manual shows which bits are R, F, and Q. The hardware manual probably does also. The low 6 bits are R. The next 9 bits are F. Then the next 3 bits are Q. So for the value 0x820544C2, R=2, F=275, Q=2 and we get 26MHz / 3 \* 2 \* 276 / 4 which is 1.196GHz.

---

<div class="post-metadata">

**Author:** ![bruce](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.sifive.com/bruce/32/452_2.png) [@bruce](https://forums.sifive.com/u/bruce)\
**Post date:** [June 3, 2021, 7:24am UTC](https://forums.sifive.com/t/installing-ubuntu-21-04-on-the-hifive-unmatched/4710/16 "2021-06-03T07:24:08Z")

</div>

> [@JawnSmith](#):
>
> I suspect that copying the SD card to the SSD may work, but there may be some headaches along the way, considering you’d be copying things from /proc, /dev on a booted system. If you try it can you post your results here along with any special steps you had to take to get it working?

I don’t think that’s any great problem, as those are procedural file systems, not actual things on the disk. dd would not see them, but only the directories they are mounted on.

But anyway, copying from the SD card is soooo slow it turned out to be far quicker to use ssh to stream the .img from another computer and dd the stream directly onto the SSD without touching SD.

I installed gnome and it’s definitely a lot more sluggish than xfce, though things such as dragging a window under the transparent launcher work just fine on my old R5 230 card (radeon driver not amdgpu).

vlc plays video files very well but unfortunately locks up the entire UI in the process and I have to kill not only VLC but also the desktop manager to recover. This may or may not be because I’m using DVI and don’t have a sound device.

I received today the 40mm Noctua fan and installed it. It’s certainly far far quieter, and temperatures are about the same. The screw holes are larger than the ones in the original fan and the head of the long screws pass right through. I used a plastic washer from the M.2 mounting kit included with the board and that works well.

---

<div class="post-metadata">

**Author:** ![JawnSmith](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.sifive.com/jawnsmith/32/1300_2.png) [@JawnSmith](https://forums.sifive.com/u/JawnSmith)\
**Post date:** [June 3, 2021, 5:09pm UTC](https://forums.sifive.com/t/installing-ubuntu-21-04-on-the-hifive-unmatched/4710/17 "2021-06-03T17:09:12Z")

</div>

Glad you got it working! I’m working on printing a case with a slot for a 120mm fan so I can also replace the stock fan. I can make a note about older graphics cards not playing very well with gnome.

---

<div class="post-metadata">

**Author:** ![bruce](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.sifive.com/bruce/32/452_2.png) [@bruce](https://forums.sifive.com/u/bruce)\
**Post date:** [June 4, 2021, 2:19am UTC](https://forums.sifive.com/t/installing-ubuntu-21-04-on-the-hifive-unmatched/4710/18 "2021-06-04T02:19:57Z")

</div>

I think it’s the CPU struggling, not the graphics card. The graphics are fine.

Also, either the Noctua fan has failed or else the 3 pin connector. I’ve gone back to the original fan.

It was working fine until I rebooted, and then no spin.

---

<div class="post-metadata">

**Author:** ![drmpeg](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.sifive.com/drmpeg/32/1301_2.png) [@drmpeg](https://forums.sifive.com/u/drmpeg)\
**Post date:** [June 4, 2021, 8:40pm UTC](https://forums.sifive.com/t/installing-ubuntu-21-04-on-the-hifive-unmatched/4710/19 "2021-06-04T20:40:48Z")

</div>

I just used an NFS mount back to my Linux box.

sudo dd if=/media/xfer/ubuntu-21.04-preinstalled-server-riscv64+unmatched.img of=/dev/nvme0n1 bs=1M status=progress  
3731881984 bytes (3.7 GB, 3.5 GiB) copied, 96 s, 38.9 MB/s  
3584+0 records in  
3584+0 records out  
3758096384 bytes (3.8 GB, 3.5 GiB) copied, 101.308 s, 37.1 MB/s

---

<div class="post-metadata">

**Author:** ![drmpeg](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.sifive.com/drmpeg/32/1301_2.png) [@drmpeg](https://forums.sifive.com/u/drmpeg)\
**Post date:** [June 4, 2021, 9:16pm UTC](https://forums.sifive.com/t/installing-ubuntu-21-04-on-the-hifive-unmatched/4710/20 "2021-06-04T21:16:55Z")

</div>

Forgot to mention, Western Digital Black SN750.

[Next page](https://forums.sifive.com/t/installing-ubuntu-21-04-on-the-hifive-unmatched/4710.md?page=2)
