FS#9061 - initscripts: minilogd fails to start and also doesn't log to syslog

Attached to Project: Arch Linux
Opened by Jonathan Frazier (wide-eye) - Monday, 31 December 2007, 06:16 GMT
Last edited by Aaron Griffin (phrakture) - Tuesday, 24 March 2009, 18:34 GMT
Task Type Bug Report
Category Packages: Core
Status Closed
Assigned To Aaron Griffin (phrakture)
Architecture All
Severity High
Priority High
Reported Version 2007.08-2
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:
1. minilogd fails to run from rc.sysinit due to /dev being read only,
2. minilogd fails to log anything to syslog-ng if above is fixed.

 bug 1 :
initscripts 2007.11-2: minilogd dies immediately, returning an error code of 5.
you can see this by removing syslog-ng from daemons, minilogd should still be running when you log in (it isn't). or by adding echo's or pidof's to rc.sysinit

fix for 1:
adding a mount ramfs as seen here: http://code.phraktured.net/?p=initscripts.git;a=commit;h=2694f1224dfb5b5c734a781fc813e639139feb39
and adding mknod /dev/null c 1 3 and mknod /dev/console above minilogd
it starts and forks successfully. but no logged messages show up in logs after syslog starts.

2. there are a few things i found wrong in minilog.c. gcc gives a warning about signed/unsigned ints. and it trys to write to syslog's /dev/log with a dgram socket which gives an EPROTOCOL error. I've attached a patch for these. but there is some other bug that makes received log messages show up as null (gdb break around line 111). my c fu isn't strong enough to figure out this remaining problem.

here's how i have been trying to figure out  bug 2 :
/etc/rc.d/syslog-ng stop; sleep 2; ./minilogd ; echo minilogd returned $? ; sleep 2;
logger 'uniquestring'; /etc/rc.d/syslog-ng start; sleep 2; grep 'uniquestring' /var/log/*.log
This task depends upon

Closed by  Aaron Griffin (phrakture)
Tuesday, 24 March 2009, 18:34 GMT
Reason for closing:  Fixed
Additional comments about closing:   FS#13722 
Comment by Jonathan Frazier (wide-eye) - Monday, 31 December 2007, 06:24 GMT
this is a "working" version of minilogd.c. but it seems to need the useless printfs and other crap to work.
Comment by Aaron Griffin (phrakture) - Tuesday, 08 January 2008, 09:42 GMT
  • Field changed: Status (Unconfirmed → Researching)
  • Field changed: Priority (Normal → High)
  • Task assigned to Aaron Griffin (phrakture)
Alright, I'm checking in what changes have been mentioned here. As always they are untested 8)

http://code.phraktured.net/?p=initscripts.git;a=shortlog;h=working

That should be a good start.

I will attempt to readd all those printfs in tomorrow. And see where I can get
Comment by Jonathan Frazier (wide-eye) - Wednesday, 09 January 2008, 17:17 GMT
I've narrowed down the suspect lines in minilogd. I was wrong about the printf's being important.

this patch is against working git, and it works at least in a running system.
Comment by Aaron Griffin (phrakture) - Wednesday, 09 January 2008, 17:40 GMT
I don't understand what this patch changes, as far as I can tell, the only gain is that the sizeof() becomes an explicit socklen_t.
Comment by Jud (judfilm) - Friday, 05 December 2008, 08:42 GMT
Is this still a problem? (over 10 months without a reply)
Comment by Jonathan Frazier (wide-eye) - Friday, 23 January 2009, 03:00 GMT
For me, minilogd starts. but does not log anything. On the two i686 machines I have available to me, any messages logged with logger during rc.sysinit are not added to the logs.
versions: initscripts 2008.09-2 and minilogd.c from git.

I was previously unable to make any sense of it all. Here is today's second try where things made more sense:

Attached is a test script, minilogd-test.sh, which should test minilogd without requiring a reboot. this fails to find any logged messages for me with git or packaged minilogd.

The one error I found today running minilogd within gdb was in runDaemon. recvsock is always -1 once minilogd recieves a message. on this line: "recvsock = accept(sock,(struct sockaddr *) &addr, &addrlen)) < 0)"
This results in incoming messages never being added to the buffer.
To get an error message from accept I removed the dup2's in main, and made runDaemon() run without forking. With that I was able to add a perror() after the above line and see that accept() was throwing an invalid argument error.

One way to avoid this error is to change addr from a sockaddr_un to a sockaddr, and remove the type cast in accept(). as seen in: 0001-fix-accept-invalid-argument-error-with-sockaddr_un.patch.
with this patch, recvsock is no longer -1, messages are added to the buffer, and the buffer is added to the logs when syslog-ng starts up.
also with this the attached test script can find the result in the logs, and logger's added to rc.sysinit show up as well. My understanding of c type casts is pretty limited so there may be a better way around this.

If someone can confirm with this test script or some other way if minilogd works for them that would be great.

Loading...