Introduction/special considerations

Raspberry Pi is a good platform for TeX: light-weight by modern standards. Typically use just a text editor (maybe IDE), TeX complier and a PDF viewer.

Special considerations

A Raspberry Pi has some specific issues in that it has fairly small storage and it’s mostly flash. Flash wears fairly quickly if it gets written too much.

Something in the region of 10^5 writes. The real effective life is dependant on which model of SD card you have and the quality of its wear levelling.

So in a RPi distribution, such as Raspbian, things are different. The runtime directories such as /tmp can be in RAM, using tmpfs. Stops the most regularly written files from wearing the SD card unnecessarily. But the downside is that these directories are of relatively small/finite size.

For most applications, including TeX, this limit isn’t normally a problem. But for build and install then some thought is needed.

I will just cover install here; build is more complex, but most people won’t ever need to know.

When the installer/tlmgr runs it makes a very large tree of directories of little files/directories in your temporary directory. On a regular hard disk this isn’t noticeable. But, with only 5 or 20MB in tmpfs, the /tmp volume can hit the limit part-way through the install, and frustrate the unprepared.

You might be lucky with your install and not get to the size limit, but during tests the full install only gets about half way before failing.

So you may need a bigger temporary directory, and some other things too.

Installation

Install needs access to the DVD contents (or other repository) and a mountable read-write volume that allows for a big temporary directory. Best that it be magnetic and not flash.

You can use a USB HDD or possibly mount your PC’s HDD over your LAN via sshfs or NFS. Net-mount could take the least additional hardware, but can be slow (especially over 100Mb/s ethernet).

The preferred solution is to use a USB HDD.

If you have a USB DVD reader, then you can plug it directly to your Pi. Or copy the DVD to a USB stick.

Remember to set TMPDIR:

Once mounted you must tell the installer/tlmgr to use your bigger temporary directory. Using the environmental variable “TMPDIR” you point there. Something of the form of: “export TMPDIR="/media/wibble/tmp"“.

If you are happy with a /tmp in your SD card (or wherever), then no need to set a new temporary directory/TMPDIR.

Decide on your mountable volumes

Primarily LAN mount or USB HDD:

LAN mount

Via sshfs or NFS you need to mount the DVD and a separate temp dir. Documentation for these share methods is elsewhere.

Typically you will do two separate shares: the DVD and the temp dir. The DVD can be mounted with export entries like: /media/cdrom and probably something like /working/tmp for the temporary.

Generally not a good idea to mount your PC’s own /tmp, so make your share’s temp dir either in your own home or in another more generally shareable directory.

Maybe you want a network swap; goes rather slowly but you can be assured that nothing’s writing to your SD card unnecessarily.

Typically your LAN mounts would look like:

/mnt/wibble/cdrom the DVD contents
/mnt/wibble/tmp temporary dir
/mnt/wibble/swapfile your new swapfile

See below the caution about interruptible swapfiles.

USB HDD

You might want a separate DVD drive, but less hardware is to copy its contents to your external HDD. If you have something like a WD PiDrive then this is nearly permanently mounted to the RPi. But you might be using a more portable one.

  1. Copy the TeX Live DVD to a reasonable directory (or  use USB DVD).
  2. Make a temporary directory
  3. Maybe make a big swapfile

So your HDD looks like:

/texlive/2018 the DVD contents (or whatever year)
/texlive/tmp temporary dir
/texlive/swapfile your new swapfile

If you are using your own bigger swapfile then read the documentation on swapon/swapoff to ensure it gets used. And you should ensure the USB connectors can’t be disturbed, else your RPi will probably crash horribly.

Controlling your package manger/stock TeX Live

Most Linuxes have Tex Live already available as packages within the distribution. For example: whichever Raspbian you are using. This will be an older version of Tex Live than is on this year’s DVD/repository; so you want to suppress it: a) so you don’t run the wrong binary/script b) saves space.

You should ensure that the stock TeX LIve packages aren’t installed when you install the DVD. Then you suppress the package manager from installing them in the future.

The instructions for this are maintained on the TeX Live Debian pages (https://www.tug.org/texlive/debian.html).

Build

The TeX Live DVD binaries are built for an ARMv6 chip, as found in a RPi v1. They will run on any variant of Pi; whether 1, 2 or 3, … (these can have ARMv7 and later) . So good for most people.

On more advanced RPis, with later chips, then possibly a native build would run more efficiently. Should you wish to do so then another page on building might get written in the future.

Conclusion

Once setup TeX works nicely on a RPi.

Thanks

Thanks to UKTUG for funding the Raspberry Pi TeX Live build project.