BeagleBoneBlack RevC Debloat [Part 1]
by kacang bawang
There are literally a million articles on the internet comparing BeagleBone vs RaspberryPi. People talk about all possible features, except one – bloatware. BeagleBone is absolutely stock-full of it. I found this out the hard way when I purchased the BeagleBoneBlack. All my searches about the topic turned up a few requests for debloat instructions with a few answers showing how to disable services via systemd
, but none about how to permanently remove the programs in question. So, without further ado, let me show you how I removed the most egregious offenders.
Let me clarify a little bit what I mean by bloat. To me, bloat is anything above a headless SSH box. Anything else should be installed after user logs in and specifies what they are going to do with the device. BeagleBone takes the opposite approach, it enables anything and everything by default (hello Windows 95) and sets the root account to be without a password (no, it doesn’t make you set a root password once you first log in). Now to some people this is a feature (not a bug) – they want everything plug-and-play, one click, out of the box. I think you probably realize where I stand in this debate if you’ve read this far. So what’s my problem with all this? My problem is that there is only one Debian distro for BBB, and it is one with everything enabled. Meaning – that now I have to go and manually purge all these things I do not want and/or need. In some cases there are uninstall mechanisms, in others there are not.
Let me state specifically which build I am using. This is what came pre-loaded on an element14 BeagleBoneBlack RevC.
1 2 3 |
$uname -a Linux beaglebone 3.8.13-bone47 #1 SMP Fri Apr 11 01:36:09 UTC 2014 armv7l GNU/Linux |
Let’s start by checking what is currently listening on our machine:
1 2 3 4 5 6 7 8 9 |
$sudo netstat -apn | grep LISTEN tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1202/sshd tcp 0 0 127.0.0.1:3350 0.0.0.0:* LISTEN 844/xrdp-sesman tcp 0 0 0.0.0.0:3389 0.0.0.0:* LISTEN 824/xrdp tcp6 0 0 :::8080 :::* LISTEN 889/apache2 tcp6 0 0 :::80 :::* LISTEN 1/systemd tcp6 0 0 :::22 :::* LISTEN 1202/sshd tcp6 0 0 :::3000 :::* LISTEN 1/systemd |
Right away we see some offenders:
1 2 3 4 |
tcp/3350,3389 #windows compatible remote desktop tcp/8080 #apache web server tcp/80 #something started by systemd (bonescript) tcp/3000 #something started by systemd (cloud9 editor) |
Both ports 80 and 8080 already taken by default? Ouch…
Remove xrdp:
1 |
$sudo apt-get purge xrdp |
Remove apache2:
1 2 |
$sudo apt-get purge apache2 apache2-mpm-worker apache2-utils apache2.2-bin apache2.2-common $sudo apt-get autoremove #get rid of no-longer needed dependencies |
The other two are a bit more troublesome, as they don’t provide an “uninstall” method, and must be removed manually
Remove cloud9:
1 2 3 4 5 6 7 8 9 |
$sudo systemctl stop cloud9.service #stop working copy $sudo systemctl stop cloud9.socket #stop working copy $sudo systemctl disable cloud9.service #disable autorun $sudo systemctl disable cloud9.socket #disable autorun $sudo rm -rf /var/lib/cloud9 #installed binaries and such $sudo rm -rf /opt/cloud9 #source download and build directory $sudo rm /etc/default/cloud9 #environment variables $sudo rm /lib/systemd/system/cloud9.* #systemd scripts $sudo systemctl daemon-reload #restart/reload systemctl deamon |
Remove bonescript:
1 2 3 4 5 6 7 8 9 |
$sudo systemctl stop bonescript-autorun.service #stop currently running copy $sudo systemctl stop bonescript.service $sudo systemctl stop bonescript.socket $sudo systemctl disable bonescript-autorun.service #purge autorun scripts $sudo systemctl disable bonescript.service $sudo systemctl disable bonescript.socket $sudo rm /lib/systemd/system/bonescript* #startup scripts $sudo rm -rf /usr/local/lib/node_modules/bonescript #binaries $sudo systemctl daemon-reload #restart/reload systemctl deamon |
Bloat found in /opt/source
1 2 3 4 5 6 7 8 9 10 11 12 13 |
black@beaglebone:/opt/source$ ls -al total 704 drwxr-xr-x 8 root root 4096 Apr 23 2014 . drwxr-xr-x 4 root root 4096 Dec 1 04:30 .. drwxr-xr-x 5 root root 4096 Apr 23 2014 BBIOConfig drwxr-xr-x 3 root root 4096 Apr 23 2014 beaglebone-universal-io -rw-r--r-- 1 root root 109206 Apr 11 2014 config-3.8.13-bone47 drwxr-xr-x 3 root root 4096 Apr 23 2014 fb-test-app -rw-r--r-- 1 root root 826 Apr 23 2014 list.txt -rw-r--r-- 1 root root 570215 Apr 11 2014 patch-3.8.13-bone47.diff.gz drwxr-xr-x 4 root root 4096 Apr 23 2014 prufh drwxr-xr-x 2 root root 4096 Apr 23 2014 u-boot_v2014.04 drwxr-xr-x 7 root root 4096 Apr 23 2014 Userspace-Arduino |
Can all be safely deleted, it is all 3rd party optional bloat (along with some kernel patches!?) with little to no documentation as to why it is here.
More unnecessary packages
At this point, I moved on to purging more preinstalled junk that was not as intrusive as the stuff above, but was nonetheless eating CPU cycles. The first thing that caught my eye was the Avahi
daemon. It may be useful on a server machine, but my BeagleBone is not a server, so off with Avahi
. But.. not so fast. I was able to remove avahi-daemon
the usual way:
1 |
$sudo apt-get purge avahi-daemon |
However attempts at removing the rest of avahi
(such as libavahi-client
) triggered apt-get
to try to remove half of the currently installed packages (such as pulse audio
, opencv
, gnome
, the list goes on). That’s not to say that I wouldn’t have uninstalled some of these later on myself, but let’s keep uninstalls localized to their subsystem.
I will search for a solution to this dependency hell and will post my findings under Part 2.
Thanks for this post! This is EXACTLY what I have been looking for without success. I was able to verify that cloud9 and Bonescript weren’t registered anymore with:
systemctl list-unit-files | grep bonescript, grep cloud9.
Thanks for your feedback Kevin!
Thanks a bunch. Been gritting my teeth at all shit it comes with.
Awesome!
Thanks!!
Hi,
many thanks for this page. That’s exactly what I searched for – and newbie save 🙂
Thomas
Very useful. Thanks!
VERY useful Kacang! Thank you for this information. It is a shame that those of us actually trying to use the BBB as the basis of an embedded device, have to jump through hoops just to get down to a minimal setup. I’d be very interested in further notes, and would love a Part2 to this blog post. It’d really help the BBB community out. Thanks again!
Thank you!
Yeah. We need a ‘pro’ distro for the BBB. I messed a bit with the IoT version which is closer, but it’s based on Wheezy not Jessie, and still incompatible with the Python libraries we use… I apt-get remove-d node and to my surprise cloud9 was still running. There’s node, in /usr/bin , not being managed by apt at all. Oops.
er, Jessie not Wheezy.
The beaglebone-universal-io directory has the config-pin script that is linked to /usr/local/bin/config-pin. You might need that if you use any of the cape-universal overlays.
Excellent Help getting rid of bloat! I continued clean up removing Chrome Browser/libraries from BB’s latest Jessie 8.4 image installed. Another 200MB saved. Happy with my Screed BBG now.
Thanks KB!!
No problem 😉 If I may ask, is the BeagleBone being used on Maui? 🙂
Why, yes it is! I’m replacing some Zoneminder Server (IP Cams) with one or two Beaglebones that feed a ZM database in the mainland. The Beagles come with bloatware already installed and even the latest BB SD images have them. I want to install a headless barebones system. Zoneminder needs all the juice it can squeeze out the BB to be functional. Thanks to your article, I was able to clean up these bloated images I installed before configuring Zoneminder.
That’s awesome. Thanks for sharing!
Thank you so much, you saved a newbie’s day.
I know I am late to this topic, and the BBB went out of fashion. Nevertheless it does what I need..
Is there a second part to this available?
Hi Nick, glad to help! May I ask what brings you back to the BBB?
Sorry, the second part didn’t happen 🙁
Sorry KB,
just dropped by, very late, as always…
The BBB works as my small back office for years now, running some services like a tiny wiki, webdav and passes on some stuff to a telegram bot.. Good enough for those things. Now I wanted to get rid of bloat from BBGreen, which seems quite different..
And still interested in following parts.. ,’-)
Cheers.
Better late than never 😉
Not sure about the BBGreen, if memory serves, it is an earlier edition that came before the black. There’s no way you can get me to work on it at this point in time 🙂 But thank you for sharing your BBB use-case!
Cheers!
This was exactly what I was looking for.
Just starting to learn about embedded linux systems, and ran into a stop bcause out of space. This helped a lot!
This worked great in 2021 on latest build. the one thing I can’t get uninstalled is nginx. It’s still running even after removing the package.
Try killing the process? Or disable with systemctl?