LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 01-13-2018, 12:28 PM   #1
linuxbawks
Member
 
Registered: Apr 2013
Distribution: Snuckware
Posts: 240

Rep: Reputation: 17
Is /var/log/packages hardcoded or can it be altered?


I was interested in putting /var/log on tmpfs. Can the /var/log/packages directory be changed to something else for package management?
 
Old 01-13-2018, 12:39 PM   #2
Alien Bob
Slackware Contributor
 
Registered: Sep 2005
Location: Eindhoven, The Netherlands
Distribution: Slackware
Posts: 8,559

Rep: Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106
You can mount /var/log on a tempfs but why? You will not be able to replay any issue when you reboot.

Last edited by Alien Bob; 01-13-2018 at 12:40 PM.
 
Old 01-13-2018, 12:51 PM   #3
drmozes
Slackware Contributor
 
Registered: Apr 2008
Distribution: Slackware
Posts: 1,547

Rep: Reputation: 1313Reputation: 1313Reputation: 1313Reputation: 1313Reputation: 1313Reputation: 1313Reputation: 1313Reputation: 1313Reputation: 1313Reputation: 1313
Quote:
Originally Posted by linuxbawks View Post
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
 
Old 01-13-2018, 12:57 PM   #4
montagdude
Senior Member
 
Registered: Apr 2016
Distribution: Slackware
Posts: 2,011

Rep: Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619
I don't get why you would want it on tmpfs. Wouldn't it be cleared on reboot, breaking package management?
 
Old 01-13-2018, 01:13 PM   #5
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,062

Rep: Reputation: Disabled
@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.
 
Old 01-13-2018, 01:29 PM   #6
linuxbawks
Member
 
Registered: Apr 2013
Distribution: Snuckware
Posts: 240

Original Poster
Rep: Reputation: 17
Quote:
Originally Posted by Didier Spaier View Post
@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.
 
Old 01-13-2018, 01:30 PM   #7
montagdude
Senior Member
 
Registered: Apr 2016
Distribution: Slackware
Posts: 2,011

Rep: Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619
Oh, I get it. I read the original post too fast.
 
Old 01-13-2018, 01:51 PM   #8
Darth Vader
Senior Member
 
Registered: May 2008
Location: Romania
Distribution: DARKSTAR Linux 2008.1
Posts: 2,727

Rep: Reputation: 1247Reputation: 1247Reputation: 1247Reputation: 1247Reputation: 1247Reputation: 1247Reputation: 1247Reputation: 1247Reputation: 1247
Quote:
Originally Posted by linuxbawks View Post
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.
 
Old 01-13-2018, 02:13 PM   #9
linuxbawks
Member
 
Registered: Apr 2013
Distribution: Snuckware
Posts: 240

Original Poster
Rep: Reputation: 17
^^^ 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.
 
Old 01-13-2018, 02:19 PM   #10
linuxbawks
Member
 
Registered: Apr 2013
Distribution: Snuckware
Posts: 240

Original Poster
Rep: Reputation: 17
Yeah I will say it here. What a dumb idea hardcoding package audits to /var/log.
 
Old 01-13-2018, 02:29 PM   #11
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,062

Rep: Reputation: Disabled
@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.

For instance I have this in ~/.profile:
Code:
export XDG_CACHE_HOME=/dev/shm/$(whoami)
mkdir -p /dev/shm/$(whoami)
chmod 700 /dev/shm/$(whoami)
export XDG_RUNTIME_DIR=$XDG_CACHE_HOME
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
 
Old 01-13-2018, 04:13 PM   #12
Richard Cranium
Senior Member
 
Registered: Apr 2009
Location: McKinney, Texas
Distribution: Slackware64 15.0
Posts: 3,858

Rep: Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225
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.
 
Old 01-13-2018, 05:22 PM   #13
upnort
Senior Member
 
Registered: Oct 2014
Distribution: Slackware
Posts: 1,893

Rep: Reputation: 1162Reputation: 1162Reputation: 1162Reputation: 1162Reputation: 1162Reputation: 1162Reputation: 1162Reputation: 1162Reputation: 1162
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.
 
1 members found this post helpful.
Old 01-13-2018, 05:35 PM   #14
Darth Vader
Senior Member
 
Registered: May 2008
Location: Romania
Distribution: DARKSTAR Linux 2008.1
Posts: 2,727

Rep: Reputation: 1247Reputation: 1247Reputation: 1247Reputation: 1247Reputation: 1247Reputation: 1247Reputation: 1247Reputation: 1247Reputation: 1247
Quote:
Originally Posted by upnort View Post
I vote for /var/cache/packages.
I for one, I believe that something like /var/lib/packages is a more appropriate location, considering that it is basically a files based database.

Last edited by Darth Vader; 01-13-2018 at 05:39 PM.
 
Old 01-13-2018, 05:47 PM   #15
Darth Vader
Senior Member
 
Registered: May 2008
Location: Romania
Distribution: DARKSTAR Linux 2008.1
Posts: 2,727

Rep: Reputation: 1247Reputation: 1247Reputation: 1247Reputation: 1247Reputation: 1247Reputation: 1247Reputation: 1247Reputation: 1247Reputation: 1247
Quote:
Originally Posted by linuxbawks View Post
^^^ 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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
/var/log/packages is empty! babyphil Slackware 31 11-01-2019 04:58 PM
/var/log/packages and /var/log/setup sunny_5252 Slackware 4 05-17-2007 08:17 PM
/var/log/packages Crazed_Mofo VectorLinux 3 04-10-2006 06:54 PM
/var/log/packages vanished Idle Slackware 3 09-19-2005 12:57 PM
/var/log/packages gone! PurpleMotion Slackware 1 10-02-2004 03:04 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 03:55 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration