dinit icon indicating copy to clipboard operation
dinit copied to clipboard

serverless dinitctl

Open jackghg opened this issue 3 years ago • 10 comments
trafficstars

In a installation dinit has never been launched yet, so I cant enable important services like networkmanager, ssh... (I dont remember this problem before, is this a new change?)

I'd like to dinitctl to enable/disable services without dinit server, or at least enable... if I execute the command as root. Always or with a option ? or maybe a workaround ? Thanks.

jackghg avatar Aug 11 '22 01:08 jackghg

I do want this to be possible, but no, it's never worked that way.

The workaround I guess is to create the link yourself. I.e. dinitctl enable xyz just looks in the boot service for a waits-for.d = directive to find a directory, then creates a symbolic link in that directory (with the name xyz, with the link referring to the xyz service description file, although it doesn't actually matter what it links to).

davmac314 avatar Aug 11 '22 09:08 davmac314

In a installation dinit has never been launched yet, so I cant enable important services like networkmanager, ssh... (I dont remember this problem before, is this a new change?)

What do you mean by "installation"? Artix installer?

mobin-2008 avatar Aug 11 '22 09:08 mobin-2008

Ok.

dinitctl enable xyz just looks in the boot service for a waitsfor.d = directive to find a directory, then creates a symbolic link in that directory (with the name xyz, with the link referring to the xyz service description file

Is this what u want it to do or what it does today ? because for me it doesnt enable the service, just give an error messagge.

Anyway, at the moment I can make a symlink, correct ?

jackghg avatar Aug 11 '22 19:08 jackghg

What do you mean by "installation"? Artix installer?

In my case i was converting arch to artix, but maybe the same problem can happend when chrooting ?

jackghg avatar Aug 11 '22 19:08 jackghg

@jackghg Dinit can run in System mode with the following command (not as System-Manager): dinit -s This commands launch Dinit, but Dinit will no longer manage things like reboot, shutdown, then you can use it with the dinitctl command. The only problem is that I don't know, this command mount dinit socket at /run/dinitctl or not? So I'm not sure this is the solution. (you can test it) from dinit man page:

-s, --system Run as the system service manager. This is the default if invoked as the root user. This option affects the default service definition directory and control socket path. -m, --system-mgr Run as the system manager (perform operations directly related to machine startup and shutdown). This is the default when running as process ID 1. The main user-visible effect of this option is to invoke the shutdown program when a shutdown is requested (and after all services have stopped), and to provide some basic support for system recovery in case the boot service (or other specified service) cannot be started.

Note: for access to terminal after this command, you need add & to command: dinit -s &

mobin-2008 avatar Aug 11 '22 19:08 mobin-2008

Dinit can run

ok, tnx, ill test. however its a bit complex workaround... like make the symlink is easyer... (but dirtyer maybe)

jackghg avatar Aug 11 '22 20:08 jackghg

Dinit can run

ok, tnx, ill test. however its a bit complex workaround... like make the symlink is easyer... (but dirtyer maybe)

It might sound "complicated", but it's really simple:

  1. Start the dinit daemon via dinit -s & command
  2. Work normally with the dinitctl command
  3. Finally, close the dinit daemon via dinitctl shutdown command.

Done! It should be almost like this.

mobin-2008 avatar Aug 11 '22 20:08 mobin-2008

Of course, doing some things (such as enabling services) is easier to do manually But it doesn't work to start or stop the service.

mobin-2008 avatar Aug 11 '22 20:08 mobin-2008

I will implement a flag to allow use of dinitctl enable when dinit isn't running at some point.

Is this what u want it to do or what it does today ? because for me it doesnt enable the service, just give an error messagge.

That's what it does when dinit is running (as well as informing dinit of the changing dependency). When dinit is not running it will give an error as you say, but I will look at allowing this at some point (via a command-line switch).

davmac314 avatar Aug 11 '22 22:08 davmac314

@mobin-2008 it worked... but i still want this feature :)

jackghg avatar Aug 12 '22 21:08 jackghg

I'm jackghg, this is my new account.

jackffmm avatar Jun 06 '23 23:06 jackffmm

@davmac314 I think it should be closed.

mobin-2008 avatar Aug 15 '23 16:08 mobin-2008

you did it ?

jackffmm avatar Aug 16 '23 20:08 jackffmm

Addressed in 788d65ff99b991284b3f782eabf5c7dc5145474d

davmac314 avatar Aug 16 '23 22:08 davmac314

u r amazing thanks!

jackffmm avatar Aug 16 '23 22:08 jackffmm