I’m having a bear of a problem with my system. One of the many issues is that /tmp is filled with files (hundreds of them) that I can’t seem to get rid of, and almost all of them are old files. I’m running Leap 15.3 (updated daily) on a Dell Desktop quad 3.4 core 16gb ram 2tb hard drive.
I’ve tried to change settings, but do not have a tmp.conf file (as mentioned in another old thread related to this issue). The reason why this is an issue: I’ve installed and ran Lynis (I’ve had some symptoms of possible hacking), and the /tmp directory files are raising red flags (maybe because of age).
How do I remove those old files without running the risk of causing more grief? I thought that they were to be removed on shut down or booting.
You say you can not remove them. But we have no idea what you tried. Thus how can we give advice on what goes wrong?
I would (as root) go to /tmp and remove them. That sounds as simple as it is, but apparently not for you?
cd /tmp
rm ...............
And cleaning /tmp on boot is something you must configure.
You can also make /tmp a tmp file system (in memery), then the contents will be removed on shutdown.
First thing I tried. I had to go through sudo to remove three files (which I recognized and which were readily removed), even though I was the creator/owner of the files. I was inaccurate in my original post - many of the ‘files’ are directories, which contain files or are in some way locked. I’m a little leery of using rm -R * (remove all recursively) in case there is some sort of link that will cause problems elsewhere (which I’d experienced a few years ago).
I use Gnome (“Classic” or whatever - the old style) and used to have a way to open a directory as administrator/root and remove files and folders that way. Now I can’t find it - but then, in the past few weeks a number of important programs and so on have become inoperable due to missing folders (and some programs have showed up that I DID NOT install).
I do appreciate the reply. I’ve been around computers since the early 80s (learned programming starting in 74) and have been using Linux since 2010, maybe earlier.
I have no idea what you mean with “some way locked”. But when you want to let us understand what you do and what you see, you should show things. Thus do such an rm command and show us it and it’s output so that we see messages and all. Copy/paste between CODE tags in your post (the # button in the toolbar of the post editor).
We can not give any advice on vague stories. We can not look over your shoulder. SHOW!
rm: cannot remove 'btrfs-defrag-plugin.1crFmm': Operation not permitted
rm: cannot remove 'btrfs-defrag-plugin.c2xhjF': Operation not permitted
rm: cannot remove 'btrfs-defrag-plugin.CfpHry': Operation not permitted
rm: cannot remove 'btrfs-defrag-plugin.D3pyKy': Operation not permitted
rm: cannot remove 'btrfs-defrag-plugin.h4fZJj': Operation not permitted
rm: cannot remove 'btrfs-defrag-plugin.jJychp': Operation not permitted
rm: cannot remove 'btrfs-defrag-plugin.Kd90Yb': Operation not permitted
rm: cannot remove 'btrfs-defrag-plugin.PbQ9iJ': Operation not permitted
rm: cannot remove 'btrfs-defrag-plugin.pNRG1r': Operation not permitted
rm: cannot remove 'btrfs-defrag-plugin.q4IMTS': Operation not permitted
rm: cannot remove 'btrfs-defrag-plugin.Qsaf7l': Operation not permitted
rm: cannot remove 'btrfs-defrag-plugin.Sr3eFH': Operation not permitted
rm: cannot remove 'btrfs-defrag-plugin.XT9UCD': Operation not permitted
rm: cannot remove 'btrfs-defrag-plugin.zWHEOj': Operation not permitted
rm: cannot remove 'run-crons.3DkOr1': Operation not permitted
rm: cannot remove 'run-crons.4pTOIw': Operation not permitted
rm: cannot remove 'run-crons.5zu3Nt': Operation not permitted
rm: cannot remove 'run-crons.6VlYtI': Operation not permitted
rm: cannot remove 'run-crons.cImqcQ': Operation not permitted
rm: cannot remove 'run-crons.CNEmp5': Operation not permitted
rm: cannot remove 'run-crons.D488LG': Operation not permitted
rm: cannot remove 'run-crons.gCavlz': Operation not permitted
rm: cannot remove 'run-crons.HL0SOk': Operation not permitted
rm: cannot remove 'run-crons.I0jW7h': Operation not permitted
rm: cannot remove 'run-crons.o4MZ4o': Operation not permitted
rm: cannot remove 'run-crons.okAPk0': Operation not permitted
rm: cannot remove 'run-crons.q4yKeN': Operation not permitted
rm: cannot remove 'run-crons.q9nZ4R': Operation not permitted
rm: cannot remove 'run-crons.S2r5kP': Operation not permitted
rm: cannot remove 'run-crons.V84aTw': Operation not permitted
rm: cannot remove 'run-crons.vGXLEb': Operation not permitted
rm: cannot remove 'run-crons.VOJaAX': Operation not permitted
rm: cannot remove 'run-crons.xgCNGX': Operation not permitted
rm: cannot remove 'run-crons.XnkCUQ': Operation not permitted
rm: cannot remove 'run-crons.y1pzJW': Operation not permitted
rm: cannot remove 'systemd-private-973d2a19f8b6405b92190ff178b15e4e-chronyd.service-tv2P3h': Operation not permitted
rm: cannot remove 'systemd-private-973d2a19f8b6405b92190ff178b15e4e-colord.service-rOySlg': Operation not permitted
rm: cannot remove 'systemd-private-973d2a19f8b6405b92190ff178b15e4e-ModemManager.service-R1DWDf': Operation not permitted
rm: cannot remove 'systemd-private-973d2a19f8b6405b92190ff178b15e4e-rtkit-daemon.service-a9Hycj': Operation not permitted
rm: cannot remove 'systemd-private-973d2a19f8b6405b92190ff178b15e4e-systemd-logind.service-PhqsBg': Operation not permitted
rm: cannot remove 'systemd-private-973d2a19f8b6405b92190ff178b15e4e-upower.service-UvCBgh': Operation not permitted
rm: cannot remove 'tracker-extract-files.1002': Operation not permitted
rm: cannot remove 'YaST2-03498-G9BFmF': Operation not permitted
rm: cannot remove 'YaST2-03498-pGniLH': Operation not permitted
rm: cannot remove 'YaST2-03518-7ylwne': Operation not permitted
rm: cannot remove 'YaST2-03518-OoXQnb': Operation not permitted
rm: cannot remove 'YaST2-03595-X14if3': Operation not permitted
rm: cannot remove 'YaST2-03595-zhnkx3': Operation not permitted
rm: cannot remove 'YaST2-03677-cmqvKg': Operation not permitted
rm: cannot remove 'YaST2-03677-M7RBde': Operation not permitted
rm: cannot remove 'YaST2-03751-NMUlbO': Operation not permitted
rm: cannot remove 'YaST2-03751-yto1NN': Operation not permitted
rm: cannot remove 'YaST2-03798-1pVm0l': Operation not permitted
rm: cannot remove 'YaST2-03798-ieFn0n': Operation not permitted
rm: cannot remove 'YaST2-03807-eg6Pz2': Operation not permitted
rm: cannot remove 'YaST2-03807-NTxqu2': Operation not permitted
rm: cannot remove 'YaST2-03822-2TOADd': Operation not permitted
rm: cannot remove 'YaST2-03822-j1bPDa': Operation not permitted
rm: cannot remove 'YaST2-06960-ilTFQr': Operation not permitted
rm: cannot remove 'YaST2-06960-NHfITt': Operation not permitted
rm: cannot remove 'YaST2-07411-o4fiZA': Operation not permitted
rm: cannot remove 'YaST2-07812-NFQG6U': Operation not permitted
rm: cannot remove 'YaST2-17530-fwvhqI': Operation not permitted
rm: cannot remove 'YaST2-17530-ZofpvK': Operation not permitted
Now I’ll try using sudo
That time it got rid of everything in the folder. I’ll need to reboot to make sure that something crazy didn’t happen - which I’ve experienced before (several years ago). I just hope there weren’t any hidden symlinks or something like that which crash my system (previous experience).
If you hear back from me shortly, then you know that at least nothing crashed my system.
To make it clear, what was actually meant is for including all that you did, character for character, everything copied from the screen, without embellishment. e.g.:
**# ls -Ggh /tmp**
total 8.0K
drwxrwxrwt 2 80 Oct 22 17:06 .ICE-unix
drwxrwxrwt 2 40 Oct 22 17:06 .Test-unix
-r--r--r-- 1 11 Oct 22 17:06 .X0-lock
drwxrwxrwt 2 60 Oct 22 17:06 .X11-unix
drwxrwxrwt 2 40 Oct 22 17:06 .XIM-unix
drwxrwxrwt 2 40 Oct 22 17:06 .font-unix
-rw------- 1 195 Nov 6 01:50 HL5470DW_latest_print_info
srwxrwxrwx 1 0 Oct 22 17:06 dbus-675AxZMeQk
drwxrwxr-x 3 60 Nov 5 20:59 gimp
drwx------ 2 100 Nov 6 19:31 mc-root
drwx------ 2 40 Oct 23 14:39 runtime-root
drwx------ 2 60 Oct 22 17:06 ssh-546UM1P2pPwh
drwx------ 3 60 Oct 22 17:06 systemd-private-...-rtkit-daemon.service-bW0nlj
drwx------ 3 60 Oct 22 17:06 systemd-private-...-systemd-logind.service-frp4vi
drwx------ 3 60 Oct 22 17:06 systemd-private-...-systemd-timesyncd.service-RozXAh
#
If you redirect to a file, then before copying from the file, edit the file to include the command, so that everything that was on the screen got copied. If there is sensitive data among the output, remove it and indicate editing with “<filter>” in its place.
As @mrmazda said. We want to see things complete, including prompts and commands. Like
boven:~ # cd /tmp
boven:/tmp # ls -l
total 4
drwxrwxrwt 2 root root 60 Nov 17 08:23 .ICE-unix
drwxrwxrwt 2 root root 40 Nov 17 07:36 .Test-unix
-r--r--r-- 1 root root 11 Nov 17 07:36 .X0-lock
drwxrwxrwt 2 root root 60 Nov 17 07:36 .X11-unix
drwxrwxrwt 2 root root 40 Nov 17 07:36 .XIM-unix
drwxrwxrwt 2 root root 40 Nov 17 07:36 .font-unix
drwx------ 2 henk wij 40 Nov 17 08:26 Temp-04598237-2279-48ee-abf9-d180b79a3f68
drwx------ 2 henk wij 40 Nov 17 08:23 plasma-csd-generator.pOcPeg
drwx------ 2 henk wij 60 Nov 17 08:23 ssh-ruTXziQTNoZq
drwx------ 3 root root 60 Nov 17 07:36 systemd-private-5336c021b7d547fd865ddce2c900b1ab-apache2.service-47Q4yg
drwx------ 3 root root 60 Nov 17 07:36 systemd-private-5336c021b7d547fd865ddce2c900b1ab-chronyd.service-cQ27Ye
drwx------ 3 root root 60 Nov 17 08:23 systemd-private-5336c021b7d547fd865ddce2c900b1ab-power-profiles-daemon.service-7ZMOwf
drwx------ 3 root root 60 Nov 17 08:23 systemd-private-5336c021b7d547fd865ddce2c900b1ab-rtkit-daemon.service-JIK4uh
drwx------ 3 root root 60 Nov 17 07:36 systemd-private-5336c021b7d547fd865ddce2c900b1ab-systemd-logind.service-hmasTe
drwx------ 3 root root 60 Nov 17 08:23 systemd-private-5336c021b7d547fd865ddce2c900b1ab-upower.service-AUlzah
boven:/tmp #
And of course ls -l and not just ls. Only names do not say much about owners and permissions, directory or normal file.
And indeed, I explained how to remove a directory with it’s contents where … was for the name of a directory. I have no idea why you did not try that on only one directory, but started to run havoc and used * to remove all and everything without first trying it on one directory.
# systemctl status systemd-tmpfiles-clean.timer
● systemd-tmpfiles-clean.timer - Daily Cleanup of Temporary Directories
Loaded: loaded (/usr/lib/systemd/system/systemd-tmpfiles-clean.timer; static)
Active: active (waiting) since Thu 2022-11-17 16:43:18 CET; 2h 23min ago
Trigger: Fri 2022-11-18 16:58:34 CET; 21h left
Triggers: ● systemd-tmpfiles-clean.service
Docs: man:tmpfiles.d(5)
man:systemd-tmpfiles(8)
Nov 17 16:43:18 xxx systemd[1]: Started Daily Cleanup of Temporary Directories.
#
# systemctl status systemd-tmpfiles-clean.service
○ systemd-tmpfiles-clean.service - Cleanup of Temporary Directories
Loaded: loaded (/usr/lib/systemd/system/systemd-tmpfiles-clean.service; static)
Active: inactive (dead) since Thu 2022-11-17 16:58:35 CET; 2h 8min ago
TriggeredBy: ● systemd-tmpfiles-clean.timer
Docs: man:tmpfiles.d(5)
man:systemd-tmpfiles(8)
Process: 2386 ExecStart=systemd-tmpfiles --clean (code=exited, status=0/SUCCESS)
Main PID: 2386 (code=exited, status=0/SUCCESS)
Nov 17 16:58:34 xxx systemd[1]: Starting Cleanup of Temporary Directories...
Nov 17 16:58:34 xxx systemd-tmpfiles[2386]: /usr/lib/tmpfiles.d/nagios.conf:2: Line references path below legacy dir>
Nov 17 16:58:34 xxx systemd-tmpfiles[2386]: /usr/lib/tmpfiles.d/net-snmp.conf:1: Line references path below legacy d>
Nov 17 16:58:35 xxx systemd[1]: systemd-tmpfiles-clean.service: Deactivated successfully.
Nov 17 16:58:35 xxx systemd[1]: Finished Cleanup of Temporary Directories.
#
You may have to modify the default behaviour to have this systemd Service clean up the specific files you’re have an issue with.
The default configuration follows the scheme below:
> cat /usr/lib/tmpfiles.d/systemd-tmp.conf
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
# See tmpfiles.d(5) for details
# Exclude namespace mountpoints created with PrivateTmp=yes
x /tmp/systemd-private-%b-*
X /tmp/systemd-private-%b-*/tmp
x /var/tmp/systemd-private-%b-*
X /var/tmp/systemd-private-%b-*/tmp
# Remove top-level private temporary directories on each boot
R! /tmp/systemd-private-*
R! /var/tmp/systemd-private-*
# Handle lost systemd-coredump temp files. They could be lost on old filesystems,
# for example, after hard reboot.
x /var/lib/systemd/coredump/.#core*.%b*
r! /var/lib/systemd/coredump/.#*
>
[HR][/HR]I can’t recall that, Leap 15.3 wasn’t automatically cleaning up old temporary system files – are you certain that, all the Leap 15.3 patches and updates have been applied?
And, the YaST temporary files you’ve listed, were usually located in /var/tmp/ – have you changed the default YaST configuration?
It may well be that, the older temporary system files you had in /tmp/ were relics from previous Leap versions which never got removed by the application of the newer housekeeping services.
Simply, occasionally, login as the user “root” and, clean out the older files in /tmp/ and /var/tmp/ …