home about
blog 2003 2004 2005 2006 2007 2008 2017 2018 2019 2020
tech android linux vim

Installing Devuan 2.0 "ASCII" on a Raspberry Pi

Tags: linux devuan raspberrypi rpi install

This outlines the basic steps to install Devuan on a Raspberry Pi. It assumes more than modest familiarity with Linux and the command line.


Materials, etc

For this project you will likely need

Download and write the disk image

You'll find a list of mirrors here: http://devuan.ksx4system.net/devuan_ascii/embedded/

Note: If you are not sure which image to download, the Devuan images seem to work like this:

  RPi1 Rpi2 Rpi3
Image raspi1 raspi1 raspi3

(I have not been able to determine which model the raspi2 image is for, possibly RPi Zero?)

Writing the media is pretty easy, and uses the standard dd command that most GNU/Linux machines will come with.

WARNING: Be very careful with the dd command. You can destroy partitions and entire drives by using it incorrectly. BE SURE YOU KNOW WHAT YOU ARE DOING.

Note: /dev/sdX is your SD or microSD card. You'll need to check what it is with sudo fdisk -l before writing the media.

	$ wget -c http://devuan.ksx4system.net/devuan_ascii/embedded/devuan_ascii_2.0.0_arm64_raspi3.img.xz
	$ time ( xzcat devuan_ascii_2.0.0_arm64_raspi3.img.xz | sudo dd of=/dev/sdX bs=2M )

Once you have written your card, now is as good a time as any to resize the root (/) partition to fill the rest of your card, or expand it and add other partitions. Once you have the card in your Pi it's no fun to shut down and do that. It's easier to do it with another machine while it's still inserted.

Resize Partition(s)

gparted is the easiest way to go, or use your preferred partitioning software. The idea is to resize the root partition so it's a bit bigger. Ideally to use the entire free space, as this is the simplest route.

If you want to have a separate /home or other partition, use approximately 10-25% of your card size for root. Then add another to fill the available space, and set it up to mount wherever is desired later. (This is entirely optional and not in any way required for any installation done on eMMC, microSD, or USB disks.)

