openwrt / openwrt

This repository is a mirror of https://git.openwrt.org/openwrt/openwrt.git It is for reference only and is not active for check-ins. We will continue to accept Pull Requests here. They will be merged via staging trees then into openwrt.git.
Other
20.3k stars 10.5k forks source link

procd returning error when starting ubusd #13600

Open oskarirauta opened 1 year ago

oskarirauta commented 1 year ago

Describe the bug

Screenshot 2023-10-03 at 20 51 25

Screenshot, because error does not seem to occur in syslog; on physical screen only (if emulated screen such as qemu counts).

disclaimer: I readed procd sources partially, all the information about procd code might not be accurate.

Failed to connect to ubus. By using more verbose boot logging, it is revealed that procd is attempting to execute /etc/init.d/ubus running when this error occurs. This file does not exist, because ubusd does not need initscript, procd starts it. I created a quite empty init script for testing purposes, which doesn't start anything. But has running function, yet error existed, as after that succeeding it procd attempts to set details of started service of ubus, to ubus. Problem is that ubus daemon is not yet ready/does not accept this connection, hence the error.

Yet, when I use ubus call service list - proper details about ubus service do exist, I didn't search details where these are set, as clearly when described error occurs, these won't be set - maybe ubus sets it's own state independently, or details are updated later? Here's output of ubus service details:

    "ubus": {
        "instances": {
            "instance1": {
                "running": true,
                "pid": 803,
                "command": [
                    "/sbin/ubusd"
                ],
                "term_timeout": 5,
                "respawn": {
                    "threshold": 3600,
                    "timeout": 1,
                    "retry": 0
                },
                "user": "ubus",
                "group": "ubus"
            }
        }
    },

Details seem to be correct.

I assume ubus startup is made in state.c of procd near line 155 - and fix to this would be to alter ubus startup to ignore updating ubus details as a service on the "first run".. Only when updated etc..

I know, it's merely a cosmetic bug. But yet, it's a bug...

OpenWrt version

r24069-954142f477

OpenWrt target/subtarget

x86/64

Device

Red Hat KVM

Image kind

Self-built image

Steps to reproduce

boot without log suppression to quiet level

Actual behaviour

unnecessary error

Expected behaviour

success without error and not to attempt update details of ubus, when ubus is not ready/available yet

Additional info

tagging here few people who've been lately involved with project, as original maintainer doesn't seem to be available at GitHub for the moment.

@nbd168 @dangowrt @hauke

Diffconfig

unrelevant

Terms

oskarirauta commented 1 year ago

@nbd168 @dangowrt @hauke

brada4 commented 1 year ago

Picture shows no sign of error?

oskarirauta commented 1 year ago

@brada4 what you mean? It says it right there;

Failed to connect to ubus at the 4th line from bottom. Printed to stdout as it's not available in syslog.