Is /var/log/packages hardcoded or can it be altered?
SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I was interested in putting /var/log on tmpfs. Can the /var/log/packages directory be changed to something else for package management?
The paths are hard coded into all of the Slackware package tools, and all 3rd party tools.
You could do something like this below and check how the package tools work, then make it permanent with /etc/fstab.
There might be many unforeseen issues with this though, and I don't recommend it.
There will be a number of processes with open files within /var/log, so you might want to close those before you do this; or manually close those afterwards (or reboot, which is easier and you can test the changes properly).
Code:
mkdir /root/slackdata
mv -fv /var/log/{setup,packages,removed_*,scripts} /root/slackdata/
# Create your tmpfs in /var/log. Adjust to size as needed:
mount -t tmpfs -o size=300m tmpfs /var/log
# Mount the Slackware data directories as bind mounts:
cd /root/slackdata
for i in * ; do
mkdir -p /var/log/$i
mount -vo bind $PWD/$i /var/log/$i
done
# Get syslog logging again:
killall -HUP syslogd
# You'd also want to restart anything else that was actively logging there.
Last edited by drmozes; 01-13-2018 at 01:52 PM.
Reason: Expanded on how to
@montagdude: I assume that linuxbawks actually wants that /var/log be cleared at each reboot (I assume to save some space on a mass storage device) , but preserve the content of /var/log/packages, hence the question about changing the directory.
As an aside, the content of /var/log/{removed_packages,scripts,removed_scripts} should also survive a reboot.
Last edited by Didier Spaier; 01-13-2018 at 01:14 PM.
@montagdude: I assume that linuxbawks actually wants that /var/log be cleared at each reboot (I assume to save some space on a mass storage device) , but preserve the content of /var/log/packages, hence the question about changing the directory.
As an aside, the content of /var/log/{removed_packages,scripts,removed_scripts} should also survive a reboot.
Yes you understand why.
It's reasonable to put logs on tmpfs, fewer disk writes as well as resulting in more relevant logs. But package mgmnt logs should be somewhere more permanent.
It's reasonable to put logs on tmpfs, fewer disk writes as well as resulting in more relevant logs. But package mgmnt logs should be somewhere more permanent.
Yeah, the logs will be really relevant while using a temporary filesystem for them, specially after a failed boot.
Seriously, looks like you really have no clue about what the Linux logging is about.
Last edited by Darth Vader; 01-13-2018 at 01:54 PM.
^^^ Don't know about you but it's you who seems to have no practical clue about using logs. Perhaps you read your logs on a minute by minute basis for entertainment or perhaps you have failed boots on a daily basis.
@linuxbawks: maybe Darth's comment could have been worded more nicely, however he is right in that logs are useful for forensic analysis and that can be necessary not only after a failed boot, but also after a lot of other issues.
Oh and he is a seasoned sysadmin and a former distribution maintainer so he is no stranger to logging issues
But if not already done, you could do something similar for cached files, without the same drawback.
As an aside, some software developers use XDG_RUN_TIME_DIR whereas others use XDG_CACHE_HOME for the same purpose, so this also helps when they need to communicate.
The same could apply to /var/cache. If I remember well some distributions do that by default using then the /run directory.
PS Not sure about that. But you can certainly make /tmp (and /var/tmp) a tmpfs if not already done and are careful on what you put there. I guess you already knew that, though.
Last edited by Didier Spaier; 01-16-2018 at 05:41 AM.
Reason: /var/tmp should survive a reboot according to the FHS
If you were using LVM, it would be child's play to make a new logical volume for the contents of /var/log/packages and mount that new logical volume on /var/log/packages. Everything else in /var/log would disappear after a reboot (What an easy way to hide someone hacking your server! Make your changes and reboot.) but the package database would persist.
Logs usually are useful but if you have a specific use case for not wanting them then by all means mount /var/log in tmpfs.
Retaining /var/log/packages is not a hard requirement for system operation, but various package tools expect to find that directory. That said, you could move /var/log/packages to /var/cache/packages, for example. Mount /var/log to tmpfs and sym link /var/cache/packages to /var/log/packages. Likewise for /var/log/removed_packages and /var/log/removed_scripts.
In my /etc/fstab I have /tmp mounted in tmpfs but not /var/tmp. According to the FHS /var/tmp is for persistent temporary files that should survive a reboot. Of course, your computer so do what you want.
Quote:
Yeah I will say it here. What a dumb idea hardcoding package audits to /var/log.
Well, saying the location is a dumb idea is not going to score many points. Pat shared how /var/log/packages came to be. That history can be seen by browsing through the package commands for the $ADM_DIR variable. Therefore another way to move /var/log/packages is to edit $ADM_DIR in the package management scripts to your desired location.
Who knows, since Pat has considered moving the location, perhaps with some sugar coated pretty pleases he might make that happen before the next release. I vote for /var/cache/packages.
^^^ Don't know about you but it's you who seems to have no practical clue about using logs. Perhaps you read your logs on a minute by minute basis for entertainment or perhaps you have failed boots on a daily basis.
If you happened to work where I work myself, most likely you had be fired in the next second after making this statement in the front of TM. No questions accepted.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.