LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 06-07-2008, 08:39 AM   #1
glore2002
Member
 
Registered: Mar 2007
Location: Buenos Aires, Argentina.
Distribution: Lubuntu 17.10 x64
Posts: 510

Rep: Reputation: 33
Cleaning Slackware. Deleting unnecesary things.


Hi again!

What steps would you recommend to keep Slackware as clean as possible. I mean: deleting orphan files, temp files, etc. Something like Ccleaner in Win. Also, what application or command would you recommend to uninstall software. Until now, I've used Kpackage to uninstall unwanted programs. There, there is an item that says Clean Cache from packages. By using that option, what would I delete? I want to make sure before deleting things that can be useful.

Thank you,
Glore2002.-
 
Old 06-07-2008, 09:30 AM   #2
[stinger]
LQ Newbie
 
Registered: May 2008
Location: Boston, Mass
Distribution: Slackware
Posts: 20

Rep: Reputation: 0
Unless you are very short on disk space, I would recommend keeping everything installed by default. Slackware's default installation is relatively lean as it is. Provided you install additional software as Slackware packages using installpkg, upgradepkg, pkgtool etc., you should not be left with "orphaned files" when you delete packages using the Slackware package management tools.

Compiling from source without creating a package (./configure, make, make_install) is a bit messier, but if you follow convention and install these applications with prefix=/usr/local and not prefix=/usr, then even these files will be easy to track down if you need to manually remove them.

HTH

P.S.

Quote:
I mean: deleting orphan files, temp files, etc. Something like Ccleaner in Win
This ain't Windows. *nix cleans up after itself much better than those Winslobs.
 
Old 06-07-2008, 02:48 PM   #3
Woodsman
Senior Member
 
Registered: Oct 2005
Distribution: Slackware 14.1
Posts: 3,482

Rep: Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546
Perhaps the following might help:

Removing Temporary Files and Clutter

The scripts are examples only. Your needs and imagination should modify the scripts accordingly.
 
Old 06-07-2008, 04:33 PM   #4
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: Slackware®
Posts: 13,922
Blog Entries: 44

Rep: Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158
Hi,

You can always trim 'YOUR' install to suit. You can use 'pkgtool' to view and to remove. 'Overview of Slackware® Package Management' is from the Slackbook. 'src2pkg-1.8' is another great package manager you might find useful.

'Minimal System' method as to what packages you should install to have a base system. You could use this as a good base system or as a guide to what you need to leave.

You could look at 'The perfect desktop - Slackware 12' to get more background information on setup.

There are a lot of methods or scripts floating around to trim a Slackware install. You can search LQ as this has been covered a lot.

These links and others are available from 'Slackware-Links'. More than just Slackware® links!
 
Old 06-07-2008, 04:39 PM   #5
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: Slackware®
Posts: 13,922
Blog Entries: 44

Rep: Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158
Hi,
Quote:
Originally Posted by [stinger] View Post
Unless you are very short on disk space, I would recommend keeping everything installed by default. Slackware's default installation is relatively lean as it is. <snip>


This ain't Windows. *nix cleans up after itself much better than those Winslobs.
Slackware® 12.1 is indeed lean but a lot can be trimmed if you desire too.

*NIX does have a clean background but a user has too invoke the actions that one desires for software that is installed to either remove or install software.
 
Old 06-07-2008, 06:18 PM   #6
rg3
Member
 
Registered: Jul 2007
Distribution: Fedora
Posts: 527

Rep: Reputation: Disabled
Quote:
Provided you install additional software as Slackware packages using installpkg, upgradepkg, pkgtool etc., you should not be left with "orphaned files" when you delete packages using the Slackware package management tools.
I'm sorry but this is clearly wrong. A good amount of Slackware packages leave orphan files behind when removed. For example, every package contaning configuration files in the form of .new files will leave the unsuffixed file in the filesystem when being removed (as the file without the .new suffix is not part of any package). Moreover, many other packages create files somewhere in /var and they are also hard to track (log files, for example). /tmp is another typical directory in which orphaned files can be left behind and should be cleaned every now and then. Keeping a Slackware system really clean is hard if you run -current for a long time, in my experience.

