I'm trying to convert an existing Ubuntu installation to a minimal config so it can run off of a 2 GB SD card (or even smaller). Right now, the current hardware (a Pi like board) needs a custom 16.04 build to support network and other on-board devices and takes up 4+ GB of space.
So the question is how to remove most packages (e.g. terminal, network, Wi-Fi and other board-specific drivers) to make it really small and lightweight? Are there any guides or recommendations on how to make it safe?
I know I can do something like this to identify and remove optional packages:
dpkg-query -Wf '${Package;-40}${Priority}\n' | awk '$2 ~ /optional|extra/ {print $2,"\t", $1}'
But what else can be safely removed?