Note: if the repartition fails, as it did for me when I tried on an older Devuan 1.0 machine, you may end up in the unenviable catch-22 of needing a working Devuan machine to administer to your non-working RPi. If this happens, you can go to the Devuan page on upgrading Debian/Jessie or Devuan/Jessie to ASCII and good luck! (I'm kidding, this is much less scary than it sounds, it worked for me on every system I tried. See below for the simple dist-upgrade procedure.)

In the end, my card with a separate /home partition looked something like this:

Mount point Size Type
boot untouched (128 MB) vfat
root 25 GB ext4
home 92 GB ext4
Total 128 GB microSDXH

Example output of some commands and a look at fstab:

	root@devuan:~# fdisk -l
	Device         Boot    Start       End   Sectors  Size Id Type
	/dev/mmcblk0p1          2048    264191    262144  128M  c W95 FAT32 (LBA)
	/dev/mmcblk0p2        264192  52692991  52428800   25G 83 Linux
	/dev/mmcblk0p3      52692992 249737215 197044224   94G 83 Linux

	root@devuan:~# df -hl
	Filesystem      Size  Used Avail Use% Mounted on
	/dev/root        25G  672M   23G   3% /
	devtmpfs        429M     0  429M   0% /dev
	tmpfs            87M  1.3M   86M   2% /run
	tmpfs           5.0M  4.0K  5.0M   1% /run/lock
	tmpfs           174M     0  174M   0% /run/shm
	/dev/mmcblk0p1  128M   35M   93M  28% /boot
	/dev/mmcblk0p3   92G   61M   88G   1% /home

	root@devuan:~# cat /etc/fstab
	## <file system>  <mount point> <type> <options>              <dump><pass>
	## bootfs
	/dev/mmcblk0p1  /boot   vfat    defaults        0       1
	/dev/mmcblk0p3  /home   ext4    defaults        0       1

The stress of repartitioning out of the way, let's get on with the setup!

Set Up

Note: On boot-up, you should see four raspberries (RPi 2/3), representing your four CPU cores, or one (RPi 1) on other cards.


If you do not have an ethernet cable attached when you boot, you'll need to make sure to issue the dhclient command once you sign in. (Default user/pass are root/toor until you change them to be more secure.)

	$ dhclient eth0

If you changed your partitioning scheme above when resizing the disk map, Make any needed changes to the fstab file so your /home partition mounts, and either restart, or manually mount that/those now. (See above for examples.)


Our next order of business is to get updated, and begin installing the packages we want/need to begin.

Your needs may be -- and indeed likely are -- entirely different than mine, but I'll show the things I regularly install first, as an example. (Chances are, if you don't know what these are, you don't need them.)

Feel free to use apt instead of apt-get, as well. I have some fairly specific complaints about apt for the time being, and basically don't use it (but it is the "recommended" way to update/install packages).

	$ apt-get update && apt-get upgrade
	$ apt-get install console-data console-setup console-setup-linux less lshw \
	lsof procps rsync screen subversion vim

Root password

Change the password to something less ridiculously simple to brute-force or guess. And don't forget what you've changed it to, you'll almost certainly need it again.

	$ passwd root
	Enter new UNIX password:
	Retype new UNIX password: 
	passwd: password updated successfully

This done, you should have a mostly working system, to which you can add additional packages easily.

User separation

If you intend this to be a headless server, it still makes sense to have a standard user for administrative tasks, as it is unwise to make it easy for root to sign in remotely.

Example: $ adduser [--home DIR] [--shell SHELL] user

	$ adduser --home /home/clover --shell /bin/bash clover
	Adding user `clover' ...
	Adding new group `clover' (1000) ...
	Adding new user `clover' (1000) with group `clover' ...
	Creating home directory `/home/clover' ...
	Copying files from `/etc/skel' ...
	Enter new UNIX password:
	Retype new UNIX password: 
	passwd: password updated successfully
	Changing the user information for clover
	Enter the new value, or press ENTER for the default
		Full Name []: clover patch
		Room Number []: <CR>
		Work Phone []: <CR>
		Home Phone []: <CR>
		Other: []: <CR>
	Is the information correct? [Y/n] y<CR>

Before you get too excited and sign in, let's make sure the new user has the ability to be an admin, otherwise you'll be using the su command to become root frequently:

	$ update-alternatives --config editor
	There are 3 choices for the alternative editor (providing /usr/bin/editor).

	  Selection    Path                Priority   Status
	* 0            /bin/nano            40        auto mode
	  1            /bin/nano            40        manual mode
	  2            /usr/bin/vim.basic   30        manual mode
	  3            /usr/bin/vim.tiny    15        manual mode

	Press <enter> to keep the current choice[*], or type selection number:
	update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/editor (editor) in manual mode

	$ visudo
		##due to complexity, append to bottom of file:##
	clover	ALL=(ALL:ALL)	ALL

Note: Be sure you use the username for the user you created, not "clover", as that's my user!

Now for the fun part, you get to sign out of the console as root, and sign into the machine as yourself!

	$ exit

Your screen should clear, at this point. if it doesn't, you can cp /etc/skel/.profile ~/.profile and next time it will!

	Devuan GNU/Linux ascii hana tty2

	hana login: clover
	Last login: Mon Jun 25 21:09:30 UTC 2018 from on pts/3
	Linux hana 4.16.14-v8+ aarch64 GNU/Linux

	The programs included with the Devuan GNU/Linux system are free software;
	the exact distribution terms for each program are described in the
	individual files in /usr/share/doc/*/copyright.

	Devuan GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
	permitted by applicable law

Congratulations! You have a working Raspberry Pi 3 B with a systemd-free operating system.

Further ideas

Fix vimrc bug

Per the dist release notes, fix vim so it works as one would expect (vimrc file loading-wise, anyway).

You may not have issues, but I had trouble with the first machine I put Devuan on: it would not let my personal .vimrc turn syntax highlighting on, no matter what I did, until I moved /etc/vim/vimrc elsewhere. So it must be related (I didn't dig into it, as it seemed trivial at the time, and this should fix that issue, regardless):

	$ sudo vim /etc/vim/vimrc
	<at bottom add:>
	let g:skip_defaults_vim = 1

Install a window manager or desktop environment

Install i3-wm (or any other window manager and xorg, so you have a GUI. I like i3-wm as it's snappy even on an RPi3, but be warned it comes with a learning curve):

	$ /usr/bin/sudo /usr/bin/apt-get install -y big-cursor clipit i3-wm i3lock i3status feh \
	libanyevent-i3-perl libjson-xs-perl libnotify4 libnotify-bin fonts-dejavu-core rofi \
	thunar wicd-gtk x11-utils xbacklight xclip xdg-utils xfonts-base xfonts-terminus xsel

Make networking nicer

Get networking and ssh (client/server) set up with wicd (network-manager is a dumpster fire of systemd and udev deps and awfulness, and I typically avoid it at all costs).

	$ sudo apt-get install -y dnsutils iproute openssh-client openssh-known-hosts openssh-server wicd wicd-curses
	$ wicd-curses

dist-upgrade to a newer release

When I began writing this note, ASCII was the newest release of Devuan. Since then, Debian Buster has come out. Its Devuan equivalent is called Beowulf.

	$ sudo vim /etc/apt/sources.list
	$ sudo apt-get update

At this time, examine the output of sudo apt-get dist-upgrade but do not run it. If any of the packages it wishes to remove are important to you, figure out why they are being removed, or mark them as manually installed so they are not removed, whichever suits.

When you are satisfied nothing important will break (and have done a backup if deemed necessary), run this for real:

	$sudo apt-get -y dist-upgrade

Upgrade References

Devuan dist-upgrade: https://devuan.org/os/documentation/dev1fanboy/upgrade-to-ascii Debian jessie migration: https://devuan.org/os/documentation/dev1fanboy/migrate-to-ascii

© 1995-2020 clover