Subject: Re: messages from init
To: Steven M. Bellovin <smb@cs.columbia.edu>
From: Auster <lrou@x.ua>
List: current-users
Date: 09/28/2006 16:38:51
>>>>> Sep 24 20:09:17 berkshire init: can't add utmpx record for runlevel
>>>>> Sep 24 20:09:17 berkshire init: can't add utmpx record for port system boot
>>>>> Sep 24 20:09:17 berkshire init: can't add utmpx record for port system down
>>>>> Sep 24 20:09:17 berkshire init: can't add utmpx record for runlevel
>>>>> Sep 24 20:09:17 berkshire init: can't add utmpx record for port console
>>>>> Sep 24 20:09:17 berkshire init: can't add utmpx record for port ttyE1
>>>>> Sep 24 20:09:17 berkshire init: can't add utmpx record for port ttyE2
>>>>> Sep 24 20:09:17 berkshire init: can't add utmpx record for port ttyE3
>>>>>
>>>> is / still read only for some reason?
>>>> 
>>> This was a straight, multi-user boot -- I assume that root was mounted
>>> read-write before those happened...
>> 
>> When do you mount /var?
>> 
> This is my laptop; /var is on /.  (And that's the default partitioning for
> new machines, I believe.)
>

 (partioning I) /var is on /dev/XXX, init:
  # `/' - mounted readonly, /var are not mounted (i.e. /var/run not exist).
  1. runlevel d -> r		pututxline failed with ENOENT
				console message: No such file or directory
				fp=NULL, readonly=0 (src/lib/libc/gen/utmp.c)

  #  `/' (and /var) are already mounted read-write.
  2.  runlevel r -> t		pututxline successful [fp!=NULL, readonly=0]
  3.  port system boot		pututxline successful
  4.  port system down		pututxline successful
  5.  runlevel t -> m		pututxline successful
  6.  port console		pututxline successful
  7.  port ttyE1		pututxline successful
  ...



 (partioning II) /var is on /, init:
  # `/' - mounted readonly (i.e. /var/run exist on read-only partition).
  1. runlevel d -> r		pututxline failed with EROFS
				console message: Read-only file system
				fp!=NULL, readonly=1 (src/lib/libc/gen/utmpx.c)

  # `/' are already mounted read-write.
  2.  runlevel r -> t		pututxline failed [fp!=NULL && readonly=1]
  3.  port system boot		pututxline failed [fp!=NULL && readonly=1]
  4.  port system down		pututxline failed [fp!=NULL && readonly=1]
  5.  runlevel t -> m		pututxline failed [fp!=NULL && readonly=1]
  6.  port console		pututxline failed [fp!=NULL && readonly=1]
  7.  port ttyE1		pututxline failed [fp!=NULL && readonly=1]
  ...



dirty fix for example:

diff -up src/sbin/init/init.c.orig src/sbin/init/init.c
--- src/sbin/init/init.c.orig
+++ src/sbin/init/init.c
@@ -1347,6 +1347,8 @@ utmpx_set_runlevel(char old, char new)
 {
 	struct utmpx ut;
 
+	if (old == DEATH)
+		return;
 	(void)memset(&ut, 0, sizeof(ut));
 	(void)snprintf(ut.ut_line, sizeof(ut.ut_line), RUNLVL_MSG, new);
 	ut.ut_type = RUN_LVL;



-- 
Auster Vl.