Re: [gentoo-amd64] Re: hardware clock often doesn't sync to system on shutdown

2008-09-17 Thread Conway S. Smith
On Wed, 17 Sep 2008 08:19:42 +0300
Thanasis [EMAIL PROTECTED] wrote:
 on 09/17/2008 08:08 AM ABCD wrote the following:
  Duncan wrote:
   But make sure you either have a copy of the device node or know
   how to create one, before you do.
 
  To recreate /dev/null, do (as root):
 
  # mknod -m 666 /dev/null c 1 3
 
 Thank you ABCD and Duncan.
 I managed to have a backup of /dev/null and /dev/console as /null
 and /console. :-)
 
 
Did you need the backups (did your /etc/adjtime - /dev/null symlink
break /dev/null)?


Conway S. Smith

-- 
The only intuitive interface is the nipple. After that, it's all
learned. (Bruce Ediger, [EMAIL PROTECTED], in comp.os.linux.misc,
on X interfaces.)



Re: [gentoo-amd64] Re: hardware clock often doesn't sync to system on shutdown

2008-09-17 Thread Thanasis

on 09/17/2008 04:34 PM Conway S. Smith wrote the following:

On Wed, 17 Sep 2008 08:19:42 +0300
Thanasis [EMAIL PROTECTED] wrote:
  

on 09/17/2008 08:08 AM ABCD wrote the following:


Duncan wrote:
  

But make sure you either have a copy of the device node or know
how to create one, before you do.


To recreate /dev/null, do (as root):

# mknod -m 666 /dev/null c 1 3

  

Thank you ABCD and Duncan.
I managed to have a backup of /dev/null and /dev/console as /null
and /console. :-)




Did you need the backups (did your /etc/adjtime - /dev/null symlink
break /dev/null)?


Conway S. Smith

  

No, at least so far everything seems good:

# ls -l /dev/null /null
crw-rw-rw- 1 root root 1, 3 2008-09-17 21:41 /dev/null
crw-rw-rw- 1 root root 1, 3 2008-09-17 10:59 /null
# ls -l /dev/console /console
crw--- 1 root root 5, 1 2008-09-17 08:00 /console
crw--- 1 root root 5, 1 2008-09-17 18:42 /dev/console
#




Re: [gentoo-amd64] Re: hardware clock often doesn't sync to system on shutdown

2008-09-16 Thread Thanasis

on 09/16/2008 01:31 AM Duncan wrote the following:

Thanasis [EMAIL PROTECTED] posted [EMAIL PROTECTED],
excerpted below, on  Mon, 15 Sep 2008 18:26:38 +0300:


on 09/15/2008 05:57 PM Sebastian Redl wrote the following:

Thanasis wrote:

I attach the /etc/init.d/clock which shows a local readonly variable
that controls a --noadjfile option. What does the following test do?

if ! touch /etc/adjtime 2/dev/null ; then
   readonly=yes
elif [[ ! -s /etc/adjtime ]] ; then
   echo 0.0 0 0.0  /etc/adjtime
fi

First it tests if a touch of /etc/adjtime succeeds. If not, the file is
not writeable, and it sets the readonly variable.

Then it tests if /etc/adjtime exists (it does, since the touch
succeeded) and has non-zero size. If not, it writes a zero adjust into
the file.

Sebastian

How can I make /etc/adjtime readonly? I tried chmod a-w /etc/adjtime,
but root can always write to it :-) , unless the init script doesn't run
as root.


A caveat in that the below are all untested ideas.  I'm just throwing 
them out as possible solutions I'd explore further if it were me.  They 
may work, or not, but it's probably worth investigating them further and/

or testing them.

There's a spot in /etc/conf.d/clock to set your own options, right?  From 
the script, perhaps it's ${CLOCK_OPTS}.  If you can set your own 
arbitrary options, you can try adding --noadjfile to them.  Except 
hwclock is called several times (twice for start, once for stop if you 
have it set to do so) with different options, and I've not checked to see 
what effect setting --noadjfile will have in all those calls.  You could 
reason it out or just try it and see.


Alternatively, the manpage says there's an --adjfile=filename option.  
You could try adding that option and pointing it elsewhere, so the 
scripts don't look in the right place.


A third thing to try would be making the adjfile a directory (make it an 
empty one just in case) instead of a file.  Obviously it won't be 
possible to write a valid adjust into it then, but I'm not sure what the 
failure mode would be, tho it shouldn't blow up the system so it should 
be safe to try.


Finally, a combination of options two and three above, pointing 
--adjfile= at a different location, an empty directory, might work.


As I said, those are ideas I'd try.

Something else I HAVE done on occasion, is hack whatever initscript a bit 
to fit my needs.  If you do so, make sure portage's (assuming that's the 
PM you're using, others... I expect you'd know what to configure in them) 
CONFIG_PROTECT variables are set to include that dir (IIRC it does as 
it's under /etc, but the mask variable may unprotect it, so check that), 
so an update lets you manage the changes instead of overwriting it 
without asking.



Thanks Duncan. You gave me an idea:
# ls -l /etc/adjtime
lrwxrwxrwx 1 root root 9 2008-09-16 16:19 /etc/adjtime - /dev/null

It seems to work well so far. :-)
Do you think it might cause any problems, to /dev/null maybe?




[gentoo-amd64] Re: hardware clock often doesn't sync to system on shutdown

2008-09-16 Thread Duncan
Thanasis [EMAIL PROTECTED] posted [EMAIL PROTECTED],
excerpted below, on  Tue, 16 Sep 2008 16:28:04 +0300:

 Do you think it might cause any problems, to /dev/null maybe?

I'm not sure how it's handled in this case, but the ones that cause 
problems redirecting to /dev/null are I believe the ones that rewrite by 
writing a temp version, then mv-ing it over the old one.  In fact, some 
of those won't work with symlinks for much the same reason.

Of course, if it's trying to do that as a normal user, it won't work, but 
if it's doing that as root (as likely here) it can cause problems.  I've 
had it happen a couple times to me...

So I'd try starting and stopping clock a time or two and then check /dev/
null to see if it's still fine.  But make sure you either have a copy of 
the device node or know how to create one, before you do.  If you're 
using udev, you should have a copy of both the null and console device 
nodes either in the /dev on / before udev mounts over it (so you can 
access it by doing a mount --bind... I have an fstab entry for just that, 
to make doing backups of the / filesystem easier), or in your initramfs/
initrd, or both.

-- 
Duncan - List replies preferred.   No HTML msgs.
Every nonfree program has a lord, a master --
and if you use the program, he is your master.  Richard Stallman




[gentoo-amd64] Re: hardware clock often doesn't sync to system on shutdown

2008-09-16 Thread ABCD
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Duncan wrote:
 But make sure you either have a copy of the device node or know how to 
 create one, before you do.

To recreate /dev/null, do (as root):

# mknod -m 666 /dev/null c 1 3

- --
ABCD
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkjQkN8ACgkQOypDUo0oQOo9egCfVpL0hhWyCSnEa3FTg184gsSp
KfwAoLqAa7Y0WyLD/1tAuTkttHDq9NjV
=k6EE
-END PGP SIGNATURE-




Re: [gentoo-amd64] Re: hardware clock often doesn't sync to system on shutdown

2008-09-16 Thread Thanasis

on 09/17/2008 08:08 AM ABCD wrote the following:

Duncan wrote:
 But make sure you either have a copy of the device node or know how to
 create one, before you do.

To recreate /dev/null, do (as root):

# mknod -m 666 /dev/null c 1 3


Thank you ABCD and Duncan.
I managed to have a backup of /dev/null and /dev/console as /null and 
/console. :-)





[gentoo-amd64] Re: hardware clock often doesn't sync to system on shutdown

2008-09-15 Thread Duncan
If you have 20 minutes to spare, then you can be well on your way to financial 
stability.
 20 minutes is all it takes to listen to two short audio clips, about a 
revolutionary home 
business, that has global status. It#039;s creating wealth and extra income 
for thousands 
around the world. Want to know more about this great opportunity...? Then just 
click on
 the link that follows this message. Thanks for your time and have a great day.
http://www.automatedblogs4cash.ws/20minutes2success


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
MONEY MONEY MONEY FAST MONEY group.
To post to this group, send email to hollaatyaboy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/hollaatyaboy
-~--~~~~--~~--~--~---



Re: [gentoo-amd64] Re: hardware clock often doesn't sync to system on shutdown

2008-09-15 Thread Thanasis

on 09/15/2008 11:49 AM Duncan wrote the following:

Thanasis [EMAIL PROTECTED] posted [EMAIL PROTECTED],
excerpted below, on  Mon, 15 Sep 2008 01:59:07 +0300:


Thanks to your guidance, I found out that I had a large systematic
drift rate in /etc/adjtime file. This must have been the reason why the
hwclock was set behind. So I've set the drift to zero (actually just
deleted the file and let the system create a new one) and I hope things
will be ok now. :-)


Are you on baselayout-1 still or -2 (which is still ~arch)?  IDR the 
details on baselayout-1, but at least with -2, you can set it not to use 
the adjtime file at all.  If you're on -2 and can't find the details 
yourself, post to that effect and I'll try to find them for you from this 
end.


Particularly if you're having trouble with the clock interrupt failing 
(as you mentioned you are), if you sync via NTP, that file can cause more 
problems than it solves, because the system keeps deciding the clock 
isn't working right and setting a larger adjustment, which fights what 
ntpd is already doing.  Thus if you're running ntpd anyway, it's best to 
disable use of that file entirely, /especially/ if as I said your acpi or 
whatever is screwing it.  If you're still on baselayout-1 and can't 
figure out how to disable adjtime, it may be worth putting a rm in /etc/
conf.d/local (make it conditional on there actually being a file to rm, 
so the rm doesn't error out if it's not there, and ensure the local 
service is in your initlevels as appropriate) for both local_start and 
stop, so it's regularly removed before it starts getting to be too big of 
a problem.



#  equery l |grep baselayout
sys-apps/baselayout-1.12.11.1

So I'm on baselayout-1.
I attach the /etc/init.d/clock which shows a local readonly variable 
that controls a --noadjfile option.

What does the following test do?

if ! touch /etc/adjtime 2/dev/null ; then
   readonly=yes
elif [[ ! -s /etc/adjtime ]] ; then
   echo 0.0 0 0.0  /etc/adjtime
fi




#!/sbin/runscript
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

opts=save

depend() {
need localmount
}

setupopts() {
if is_uml_sys ; then
TBLURB=UML
fakeit=1
elif is_vserver_sys ; then
TBLURB=VServer
fakeit=1
elif is_xenU_sys ; then
TBLURB=xen
fakeit=1
elif is_vz_sys ; then
TBLURB=VZ
fakeit=1
elif grep -q ' cobd$' /proc/devices ; then
TBLURB=coLinux
fakeit=1
elif [[ $(uname -m) == s390* ]] ; then
TBLURB=s390
fakeit=1
elif [[ ${CLOCK} == UTC ]] ; then
myopts=--utc
TBLURB=UTC
else
myopts=--localtime
TBLURB=Local Time
fi
[[ ${fakeit} -eq 1 ]]  return 0

if [[ ${readonly} == yes ]] ; then
myadj=--noadjfile
else
myadj=--adjust
fi

if [[ ${SRM} == yes ]] ; then
myopts=${myopts} --srm
fi
if [[ ${ARC} == arc ]] ; then
myopts=${myopts} --arc
fi
myopts=${myopts} ${CLOCK_OPTS}

# Make sure user isn't using rc.conf anymore.
if grep -qs ^CLOCK= /etc/rc.conf ; then
ewarn CLOCK should not be set in /etc/rc.conf but in 
/etc/conf.d/clock
fi
# Make sure people set their timezone ... we do it here
# even though we don't actually use the variable so that
# people see the warning on boot.
if [[ -z ${CDBOOT}  ${TIMEZONE-Factory} == Factory ]] ; then
ewarn Your TIMEZONE in /etc/conf.d/clock is still set to 
Factory!
fi
}

start() {
local myopts=
local myadj=
local TBLURB= fakeit=0
local errstr=
local readonly=no
local ret=0

if ! touch /etc/adjtime 2/dev/null ; then
readonly=yes
elif [[ ! -s /etc/adjtime ]] ; then
echo 0.0 0 0.0  /etc/adjtime
fi

setupopts

if [[ ${fakeit} -ne 1  -e /proc/modules  ! -e /dev/rtc ]] ; then
modprobe rtc  /dev/null || modprobe genrtc  /dev/null
fi

ebegin Setting system clock using the hardware clock [${TBLURB}]
if [[ ${fakeit} -eq 1 ]] ; then
ret=0

elif [[ -x /sbin/hwclock ]] ; then
# Since hwclock always exit's with a 0, need to check its 
output.
errstr=$(/sbin/hwclock ${myadj} ${myopts} 21 /dev/null)
errstr=${errstr}$(/sbin/hwclock --hctosys ${myopts} 21 
/dev/null)

if [[ -n ${errstr} ]] ; then
ewarn ${errstr}
ret=1
else
ret=0
fi

Re: [gentoo-amd64] Re: hardware clock often doesn't sync to system on shutdown

2008-09-15 Thread Thanasis

on 09/15/2008 05:57 PM Sebastian Redl wrote the following:

Thanasis wrote:
I attach the /etc/init.d/clock which shows a local readonly 
variable that controls a --noadjfile option.

What does the following test do?

if ! touch /etc/adjtime 2/dev/null ; then
   readonly=yes
elif [[ ! -s /etc/adjtime ]] ; then
   echo 0.0 0 0.0  /etc/adjtime
fi
First it tests if a touch of /etc/adjtime succeeds. If not, the file 
is not writeable, and it sets the readonly variable.


Then it tests if /etc/adjtime exists (it does, since the touch 
succeeded) and has non-zero size. If not, it writes a zero adjust into 
the file.


Sebastian
How can I make /etc/adjtime readonly? I tried chmod a-w /etc/adjtime, 
but root can always write to it :-) , unless the init script doesn't run 
as root.





