How to handle bloat on GNU/Linux?

Joined
Mar 18, 2024
Messages
43
Reaction score
6
Credits
413
One of my main reasons to switch to GNU/Linux is the lack of bloat. But I was a little wrong. On Ubuntu right now. The system can generate quite a bit of bloat. And I have a tendency to mess around in the deep to remove bloat, and I end up breaking the system, as I have done now.

I am really frustrated about this. I know, a few KBs of bloat is nothing, but I still hate to have those many files over complicating the system and the file structure.

For example, installed neofetch, and purged it. Using find, I can still see a lot of terms related to it on my drive. A lot of them are logs, my main enemy, cuz I don't care about any logs. Then I saw that the literal config of neofetch was still in my home directory, even after purging it. How do I not ponder all the time when installing a program like this?

About the logs, I hate them. I generally disable journald. Just 2-3 days of work, and there are more than 70K lines in the journald log and taking a few hundred MBs of storage. I also don't like logs because they hammer your drive IO, and again, because I do not care about logs until I have a specific problem or debugging to do. Upon that, there is also apt logs, and logs of a lot of other programs. I just hate.

Without breaking my system time to time, what are all the directories that I should check and remove to safely remove bloat. Is there really no better way to do this? An automated way?
 


You almost always need at least a few logs around. The question is, how many for how long?

I use logrotate. It's the default on most of the distro's I use.

My /etc/logrotate.conf file looks like this.

