summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Golle2020-12-04 09:51:34 +0000
committerDaniel Golle2020-12-04 09:51:34 +0000
commit6acc48c7a2faac48c534b8a5516500c270550a9e (patch)
treecfb15c73feeebf3e8f54fb0889070d208e56fe57
parent09478ba23019ec5cbfc1068a7a632215c946b679 (diff)
downloadprocd-6acc48c7a2faac48c534b8a5516500c270550a9e.tar.gz
early: fall-back to run ubus as root if user can't be found
Users have been reporting problems in case the ubus user is missing in /etc/passwd. Run ubus as root in that case and display warning. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
-rw-r--r--state.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/state.c b/state.c
index 6ca1d5e..44f56c6 100644
--- a/state.c
+++ b/state.c
@@ -140,12 +140,15 @@ static void state_enter(void)
// try to reopen incase the wdt was not available before coldplug
watchdog_init(0);
set_stdio("console");
- LOG("- ubus -\n");
p = getpwnam("ubus");
if (p) {
+ LOG("- ubus -\n");
mkdir(p->pw_dir, 0755);
chown(p->pw_dir, p->pw_uid, p->pw_gid);
+ } else {
+ LOG("- ubus (running as root!) -\n");
}
+
procd_connect_ubus();
service_start_early("ubus", ubus_cmd, p?"ubus":NULL, p?"ubus":NULL);
break;