📜 ⬆️ ⬇️

Remove excess packages from Raspbian. Or how to make your Raspbian Mini ...

Raspbian is the recommended distribution for anyone who begins their acquaintance with the Raspberry Pi, the only problem is that by default it includes many packages. And since very few people use Malinka as a desktop, these packages can hardly be considered necessary. On the Internet, you can find images of minimalistic versions (for example, from this article ), but unfortunately the 2 versions presented there (Raspbian Server Edition and Raspbian Minimal) have not been updated for more than 2 years.

In this regard, it was decided to independently cut out all unnecessary components from the installed system. On the Internet, only one more or less complete article in English was found. Most of it is taken from it with my small corrections and additions.

PS Connoisseurs of Linux systems with this are unlikely to have problems, and for beginners it may be useful.

What is there


A clean installation of the system was made (as of this writing, NOOBS LITE version 1.4 Release date 2015-02-18 was installed).
')
Installation was made on a 8 GB flash drive, according to the instructions: www.raspberrypi.org/help/noobs-setup .

As a result, after installation, we have:

# df Filesystem 1K-blocks Used Available Use% Mounted on rootfs 7338472 2521720 4420928 37% / /dev/root 7338472 2521720 4420928 37% / devtmpfs 470416 0 470416 0% /dev tmpfs 94944 240 94704 1% /run tmpfs 5120 0 5120 0% /run/lock tmpfs 189880 0 189880 0% /run/shm /dev/mmcblk0p5 61302 19164 42138 32% /boot 

As you can see 2 521 720 bytes are used, that is 2.5 GB. Also, when loading, the raspberry devours about 200 MB of RAM.

Before you start, you can run raspi-config and make the necessary settings. Here is what I changed:

To view the list of installed packages, you can use two commands:
 # dpkg --get-selections # aptitude search '~i' 

The second command, in addition to the name, will display a description of the packages.

Proceed to delete


Remove the GUI and desktop environment:
 # aptitude purge x11-common lxde gconf2-common gnome-desktop3-data 

Remove LXDE Tails
 # aptitude purge lxappearance lxde-common lxde-icon-theme lxinput lxmenu-data lxpanel lxpanel-data lxpolkit lxrandr lxsession lxsession-edit lxshortcut lxtask lxterminal 

Remove the python:
 # aptitude purge python python-minimal python2.7 python2.7-minimal python3 python3-minimal python3.2 python3.2-minimal 

Remove the developer packages:
 # aptitude purge `sudo dpkg --get-selections | grep "\-dev" | sed s/install//` 

Remove the raspi-config, we will no longer need it:
 # aptitude purge raspi-config 

Remove the sound support. On the server to anything
 # aptitude purge `sudo dpkg --get-selections | grep -v "deinstall" | grep sound | sed s/install//` 

After X's, there's still a lot of trash. It would also be nice to remove it:
 # aptitude purge `sudo dpkg --get-selections | grep -v "deinstall" | grep x11 | sed s/install//` 

Leaving only the latest version of GCC:
 # dpkg --get-selections | grep gcc\- gcc-4.5-base:armhf install gcc-4.6 install gcc-4.6-base:armhf install gcc-4.7-base:armhf install gcc-4.8-base:armhf install 

The latest installed version is 4.8, the other three are removed:
 # aptitude purge gcc-4.5-base:armhf gcc-4.6-base:armhf gcc-4.7-base:armhf 

Now you can remove packages that you do not need. The list of minimum required packages for Debian is given below. Also, when you try to remove some packages, you will receive a warning from the system. Such packages also should not be deleted.