Code:
/var/logs/*.log {
    missingok
    notifempty
    daily
    rotate 7
    compress
    delaycompress
    maxage 30
    size 100M
    endscript
}

  • In this example:
    • missingok: Ignores missing log files.
    • notifempty: Doesn’t rotate empty log files.
    • daily: Rotates logs daily.
    • rotate 7: Keeps a maximum of 7 compressed log files.
    • compress: Compresses rotated log files.
    • delaycompress: Delays compression until the next rotation.
    • maxage 30: Deletes logs older than 30 days.
    • size 100M: Deletes logs larger than 100MB.
Note that this only takes care of logs in /var/log, but you can add as many directories as you like.

Note: In my opinion, using snap is what causes a bigger bloat.
 
And I have a tendency to mess around in the deep to remove bloat, and I end up breaking the system, as I have done now.
One of our members here has as part of their signature..."You reap what you tweak"

Truer words never spoken.

Your profile says you are 16....if that is correct, you have been with xfce etc for around 5 minutes....fat too short a time to be worried about what amounts to zero.

Logs can get to be a bit over the top. Follow @dos2unix's suggection to harness them

Apart from that.....leave the system alone. This is not windows.
Using find, I can still see a lot of terms related to it on my drive.
How would you know those terms are actually related to neofetch.....dependencies more often than not are used by more than one app.

Linux is made to be enjoyed, not to drive you to distraction.
 
The name @Debian_SuperUser conjures up a few images: the root user, and then, an exceedingly well informed user :)

There are many definitions of "bloat" and the OP's description appears to mean "data that takes up space on the hard drive which could be removed without interfering with the operating system running".

The examples given however, all have straight forward solutions.

In the case of neofetch, it can be removed entirely from the system files with the purge option which takes out the executable and the configuration files leaving nothing in the system files:
Code:
apt purge neofetch

In relation to the neofetch files in the ~/home/<user> directory, these are the responsibility of the user who can delete them by hand. If the program is re-installed, the files in ~/home/<usr> are usually re-created.

In relation to the journal logs, they can be restricted in size via the configuration file:
/etc/systemd/journald.conf.

The observation that logs "hammer your drive IO" can be checked through the output of the program: iotop, to see which processes are doing most of the I/O work. The usual output doesn't show log writing as one of them. In fact here, it's so low in i/o activity, it doesn't appear in the output at all.

Logs serve a fundamental purpose which is to help the user, especially in cases of last resort. They can be conceived as a sort of safety net of information for the user. On the other hand, programs like apt and dpkg use the logs to provide information to the user and for themselves in their own functioning.

The dpkg program in particular is valuable in detecting left over data which may be considered as bloat in the OP's terms. For example the following command will show packages that, although removed, have left over configuration files:
Code:
dpkg --list |grep "^rc"
Once these configuration files have been identified, the packages from which they derive can be purged with the apt command to delete them. Using the package manager's facilities for the system files keeps it in a stable predictable, reliable order. Selective manual user deletions disturb that state and therefore are inadvisable.

In general the use of the term "bloat" as a perjorative term, is less than useful for dealing with the actual problems of excessive files and software that are deemed unnecessary because there are means of reducing the data deemed unnecessary in many cases.

A more difficult problem in relation to bloat is when a program is upgraded which includes a lot of extra functionality that the earlier program didn't include, but where the extra functions are unnecessary for the user, but cannot be excluded from the new version of the program. In that situation, the user has, from their point of view, a "bloated" program which they need however, to retain on the machine because of the functional elements of that program that they routinely use. The term "bloatware" is often used to describe such software, but it's perhaps the small price a user pays which is offset by the usefulness of the program itself.

It's probably worth noting that there's a difference between a fully featured system that has been treated to remove bloat, and a minimalist system. Minimalism is a philosophy of its own which by its very nature eschews bloat by only including bare bones programs for its running in the first place. Minimal systems are sought for many reasons such as for embedded systems, or to decrease the attack surface for the user. Fully featured systems, on the other hand, that may have an excess of files on the system or bloated software, need a different approach in dealing with bloat.
 
Last edited:
The thing you need to remember...Linux isn't windoze and doesn't fill up with crap or as you say bloatware.

You should not remove all log files as they come in handy...set the minim of log files to keep at 100MB.
To see log files run this command...
Code:
du -sh /var/log/journal

To set log files to keep at 100MB...run this command...
Code:
sudo journalctl  --vacuum-size=100M

Every 6 mths or so...you can run...the above command.
You can also take a look at this...
https://www.linux.org/threads/do-you-really-need-to-clean-mint.43752/

Hope this helps.
1717029819389.gif
 
Some Linux distros offer minimal installs from the git-go although few and far between.

The big mainstream flagship Ubuntu offers a minimal install that allows the user to install what the user wants.

I agree that Linux distros come with unneeded unnecessary default software that developers seem to think users want.

First thing I do is carefully remove what I don't want and will never need and never use using the default installed software manager.

Be very careful when removing default software as there are shared dependencies with other software that is installed.

Code:
sudo apt autoremove

Code:
sudo apt clean

Code:
sudo apt autoclean

These commands will usually remove most of the leftovers.
 
I usually just use the "sudo apt autoremove && sudo apt clean" command, but I found this online:

Here are some strategies and tools you can use to manage bloat without risking system integrity:

  1. Regular Maintenance Commands:
    • sudo apt autoremove: This command removes packages that were automatically installed to satisfy dependencies for other packages and are no longer needed.
    • sudo apt clean: This command cleans up the local repository of downloaded package files.
  2. Managing Logs:
    • Journalctl: You can use journalctl to manage logs more effectively. For example, journalctl --vacuum-size=100M will limit the size of the logs to 100MB. You can also set up a cron job to regularly clean up logs.
    • Disable Unnecessary Logging: Some services might have options to disable logging or reduce the verbosity of logs. Check the documentation for these services.
  3. Cleaning Up After Applications:
    • Manual Cleanup: After uninstalling an application, check common locations like /var/log, /var/cache, and your home directory for any lingering files. Be cautious and ensure these files are not critical before deleting them.
    • Use Specific Tools: Some applications might leave configuration files in your home directory. These are usually hidden and can be found using find or by manually checking directories like ~/.config and ~/.local/share.
  4. Automated Cleanup Tools:
    • BleachBit: This is a system cleaner that can delete various types of files that are no longer needed, including cache, cookies, and temporary files.
    • Stacer: An application that provides a graphical interface for system monitoring and cleaning. It includes features to clean application cache, system cache, and unused packages.
  5. Preventative Measures:
    • Be Selective with Software: When installing new software, consider whether you really need it and if it's necessary for your workflow.
    • Use Lightweight Alternatives: If bloat is a major concern, consider using lightweight versions of applications or different software that is known for being less resource-intensive.
  6. System Configuration:
    • Tweak System Settings: Depending on your system and usage, you might be able to tweak settings to reduce the amount of logging or cache generation.
  7. Backup and Restore:
    • Use Snapshots or Backups: Before making significant changes to your system, consider using tools like Timeshift to create a snapshot. This way, if something goes wrong, you can restore your system to a previous state.
Remember, while it's good to keep your system clean and efficient, it's also important not to overdo it, especially when it comes to system files and logs that might be necessary for troubleshooting or system stability. Always ensure you understand what a file or package does before removing it, and consider the potential impact on your system.
 
The only point I would make re the above, is the Automated cleanup Tools. ...BleachBit & Stacer

I have heard all the "she'll be right, mate" stories...."I use it once a month every month and it does no harm....makes the system run quicker etc etc etc etc

BS If the system does indeed run quicker then your browsing habits and downloading habits could do with a make over.......you are using an easily misused tool to make up for your own mistakes/sloppy behaviour.

If you have not used either of these previously, you have been warned..

The rest of the advice there is good value
After running apt remove and apt clean....
I would also run : sudo dpkg --configure -a

( dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem)....worth a search and a read)
 
Last edited:
@Freepoorman @Condobloke

I will definitely try those programs, but I wanted to know, that if there is a program which can track what programs write where. Like on Windows, there is IObit uninstaller.


If you want to see which programs write where on a Linux system, you can use the inotify-tools package. This package provides a set of command-line tools that can be used to monitor file system events in real time.

To install inotify-tools, you can use the following command:

Code:
sudo apt-get install inotify-tools

Once inotify-tools is installed, you can use the inotifywait command to monitor file system events. For example, you can use the following command to monitor the /var/log directory for any changes:

Code:
inotifywait -m /var/log

This command will continuously monitor the /var/log directory for any changes, such as file creations, deletions, or modifications. You can then use the inotifywait command to monitor other directories or files as needed.

Another option is to use auditd, which is a system daemon used to collect and log audit records. Auditd can be used to monitor file system events and generate detailed logs of what programs are writing where.

To install auditd, you can use the following command:

Code:
sudo apt-get install auditd

Once auditd is installed, you can use the auditctl command to configure the audit system. For example, you can use the following command to monitor the /var/log directory for any changes:

Code:
auditctl -w /var/log -p wa -k log_changes

This command will monitor the /var/log directory for any write or attribute changes, and will generate an audit record for each event. You can then use the ausearch command to search the audit logs and see what programs are writing where.

Both inotify-tools and auditd can be used to monitor file system events and see what programs are writing where on a Linux system. However, auditd is more powerful and can generate more detailed logs, while inotify-tools is easier to use and has a simpler interface.
 
@Freepoorman @Condobloke

I will definitely try those programs, but I wanted to know, that if there is a program which can track what programs write where. Like on Windows, there is IObit uninstaller.
Being unaware of IObit uninstaller, I visited MS to see what it does.
These were mentioned as its functions:
remove unwanted programs
remove malicious/ad browser extensions
giving you a clean PC
easily getting rid of bundleware and stubborn programs


In linux such a program is redundant because the package manager can control most all aspects and manipulations of programs. The package manager also keeps a complete record of where all files are located in the filesystem. It has a verification system to check if all files are in order and as intended, if the user needs to check on them. To keep abreast of what's happening on the filesystem, all that is needed is the ability to read up a bit on how to run the package manager.

In relation to extensions on browsers, they are usually added and removed through the browser add-on and extension facilities. Nothing more is usually needed.

If a program by chance becomes corrupted, the package managers have means specially to deal with those situations. In addition to verification, they can usually add, remove, reconfigure, alter and adjust as required.

As an example, the package manager on debian based systems is apt. But apt is part of a family of programs that are greatly more far reaching in their functionality than the MS program mentioned above. Here's an incomplete list of them:

apt
apt-cache
apt-cdrom
apt-config
apt-extracttemplates
apt-file
apt-forktracer
apt-ftparchive
apt-get
aptitude
apt-build
apt-cacher
apt-dater
apt-dater-host
apt-mirror
apt-show-source
apt-move
apt-offline
aptitude-changelog-parser
aptitude-create-state-bundle
aptitude-curses
aptitude-run-state-bundle
apt-key
apt-listbugs
apt-listchanges
apt-mark
apt-show-versions
apt-sortpkgs

When running linux, it's information about linux that counts. Rather than thinking of which program in linux replicates a program from another operating system, it's far more useful to define the issue one wishes to address, and then ask of linux how to address that issue. There is an absolute preponderance of programs, or applications available in linux. At the time of writing this, there are over 67,000 distinct packages, each of which constitutes a program of one sort or another, available for debian based distros:
Code:
[tom@min ~]$ apt-cache stats | grep -e names -e versions
Total package names: 144725 (4,052 k)
Total distinct versions: 67083 (5,903 k)

Since linux is a free open source operating system, the tools are freely available for users to create programs that may not already exist, but for users not into that sort of thing, there's already enough programs for most imaginable tasks.
 
Last edited:
@Freepoorman

That is so AI generated :rolleyes:.
Well what you recommended might be useful, IObit uninstaller can track what programs right where and uninstall it itself rather than using the crappy uninstaller the program comes with. This in GNU/Linux would be hard though as package uninstallation would require integration with apt, so I don't know but I hope something is similar. I mean the most I can do is remove all the left over files which have the term relating to the program I just uninstalled, but that is unsafe and not reliable.

Also for @osprey , IObit uninstaller has a feature to track down what programs right where and uninstall it by itself. Revo uninstaller is also an alternative.
 
Does it even matter if you get the information you need?
I already said that in another thread, but the issue with current state of AI is that it's answers are not authoritative,
for instance you can't ask the AI for a legal advice.
You also need to care when it comes to simple thing like fixing your PC because by following AI answers it might lead to data loss or hardware damage.
Also for instance there are things to which the AI will refuse to answer, such as how to assemble a bomb or to perform hacking task or do some similar criminal task, even though that's justified the AI is supposed to act like human not like a limited machine with non authoritative answers.
Also privacy wise the AI is very hostile toward your privacy and largely undefined by either the law or PP so you can be exploited by the AI owner.

I'm sure many such examples exist, and that's one reason why I just don't use the AI, google and my own judgement is better even though much slower process.
 
The only point I would make re the above, is the Automated cleanup Tools. ...BleachBit & Stacer

I have heard all the "she'll be right, mate" stories...."I use it once a month every month and it does no harm....makes the system run quicker etc etc etc etc

BS If the system does indeed run quicker then your browsing habits and downloading habits could do with a make over.......you are using an easily misused tool to make up for your own mistakes/sloppy behaviour.

If you have not used either of these previously, you have been warned..
The problem with system cleaners such as Bleachbit and Stacer is the user.

The new user fails to learn exactly what each cleaning feature of each system cleaning removes.

If any system cleaners are used haphazardly then yes there is most likely a good chance of breaking your installed Linux distro.

Don't be fooled an inexperienced user can also break their installed Linux disto if using terminal commands haphazardly.

I've used Bleachbit and Stacer without problems although I've spent the time to learn exactly what each system cleaning feature removes.


Bleachbit and Stacer are good system tools if properly used and a user must learn to properly use any system cleaner for a good end result.

Learn how to use your Linux
and how to keep it properly maintained and you shouldn't have any problems.

I've been using Linux since 2014 and the problems I've had were all problems I created because I didn't know what I was doing.

It's called tuition for the price of an education or learn by breaking.
 
Last edited:
Also for instance there are things to which the AI will refuse to answer, such as how to assemble a bomb or to perform hacking task or do some similar criminal task, even though that's justified the AI is supposed to act like human not like a limited machine with non authoritative answers.
Also privacy wise the AI is very hostile toward your privacy and largely undefined by either the law or PP so you can be exploited by the AI owner.

I'm sure many such examples exist, and that's one reason why I just don't use the AI, google and my own judgement is better even though much slower process.
With Huggingface and Ollama you can train your own local offline models to be uncensored by editing the modelfile... Also private.

I don't mind either way, if information is useful it's useful regardless of the source. As far as corrupting your system by following AI advice goes, always verify before doing anything starting with sudo...

AI is like any other tool, if used properly it can be great, if not then not so great at all
 

Members online


Latest posts

Top