Re: [gentoo-amd64] Re: hardware clock often doesn't sync to system on shutdown

2008-09-15 Thread Sebastian Redl

Thanasis wrote:
I attach the /etc/init.d/clock which shows a local readonly variable 
that controls a --noadjfile option.

What does the following test do?

if ! touch /etc/adjtime 2/dev/null ; then
   readonly=yes
elif [[ ! -s /etc/adjtime ]] ; then
   echo 0.0 0 0.0  /etc/adjtime
fi
First it tests if a touch of /etc/adjtime succeeds. If not, the file is 
not writeable, and it sets the readonly variable.


Then it tests if /etc/adjtime exists (it does, since the touch 
succeeded) and has non-zero size. If not, it writes a zero adjust into 
the file.


Sebastian



[gentoo-amd64] Re: hardware clock often doesn't sync to system on shutdown

2008-09-15 Thread Duncan
Thanasis [EMAIL PROTECTED] posted [EMAIL PROTECTED],
excerpted below, on  Mon, 15 Sep 2008 18:26:38 +0300:

 on 09/15/2008 05:57 PM Sebastian Redl wrote the following:
 Thanasis wrote:
 I attach the /etc/init.d/clock which shows a local readonly variable
 that controls a --noadjfile option. What does the following test do?

 if ! touch /etc/adjtime 2/dev/null ; then
readonly=yes
 elif [[ ! -s /etc/adjtime ]] ; then
echo 0.0 0 0.0  /etc/adjtime
 fi
 First it tests if a touch of /etc/adjtime succeeds. If not, the file is
 not writeable, and it sets the readonly variable.

 Then it tests if /etc/adjtime exists (it does, since the touch
 succeeded) and has non-zero size. If not, it writes a zero adjust into
 the file.

 Sebastian
 How can I make /etc/adjtime readonly? I tried chmod a-w /etc/adjtime,
 but root can always write to it :-) , unless the init script doesn't run
 as root.

A caveat in that the below are all untested ideas.  I'm just throwing 
them out as possible solutions I'd explore further if it were me.  They 
may work, or not, but it's probably worth investigating them further and/
or testing them.

There's a spot in /etc/conf.d/clock to set your own options, right?  From 
the script, perhaps it's ${CLOCK_OPTS}.  If you can set your own 
arbitrary options, you can try adding --noadjfile to them.  Except 
hwclock is called several times (twice for start, once for stop if you 
have it set to do so) with different options, and I've not checked to see 
what effect setting --noadjfile will have in all those calls.  You could 
reason it out or just try it and see.

Alternatively, the manpage says there's an --adjfile=filename option.  
You could try adding that option and pointing it elsewhere, so the 
scripts don't look in the right place.

A third thing to try would be making the adjfile a directory (make it an 
empty one just in case) instead of a file.  Obviously it won't be 
possible to write a valid adjust into it then, but I'm not sure what the 
failure mode would be, tho it shouldn't blow up the system so it should 
be safe to try.

Finally, a combination of options two and three above, pointing 
--adjfile= at a different location, an empty directory, might work.

As I said, those are ideas I'd try.

Something else I HAVE done on occasion, is hack whatever initscript a bit 
to fit my needs.  If you do so, make sure portage's (assuming that's the 
PM you're using, others... I expect you'd know what to configure in them) 
CONFIG_PROTECT variables are set to include that dir (IIRC it does as 
it's under /etc, but the mask variable may unprotect it, so check that), 
so an update lets you manage the changes instead of overwriting it 
without asking.

-- 
Duncan - List replies preferred.   No HTML msgs.
Every nonfree program has a lord, a master --
and if you use the program, he is your master.  Richard Stallman