About /tmp, it's easy. A common practice is to use "tmpfs" for it if you have enough memory. If not, remove its contents from the local shutdown file, /etc/rc.d/rc.local_shutdown (you need to create it and give it execution permissions if it does not exist). I use something like the following code. I know it's a bit complicated, but it's almost guaranteed to remove everything under /tmp, including hidden files, unless there's weird stuff in there, like files with the immutable bit set.

Code:
/usr/bin/find /tmp -mindepth 1 -maxdepth 1 -print0 | xargs -0r /bin/rm -fr
As for orphaned files, I tried to solve this problem once. When I got something half-decent (it's a hard problem and can't be solved easily), I integrated the functionality into slackroll. It's able to detect orphaned files under any hierarchy you indicate, but the number of false positives is surprisingly high, so checking for orphaned files is not something you want to do every week, but something closer to every year.

See for example the output of slackroll when I tell it to search for orphaned files under /usr/share. The operation takes a good amount of time because it has to build a normalized list of files. Normalized means resolving any symlinks along the way and getting a simplified, unique and real path for every package file:

Code:
[01:03 ~]# slackroll orphan-search /usr/share
WARNING: This operation may take a long time to complete
WARNING: Results should be interpreted carefully
Press Ctrl+C to cancel or Enter to continue... 

Reading normalized contents of /var/log/packages ...
Examining specified paths...
Finding orphan files...
Orphan files:
    /usr/share/applications/mimeinfo.cache
    /usr/share/apps/kdm/faces
    /usr/share/apps/konsole/fonts/fonts.scale
    /usr/share/config/.kthemestylerc.lock
    /usr/share/fonts/TTF/fsex2p00_public.ttf
    /usr/share/fonts/default
    /usr/share/fonts/default/Type1
    /usr/share/fonts/default/Type1/fonts.cache-1
    /usr/share/fonts/default/fonts.cache-1
    /usr/share/fonts/fonts.cache-1
    /usr/share/fonts/local
    /usr/share/fonts/local/fonts.dir
    /usr/share/fonts/local/fonts.scale
    /usr/share/fonts/misc/encodings.dir
    /usr/share/fonts/terminus/fonts.dir
    /usr/share/fonts/terminus/fonts.scale
    /usr/share/icons/hicolor/icon-theme.cache
    /usr/share/icons/locolor/16x16/mimetypes
    /usr/share/icons/locolor/32x32/mimetypes
    /usr/share/texmf/man/whatis
    /usr/share/texmf/tex/latex/config/latex.fmt
    /usr/share/texmf/tex/latex/config/latex.log
    /usr/share/texmf/tex/latex/config/texsys.aux
    /usr/share/texmf/texsys.aux
End of list
From that list, only /usr/share/fonts/TTF/fsex2p00_public.ttf is a real orphan file. The rest, while not present in any package, are not files you want to delete, probably, like the fonts.dir and fonts.scale files. However, these files will be left behind even if you remove the X packages, for example. And let's not go to see what happens when you ask to search for orphaned files in /etc or /usr/man. Many system files are not part of any package. /etc/fstab, to mention a significant example.

Another thing you could also try to care about are the broken symlinks. For that, I also created the "broken-symlinks" operation in slackroll, but it's also easy to create a shell script that would output a list of them. However, many times there are broken symlinks in your system that you don't want to remove. Some packages create symlinks to files from other packages, and if you don't have both installed, you'll have a broken symlink. But maybe you don't want to remove it because you may want to install the second package in the future and have it working as it should. Agreed, this is not a problem if you run a full installation, but a user with a real desire of keeping his system clean is not going to do a full install, probably.

