Skip to content
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

Delete aconfmgr directory from /tmp when exiting #3

Closed
thenaterhood opened this issue Sep 17, 2016 · 18 comments
Closed

Delete aconfmgr directory from /tmp when exiting #3

thenaterhood opened this issue Sep 17, 2016 · 18 comments

Comments

@thenaterhood
Copy link

The /tmp/aconfmgt- directory doesn't get deleted when the program exits. Depending on the system, this can take up a fair amount of room (especially on the first run before all the necessary ignores are added).

@CyberShadow
Copy link
Owner

CyberShadow commented Sep 17, 2016

Deleting the directory automatically would interfere with the --skip-inspection switch.

Follow-up runs (with better ignore rules) should shrink the directory size, because the relevant subdirectories will be deleted and recreated.

Isn't /tmp a tmpfs on Arch?

@ijustlovemath
Copy link

It is. All files are deleted from /tmp on reboot.

@thenaterhood
Copy link
Author

Yes it is. Maybe a config option somewhere to remove it on exit would be good too.

@etcusrvar
Copy link

/tmp may default to being tmpfs in some cases, but there's nothing that says it has to be. I have /tmp mounted as a separate file system, just like /, /var, etc.

@ijustlovemath
Copy link

Where its physically located on disk or in LVM does not matter. If you
place a file in /tmp and restart, it will be gone. That's decided not at
the user level but at the distro level. I encourage you to try it out.

On Sunday, September 18, 2016, mezzoatic notifications@github.com wrote:

/tmp may default to being tmpfs in some cases, but there's nothing that
says it has to be. I have /tmp mounted as a separate file system, just like
/, /var, etc.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#3 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AL3tMI6BERZppinb3SOYLbvx8Ppvw7Exks5qrT0_gaJpZM4J_tnj
.

@etcusrvar
Copy link

@ijustlovemath That's not true. I use Arch, reboot periodically, and /tmp is not cleared on reboot. This is off-topic, and my setup may be different others', but I was just trying to point out that the assumption that /tmp has to be mounted as tmpfs is incorrect.

@thenaterhood
Copy link
Author

/tmp should be cleared on a reboot unless you've got something set up so it
isn't.

I guess my reason for this could use a little more clarification. What
happened to me on first run was that my /tmp got filled. I had to add a
bunch of ignores before I could do a save, and needed to remove the folder
from /tmp to get things working. Adding a flag to not keep /tmp after
exiting would have saved me a command the first couple times I ran it.

Not a huge deal either way, just something I felt might be a good addition.

On Sun, Sep 18, 2016, 11:06 etcusrvar notifications@github.com wrote:

@ijustlovemath https://github.com/ijustlovemath That's not true. I use
Arch, reboot periodically, and /tmp is not cleared on reboot. This is
off-topic, and my setup may be different others', but I was just trying to
point out that the assumption that /tmp has to be mounted as tmpfs is
incorrect.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#3 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ACdwxPmZBirpbvydUm6sEY9xAG4ROJeWks5qrVNzgaJpZM4J_tnj
.

@etcusrvar
Copy link

etcusrvar commented Sep 18, 2016

"should be cleared on a reboot unless you've got something set up so it isn't" There's nothing that says /tmp should be cleared on reboot, and yes, it can be set up so it isn't.
I'm not trying to drag this off topic-- I'm indifferent to the topic of keeping or removing /tmp/aconfmgt- . Again, I'm simply trying to point out incorrect assumptions.

@ijustlovemath
Copy link

It's the systemd default behavior. Certainly not "should", but "expected".

On Sunday, September 18, 2016, etcusrvar notifications@github.com wrote:

"should be cleared on a reboot unless you've got something set up so it
isn't" There's nothing that says /tmp should be cleared on reboot, and
yes, it can be set up so it isn't.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#3 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AL3tMNBOmHHaXhvYz7zoAoHZKO4iupafks5qrVfSgaJpZM4J_tnj
.

@CyberShadow
Copy link
Owner

CyberShadow commented Sep 18, 2016

I could add an exit hook that would allow the configuration to clean up the temporary directory on exit.

However, such a solution would not be discoverable, and relies on the user being aware of the problem and the solution only after the problem presents itself. Perhaps it would be better to address the underlying problem directly. To do that, first we should determine what it is.

  • /tmp becoming full and preventing successive commands from working? Then perhaps aconfmgr should warn on exit if free disk space in /tmp is low, or even delete its temporary directory to free up space immediately.
  • The used space under /tmp being an unexpected drain on the system disk space? Then perhaps aconfmgr should warn if /tmp is not a tmpfs, and its temporary directory size exceeds a certain threshold.
  • Something else?

@etcusrvar
Copy link

My personal preference would be to simply document what files/directories are created in /tmp. You may add a config option to use a different base directory from /tmp, but I don't think even this is needed. When I've run into this situation before with other tools (several AUR helpers come to mind), the tool would simply crash when /tmp was full, and I would manually clean up /tmp, put a symlink in /tmp for the offending file/dir to a location with more space, then run the tool again. If aconfmgr filled up my /tmp, I would do the same thing.

@CyberShadow
Copy link
Owner

My personal preference would be to simply document what files/directories are created in /tmp.

I added a mention to the FILES section of the man page in 68ea74e.

You may add a config option to use a different base directory from /tmp, but I don't think even this is needed.

The temporary directory location can be set by setting the TMPDIR environment variable, e.g. TMPDIR=~/.tmp aconfmgr ....

@CyberShadow
Copy link
Owner

Then perhaps aconfmgr should warn on exit if free disk space in /tmp is low

Implemented in c95a65b.

If there are no further suggestions, I'll consider this issue resolved.

@mxmilkiib
Copy link

So, as it stands, after my sudo TMPDIR=/var/aconfmgr/tmp aconfmgr save -c /var/aconfmgr I'm left with (from ncdu ran in /var/aconfmgr);

  174.5 MiB [##########] /tmp
  137.4 MiB [#######   ] /files
...

To be sure, is my understanding that the /tmp directory is only required for a shorter runtime of aconfmgr correct?

@CyberShadow
Copy link
Owner

Yes, if you opt in to that with the --skip-inspection switch.

@mxmilkiib
Copy link

Or just by deleting the tmp dir?

@CyberShadow
Copy link
Owner

You can delete it if you don't want to use --skip-inspection. Deleting it will not make aconfmgr run faster without the switch (and it will fail with the switch).

@CyberShadow
Copy link
Owner

BTW, a configuration size in the order of hundreds of MBs sounds atypical. If some of those files shouldn't be in the configuration, you can ignore them (using IgnorePath). If they are modified versions of packaged files, you can use GetPackageOriginalFile and related helpers to patch them from your configuration. If they are binaries of built and installed programs, you could package them into a pacman package.

CyberShadow added a commit that referenced this issue Aug 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants