Re: LFS does not save bash history on shutdown

2006-06-19 Thread Jason Aeschilman

Matthias B. wrote:

On Tue, 13 Jun 2006 12:23:03 -0600 Jason Aeschilman
<[EMAIL PROTECTED]> wrote:
ash history is not saved on shutdown.  I have commented out the line 
"unset HISTFILE" from /etc/profile so now history is saved for root, but


it only works when I log out of a terminal.  If I reboot or shutdown, 
the history does not get saved to ~/.bash_history.  Does anyone know how


this can be fixed?  Shouldn't this be standard on the LFS system?  Even 
if you keep "unset HISTFILE" for root, regular users should not lose 
their bash history on shutdown.


Are you sure that you are losing history rather than getting the history
for some interactive shell that you had open but didn't use?
AFAIK, by default, bash overwrites the history file on exit, i.e. the last
shell that terminates gets to write the history. When you shut down,
shells terminate in no well-defined order so that with
history-overwriting, the shell that wins the race to write history may
just be the wrong one.

Try putting

shopt -s histappend

into your /etc/profile and see if that fixes your problem. This will cause
bash to append to the history file rather than overwrite it, thereby
causing your history to store history from all shells, not just the one
terminated last.

MSB
I have exactly one console session up.  So it's not a case where one 
console is overwriting another.  I suppose sending the SIGHUP signal to 
all bash processes on shutdown may be the best solution.

--
http://linuxfromscratch.org/mailman/listinfo/blfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page


Re: LFS does not save bash history on shutdown

2006-06-15 Thread Jason Aeschilman

S. Anthony Sequeira wrote:

On Thu, 2006-06-15 at 12:24 -0600, Jason Aeschilman wrote:
  

I have lost history enough times, so I'm careful to logout of any
session I want to save.
  
Well, this came up because our (very old) Caldera-based system didn't 
have this problem.  I just now tested this on Fedora and it doesn't
have 
this problem either.   I'm curious what is different on LFS.  I
wonder 
if their reboot command is compiled differently.  I suppose one
solution 
would be to create an alias for reboot (alias reboot='reboot; exit')
but 
it seems silly to have to do that. 



As far as I am aware this is not specific to LFS.  I believe Debian bash
and cygwin bash exhibits this same behaviour, if the term session is not
gracefully shutdown history is lost.

Next time I have to reboot one of my Debian servers I will check this
out.
  
I don't have access to a pure Debian machine but I had my co-worker test 
this on his Ubuntu machine and it also saves bash history on reboot.  
Again, I'm just curious how they make this work.  I understand your 
point of view, that you should lose history since you don't explicitly 
exit the terminal session, but at least some distros have changed it so 
history is saved on reboot/shutdown, which is the behavior I desire.  
Let me know what you find out with Debian.

--
http://linuxfromscratch.org/mailman/listinfo/blfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page


Re: LFS does not save bash history on shutdown

2006-06-15 Thread Jason Aeschilman

S. Anthony Sequeira wrote:

On Tue, 2006-06-13 at 12:23 -0600, Jason Aeschilman wrote:
  
Bash history is not saved on shutdown.  I have commented out the line 
"unset HISTFILE" from /etc/profile so now history is saved for root, but 
it only works when I log out of a terminal.  If I reboot or shutdown, 
the history does not get saved to ~/.bash_history.  Does anyone know how 
this can be fixed?  Shouldn't this be standard on the LFS system?  Even 
if you keep "unset HISTFILE" for root, regular users should not lose 
their bash history on shutdown.


Jason



I believe this is standard.  If the terminal session is not logged out
of, history for that session is not saved.

What I do if I reboot/shutdown from a virtual terminal:

reboot ; exit

I have lost history enough times, so I'm careful to logout of any
session I want to save.
Well, this came up because our (very old) Caldera-based system didn't 
have this problem.  I just now tested this on Fedora and it doesn't have 
this problem either.   I'm curious what is different on LFS.  I wonder 
if their reboot command is compiled differently.  I suppose one solution 
would be to create an alias for reboot (alias reboot='reboot; exit') but 
it seems silly to have to do that.

--
http://linuxfromscratch.org/mailman/listinfo/blfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page


Re: kernel messages write to console even when not defined in syslog

2006-06-13 Thread Jason Aeschilman

Ken Moffat wrote:

On Tue, Jun 13, 2006 at 12:58:50PM -0600, Jason Aeschilman wrote:
  
I'm using a kernel module that sends warn (KERN_WARN ) log level 
messages to the console but I want them to only go to the logs.  I would 
like only kernel messages that are log level error or higher to go to 
the console.  So I added the following to the top of the default LFS 
/etc/syslog.conf file:


*.error /dev/console

However, this does not prevent the warning messages from going to the 
console. 


See man 8 klogd.  I do the following on all my builds, which is
close to what you wish to achieve, but best to double-check the
level against the log page:

sed -i 's/\(loadproc klogd\)/\1 -c 4/' /etc/rc.d/init.d/sysklogd

Ken
Thanks, I'll try that.  Does anyone know why putting settings like I did 
in /etc/syslog.conf is not doing what I expect?  How do the popular 
distros handle this?

--
http://linuxfromscratch.org/mailman/listinfo/blfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page


kernel messages write to console even when not defined in syslog

2006-06-13 Thread Jason Aeschilman
I'm using a kernel module that sends warn (KERN_WARN ) log level 
messages to the console but I want them to only go to the logs.  I would 
like only kernel messages that are log level error or higher to go to 
the console.  So I added the following to the top of the default LFS 
/etc/syslog.conf file:


*.error /dev/console

However, this does not prevent the warning messages from going to the 
console.  In fact, I even tried this:


*.* /dev/null

And STILL the warning messages go to the console.  I'm at a loss as to 
why this is.  Any help or guidance would be appreciated.  I've looked at 
the man page for syslog and I couldn't find anything there as to why 
this would be happening.


Now what I did find out so far is that the command "setterm -msglevel 3" 
will prevent KERN_WARN messages from going to the console, but I'm 
concerned that this would interfere with syslog.conf which is where this 
stuff should be set anyway.  Also, this command is terminal specific and 
I'm not sure how I would even execute it for each terminal.  I don't 
want any KERN_WARN messages going to any console, even when nobody is 
logged in, otherwise it just periodically spams the heck out of the console.


Jason
--
http://linuxfromscratch.org/mailman/listinfo/blfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page


LFS does not save bash history on shutdown

2006-06-13 Thread Jason Aeschilman
Bash history is not saved on shutdown.  I have commented out the line 
"unset HISTFILE" from /etc/profile so now history is saved for root, but 
it only works when I log out of a terminal.  If I reboot or shutdown, 
the history does not get saved to ~/.bash_history.  Does anyone know how 
this can be fixed?  Shouldn't this be standard on the LFS system?  Even 
if you keep "unset HISTFILE" for root, regular users should not lose 
their bash history on shutdown.


Jason
--
http://linuxfromscratch.org/mailman/listinfo/blfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page


package management with lpm & listnew

2006-03-03 Thread Jason Aeschilman
I'd like to share my modified package management scripts with everyone.
They worked quite well to build up and strip down my LFS system.  I first
created a full LFS system for development use, then from that I created a
stripped-down minimal LFS system for production (fits on a flash drive).  I
used "lpm -e package" to remove packages.  I also followed much of the
advice in the small-lfs.txt hint to get rid of unnecessary files and
directories.  I was able to get the system down to just 85MB in size.

=== lpm 

lpm is a script that acts as a wrapper for the install-log installation
logger (see install-log.txt hint). It provides a simple form of package
management. I took the lpm script as provided by the lpm.txt hint and added
a few more features, making it more rpm-like in the process. See the usage
in the script below.

SAMPLE OUTPUT

# lpm -q sed
sed-4.1.4

# lpm -ql sed
/bin/sed
/usr/share/doc/sed-4.1.4/sed.html
/usr/share/info/sed.info
/usr/share/man/man1/sed.1

# lpm -qf /bin/sed
sed-4.1.4

SCRIPT /usr/bin/lpm