Last edited by rg3; 06-07-2008 at 06:20 PM.
 
1 members found this post helpful.
Old 06-07-2008, 09:46 PM   #7
[stinger]
LQ Newbie
 
Registered: May 2008
Location: Boston, Mass
Distribution: Slackware
Posts: 20

Rep: Reputation: 0
Quote:
I'm sorry but this is clearly wrong. A good amount of Slackware packages leave orphan files behind when removed. For example, every package contaning configuration files in the form of .new files will leave the unsuffixed file in the filesystem when being removed (as the file without the .new suffix is not part of any package). Moreover, many other packages create files somewhere in /var and they are also hard to track (log files, for example). /tmp is another typical directory in which orphaned files can be left behind and should be cleaned every now and then. Keeping a Slackware system really clean is hard if you run -current for a long time, in my experience.
No it is not wrong. Running -current with the continual upgrades of packages would create the situation you describe, but that is NOT what I think we are talking about here. Here I believe are talking about keeping an installation of a stable release clean. Using properly built packages and the Slackware package tools will work quite nicely indeed to achieve this end. Running -current between 10.2 and 11.0 took all the fun out of running -current as far as I'm concerned. Give me a stable release over -current anytime. If you choose to run -current then yes, you will have some house keeping to do.

I also disagree with the notion that there is any benefit at all to removing anything from a stock Slackware install unless we are talking about a severe limitation in disk space. Please explain to me why I need to remove anything I'm not using if disk space is not not a problem. What would I gain?
 
Old 06-08-2008, 12:05 AM   #8
irishbitte
Senior Member
 
Registered: Oct 2007
Location: Brighton, UK
Distribution: Ubuntu Hardy, Ubuntu Jaunty, Eeebuntu, Debian, SME-Server
Posts: 1,213
Blog Entries: 1

Rep: Reputation: 88
Personally, I have Slack running as an experiment as a home file and print server, which various members of my family use to share files, folders and printers.

It's Slack 12, stable, on an old generic laptop, and has been up for, give or take, a year. Every so often, samba falls over, but I have monit on there to maintain it. I have apache running, and a small MySQL DB.

honestly, unless you are really really stuck for space, I don't see the point of killing yourself to track down every logfile, broken link, etc.

Just my
 
Old 06-08-2008, 01:05 AM   #9
shadowsnipes
Senior Member
 
Registered: Sep 2005
Distribution: Slackware
Posts: 1,443

Rep: Reputation: 73
It's all really simple. Install everything as a package that you can. Use tools such as SlackBuilds and src2pkg to help you with this. Remove that packages you don't want/need.

There really shouldn't be too many, if any, orphaned files under /usr. When you removepkg it will tell you if there are any such files. Simply pay attention to the messages when you use the Slackware pkgtools. As for the config files under /etc, these are so small that it really shouldn't matter. The same should go for most of the log files under /var/log. If there are any large logs you don't need then the find command can easily take care of them.

A bigger concern is to be aware of what files are world writable (particularly if SUID/GUID), what files are SUID/GUID, if any broken links are found, if any unexpected hard links exist, etc.

So, if you have good habits with using pkgtools then your system should stay pretty clean. The "messiest" places is probably your home directory, and keeping that clean is all based on your organization. /tmp can also get a bit of junk in it, but most of it should be automatically deleted after its use has expired. Never remove all the files under that directory while, for instance, KDE is in use. If you do "clean" /tmp do it during bootup or shutdown as mentioned previously (or just know what you are deleting is safe to delete). Personally, I find I only need to clean mine perhaps during a system upgrade, but I don't have multiple users using my machine at the same time.

