-
Notifications
You must be signed in to change notification settings - Fork 835
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
/tmp never cleared #1278
Comments
@Meinersbur I wonder if they're going to make it actual in-RAM storage like it is on Linux. If that's the plan, they might not do it this way. |
@fpqc FYI -- |
It's not only /tmp all the files that You deleting under bash are left on the hdd. |
@S-ed I believe it does clean them up after you end the Linux Instance (right now this means close all instances of bash.exe) |
@fpqc nope, still there, even after windows reboot. |
@Sed On Drvfs? On Lxfs (outside of /mnt)? Did you touch them with Windows tools? |
Did nothing (outside of bash). Try it Yourself, use:
edit: now I've got it |
@S-ed please READ THIS - we STRONGLY recommend you do NOT spelunk into the Linux filesystem using Windows apps and tools. https://blogs.msdn.microsoft.com/commandline/2016/11/17/do-not-change-linux-files-using-windows-apps-and-tools/ |
@bitcrazed Yeah. I've kinda learned this lesson last year. |
The ask in the original post here was that WSL On recent versions of Ububtu This is a dupe of #511, or, alternately, a feature request (with the 'init' label) if one subscribes to the idea that WSL |
@therealkenc Yep. I thought it's caused by the same issue as the |
@therealkenc I think there is more than one way to implement this, Running tmpreaper would be one possibility, but not the only one. Considering that "Windows Disk cleanup" is a Windows component that should be aware of special paths, I don't think its terribly unfortunate. One could install a Disk Cleanup Handler that runs eg. |
There, you used the words again. Can't say I didn't try to help you out.... |
Yeah, no. We won't be relying on WinDiskCleanup to non-deterministically clean tmpfs in WSL - that's something we do when terminating a session. Just got off a team-sync call where we briefly discussed some of the init challenges and what we might be able to do. Will be meeting post-turkey-coma to discuss in more detail. |
Has anything come of this? |
Hey @ALL. We've certainly discussed it, but we've yet to figure-out a sensible, universal/cross-distro solution that would work for everyone.
As @Meinersbur points out above: There isn't even much consistency in the Linux distros themselves about when tmp gets cleared:
I think its best we leave decisions about when and how to nuke your tmp folder to the user and/or distro. Though we'd love to hear suggestions from y'all if you think you have a universal solution. |
I didn't realize different distros did it differently. I was always under the impression that everyone wiped it on bootup/shutdown depending on if it was tmpfs or not. So I'm all for as soon as the Windows session ends, clear /tmp. |
Would that be the Or are we referring to the background task support? |
I would advocate that WSL itself ideally shouldn't do this. I think it should be the responsibility of the distro userspace, because that's how it works on regular Linux. If WSL doesn't yet support whatever mechanism a given distro uses, I would propose tweaking its image to do something equivalent using kernel and init surfaces that WSL does currently surface. Are there any WSL distro maintainers on this bugtracker these days? Do they have any thoughts about what the best experience is for their users? I don't personally see a need to rush this. But if there is a need, +1 to "wipe on session termination" as a short-term hack. I think the lack of awareness here that different distros do this differently is an argument that people probably won't care hugely if the behavior changes slightly as WSL becomes able to use distros' built-in /tmp-clearing logic. |
People who feel strongly about it can start I keep meaning to make a run at |
@bitcrazed Let users set this setting. |
I also agree that WSL should support whatever distros require for their mechanisms to work to clear |
I had exactly the same issue with my Windows ... but is it created by WLS ? Or something else ?? |
It's part of the userspace that's pulled down with the image. Just open WSL, |
I agree that this is the distro policy whether cleaning /tmp on boot or not. |
Absolutely. It should be made as general as possible though, to address Rich's tough questions. It should probably be able to run arbitrary scripts, be it Something like that. |
Since #344 was deemed addressed, following suit. |
@therealkenc #344 did not address this issue on ubuntu, the /tmp directory still grows indefinitely on a default ubuntu wsl instance. |
Here is my interim workaround:
(you know where this is going...)
(my own version of this file also starts dbus, avahi-daemon and xrdp so I have a stable DNS name to connect to....) |
Hey there. I've run into the same problem — the But suddenly my
I'm sure that I didn't touch this file by myself. However it looks very strange. So, I'm here to ask those of you who encounter the same problem on Ubuntu 18.04 or newer. Would you mind to check your |
Ah, nevermind. It looks like As an alternative, I guess, it should be possible to run this command on cron, or use But for some reason |
Sorry, why was this issue closed? I'm not really sure the problem is solved here... |
I second this. /tmp is not cleaned on Ubuntu 22.04 |
FYI if you enable the new systemd support in WSL2, afterwards you can enable After the above and restarting WSL, you can check if it worked via You can obviously confirm further by "touching" a file (ie Knowledge credit: #6999 (comment) |
One potential caveat: doing this replaces your In my case, I had to disable
|
Ubuntu deletes all files in /tmp when booting. Other distributions (eg. RedHat) have a cronjob tmpwatch that deletes these files or even use tmpfs to mount /tmp.
WSL does not 'boot' nor has anacron running. The Windows Disk cleanup program does not consider the files in
%USERPROFILE%/AppData/Local/lxss/rootfs/tmp
. Hence these are never deleted (automatically).My suggestion is to clean /tmp when the last lxss process closes. It already terminates background processes when there is no more bash session. At that point no process can access files in /tmp anymore and by Filesystem Hierarchy Standard files cannot be expected to be kept.
The text was updated successfully, but these errors were encountered: