The usual advice you get when seeking a more resource conserving distro is to use a lighter spin-off such as Xubuntu, Lubuntu, or a Debian with Openbox, etc. However, not many people know that even a “heavy” distro such as Ubuntu 16.04 LTS with the default Unity Desktop could be made much lighter by uninstalling some stuff and removing others from the startup. Lets see how it can be achieved:
1.Remove unwanted items from Startup Applications.
When you go to the Ubuntu Dash and start the “Startup Applications” dialog, it doesn’t show you the whole picture. There are still many “hidden apps” that silently start in the background without you knowing it. In order for all these hidden apps to be displayed in that dialog, you’ll have to run the following command in the terminal once:
sudo sed -i 's/NoDisplay=true/NoDisplay=false/g' /etc/xdg/autostart/*.desktop
Once you run this and then open the “Startup Applications” dialog, you’ll be able to see the hidden apps too:
From this dialog, you can disable an app from starting up by “unchecking” it. The most important that I typically uncheck on a new installation are Backup Monitor and Desktop Sharing. It doesn’t make sense to have such a huge backup schizophrenia on a non-production desktop computer, so I wonder why the Backup Monitor is enabled in the first place. About 99% of sysadmins either perform a manual backup periodically, or write an automation script use something like rsync which is specifically designed for the job.
Desktop Sharing is an equally unnecessary tool to have been enabled by default on a linux desktop. This ain’t the Windows world where people use Remote Desktop clients to connect to other PCs on the same network. Again, around 99% of linux folks use ssh to connect to remote machines. But that doesn’t mean that you have to keep ssh server enabled by default either. Desktop Sharing should be an opt-in feature in any case and a user who specifically needs it can enable it when needed.
2. Remove unnecessary background services such as cups and avahi-daemon.
On a fresh Ubuntu 16.04 installation, run sudo netstat -antpe and you’ll see the rarely used cupsd daemon (common unix printing service) running on a free TCP port leeching your memory and network resources. Similarly, run sudo netstat -anupe to scan for UDP ports and you’ll similarly see the cups browser daemon (cups-browsed) and the avahi daemon (avahi-daemon) services.
Again, use of printers has become less and less especially since the oncoming of digital age and Internet revolution. Hell, even companies have been encouraging email communication these days in a bid to avoid paper work and save trees, my bank sends me an email statement since last two years instead of a postal envelope to my address, and here we are – one of the top linux distributions running a printer service by default! Again, please make it an opt-in feature, those who need it will have enough sense to type sudo apt install cups. Until that happens, the rest of the folks can do the following:
sudo systemctl disable cupsd.service sudo systemctl disable cups-browsed.service
We are not uninstalling it, just disabling the service just in case. And before you say that cups is needed for PDF exports from browsers, then no, the latest versions of firefox and chrome come with their own PDF extensions and don’t depend on this service anymore.
As for the other service (avahi-daemon), it really doesn’t make any sense as avahi is the linux implementation of Apple’s proprietary protocols for peer-to-peer communication between their iDevices. Now, who in their right mind would be using Ubuntu on their PC/Laptop and still use an Apple product like iPhone or MacBook? The two just don’t play well together as Apple products are a closed system and doesn’t allow much interaction with anything else without going through a lot of hoops. A user who can handle a linux distribution such as Ubuntu can easily handle something like Android which interacts well with a linux system (since Android itself is based on the linux kernel).
Again, for the extremely rare folks who do have such a setup, let them install it themselves. For others, to disable the avahi-daemon, just:
sudo systemctl disable avahi-daemon
3. Disable HUD (if you don’t use it).
One of the reasons why Xubuntu has such a low memory footprint (~200 MB at idle) is that it doesn’t come with memory leeching services such as the HUD. For example, on my laptop, HUD service eats a good 30MB of RAM which is too much for a service that I don’t even use. As described in this post, you can disable the HUD service from the terminal as follows:
on 32bit systems
sudo chmod -x /usr/lib/indicator-appmenu/hud-service
on 64bit systems
sudo chmod -x /usr/lib/x86_64-linux-gnu/hud/hud-service
4. Disable evolution processes (if you use Thunderbird or anything else instead).
Evolution processes(such as evolution-calendar-factory and evolution-addressbook-factory) are huge memory leechers and a big drain on your resources. If you just start the System Monitor and search for “evolution”, then you’ll find 4-5 different processes that will be totally consuming a good 120MB of your RAM! Now, for someone who doesn’t even use the evolution email client or any of these services, why should they be there in the first place? But unfortunately, you cannot just remove (uninstall) these packages using apt. Trying to remove evolution-data-server will break your system as they have made it a core part of the desktop. What you can do instead (if you really want to claim back that RAM) is a workaround suggested in this post. Simply rename the folders as follows (or use the other hack mentioned in the answer):
sudo mv /usr/lib/evolution-data-server /usr/lib/evolution-data-server-disabled sudo mv /usr/lib/evolution /usr/lib/evolution-disabled
5. Remove GNOME software center (only if you don’t use it):
This piece of junk takes a good 70-80MB on any typical Ubuntu installation. For managing software, I personally find the good old apt install way to be much more intuitive than the GNOME software center. For those rare cases when you absolutely need a GUI, the synaptic package manager works absolutely fine and works without taking a constant toll on your resources.
As described in this answer, all it takes to safely remove GNOME software center it from your system is:
sudo apt purge gnome-software
After trimming the programs and services as mentioned above, your system should become nearly as light-weight as those other lighter distros like Xubuntu/Lubuntu/etc. and you’ll still be able to enjoy and work with a richer and better user interface.
On my own laptop, I was able to reduce the idle memory consumption from ~550MB to ~300MB which is as close as it gets to Ubuntu MATE!