The absolute way to keep your system clean to the obsessive compulsive level is to simply know what has changed. I backup up my systems every week by using a custom script I made. It basically uses rsync to backup various parts of the system to a removable hard disk. The script also logs all of the changes. Typically I run a test run, check the logs for changes, and clean up any files that I feel are out of place or unneeded. After I am done I run the real backup (which is logged as well). The backups are incremental, of course. It's a nice habit that keeps my systems backed up, and I can see a weekly log of all the changes, which is a good reminder of how I used my computer for the week. Typically the only files that I feel I need to adjust are those under /home.
 
Old 06-08-2008, 04:12 AM   #10
rg3
Member
 
Registered: Jul 2007
Distribution: Fedora
Posts: 527

Rep: Reputation: Disabled
Quote:
No it is not wrong. Running -current with the continual upgrades of packages would create the situation you describe, but that is NOT what I think we are talking about here. Here I believe are talking about keeping an installation of a stable release clean.
That doesn't make a difference. You said no orphaned files would be left behind when removing packages with the slackware packages tools, and that's wrong because they will. Configuration files without .new suffix, log files, data files in /var, other misc stuff like the fonts.dir and fonts.scale files, etc. In -stable and in -current, this is no different.

Quote:
I also disagree with the notion that there is any benefit at all to removing anything from a stock Slackware install
A bit short-sighted, IMHO. In my case, bandwidth issues. I don't want to download unneeded upgrades for stuff I don't use because it takes too long. That's one benefit. Also, if you use Slackware in a production server in a serious environment it would be good practice or even a requirement to install only the software you really need, specially if you expect security audits.

Last edited by rg3; 06-08-2008 at 04:16 AM. Reason: Changed [code] to [quote]
 
Old 06-08-2008, 05:52 AM   #11
pxumsgdxpcvjm
Member
 
Registered: Aug 2005
Posts: 235

Rep: Reputation: 30
The only unnecessary things that I've found is the log files and the /var/log/removed_* folders. The latter contains information about packages you have removed and upgraded. No official Slackware script uses them so they're safe to delete, although you won't be saving much space as they are only text files.

If you wanted, you could also remove the translations (locale) files which I've heard saves a decent amount of space, although I haven't tried it personally.

/tmp is another but I think most users would find it empty anyway.

I don't believe there is any other places on the system that'll contain files that would be safe to delete.
 
Old 06-08-2008, 07:49 AM   #12
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,873

Rep: Reputation: 4982Reputation: 4982Reputation: 4982Reputation: 4982Reputation: 4982Reputation: 4982Reputation: 4982Reputation: 4982Reputation: 4982Reputation: 4982Reputation: 4982
Quote:
Originally Posted by rg3 View Post
... if you use Slackware in a production server in a serious environment it would be good practice or even a requirement to install only the software you really need, specially if you expect security audits.
Having been in this position myself, this is a valid point. Though Slackware is still my favorite distro, I would love for some changes, not in its philosophies, of simplicity and vanillaism (yay!.. new word invented), but in the way the "disk-sets" are organised. Change the 'A' set and call it BASE, move anything non essential (stuff that is obviously non-OS related) to the other sets. Move the other essentials found in the 'n', 'd', 'l' and 'ap' sets into BASE. The idea would be to make BASE a perfectly viable standalone install, which you can then add to.

Also, our packages have a doinst.sh to do post install configuration. Shouldn't we perhaps have a doremove.sh in there too to allow package creators to do cleanup operations? I wouldn't want to see our packages get as complicated as what debian does, but a simple cleanup script run during removal doesn't seem any worse than including one during install.

I've been casting my eye at Arch Linux these last few days, and though I've not tried it, I like a lot of what I've read. However, they have a policy of stripping documentation out of their packages which I don't like, and its rolling-release concept would be unsuitable for servers that need to be in a consistent/known state.

To my mind, the 'diskset' organisation would definitely benefit from an overhaul, and make Slackware even better than it is currently.
 
Old 06-08-2008, 08:03 AM   #13
[stinger]
LQ Newbie
 
Registered: May 2008
Location: Boston, Mass
Distribution: Slackware
Posts: 20

