Artix Linux => System => Topic started by: ryukinix on 16 February 2019, 01:30:09
Title: Error: fopen(/run/openrc/rc.log) failed: No such file or directory
Post by: ryukinix on 16 February 2019, 01:30:09
This messages shows always on start of tty1. I'm really trying to find why this doesn't works properly. A refresh install probably will fix it, but I don't want do this. Any suggestion?
Title: Re: Error: fopen(/run/openrc/rc.log) failed: No such file or directory
Post by: ####### on 16 February 2019, 20:46:35
I see that error a lot, I don't think a fresh install will help. So far as I can tell it is harmless though and the temporary log file in tmp hasn't been created on the first pass through that section of code somehow, but on the next run it has been created so you only get one error message. It could be timing related too, not everybody might see it. I did something to mess up /tmp being mounted once and those errors filled the screen, the boot hung, CPU went to 100% as the fans came on full - now that was a real error ;)
Title: Re: Error: fopen(/run/openrc/rc.log) failed: No such file or directory
Post by: artoo on 16 February 2019, 21:07:47
It is m suspicion too, that this may be timing or a hardware specific thing. I am affected by this since i moved to a nvme drive from old hdd.
Title: Re: Error: fopen(/run/openrc/rc.log) failed: No such file or directory
Post by: ####### on 17 February 2019, 03:51:24
Disabling rc logging does make the error message go away! Actually I've just got used to seeing that red spot and ignore it... This is one guess what might be happening, but I don't know for sure. There might be some odd issue with multiple streams on the same file too. I think the tmp file systems exist and are OK when the error happens though.
if ((log = fopen(TMPLOG, "ae"))) <<<<<< it might get created here but there would be no error if it wasn't write_time(log, "started"); else { free(logbuf);
.....
if (logbuf) { <<<<<<<< if logbuf was empty on the first run through TMPLOG would not get created here by "ae" if ((log = fopen(TMPLOG, "ae"))) { write_time(log, "started"); write_log(fileno(log), logbuf, logbuf_len); } free(logbuf); }
........
if ((plog = fopen(logfile, "ae"))) { <<<<<< that is the log in /var/log if ((log = fopen(TMPLOG, "re"))) { <<<<<< r is just read, not create while ((bytes = fread(buffer, sizeof(*buffer), BUFSIZ, log)) > 0) { if (fwrite(buffer, sizeof(*buffer), bytes, plog) < bytes) { log_error = 1; eerror("Error: write(%s) failed: %s", logfile, strerror(errno)); break; } } fclose(log); } else { log_error = 1; eerror("Error: fopen(%s) failed: %s", TMPLOG, strerror(errno)); <<<<<<<< that is the error message }
fclose(plog); } else { /* * logfile or its basedir may be read-only during sysinit and * shutdown so skip the error in this case */ if (errno != EROFS && ((strcmp(level, RC_LEVEL_SHUTDOWN) != 0) && (strcmp(level, RC_LEVEL_SYSINIT) != 0))) { log_error = 1; eerror("Error: fopen(%s) failed: %s", logfile, strerror(errno)); <<<<<< not the error as it is "logfile" /var/log } }
Title: Re: Error: fopen(/run/openrc/rc.log) failed: No such file or directory
Post by: Seventh on 17 February 2019, 05:05:25
I was seeing this as well because i use startx instead of login manager. Ive stopped seeing now though.
Title: Re: Error: fopen(/run/openrc/rc.log) failed: No such file or directory
Post by: ####### on 18 February 2019, 19:54:22
It's something about going into the default runlevel I think, the file exists on the first fopen but then cannot be opened for reading: * Error: fopen(/run/openrc/rc.log) failed: No such file or directory ae1=1 ae2=0 ae3=1 level=default
So openrc presumably causes the trouble as it deletes the log with syscall 87 as it enters the default runlevel. But here is a weird thing - so where is the failed open that creates the error message? There are some earlier open's, syscall 257. But no failures are logged!!! Perhaps audit can't monitor a non existent file though, so when it is deleted it is no longer logged?
Title: Re: Error: fopen(/run/openrc/rc.log) failed: No such file or directory
Post by: Seventh on 22 February 2019, 16:22:27
^ I think it is possibly a bug upstream, im not getting it anymore but my rc.log still says below.
* Checking your configfile (/etc/syslog-ng/syslog-ng.conf) ... 2328 [2019-02-22T21:01:29.495778] WARNING: Configuration file format is too old, syslog-ng is running in compatibility mod$ 2329 [ ok ] 2330 * Starting syslog-ng ... 2331 [2019-02-22T21:01:30.265561] WARNING: Configuration file format is too old, syslog-ng is running in compatibility mod$ 2332 [2019-02-22T21:01:30.350609] WARNING: With use-dns(no), dns-cache() will be forced to 'no' too!;
Title: Re: Error: fopen(/run/openrc/rc.log) failed: No such file or directory
Post by: ####### on 22 February 2019, 20:24:02
I checked failed syscalls in the whole directory: -a always,exit -F arch=b32 -F dir=/run/openrc/ -S all -F success=0 -F key=runtmpfail -a always,exit -F arch=b64 -F dir=/run/openrc/ -S all -F success=0 -F key=runtmpfail
And although there were a lot of results, they were all syscalls 83 84 87 133 which are mkdir rmdir unlink and mknod. But now my guess is that when fopen gets called on the non-existent file, at some point the OS checks to see if the file exists and returns the error message rather than actually doing the open syscall and that failing.
It certainly seems like an 'upstream' issue though ::) It was interesting finding out a bit more about why the error message appears though. (It appears because the 'tmplog' /run/openrc/rc.log gets deleted by openrc when you go from the boot runlevel into the default runlevel, and rclogger is partway through a section of code and has not realized this yet)
"WARNING: Configuration file format is too old" - I had something like that, and I think I updated a version number in the conf file or perhaps swapped it for a pacnew one, but it is something to do with the conf file in /etc anyway.
Title: Re: Error: fopen(/run/openrc/rc.log) failed: No such file or directory
Post by: ####### on 23 February 2019, 21:37:38
I just tested out audit logging on some failed fopen "re" attempts in both the /run/ tmpfs amnd on the regular fs. It doesn't log the failed opens on a non existent file, so that's normal behaviour for audit. There was something else that points to the fopen "not happening" in this case - I noticed in the rc-logger.c code it tests the assignment, not the returned result, and avoids a compiler warning by using an extra set of brackets. But this still gives the correct logical result, which shows that if fopen fails in this instance it doesn't actually assign anything to the FILE*. So that seems to answer the side issue about the lack of failed syscalls in the audit logs.
-a always,exit -F arch=b32 -F dir=/run/openrc/abcxyz/ -S all -F key=ntestfail -a always,exit -F arch=b64 -F dir=/run/openrc/abcxyz/ -S all -F key=ntestfail -a always,exit -F arch=b32 -F dir=/opt/aaa -S all -F key=ntestfail -a always,exit -F arch=b64 -F dir=/opt/aaa -S all -F key=ntestfail
(audit did not log any failed opens, only the successful ones)
If anyone tried this you need to make the directories /run/openrc/abcxyz and /opt/aaa first. Because the run one will be deleted on reboot you should get rid of the audit rules if they were defined in audit.rules before then too, or it will probably cause an error on the next boot btw. It doesn't really do anything useful except test out that idea anyway.
Title: Re: Error: fopen(/run/openrc/rc.log) failed: No such file or directory
Post by: artoo on 23 February 2019, 22:31:08
I just tested out audit logging on some failed fopen "re" attempts in both the /run/ tmpfs amnd on the regular fs. It doesn't log the failed opens on a non existent file, so that's normal behaviour for audit. There was something else that points to the fopen "not happening" in this case - I noticed in the rc-logger.c code it tests the assignment, not the returned result, and avoids a compiler warning by using an extra set of brackets. But this still gives the correct logical result, which shows that if fopen fails in this instance it doesn't actually assign anything to the FILE*. So that seems to answer the side issue about the lack of failed syscalls in the audit logs.
-a always,exit -F arch=b32 -F dir=/run/openrc/abcxyz/ -S all -F key=ntestfail -a always,exit -F arch=b64 -F dir=/run/openrc/abcxyz/ -S all -F key=ntestfail -a always,exit -F arch=b32 -F dir=/opt/aaa -S all -F key=ntestfail -a always,exit -F arch=b64 -F dir=/opt/aaa -S all -F key=ntestfail
(audit did not log any failed opens, only the successful ones)
If anyone tried this you need to make the directories /run/openrc/abcxyz and /opt/aaa first. Because the run one will be deleted on reboot you should get rid of the audit rules if they were defined in audit.rules before then too, or it will probably cause an error on the next boot btw. It doesn't really do anything useful except test out that idea anyway.
Could you please share your findings openrc upstream ticket (https://github.com/OpenRC/openrc/issues/216)? It'd be a much more suitable place to cure the issue.