Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

init / systemd scripts missing #250

Open
ruben-herold opened this issue Sep 4, 2017 · 16 comments

Comments

@ruben-herold
Copy link

@ruben-herold ruben-herold commented Sep 4, 2017

hi,

I can't find any documenation's or examples howto intergrate jool into normal system start processes.
Can't find any init / systemd scripts so that the settings will be persistent over reboot's.

@ydahhrk

This comment has been minimized.

Copy link
Member

@ydahhrk ydahhrk commented Sep 6, 2017

Thanks for this issue. This has been in the back of my head for some time, but had never materialized into an actual TODO. @TheRedTrainer is currently analyzing the scope, and we should have a plan laid out in the following few days.

@ydahhrk ydahhrk added the New feature label Sep 6, 2017
@TheRedTrainer

This comment has been minimized.

Copy link
Contributor

@TheRedTrainer TheRedTrainer commented Sep 8, 2017

I created a new branch 'issue250' , including the directory with the .service files required by systemd and a README.md explaining all the configuration. @ruben-herold could you please check it?

https://github.com/NICMx/Jool/tree/issue250/systemd

I tested the config in Ubuntu 16.04 and Centos 7.3.1611, and it worked fine. I'll be working on init scripts to commit them as soon as possible.

@ruben-herold

This comment has been minimized.

Copy link
Author

@ruben-herold ruben-herold commented Sep 9, 2017

@TheRedTrainer I will it monday, but I have take a look over it. It looks in the moment for me like a wrapper for an bash script. Why can't we do it more modular with error checking?

I'm thinking about something like an /etc/jool directory with the json files for the atomic configuration.
So that the systemd scripts modprobe the modules an the load the config via the json files.

The network config like configure the network interfaces the user should do with the normal configuration from the distributions.

What do you think about it?

@TheRedTrainer

This comment has been minimized.

Copy link
Contributor

@TheRedTrainer TheRedTrainer commented Sep 12, 2017

I've included the scripts for init.d and modified both systemd and init.d configurations in order to allow to configure Jool with the json files for atomic configuration. Let me check if we can handle the error checking using systemd and init.d; the only debugging help that I found at this moment related to this issue is the information displayed in logs (like "systemctl status 'service'" or "journalctl" for systemd, and "service 'service' status" for init.d).

@ruben-herold

This comment has been minimized.

Copy link
Author

@ruben-herold ruben-herold commented Sep 13, 2017

Look's much better to me !!

@ydahhrk

This comment has been minimized.

Copy link
Member

@ydahhrk ydahhrk commented Nov 10, 2017

$ jool
Jool's socket family doesn't seem to exist.
(This probably means Jool hasn't been modprobed.)
$ systemd start jool
$ jool
  Status: Enabled

Ok so far. But then:

$ systemctl is-active jool
inactive
$ systemctl is-failed jool
inactive
$ systemctl stop jool
$ jool
  Status: Enabled
$ systemctl is-active jool
inactive
$ systemctl is-failed jool
inactive

Trying to at least fix the systemctl stop thing, I tried adding

ExecStop=/sbin/modprobe -r jool

to jool.service, but systemd executes it immediately during a systemctl start for some reason, so it fails even harder.

I think that all of this is because systemd thinks that the service is the jool --file (ExecStart) command, and not the kernel module... and because jool --file ends early, it thinks the NAT64 isn't working anymore.

I think a "Service" is supposed to be some daemon running in userspace by definition. This makes sense, considering that PID 1 is the one meant to parent them all. Because Jool is a kernel module, it isn't fit to be considered one. I wonder if some other unit type would be more suitable for Jool.

Also, there's probably a way to merge the deb/rpm packaging and the systemd stuff, so the service files are installed automatically along with the binaries. (And so systemctl enable is executed automatically too.)

I'm afraid that I do not think that the solution is presentable as it is. I really need to stop stalling Jool 3.5.5 however, so I'm going to postpone this issue again. Sorry.

@ydahhrk

This comment has been minimized.

Copy link
Member

@ydahhrk ydahhrk commented Nov 10, 2017

Derp. When I said "I'm going to postpone this issue again", I meant #243.

I think of #243 and #250 as the same issue.

ydahhrk added a commit that referenced this issue Apr 18, 2018
Turns out that all I had to do was add the "RemainAfterExit=yes" directive.

I did find another problem with the unit file, though.
Namely, it didn't account for other jool instances that something else might
have manually added and got confused easily. I fixed this by separating the
modprobe from the instance add.

And also: I changed the location of the configuration files to better match
Ruben's suggestions. They used to be /etc/jool.conf and /etc/jool_siit.conf,
now they are /etc/jool/jool.conf and /etc/jool/jool_siit.conf.

Fixes the systemd half of #250. I still have to check the init.d stuff.
@ydahhrk

This comment has been minimized.

Copy link
Member

@ydahhrk ydahhrk commented Apr 18, 2018

All right, sorry for taking so long. I've been assigned time to finish this issue.

I think I fixed the remaining systemd problems in the commit I just uploaded.

$ sudo systemctl start jool
$ systemctl is-active jool
active
$ jool
Status: Enabled
$ sudo systemctl stop jool
$ systemctl is-active jool
inactive
$ jool
Jool Error: This namespace lacks a Jool instance.

I'm going to check init.d next.

@ruben-herold

The network config like configure the network interfaces the user should do with the normal configuration from the distributions.

Ok, this is fine, but is it really possible to adjust forwarding and offloads with these tools?

@ruben-herold

This comment has been minimized.

Copy link
Author

@ruben-herold ruben-herold commented Apr 19, 2018

@ydahhrk: depends on the tools. First you need the right sysctl settings I think each distribution will have
a way to do it ( /etc/sysctl.conf, /etc/sysctl.d/* and so on). For offloading centos/rheld see:

https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html-single/Deployment_Guide/#s2-networkscripts-interfaces-eth0

They can do it via the network interface configuration

@ydahhrk

This comment has been minimized.

Copy link
Member

@ydahhrk ydahhrk commented Apr 19, 2018

First you need the right sysctl settings I think each distribution will have
a way to do it ( /etc/sysctl.conf, /etc/sysctl.d/* and so on). For offloading centos/rheld see:

Ok, but these are the same methods described in Jool's documentation (sysctl and ethtool). So far it seems that no network managers take care of them. These commands still need to be issued in some startup script somewhere.

And my point is, loading atomic configuration is fine, but shouldn't the startup routine of the Jool service take care of it as well? It seems odd that we're giving users a means to start Jool on boot, but they still need to set up other stuff on boot. Doesn't that defeat the purpose?

Shouldn't the Jool service start with a script that tweaks these values, and then reads the JSON configuration file?

@ydahhrk

This comment has been minimized.

Copy link
Member

@ydahhrk ydahhrk commented Apr 19, 2018

I have another question:

By "init", you mean "init.d"?

Do you really need it? It seems that init.d has long been deprecated, at least by all major distributions. Even Upstart has been considered deprecated for years, and that was one of its successors.

Can we just end this issue at the systemd templates?

@ydahhrk ydahhrk added this to the 3.6.0 milestone May 22, 2018
@ruben-herold

This comment has been minimized.

Copy link
Author

@ruben-herold ruben-herold commented Jun 6, 2018

I run only centos systems with systemd

@ydahhrk

This comment has been minimized.

Copy link
Member

@ydahhrk ydahhrk commented Jun 6, 2018

Ok.

@ydahhrk ydahhrk removed this from the 3.6.0 milestone Nov 23, 2018
@myxal

This comment has been minimized.

Copy link

@myxal myxal commented May 7, 2019

What happened to this effort? (It's getting mildly annoying having to re-issue the command on every boot).

I've looked at the attached fork, and noticed there's a json with configuration - is this actually used anywhere else/could systemd's unit templates be used instead?

@ydahhrk

This comment has been minimized.

Copy link
Member

@ydahhrk ydahhrk commented May 7, 2019

What happened to this effort?

We got temporarily assigned to a different project, and Jool is in maintenance mode now. I'm only putting out emerging fires.

Once we're back, this is scheduled to be patched after Debian packages (#243), as per survey results.

I've looked at the attached fork, and noticed there's a json with configuration - is this actually used anywhere else?

If you're talking about the issue250 branch, then no. That is based off very old code (Jool 3.5.4), and I don't think it's finished.

It probably needs an uphill struggle of an update.

could systemd's unit templates be used instead?

I suppose so. I dunno; it's been a while. I probably need to re-learn systemd at this point.

That's the thing. Do you really need us for this? I'm not the best at systemd and anyone with some experience or willpower should be able to contribute whatever does what's needed.

@ydahhrk

This comment has been minimized.

Copy link
Member

@ydahhrk ydahhrk commented Aug 2, 2019

Update:

The Debian package currently in review (see this comment) ships with systemd unit files. I am not thrilled to announce that Debian's policy also forced me to provide System V init scripts, so they are included too.

Even though this package is likely only installable in Debian-based systems, I'm planning to close this bug once the package is approved. I think this is reasonable, because every environment risks being different, and so I cannot provide generic unit files and init scripts for every distro. (Although alternate solutions can be discussed in this thread.)

For everyone who's either using System V or systemd but not a Debian derivative, you can pirate my latest unit files and init scripts from my packaging repository:

Few things to note if you intend on doing that:

  • These files assume that you're using the latest Jool version, which (at present) is 4.0.4. (I didn't announce this version in the mailing list because it's a "transitional" package for now.)
  • You probably need to rename jool-tools.jool_siit.service into /lib/systemd/system/jool_siit.service, jool-tools.jool.init into /etc/init.d/jool, et cetera.
  • The files contain hardcoded paths that you might need to change, such as /usr/bin/jool and /etc/jool/jool_siit.conf.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.