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
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
|
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. 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 /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
Tuesday, 24 March 2009, 18:34 GMT
Reason for closing: Fixed
Additional comments about closing:
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
this patch is against working git, and it works at least in a running system.
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.
0001-fix-accept-invalid-argum... (0.9 KiB)