Rep: Reputation: 0
Quote:
Originally Posted by rg3 View Post
That doesn't make a difference. You said no orphaned files would be left behind when removing packages with the slackware packages tools, and that's wrong because they will. Configuration files without .new suffix, log files, data files in /var, other misc stuff like the fonts.dir and fonts.scale files, etc.
You seem to changing the circumstances of the situation to suit your arguments. We have an OP who wants to remove files he does not need or want using a KDE RPM package management tool instead of the tools specific to Slackware package management. This tool has an option that removes orphaned files. This leads the OP to believe that this will be an issue regardless of the manner with which he maintains his Slackware install. My reply that the use of the Slackware package management tools and properly built packages would not leave orphaned files still holds true. You are correct that there may be exceptions to this being being the case, but for the purposes of the original question - a Slackware newbie wanting to know how to properly maintain his box - my statement still holds true.

Quote:
Originally Posted by rg3 View Post
In -stable and in -current, this is no different.
It will happen FAR more when running -current over the long term than it will if only running a stable release. Further, log and data files are often only going to be created if a program is being used. These files should be reviewed and then deleted by hand. I do not consider these to be orphaned files and would not want them to be automaticly removed without review. If they ARE left hanging around then that's the admins fault.

Quote:
Originally Posted by rg3 View Post
A bit short-sighted, IMHO. In my case, bandwidth issues. I don't want to download unneeded upgrades for stuff I don't use because it takes too long. That's one benefit.
How is that a benefit? Why would you download a patch to something you don't use in the first place? No one's holding a gun to your head - this is Slackware afterall. Additionally, the security patches released for Slackware are not released often and are generally not huge - but can be depending on what's being patched. Again, a different story if you are running -current. Why anyone want to run -current on dial-up is beyond me, but it's your life.

Quote:
Originally Posted by rg3 View Post
Also, if you use Slackware in a production server in a serious environment it would be good practice or even a requirement to install only the software you really need, specially if you expect security audits.
Hard to argue this point. Hopefully you aren't using -current in a production server. Is this the same "low bandwidth" environment, or are we changing the situton to suit the argument?

Cheers
 
Old 06-08-2008, 09:14 AM   #14
rg3
Member
 
Registered: Jul 2007
Distribution: Fedora
Posts: 527

Rep: Reputation: Disabled
My bad...

Quote:
You seem to changing the circumstances of the situation to suit your arguments. We have an OP who wants to remove files he does not need or want using a KDE RPM package management tool instead of the tools specific to Slackware package management. This tool has an option that removes orphaned files. This leads the OP to believe that this will be an issue regardless of the manner with which he maintains his Slackware install. My reply that the use of the Slackware package management tools and properly built packages would not leave orphaned files still holds true.
I am NOT changing any situation. I am replying to you, and more specifically to your recurring and false comment that using the standard slackware package management tools will not leave orphaned files. It is not true and never will even if you repeat it ad infinitum. There are too many packages for which that's not true and they are in no way an exception. They are one of the common situations. I don't know if kpackage has a tool to remove orhpaned files, the OP never mentioned that. He mentioned there was an option to "Clean Cache from packages", and asked what it did. I don't know what that is or what it does, hence I never replied to that question. By the way, you accuse me of changing the circumstances and now you mention some "exceptions", so please indicate me where are those "exceptions" mentioned in your original statement:

Quote:
Provided you install additional software as Slackware packages using installpkg, upgradepkg, pkgtool etc., you should not be left with "orphaned files" when you delete packages using the Slackware package management tools.
Going on...

Quote:
It will happen FAR more when running -current over the long term than it will if only running a stable release.
You should define how much is "FAR more" for you. I guess it depends on how you use -stable, in how many packages you install and remove, for example, and on if the installation is one from scratch, having erased a previous installation, or if you upgraded between major releases.

