Setup C++ IDE CLion on Raspberry Pi with Ubuntu Mate

CLion is a crossplatform IDE for C++ made by JetBrains. CLion is not free but it is really helpful – with all its intentions, hints and refactorings. CLion has 30 days free trial license. Find out more on video introductions.

Eclipse is a free alternative but with less automation, assistance and features (this article describes the installation of Eclipse on Ubuntu).

Known issues on Raspberry Pi with Ubuntu Mate

  • Debugging does not work – because of not supported GDB version
  • On basic “Hello world” example there are issues with running the code – one of native terminal libraries fails. Compiled executable works fine. More complex example also works.

Install Ubuntu Mate on Raspberry Pi

Follow the original instruction or the description below (performed on Ubuntu)

Read also Connect to network Raspberry Pi with Ubuntu

Get image with Ubuntu for Raspberry Pi

Download the archive with image of Ubuntu Mate for Raspberry Pi  (within the section Download). Start the terminal (Ctrl+Alt+T) and navigate to the Downloads directory

cd ~/Downloads

Check if the archive with image exists  (asterisks/stars in the command are to avoid dependency on versions)

ls ubuntu-mate-*raspberry-pi*.img.xz

Extract image from the archive (wait a minute while its completed)

unxz ubuntu-mate-*raspberry-pi*.img.xz

Check if the image exists

ls ubuntu-mate*raspberry-pi*.img


The image can be seen in the Files window as well


Write image with Ubuntu to CF-card

Plug a CF-card to the computer (e.g. with CF-reader) and check its disk and partions names with command lsblk (“list block devices”)



The name of the CF-card disk name is sdb, wile the name of main disk name is sda. Unmount the CF-card partitions with command umount (not unmount!).

hint How to type long names quickly

No need to type all the letters in the volume name – type beginning and hit Tab key to complete it automatically. Type

umount /med

and hit the Tab key – the command is populated with /media/user1/ – this is because there is two volume names starting with “/media/user1/” but with different characters after it. Continue typing with “A” (as in names on the example above – use name of your CF-card volume instead)

umount /media/user1/A

and hit the Tab key – the command is populated with umount /media/user1/AB3E-B34D. Hit the Enter to execute the unmounting command.

Check that partitions are unmounted



An image can be written to a CF-card with util dd , but there are some reports on issues with it. The util ddrescue is recommended instead

sudo apt-get install gddrescue xz-utils

hint Write with util dd image to CF-card or backup CF-card to file

dd requires command line parameters ifinput file (image file in this case), ofoutput file (or disk name in this case) and also a block size. File name can we specified with path (e.g. “~/Downloads/ubuntu-mate-15.10.3-desktop-armhf-raspberry-pi-2.img”)

sudo dd if=ubuntu-mate-15.10.3-desktop-armhf-raspberry-pi-2.img of=/dev/sdb bs=4M

File name can we specified with path. ~ stand for “home”-folder of the user: e.g. /home/username

sudo dd if=~/Downloads/ubuntu-mate-15.10.3-desktop-armhf-raspberry-pi-2.img of=/dev/sdb bs=4M

dd can be also used to backup CF-card to a file

sudo dd  if=/dev/sdb of=~/ubuntu-mate-r-pi-backup.img bs=4M

Write the image to the CF-card. Change the highlighted part of the command according to image version and CF-card disk name if differs. sudo runs the command under root (“superuser”) permissions and it requests for the password of the user

sudo ddrescue -D --force ubuntu-mate-15.10.3-desktop-armhf-raspberry-pi-2.img /dev/sdb


Sync the written data before unplugging or perform further operations the CF-card


Extend partitions on CF-card

Before writing the image CF-card partitions have large allocated size (11.7GB in this example)


Now command lsblk shows the smaller allocated size (3.6GB)


The partition can be extended – 3.6GB is a minimum the Ubuntu Mate would work and it will quickly ran out of space. One option is to use utils/commands fdisk and resize2fs (as described in section “Re-size file system”) . Another option is to use GUI tools like GParted.

 hint Extend partitions with GUI tool GParted

Install the tool GParted

sudo apt-get install gparted

Start GParted from the terminal

sudo gparted

Select CF-card disk in the disk list


Right click on the partition /dev/sdb2 (with File System ext4 and size 3.6GB) and select in the context menu an item “Resize/Move”


Set a new size (e.g. 12000MB). Leave couple of GBs for now to create swap-partition afterwards. Hit the “Resize/Move” button


Click on the button “Apply All Operations” to complete resize operation


Confirm operation


Wait while the partition is extending


Only 3.4GB of the 12 GB of new size is used – what was written from the image


To create a swap-partition – right click on the unallocated item in the partition list


In the “Create new partition dialog” select linux-swap File System type and hit “Add” button. Alternatively run command sudo swapon -a


Click on the button “Apply All Operations” to complete resize operation, confirm it and wait while it is completed


Swap partition need to be turned on


Sync the written data and unplug the CF-card


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.