That's what happened with me:
 # aptitude purge xkb-data xdg-utils xarchiver weston epiphany-browser-data gconf-service gconf2-common gnome-desktop3-data gnome-icon-theme gnome-icon-theme-symbolic gnome-themes-standard gnome-themes-standard-data libgconf-2-4 libgnome-keyring-common libgnome-keyring0 libsoup-gnome2.4-1 libxml2 gconf-service gconf2-common aspell bash-completion binutils bzip2 ca-certificates cgroup-bin cifs-utils console-setup-linux cups-common dbus debian-reference-common desktop-file-utils dictionaries-common ed fbset file fontconfig fontconfig-config fonts-freefont-ttf freepats fuse gdbserver gir1.2-glib-2.0 gsfonts gstreamer1.0-libav gstreamer1.0-omx gstreamer1.0-plugins-base hicolor-icon-theme init-system-helpers initramfs-tools isc-dhcp-client isc-dhcp-common java-common keyboard-configuration klibc-utils krb5-locales less logrotate lua5.1 luajit make makedev menu menu-xdg mime-support module-init-tools ncdu ncurses-term netsurf-common nfs-common openresolv parted pciutils perl pkg-config psmisc qdbus strace tasksel usbutils v4l-utils xz-utils zenity-common libaspell15 libasyncns0 libavahi-client3 libavahi-common-data libavahi-common3 libavahi-glib1 libavahi-gobject0 libavcodec53 libavutil51 libavutil52 libbluetooth3 libbluray1 libboost-iostreams1.46.1 libboost-iostreams1.48.0 libboost-iostreams1.49.0 libboost-iostreams1.50.0 libbsd0 libcap2 libcdio-cdda1 libcdio-paranoia1 libcdio13 libchromaprint0 libck-connector0 libcups2 libcurl3 libcwidget3 libdatrie1 libdca0 libdirac-encoder0 libdrm-nouveau1a libdrm-radeon1 libdrm2 libdvdnav4 libdvdread4 libedit2 libenca0 libept1.4.12 libexif12 libexpat1 libfaad2 libffi5 libfftw3-3 libflac8 libfontenc1 libfreetype6 libfribidi0 libfuse2 libgcrypt11 libgdbm3 libgdk-pixbuf2.0-common libgif4 libgirepository-1.0-1 libgl1-mesa-dri libglapi-mesa libglib2.0-0 libglib2.0-data libgme0 libgnutls26 libgomp1 libgpg-error0 libgphoto2-port0 libgpm2 libgraphite2-2.0.0 libgsm1 libgssapi-krb5-2 libgtk2.0-common libgtop2-7 libgtop2-common libharfbuzz-icu0 libharfbuzz0a libhunspell-1.3-0 libid3tag0 libident libidn11 libilmbase6 libiw30 libjack-jackd2-0 libjasper1 libjavascriptcoregtk-3.0-0 libjbig0 libjpeg8 libjson0 libk5crypto3 libkate1 libkeyutils1 libklibc libkrb5-3 libkrb5support0 liblcms1 libldap-2.4-2 libltdl7 libmagic1 libmimic0 libmms0 libmng1 libmodplug1 libmp3lame0 libmpg123-0 libnettle4 libnewt0.52 libnih-dbus1 libnih1 libnspr4 libnss3 libofa0 libogg0 libopenal-data libopenal1 libopencv-calib3d2.4 libopencv-core2.4 libopencv-features2d2.4 libopencv-flann2.4 libopencv-imgproc2.4 libopencv-ml2.4 libopencv-photo2.4 libopencv-stitching2.4 libopencv-ts2.4 libopencv-video2.4 libopenexr6 libopenjpeg2 libopts25 liborc-0.4-0 libp11-kit0 libpipeline1 libpixman-1-0 librtmp0 libsamplerate0 libsasl2-2 libsasl2-modules libsbc1 libschroedinger-1.0-0 libsecret-1-0 libsecret-common libwebkitgtk-3.0-common libwebp2 libwildmidi-config libwildmidi1 libwnck-3-common libx264-123 libxapian22 libxau6 libxcb-glx0 libxcb-render0 libxcb-shm0 libxcb-util0 libxcb1 libxdmcp6 libxfont1 libxvidcore4 libpng12-0 libpolkit-agent-1-0 libpolkit-backend-1-0 libpolkit-gobject-1-0 libqt4-xml libqtcore4 libqtdbus4 libsigc++-1.2-5c2 libsigc++-2.0-0c2a libsndfile1 libspandsp2 libspeex1 libsqlite3-0 libsrtp0 libswscale2 libsysfs2 libsystemd-login0 libtasn1-3 libthai-data libthai0 libtheora0 libtiff4 libva1 libvorbis0a libvorbisenc2 libvpx1 

By executing the top command, we also removed the SSH server, instead of it we will put a more lightweight dropbear:
 # apt-get install dropbear 

Clean up the remaining configuration files:
 # apt-get purge `dpkg-query -f '${Package} ${Status}\n' -W | grep config-files$ | cut -d" " -f1` 

Clear the cache:
 # apt-get clean 

Delete the directory with the video sample (/opt/vc/src/hello_pi/hello_video/test.h264):
 # rm -rf /opt 

Remove the toys that are in the home directory:
 # rm -rf /home/pi/python_games 

Next, clear the logs:
 # cd /var/log/ # rm `find . -type f` 

That's all. Check for free space:
 # df -h      % C  rootfs 7,0G 430M 6,3G 7% / /dev/root 7,0G 430M 6,3G 7% / devtmpfs 484M 0 484M 0% /dev tmpfs 98M 204K 98M 1% /run tmpfs 5,0M 0 5,0M 0% /run/lock tmpfs 195M 0 195M 0% /run/shm /dev/mmcblk0p5 60M 19M 42M 32% /boot 

Total we have left occupied 330 MB (100 MB takes swap) on a flash drive and 42 MB of busy RAM. We can assume that our Raspbian Mini is ready.

Debian - Recommended Packages
adduser
apt
apt-utils
aptitude
bsdmainutils
cpio
cron
debian-archive-keyring
debian-backports-keyring
debian-multimedia-keyring
dhcp3-client
dhcp3-common
dmidecode
ed
gnupg
gpgv
groff-base
ifupdown
info
install-info
iproute
iptables

base-files
base-passwd
bash
bsdutils
coreutils
debconf
debconf-i18n
debianutils
diffutils
dpkg
e2fslibs
e2fsprogs
findutils
gcc-4.2-base
gcc-4.3-base
gcc-4.4-base
grep
gzip
hostname
initscripts
libacl1
libattr1
libblkid1
libc-bin
libc6
libcomerr2
libgcc1
liblocale-gettext-perl
libncurses5
libpam-modules
libpam-runtime
libpam0g
libselinux1
libsepol1
libslang2
libss2
libstdc ++ 6
libtext-charwidth-perl
libtext-iconv-perl
libtext-wrapi18n-perl
libunwind7
libuuid1
libvolume-id1
login
lsb-base
lzma
mawk
mount
ncurses-base
ncurses-bin
passwd
perl-base
procps
sed
sensible-utils
sysv-rc
sysvinit
sysvinit-utils
tar
tzdata
util-linux
zlib1g


Thanks to the article from cnxsoft

Source: https://habr.com/ru/post/264353/


All Articles