Log In  


Pico 8 Linux Laptop

Intro

The guide below shows how to configure a laptop to automatically boot and launch Pico 8. The laptop will shutdown when the SHUTDOWN command is issued in Pico 8 console.

Requirements

Install Ubuntu

If Windows is installed use MMC / Disk Management to shrink the Windows partition.
Install Ubuntu 22.04 Server (e.g. USB - press ESC or F2 to enter bios);

After booting the Ubuntu 22.04 Server Installer:

  • Select Install Ubuntu Minimal
  • If you want to keep Windows, make sure you are not overwriting the partition. Ubuntu will dual-boot if not installed on a full disk.
  • During installation, configure the administrative user. You will use this to update Pico8, etc.
  • You may want to install OpenSSH Server if you'd like to ssh to / scp from the Pico8 Laptop.

Configure Ubuntu 22.04 Minimal Server

Either log-on to local console or, if OpenSSH was installed, remote in using ssh.

Install dependencies

sudo apt install xinit xterm alsa-utils mingetty unzip

Create and configure Pico8 user

The p8 user will run Pico8. Auto-logon will be configured as well.

sudo useradd -m -s /bin/bash p8
sudo passwd p8
sudo usermod -aG sudo p8
sudo usermod -aG audio p8
alsamixer

Reboot

sudo reboot now

Test audio

To test speakers use either of the following:

  • speaker-test
  • alsabat-test

Press Ctrl+C to stop.

Test video

startx xterm

Move mouse to go over the terminal and press Ctrl+D to exit.

Configure auto-logon for the P8 user

Taken from <https://askubuntu.com/questions/168706/how-do-i-auto-login-as-root-into-the-tty-upon-boot>;:

sudo su
mkdir -p /etc/systemd/system/[email protected]

cat > /etc/systemd/system/getty\@tty1.service.d/override.conf <<- "_EOF_"
 [Service]
 ExecStart=
 ExecStart=-/sbin/mingetty --autologin p8 --noclear tty1
 _EOF_

systemctl enable [email protected]

Reset and test auto-logon:
reboot now

After reboot, p8 user should automatically log-in (no password required).

Important:

  1. To switch to another terminal/user at any point: Ctrl+Alt+F2 (or F3-F6).
  2. To terminate pico8 from another console: sudo killall pico8

Download Chromium and Pico8

We will use Chromium to log-on to and download Pico8.

sudo snap install chromium
startx chromium

Download your Linux purchased copy of Pico-8 from https://www.lexaloffle.com/. Match your CPU architecture (x64 is most common.)

Exit Chromium and search for your download:

find ~/snap | grep pico

Copy the zip file to p8's home folder. Extract the linux pico-8 into ~/pico-8.
Note Press TAB to autocomplete file names. Folder names must match in order for auto-run to work.

cd ~
cp <location_of_pico8_zip> .
unzip pico-8<version>.zip

Test Pico-8

Note to eliminate mature content, you need to pass -splore_filter 1

cd ~/pico-8
startx ./pico8 -fullscreen_mode 0 [-splore_filter 1]

To exit Pico8, type SHUTDOWN.

Configure Pico 8 (Optional)

You can also use nano or any other editor. At a minimum, fullscreen_method must be set to 0 for input to work in xinit/startx:

vim ~/.lexaloffle/pico-8/config.txt

Note Likely cause for fullscreen_method is that SDL2 requires a Window to work: (https://stackoverflow.com/questions/44777929/sdl2-keyboard-detection-doesnt-work)

Set Pico-8 Autostart

cat > ~/.xinitrc <<- "_EOF_"
cd ~/pico-8
./pico8 -fullscreen_method 0 -splore_filter 1
shutdown now
_EOF_
cat > ~/.bash_login <<- "_EOF_"
startx
_EOF_

Restart the system:

sudo reboot now

The system should now auto-boot Ubuntu, auto-login p8 and start Pico8.
When you SHUTDOWN pico8, your computer should also shutdown.

Recovery

Ubuntu Console

In case you need to make changes, at any time you can log-in with the administrator user you've configured during Ubuntu install to another console:

  1. Ctrl+Alt+F2 (to F6)
  2. Log-on with admin user

Booting back to Windows

During boot, you will see a menu for GNU GRUB. Select Windows Boot Manager to go back to windows.

When you restart Windows, the menu goes back to Ubuntu default.

Optimizing Boot Time

Grub Wait Time

By default, GRUB will wait for 10 seconds for the user to make a selection. This is changing to 1 second. Note that 0 means default.

Use the Recovery step to log-on to another console.

sudo vim /etc/default/grub

Edit the file to change GRUB_TIMEOUT=1

sudo update-grub

Remove Unneeded Services

From https://askubuntu.com/questions/10290/how-do-i-improve-boot-speed
Use the following to identify long-running tasks during start-up.

systemd-analyze
systemd-analyze critical-chain
systemd-analyze blame

A few services I have disabled. It's important to maintain the Internet, Wifi services to allow splore access.

sudo systemctl disable snapd.service --now
sudo systemctl disable snap.lxd.activate.service --now
sudo systemctl disable snapd.seeded.service --now
sudo systemctl disable cloud-init.service --now
sudo systemctl disable cloud-final.service --now
sudo systemctl disable cloud-init-local.service --now
sudo systemctl disable snapd.apparmor.service --now
sudo systemctl disable cloud-config.service --now
sudo systemctl mask systemd-networkd-wait-online.service 
5


This is a great guide, thanks for sharing! I love when "obsolete" hardware is put to good use.


Nice guide! That's a clever trick with the shutdown command, too.

For anyone interested, Debian might be a bit lighter than Ubuntu for older hardware. Going even further, Raspberry Pi version of PICO-8 works on postmarketOS (based on Alpine Linux) on aarch64 devices (ARM8 architecture, which includes newer Raspberry Pi, PinePhone, and most recent smartphones). All it needs is a gcompat package (because postmarketOS uses musl instead of glibc, installable via apk add gcompat). So you might be able to repurpose an old smartphone or a tablet as a PICO-8 device, too.



[Please log in to post a comment]