User Tools

Site Tools

This translation is older than the original page and might be outdated. See what has changed.



This is an old revision of the document!



Steps to get ubuntu-system (use armhf as arch):

sudo apt-get install qemu-user-static debootstrap binfmt-support
sudo debootstrap --arch=$arch --foreign $distro $targetdir
#if you got this error: E: Cannot install into target '...' mounted with noexec or nodev
sudo mount -i -o remount,exec,dev /mounted_dir
sudo cp /usr/bin/qemu-arm-static $targetdir/usr/bin/
sudo cp /etc/resolv.conf $targetdir/etc
sudo distro=$distro chroot $targetdir
export LANG=C
/debootstrap/debootstrap --second-stage
#echo "deb-src $distro main">>/etc/apt/sources.list
#echo "deb $distro-security main">>/etc/apt/sources.list
#echo "deb-src $distro-security main">>/etc/apt/sources.list
echo "deb $distro main">>/etc/apt/sources.list
echo "deb-src $distro main">>/etc/apt/sources.list
echo "deb $distro-updates main">>/etc/apt/sources.list
echo "deb-src $distro-updates main">>/etc/apt/sources.list
echo "deb $distro-security main">>/etc/apt/sources.list
echo "deb-src $distro-security main">>/etc/apt/sources.list
echo "bpi-r2-ubuntu" >/etc/hostname 
#set root-password! else you will not be able to login

configure fstab/… like it's done for debian :!: ubuntu 18.4 uses netplan as default network-framework bionic releasenotes

#exit chroot


cd $targetdir
sudo tar cvpzf ../debootstrap_$distro.tar.gz .

install System to SD-Card

prepare SD-Kard

#unpacking in root-partiton with
sudo tar -xpzf /path/to/debootstrap_$distro.tar.gz
sudo mkdir lib/modules/
cd lib/modules/
#unpack kernel-modules here

temporary configure network:

ip a
ip link set eth0 up
ip addr add dev lan0 #ip/prefix in your lan-segment not used
ip link set lan0 up
ip route add default via #ip from your router
echo "nameserver" >>/etc/resolv.conf #ip from your router for dns resolution

install “ifupdown” and add “netcfg/do_not_use_netplan=true” to bootopts in /boot/bananapi/bpi-r2/linux/uEnv.txt

after reboot the “old” system with /etc/network/interfaces is used. currently /etc/resolv.conf is resetted every reboot

root@bpi-r2-ubuntu:~# ls -l /etc/resolv.conf                                    
lrwxrwxrwx 1 root root 39 Jun 13 10:27 /etc/resolv.conf -> ../run/systemd/resolve/stub-resolv.conf
#delete symlink and replace it by a static file with your settings
rm /etc/resolv.conf
echo "nameserver" >>/etc/resolv.conf

in ubuntu 18.4 there is a own dns-service running, which have to be disabled (followed by a reboot), in order to get e.g. DNSMasq running (like in my

systemctl disable systemd-resolved

create the image

sudo dd if=/dev/sdx of=$imgfile
#watch state of dd from another terminal with "sudo kill -SIGUSR1 $(pidof dd)"
#truncate image to last partitions end...make sure your path does not contain spaces!
IFS=$'\t' #just for security reasons (ignore spaces in path)
ENDOFDATA=$(fdisk -l "$imgfile" |tail -1|awk '{print $3}')
truncate --size=$[($ENDOFDATA+1)*512] $imgfile
#check size
ls -lh "$imgfile"
#maybe do some stuff with the img
loopdev=$(losetup -f)
sudo losetup $loopdev $imgfile
sudo partprobe $loopdev
sudo mount ${loopdev}p2 /mnt
ls /mnt
sudo sh -c 'cat /dev/zero >/mnt/null.dat'
sudo rm /mnt/null.dat
sudo umount /mnt
#pack image
gzip $imgfile
md5sum $imgfile.gz > $imgfile.gz.md5

i have uploaded my image to my gdrive for testing (ubuntu-18.04-bpi-r2-preview.img.gz)

Lan0-IPv4 is (second port,next to wan) you can change it in /etc/network/interfaces. More on network



dd if=path/to/ubuntu.img of=/dev/sdx


  • dd if=path/to/ubuntu.img of=/dev/mmcblkx
  • maybe you need reboot reading the partitiontable
  • First follow steps here
  • in /boot/bananapi/bpi-r2/linux/uEnv.txt: find the line “root=…” and replace /dev/mmcblk0p2 with /dev/mmcblk1p2
  • in /etc/fstab: replace /dev/mmcblk0p2 with /dev/mmcblk1p2


ssh-server is installed on my image ubuntu-18.04-bpi-r2-preview.img.gz from my gdrive, but root-login have to be enabled

echo "PermitRootLogin yes" >> /etc/ssh/sshd_config
service sshd restart

you should create new host-keys for ssh…

#first delete your old keys
rm /etc/ssh/ssh_host_*
#reconfigure sshserver-package
dpkg-reconfigure openssh-server
en/bpi-r2/ubuntu.1529857844.txt.gz · Last modified: 2020/08/29 17:14 (external edit)