#!/bin/sh
#
# LPM - Linux from scratch Package Manager - v1.3 (1.3.3)
# Date: 24-04-2004 (Edited: 20-01-2006)
#
#
# CC-GPL 2004 Daniel Zilli <[EMAIL PROTECTED]>
#
# This program is free software; you can redistribute it and/or modify it
under
# the terms of the GNU General Public License as published by the Free
Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but
WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS
# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
# details.
#
# http://creativecommons.org/licenses/GPL/2.0/legalcode.pt
#
# Changes by Jason Aeschilman <[EMAIL PROTECTED]>
# > changed some options to be more rpm-like
# > added -f option
# > added -q option
# > added -qa option
# > added -qf option
# > added -ql option

# Alias to make the command shorter
logpath="/var/log/install-log"

option=$1
arg=$2

# Shows the options and version of LPM.
usage()
{
echo "LPM: Linux from scratch Package Manager - v1.3.3"
echo "  -l   log the install"
echo "  -f   log the install (force update)"
echo "  -e   erase a package"
echo "  -q   display package name and version"
echo "  -qa  list all packages"
echo "  -qf  list all packages owning FILE"
echo "  -ql  list files in a package"
}

checkarg()
{
if [ -z "$arg" ]; then
echo "LPM: missing argument to '$option'"
usage
exit
fi
}

# Check for force argument
F=""
if [ "$option" = "-f" ]; then
F="-f"
fi

# Log installation
if [ "$option" = "-l" -o "$option" = "-f" ]; then
# If you didn't pass a second argument, LPM will use
# your pwd as name of the logfile
if [ -n "$arg" ]; then
/usr/bin/install-log $F $arg
else
/usr/bin/install-log $F $(basename $(pwd))
fi
exit
fi

# Erase all the files installed by the package.
if [ "$option" = "-e" ]; then
checkarg
echo -n "Are you sure you want to uninstall package '$arg' [y/n]? "
read response
if [ "$response" = "y" -o "$response" = "Y" ]; then
xargs rm < $logpath/$arg && rm $logpath/$arg
echo "LPM: package '$arg' successfully removed"
else
echo "LPM: erase aborted by user - no files modified"
fi
exit
fi

# Display package name and version
if [ "$option" = "-q" ]; then
checkarg
ls -1 $logpath/$arg* | sed -e "[EMAIL PROTECTED]/@@"
exit
fi

# List all packages
if [ "$option" = "-qa" ]; then
ls -1 $logpath
exit
fi

# List all packages owning FILE
if [ "$option" = "-qf" ]; then
checkarg
FILENAME="$arg"
if [ ${arg:0:1} != "/" ]; then
PWD=`pwd`
BASENAME=`basename $arg`
FILENAME="$PWD/$BASENAME"
fi
egrep "^$FILENAME$" $logpath/* | sed -e "[EMAIL PROTECTED]/@@" -e
"s@:.*@@"
exit
fi

# List files in a package
if [ "$option" = "-ql" ]; then
checkarg
cat $logpath/$arg-*
exit
fi

# If no option match, display usage
usage

=== listnew 

listnew is a script that wi

ghost and grub problem

2006-02-16 Thread Jason Aeschilman
I successfully built an LFS system (SVN-20050920) awhile back and now I'm
trying to clone it to another drive (using Ghost 8.0) but I keep getting
"GRUB GRUB GRUB" across the screen.  I can fix this by re-installing grub on
that disk, but I would like to avoid this extra step as this is going to be
done many times -- we sell a Linux-based product.

What I don't understand is Ghost 8.0 does support grub.  In fact, it will
successfully clone Fedora Core 4 which also uses grub.  Why would it
successfully clone Fedora with grub but not LFS with grub?  Incidentally, I
also tried with lilo, and that has a problem as well.  I get "L99 99 99"
across the screen.

Does anyone have any idea why I would be having problems cloning LFS with
grub and lilo?  I've done quite a bit of googling and haven't figured this
out yet.  I am going to look at some alternative cloning software, but none
of them seem as easy to use as Ghost.  Has anyone else had any problems like
mine?  Or does anyone have any ideas of what I could try?

Thanks for any help you can provide.

Jason

-- 
http://linuxfromscratch.org/mailman/listinfo/blfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page