Quote:
Further, log and data files are often only going to be created if a program is being used. These files should be reviewed and then deleted by hand. I do not consider these to be orphaned files and would not want them to be automaticly removed without review. If they ARE left hanging around then that's the admins fault.
Nothing significant here. Precisely one of my points is that orphaned files, and let's consider that files not belonging to any installed package, cannot be deleted automatically. Let's not go into discussing who's at fault for having orphaned files in a system. Some people will say the package manager could do more, some other people will say it's entirely the admin fault.

Quote:
How is that a benefit? Why would you download a patch to something you don't use in the first place?
I can only comment that leaving installed software unpatched because you know (or think) you're not really using is very very poor practice, in my humble opinion. Maybe you don't agree with that, but if I have a package installed and there's a patch for it, I'll download it. It doesn't matter if I'm not using the software at this moment.

Quote:
Hard to argue this point. Hopefully you aren't using -current in a production server. Is this the same "low bandwidth" environment, or are we changing the situton to suit the argument?
I don't know why you accuse me again of changing the situation. You said you "[disagreed] with the notion that there is any benefit at all to removing anything from a stock Slackware install unless we are talking about a severe limitation in disk space". I provided two very different situations. In my case, not having to download updates to software that is not installed. Then I provided a second and completely different example. They were never intended to be the same or to be mixed. How you got confused about this is beyond my knowledge, but I hope you didn't do it on purpose to throw an accusation.

So, summing up, orphan files: they are there. They are present in a system running normally, and they are left behind when uninstalling some stock slackware packages. Deciding which ones could or should be removed is hard and requires manually overviewing the list. You said one thing which is wrong: that no orphan files are left behind if you remove packages with the slackware package tools. That's false. Period. You said two things I disagree with: that there's no benefit from not running a full stock installation, and I provided two examples, and that you don't "need" to download patches for software you have installed but you don't use. Strictly speaking, you don't need it, in the same way many times you don't "need" to install a security upgrade if there's not an exploit in the wild, but that's poor practice.
 
Old 06-08-2008, 09:20 AM   #15
glore2002
Member
 
Registered: Mar 2007
Location: Buenos Aires, Argentina.
Distribution: Lubuntu 17.10 x64
Posts: 510

Original Poster
Rep: Reputation: 33
what I see until now...

First of all, thanks for such a discussion. I really appreciate it.

Let's see if I can put some thing in order to make it clearer to me:

a) I should only remove unneeded stuff if necessary (for instance if I run out of disk space).

b) Slackware is clean enough. It is not compulsory , as in Win, to clean residual files often.

c) Removing KDE components that come with Slackware are not recommended to uninstall (I am not sure about this point but if there is a safe way to remove things -such as noAtun or JuK- please, let me know).

d) Some orphan files may be left behind but they are not a real problem if I leave them the way they are.

e) Once I installed a package. ¿What can I remove after installing it? Can I remove the /tmp contents? (I think yes but I didn't do it yet). For instance, I download and install a package from Slackbuild.org. Once installed, what should I keep to be able to reinstall the package if needed and what can I safely remove?

f) What does clean cache mean in KPackage? What would I really remove if choosing this option?

g) There are some scripts I could use to remove certain things or, even, modify them according to my needs but they could be risky for a Slack newbie like me.

I am adding new questions daily. They are a newbie questions. Thank you for your understanding. Thank you all.

Glore2002.-
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Cleaning Ubuntu. Unnecesary files. glore2002 Linux - Software 2 05-08-2007 08:59 AM
Five things I still can't do with Slackware 11... Lufbery Slackware 13 11-03-2006 10:22 PM
Cleaning up my Slackware 10.1 avheretic Slackware 4 07-26-2006 04:09 AM
Cleaning up files on my Slackware box? JockVSJock Slackware 3 06-29-2005 08:29 AM
deleting things that don't exist... nakedjohn Linux - Newbie 2 07-16-2003 09:43 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 09:54 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration