TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Debian's /tmpest in a teapot

204 点作者 jwilk11 个月前

31 条评论

candiddevmike11 个月前
&#x2F;var&#x2F;tmp, IMO, shouldn&#x27;t exist--the idea of temporary files that should persist beyond a reboot is tech debt, those files should exist under a proper &#x2F;var&#x2F;{cache,lib} directory. Podman uses this directory and it drives me nuts.<p>The XDG base directory spec (<a href="https:&#x2F;&#x2F;specifications.freedesktop.org&#x2F;basedir-spec&#x2F;basedir-spec-latest.html" rel="nofollow">https:&#x2F;&#x2F;specifications.freedesktop.org&#x2F;basedir-spec&#x2F;basedir-...</a>) was supposed to solve all of this...
评论 #40579552 未加载
评论 #40591379 未加载
评论 #40580028 未加载
评论 #40583474 未加载
评论 #40583983 未加载
评论 #40578948 未加载
评论 #40578889 未加载
pledess11 个月前
The essence of the problem is that there&#x27;s no standard pathname for a personal directory that&#x27;s guaranteed to be on local disk, even if $HOME isn&#x27;t. Consequently, people have relied on &#x2F;var&#x2F;tmp&#x2F;$USER for this. There are realistically affected users who can&#x27;t change the new defaults.<p>Cleaning up &#x2F;var&#x2F;tmp on a timer is relevant to this academic environment (desktop-based research computing):<p>1. Each Debian machine is used by only one graduate student, but students do not have root access.<p>2. Today, &#x2F;var&#x2F;tmp is the only persistent local directory where the student has write access ($HOME is on a network filesystem backed up by the university).<p>3. Within the student population, there is strong institutional memory that &#x2F;var&#x2F;tmp isn&#x27;t backed up by the university and isn&#x27;t extremely robust (e.g., RAID), but also that nothing there is automatically deleted.<p>4. Students use &#x2F;var&#x2F;tmp for hundreds of Gb of data from simulations that take days or weeks. $HOME is too small and too slow for this.<p>5. In practice, less than 1% of students lose data through disk failure, accidents, etc.<p>6. A much larger fraction of students will lose data when sysadmins, who didn&#x27;t get the memo about the &#x2F;var&#x2F;tmp change and thus haven&#x27;t addressed the ingrained institutional memory, deploy new Debian machines.<p>7. Some of the students who lose data won&#x27;t graduate on time.
评论 #40580155 未加载
评论 #40580735 未加载
评论 #40580600 未加载
评论 #40580177 未加载
评论 #40581423 未加载
评论 #40580329 未加载
评论 #40580286 未加载
skissane11 个月前
I wish Linux (and other Unix-like systems) had an API to let you create named temporary files which are automatically deleted - by the operating system - when a process exits.<p>If you create an anonymous temporary file, then it will be deleted when the last file descriptor to it is closed-but anonymous temporary files are difficult to use (even given access via &#x2F;dev&#x2F;fd aka &#x2F;proc&#x2F;self&#x2F;fd). You can delete it using atexit() but that doesn’t get run if the process terminates abnormally (core dump, kernel panic, kill -9, power outage, etc)<p>Maybe something like a pidtmpfs where the top-level directories are pid numbers, you can create any files or directories you want under them, but it all disappears as soon as the process with that pid exits. Actually, pids are a bad idea due to pid reuse, you want something like a process serial number or a process UUID which doesn’t get reused.<p>Another somewhat more flexible idea would be that you can create arbitrary top-level directories, but they - and all their content - are automatically deleted as soon as the last open fd to them is closed. That way you could have multiple processes sharing a temporary workspace, and the workspace could survive the failure of any one of them, but if they all fail it gets deleted
评论 #40581725 未加载
评论 #40584431 未加载
评论 #40581715 未加载
评论 #40582936 未加载
评论 #40584553 未加载
o11c11 个月前
&#x2F;tmp on tmpfs is fine.<p>&#x2F;var&#x2F;tmp being cleaned on boot is probably fine despite contrary standards in the past.<p>But automatically deleting files - in either of those - while the system is running is going to break all sorts of things.<p>As a random example, `chromium --temp-profile` will have half the profile deleted (since some particular files aren&#x27;t accessed frequently) while the browser is running. This looks <i>designed</i> to cause system-level UB.<p>Note that locks on directories are pretty rare; locks on a file <i>within</i> the directory are the de facto standard, on the assumption that only cooperating programs will access them.
评论 #40581781 未加载
评论 #40581125 未加载
评论 #40581758 未加载
influx11 个月前
I was really impressed how Boccassi &quot;project managed&quot; this change, gathering feedback, addressing feedback where necessary, and continued to push the ball forward even under lots of objection. Many people would have just given up and the status quo would have remained for another couple years.
评论 #40579196 未加载
评论 #40578910 未加载
评论 #40579053 未加载
probably_wrong11 个月前
I&#x27;ve had cases where &#x2F;tmp was full, usually by some runaway program that didn&#x27;t clean up properly. The first indicator is usually that Bash auto-complete fails, followed by no one being able to SSH into the machine. I suppose mounting &#x2F;tmp in RAM means this will happen more often (as RAM is usually smaller than hard drive space), but I don&#x27;t see this becoming a giant issue.<p>Now, auto-cleaning &#x2F;var&#x2F;tmp... that&#x27;s going to cause SO MUCH data loss across people I know. I see a parallel with keeping files in your Desktop: yes, that&#x27;s not what it&#x27;s there for and ideally you&#x27;d store things properly, but you don&#x27;t go around deleting people&#x27;s documents just because you don&#x27;t like it!<p>Time to start sending warning E-Mails, I guess.
评论 #40579305 未加载
评论 #40580353 未加载
throw0101c11 个月前
From FHS:<p>&gt; <i>The &#x2F;var&#x2F;tmp directory is made available for programs that require temporary files or directories that are preserved between system reboots. Therefore, data stored in &#x2F;var&#x2F;tmp is more persistent than data in &#x2F;tmp.</i><p>&gt; <i>Files and directories located in &#x2F;var&#x2F;tmp must not be deleted when the system is booted. Although data stored in &#x2F;var&#x2F;tmp is typically deleted in a site-specific manner, it is recommended that deletions occur at a less frequent interval than &#x2F;tmp.</i><p>* <a href="https:&#x2F;&#x2F;refspecs.linuxfoundation.org&#x2F;FHS_3.0&#x2F;fhs&#x2F;ch05s15.html" rel="nofollow">https:&#x2F;&#x2F;refspecs.linuxfoundation.org&#x2F;FHS_3.0&#x2F;fhs&#x2F;ch05s15.htm...</a><p>IRIX docs:<p>&gt; <i>The directories &#x2F;usr&#x2F;tmp.O, &#x2F;var&#x2F;tmp, and &#x2F;var&#x2F;spool&#x2F;uucppublic are public directories; people often use them to store temporary copies of files they are transferring to and from other systems and sites. Unlike &#x2F;tmp, they are not cleaned out when the system is rebooted. The site administrator should be even more conscientious about monitoring disk use in these directories.</i><p>* <a href="http:&#x2F;&#x2F;rsusu1.rnd.runnet.ru&#x2F;sgi&#x2F;advanced&#x2F;ch8.html" rel="nofollow">http:&#x2F;&#x2F;rsusu1.rnd.runnet.ru&#x2F;sgi&#x2F;advanced&#x2F;ch8.html</a><p>From FreeBSD 1.0 (July 1991):<p><pre><code> &#x2F;var […] tmp&#x2F; temporary files not removed between system reboots vi.recover&#x2F; recovery files for the vi(1) editor </code></pre> * <a href="https:&#x2F;&#x2F;man.freebsd.org&#x2F;cgi&#x2F;man.cgi?query=hier&amp;sektion=7&amp;manpath=FreeBSD+1.0-RELEASE" rel="nofollow">https:&#x2F;&#x2F;man.freebsd.org&#x2F;cgi&#x2F;man.cgi?query=hier&amp;sektion=7&amp;man...</a><p>This is also true for Solaris, which I used to admin many moons ago. So I&#x27;m not sure where the idea that &#x2F;var&#x2F;tmp gets cleaned on reboot came from since I have always understood it to be fairly static.
评论 #40581811 未加载
pantalaimon11 个月前
I don’t like it, I tend to use &#x2F;tmp for large files or directories that are just that - temporary.<p>Now they will either fill up my RAM or require a large swap partition (which I usually don’t have as it’s otherwise wasted space).<p>I really like making &#x2F;tmp the default destination for downloads, so either I need the file and move it elsewhere, but usually it’s an archive and I just want a file from it. Saves me from an ever growing Download folder.<p>Those files are most dispensable and should not consume precious RAM.<p>Some file systems are even adding specific tmpdir support where fsync() is turned into a noop. So they have all the advantages of tmpfs without eating into precious RAM&#x2F;Swap.
评论 #40579055 未加载
评论 #40579236 未加载
JonChesterfield11 个月前
Tmpfs is great. If you&#x27;re a compiled language person and the build dir isn&#x27;t in a tmpfs yet, give it a try. Faster than nvme and less prone to burning out from lots of writes.<p>Defaulting to &#x2F;tmp in tmpfs means I can remove a line from my post install setup script. That doesn&#x27;t matter much. But it also means less divergence between my system and the default, so there should be a reliability improvement from other people stumbling over problems with the ramdisk before me. So a win all around, happy to see it.
评论 #40578868 未加载
评论 #40579097 未加载
评论 #40578983 未加载
评论 #40579223 未加载
dekhn11 个月前
I really dislike people using the &quot;I have an inflexible scientific code that needs &#x2F;var&#x2F;tmp to be disk and persisted forever&quot; argument to keep things the way they are. Debian&#x27;s user base is far larger than a few inflexible codes, and it&#x27;s straightforward to change the default.
评论 #40580373 未加载
评论 #40581627 未加载
aftbit11 个月前
The discussions about swap in the LWN comments are interesting. I wasn&#x27;t aware that at the &quot;swap should be 2x RAM&quot; tip was actually a hard requirement at one point (allegedly around Linux 2.4). I also wasn&#x27;t aware that common recommendation was to run with swap again.<p>I have some systems (usually VMs) where RAM is much bigger than the root disk. For example, 500+ GiB of RAM and only 100 GiB of disk. I have other VMs where the disk is orders of magnitude slower than the RAM (e.g. EBS on AWS EC2).<p>I wonder what I should be doing for swap and vm.swappiness. Usually I just run with either no swap or a tiny 4 GiB swap file on &#x2F;.
评论 #40579808 未加载
评论 #40579277 未加载
评论 #40580966 未加载
评论 #40580858 未加载
评论 #40579024 未加载
评论 #40578994 未加载
评论 #40580235 未加载
评论 #40600647 未加载
评论 #40581677 未加载
shadowgovt11 个月前
While I generally appreciate Debian&#x27;s careful approach (it is my go-to distro if I want things to be predictable with minimal upgrade frequency), it always blows my mind to watch open-source communities bury topics like this in committee for twelve years while commercial OS&#x27;s just tend to go &quot;It&#x27;s better for the end user. Here&#x27;s some money. Make it work. If it breaks some key software, make <i>it</i> work.&quot;
评论 #40578875 未加载
评论 #40579098 未加载
rwmj11 个月前
What&#x27;s the point of putting &#x2F;tmp in RAM when a competent disk-backed filesystem will do that with the most heavily used files anyway?
评论 #40579442 未加载
评论 #40579337 未加载
评论 #40579979 未加载
评论 #40579733 未加载
评论 #40579146 未加载
pm222211 个月前
Oh really I thought my arch should only clear &#x2F;tmp upon startup. No wonder I lost files in &#x2F;tmp<p><pre><code> The upstream defaults for systemd are to mount &#x2F;tmp as a tmpfs and delete files that have not been read or changed after ten days in &#x2F;tmp and 30 days for those stored in &#x2F;var&#x2F;tmp.</code></pre>
评论 #40580304 未加载
dopylitty11 个月前
I believe I speak for all when I say I keep all my most important files in &#x2F;tmp and ~&#x2F;Downloads
评论 #40579960 未加载
ars11 个月前
It&#x27;s a <i>lot</i> slower to write a large file to a ram based &#x2F;tmp and let it swap out, vs writing that file to disk directly.<p>If they want to do this they need to modify tmpfs to do a better job of shifting data to disk when full, instead of letting swap handle it.
评论 #40580917 未加载
评论 #40580047 未加载
hsbauauvhabzb11 个月前
In the article there’s some mention of the implications of ram and swap - this has caught me before - if you wget an iso to &#x2F;tmp, you may be consuming more ram than expected. And sure, that’ll get swapped out to disk, but that might be unexpected if you’re intending on using ram for virtual machines etc, you may end up OOM because of this behaviour.<p>I did this on Fedora, and it left a bad taste in my mouth.
camel-cdr11 个月前
Is there a easy&#x2F;non hacky way to configure &#x2F;tmp to only delete files on regular shutdown? I sometimes have the occasional crash, and have been bitten by doing some temporary work in &#x2F;tmp before such a crash 2-3 times.
评论 #40579408 未加载
aidenn011 个月前
&gt; Sam Hartman noted that ssh-agent created its socket under &#x2F;tmp, but it would be better if it respected the $XDG_RUNTIME_DIR setting and created its socket under &#x2F;run&#x2F;user. Boccassi agreed and said that he had filed a bug for ssh-agent. Richard Lewis pointed out that tmux stores its sockets in &#x2F;tmp&#x2F;tmux-$UID, and deleting those files might mean users could not reattach to a tmux session that had been idle a long time. Boccassi suggested that using flock() would be the right solution to stop the deletion, and said he had filed a bug on that as well.<p>Ah, yet another group of Linux users looking to get ssh to adopt the XDG specification. Moving ~&#x2F;.ssh to ~&#x2F;.config&#x2F;ssh has been repeatedly requeseted. XDG_RUNTIME_DIR is going to be even harder because it can be nonexistent on BSDs.
jimbobthrowawy11 个月前
I only learned that disk backed &#x2F;tmp&#x2F; wasn&#x27;t the default a couple of months ago after mainly using ubuntu for years and wondering why I was quickly running out of ram on a fedora machine.
iforgotpassword11 个月前
I prefer &#x2F;tmp on disk. Nvme disks are fast enough, wear is not an issue nowadays. I occasionally extract large files there. So either the tmpfs would be too small or the machine would eventually start swapping random things to disk, for which I&#x27;d have to grow my swap partition first - it&#x27;s only 1GB.<p>I mean I could start using &#x2F;var&#x2F;tmp or make a directory in $HOME and clean that up occasionally, but that would mean I have to change old habits. ;) so I guess masking tmp.mount it is.
bionade2411 个月前
Hopefully Ubuntu will align with this decision, so that MATLAB is finally forced to fix their shitty software. (I am aware that you can set the TMPDIR as an env var)
LooseMarmoset11 个月前
I have always assumed that &#x2F;tmp means &quot;temporary&quot;. I mean, it&#x27;s right there in the name. So, a move to tmpfs means &quot;automatic cleanup&quot; to me, which seems just fine, and worth doing for that.<p>If we&#x27;re doing because the systemd maintainers say &quot;we have to do it because systemd&quot;, though, well...<p>How long till the systemd guys make package dependencies and installation as a service? You know, sponsored by the IBM&#x2F;Redhat team, and signed by Microsoft?<p>signed,<p>a Devuan devotee
评论 #40589680 未加载
ericbarrett11 个月前
When I started in tech I worked for a storage vendor’s tech support. One of my first big cases was troubleshooting why a customer’s files older than a week were disappearing. Given the topic, I’m sure you can guess—they had it mounted under &#x2F;tmp and the cleanup script was doing its thing.<p>Hopefully the new Debian version of this script is a bit smarter!
M95D11 个月前
Programmers and sysadmins should keep track of their garbage, not break all of our systems just so they can get lazy.
评论 #40583461 未加载
m46311 个月前
I&#x27;m annoyed that it is getting harder and harder to find what physical filesystems are on a system.<p>My goto commands &quot;df -h&quot; and &quot;mount&quot; are cluttered with all kinds of ephemeral filesystems, with no easy way to filter (say, a one-character flag). lsblk is close but .. lvm and snaps.
评论 #40595642 未加载
juliangmp11 个月前
&gt;The knobs to control how &#x2F;tmp is mounted, and the handling of temporary files, are part of systemd.<p>Huh? Someone explain this to me, wasn&#x27;t fstab <i>the</i> mechanism to define things like this? Why does my init&#x2F;service manager need to mess with it???
评论 #40583487 未加载
quesne11 个月前
In addition to this upgrade, debian has removed the &#x27;last&#x27; command and related data files.
throwaway98439311 个月前
I find that, unless there&#x27;s an extremely necessary reason, it&#x27;s almost always bad to break backwards compatibility. If there&#x27;s any concept whatsoever of continuity between major releases, backwards compatibility should be the default, with changes being options.<p>Naturally this leads to more difficulty in testing and maintenance over time. But that extra work pays for the benefit of having a very long lived product and compatibility with past integrations.<p>At the end of the day you have to decide if you&#x27;re building a product to be easier for the users, or the maintainers. Personally I&#x27;m on the side of the users.
neilv11 个月前
In addition to `&#x2F;tmp`, you can put your `~&#x2F;.cache` on `tmpfs`.<p>Laptops have ridiculously large amounts of RAM nowadays. My Linux laptop setup barely makes a dent in the RAM, even when running 3 different Web browsers and other gluttonous desktop programs. `tmpfs` is a great use for excess RAM, reducing wear on SSD. (I also disable swap.)<p>I&#x27;ve also done things like build an entire large ecosystem of packages in `tmpfs`, when the build server happened to have mirrored 10krpms drives, and I didn&#x27;t want the tons of intermediate files to eventually be synced to disk. (Even though, with disk, they would also probably hang around in Linux filesystem buffers, not reads hitting disk each time.)
评论 #40578954 未加载
评论 #40579256 未加载
评论 #40578909 未加载
评论 #40579015 未加载
评论 #40581411 未加载
评论 #40578844 未加载
评论 #40578993 未加载
bdjsiqoocwk11 个月前
Very OT, but I don&#x27;t know where else to turn to because the Reddit community has been of no help.<p>I used i3 and I absolutely love the way it feels. However I would like to configure it in a way that I can press a button and every app turns into dark mode. My main apps (Firefox, vscode) have an option to say &quot;use system theme&quot; i.e. if the os is dark, theme this app dark. Great! The problem is I don&#x27;t know how to set the system theme. And every time I&#x27;ve asked around, I see people respond with GTK, QT and what not. I don&#x27;t have those, I have i3.<p>Help?
评论 #40580033 未加载
评论 #40579154 未加载