getumbrel / umbrel-os

umbrelOS for Raspberry Pi 4 (only). Covert your Raspberry Pi into a home server in one click. For other hardware, checkout https://github.com/getumbrel/umbrel
https://umbrel.com
BSD 3-Clause "New" or "Revised" License
586 stars 55 forks source link

Remove python2 #113

Closed AaronDewes closed 4 years ago

AaronDewes commented 4 years ago

The only package that still depended on python2 was rpi-eeprom, but with version 7.11-1, it now uses python3.

AaronDewes commented 4 years ago

Something still depends on it, but I'll figure out what exactly tomorrow.

AaronDewes commented 4 years ago

Sorry, have been working on a lot of things over the weekend, will do this soon.

AaronDewes commented 4 years ago

Didn't have much impact on the file size, but I think it's removed now.

@mayankchhabra There are other packages that In my opinion could be removed, what do you think?

psmisc
strace
ncdu
crda
manpages-dev
pkg-config
v4l-utils
libraspberrypi-dev
libfreetype6-dev
libpam-chksshpwd
policykit-1
lukechilds commented 4 years ago

@AaronDewes great idea on slimming the OS image down and removing unnecessary dependencies.

Every unnecessary dep is an extra unnecessary attack vector, so happy to remove anything and everything we don't explicitly need. Which is probably quite a bit since almost everything is running inside it's own Docker environment with all required deps living inside there.

To aid us in reviewing, would you be able to give a quick description of what each of those deps does and why you don't think we need them in Umbrel OS?

Thanks!

AaronDewes commented 4 years ago

I'm listing parts of the man pages here (If a package contains multiple tools, I list the description of all).

psmisc

(I'm not sure if this should be removed, it might be useful)

This contains multiple tools that use the /proc file system. fuser - identify processes using files or sockets killall - kill processes by name peekfd - peek at file descriptors of running processes pstree - display a tree of processes prtstat - print statistics of a process

strace

strace - trace system calls and signals

ncdu

ncdu - NCurses Disk Usage ncdu (NCurses Disk Usage) is a curses-based version of the well-known 'du', and provides a fast way to see what directories are using your disk space.

crda

crda - send to the kernel a wireless regulatory domain for a given ISO / IEC 3166 alpha2

manpages-dev

These man pages describe the Linux programming interface, including these two sections: 2 = Linux system calls. 3 = Library calls (note that a more comprehensive source of information may be found in the glibc-doc and glibc-doc-reference packages).

pkg-config

Return metainformation about installed libraries. (This is used by multiple C/C++ configuration utils, for example CMake, QMake, autoconfigure, but I think these aren't needed here either, because normally umbrel isn't used to compile C code)

libraspberrypi-dev & libfreetype6-dev

Both contain C development headers for the library.

Other

the last two packages were needed, and I listed them by misstake.

AaronDewes commented 4 years ago

Also, the text editor vim could be removed, I don't think many people are really needing a text editor on Umbrel, there might be small changes needed, but they can be done with nano as well.

Additional documentation in libraspberrypi-doc can be removed.

Debconf-utils itself is a small packge, but has multiple bigger dependencies, including perl (but I'm not sure if other packages depend on perl too).

AaronDewes commented 4 years ago

Forgot v4l-utils:

Collection of command line video4linux utilities v4l-utils contains the following video4linux command line utilities: . decode_tm6000: decodes tm6000 proprietary format streams rds-ctl: tool to receive and decode Radio Data System (RDS) streams v4l2-compliance: tool to test v4l2 API compliance of drivers v4l2-ctl, cx18-ctl, ivtv-ctl: tools to control v4l2 controls from the cmdline v4l2-dbg: tool to directly get and set registers of v4l2 devices v4l2-sysfs-path: sysfs helper tool

AaronDewes commented 4 years ago

Removing man-db and htop could aso lead to size improvements, but they might be usefull for debugging.

AaronDewes commented 4 years ago

libmtp-runtime could also be removed. It is a library for the Media Transfer Protocol (MTP).

I now have a test build running here, that removes all packages from my first comment, except the two last packages, but removes vim. https://github.com/AaronDewes/umbrel-os/runs/1105464996

lukechilds commented 4 years ago

Ok merged this, thanks @AaronDewes!

Would be great if you could submit another PR stripping out the other packages once it's built and you've tested the image.

(Also I think we should keep the psmisc package)

AaronDewes commented 4 years ago

I'll do that once the images is build and tested.

What do you think about htop & man-db?

lukechilds commented 4 years ago

Also happy to remove vim, libraspberrypi-doc and libmtp-runtime.

Will man-db will completely nuke man and all its files? Or just the man binary and each other package will still include it's manfiles but they'll just be unusable? Do you have a rough idea how much space it'll save?

If it's a big space saving I think that's also ok to remove. The vast majority of users will never use CLI, and if they do, they'll have us walking them through it. So not super important to have man available to them. But if it's only small then it's probably worth keeping it around.

htop I think would definitely be good to keep around because it's pretty useful for debugging, and for anyone who's capable of debugging without our help, it's probably one of the first tools they'll reach for.

lukechilds commented 4 years ago

So I'd say for a complete list:

strace
ncdu
crda
manpages-dev
pkg-config
v4l-utils
libraspberrypi-dev
libfreetype6-dev
libpam-chksshpwd
policykit-1
vim
libraspberrypi-doc
libmtp-runtime

And maybe also man-db if it's a significant size reduction.

And feel free to open more PRs in the future if you spot any more deps you don't think are required. PRs that remove code are my favourite PRs!

AaronDewes commented 4 years ago

Man-db itself doesn't remove manual pages, but that can be done with rm -rf /usr/share/man/. I'm starting a test build for size comparision now.

AaronDewes commented 4 years ago

Comparison

Build type Size
Latest Umbrel OS release: 928 MB
Latest Umbrel OS master (without python2): 921 MB
Without the listed packages: 877 MB
Without the listed packages and manuals: 874 MB

Should I start a PR with or without man-db (The last build also doesn't contain manuals, not only man-db itself was removed)?