Comments (15)
Tested, nice work!
from finit.
Thank you for your patience! 😌
from finit.
This could be a good place to gather information and links to experiences with both udev and eudev. I think it's great that you're using Finit and trying it out with udev and eudev! 😃
Unfortunately, my primary use-case for Finit is embedded, with BusyBox and thus mdev. At least for the moment, so I wont be able to test and help out as much as I'd like. There are some thoughts about moving to Alpine Linux "soonish", which could be beneficial to this issue, but not in the near future.
However, as usual I'm more than happy to discuss fixes and pull requests with fixes and/or extensions to support other systems.
from finit.
@troglobit is there a function in finit that run commands sync(not async or fork)? I think i get the point, udevd is running while mounting, so....
gentoo's openrc is sync, right?
from finit.
Yup, there's run
... it's like task
but runs in sequence in the given runlevel. So try something like this:
service [S] /path/to/daemon1 ...
run [S] /path/to/cmd --some-args -- Some description of what cmd does
# Service will not be started until cmd has completed.
service [S12345] /path/to/daemon2 -- Description
At boot, runlevel [S]
, this example starts daemon1
in the background and then waits for cmd
to complete before proceeding to fork off daemon2
. Hopefully this does what you want.
Both systemd and OpenRC can also be made to execute tasks synchronously.
from finit.
@troglobit Oh...my god...you should not move bootclean to bootmisc, since it will clean udev!
--- finit.c 2016-11-20 13:33:11.277907155 +0000
+++ b/finit.c 2016-11-20 13:33:11.277907155 +0000
@@ -329,8 +331,9 @@
run_interactive(devfsd, "Populating device tree");
if (fexist("/sbin/udevadm")) {
run("/sbin/udevadm trigger --action=add --type=subsystems");
run("/sbin/udevadm trigger --action=add --type=devices");
+ run("/sbin/udevadm settle --timeout=120");
}
/*
--- .src/finit-master/plugins/bootmisc.c 2016-11-20 15:15:38.257645296 +0000
+++ finit-master/plugins/bootmisc.c 2016-11-20 15:15:38.257645296 +0000
@@ -39,6 +39,9 @@
static int do_clean(const char *fpath, const struct stat *UNUSED(sb), int UNUSED(tflag), struct FTW *ftwbuf)
{
+ // skip udev files
+ if((strstr(fpath, "/var/run/udev") - fpath) == 0)
+ return 0;
if (ftwbuf->level == 0)
return 1;
EDIT: /var/run is a link to /run on my system, also a number of others...
from finit.
Actually, /var/run (or /run) should be clean on boot. But what you're saying is that there is a dependency on udev/eudev to run after bootclean?
I'm thinking maybe it's time to move that part of the boot to a plugin and properly delare that plugin to depend on bootmisc.so. That way the udev files would not be removed.
Good catch!
from finit.
OK, I've now looked at how SysV init in Debian does this.
- In mountall, which runs very early, they mark tmpfs file systems like /run with a flag,
/run/.tmpfs
- In bootclean, which runs before bootmisc, they check for
$DIR/.tmpfs
before cleaning out files
How do you set up /var/run
or /run
? In Finit I have added builtin support for creating /run
as a tmpfs if its not already mounted, with /var/run
symlink created in bootmisc. Maybe you are using something else?
My idea right now is to skip all mount points listed in bootclean()
which we can identify as tmpfs
using /proc/mounts
.
from finit.
@xhebox I hope these two fixes resolve your issue. If not, feel free to reopen it or file a new issue.
from finit.
@troglobit I cant reopen the issue you closed...
And this is not working. You need to find which file the symbolic refers to, this check the link file /var/run but miss the real dir /run.
from finit.
Ah, thanks. Didn't know I was the only one allowed to reopen issues.
OK, you're obviously correct, sorry! I'll improve the check.
from finit.
Hopefully current master, as of 47060c9, works better ...
from finit.
@troglobit Not working, you need to use lstat, since stat will resolve the symbolic automatically. And strip the '/' from the end of path. Check the man. But forget it, i think this way better:
--- bootmisc.c 2016-11-21 13:29:55.725183408 +0000
+++ b/plugins/bootmisc.c 2016-11-21 13:29:55.725183408 +0000
@@ -32,33 +32,15 @@
#include "../plugin.h"
#include "../utmp-api.h"
-/* Resolve symbolic links */
-static char *desym(char *dir)
-{
- static char path[80]; /* Should be enough for our use-case */
- struct stat st;
-
- if (stat(dir, &st))
- return NULL;
-
- if (S_ISLNK(st.st_mode)) {
- if (-1 == readlink(dir, path, sizeof(path)))
- return NULL;
-
- return desym(path);
- }
-
- return dir;
-}
-
-static int is_tmpfs(char *dir)
+static int is_tmpfs(char *path)
{
int tmpfs = 0;
FILE *fp;
struct mntent *mnt;
+ static char dir[80]; /* Should be enough for our use-case */
/* If /var/run is a symlink, check what it resolves to */
- dir = desym(dir);
+ realpath(path, dir);
if (!dir)
return 0; /* Outlook not so good */
More there.
from finit.
Ah, lstat()
of course. Your version looks much cleaner, didn't even know about realpath()
, thanks!
from finit.
Slight variation of your proposal, without hardcoded array, in b9ae4d0.
from finit.
Related Issues (20)
- task with untriggered condition in runlevel S blocks boot HOT 5
- Does finit start rc.local and gettys too early? HOT 2
- unexpected service restart on initctl reload, notify-related? HOT 4
- dbus and runparts not working
- Finit v4.5 drops all but first word in sourced service environment
- All internal conditions get stuck in flux after initctl reload
- Explicit declaration of PID style readiness notification
- Variables declared with `set NAME=VAL` set in environment with leading `set `
- Build error using clang 17 on musl (call to undeclared function 'basename') HOT 1
- Processes depends on notify:pid did not stop when their parent process was killed HOT 3
- tmpfiles.d feature does not work for statically-linked Finit et al. HOT 2
- dBus server HOT 3
- finit hangs during system shutting down HOT 6
- Spell out unsupported command or change to initctl error string
- Mounting filesystems from /etc/finit "OK" even though mount call fails HOT 3
- sysctl with complex values fails HOT 1
- initctl touch does not respect -n flag
- initctl touch does not support template services
- Possible undefined behavior when --with-fstab=no is set HOT 3
- Parsing active consoles fails HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from finit.