# systemd fails on Apply Kernel Variables

## Althorion

Hi.

After updating systemd to 236, it fails at Applying Kernel Variables and recommends checking logs. Unfortunately, I cannot make sense of them:

```
$ systemctl status systemd-sysctl.service

● systemd-sysctl.service - Apply Kernel Variables

   Loaded: loaded (/lib/systemd/system/systemd-sysctl.service; static; vendor preset: disabled)

   Active: failed (Result: exit-code) since Mon 2017-12-18 13:49:39 CET; 2min 4s ago

     Docs: man:systemd-sysctl.service(8)

           man:sysctl.d(5)

  Process: 312 ExecStart=/lib/systemd/systemd-sysctl (code=exited, status=1/FAILURE)

 Main PID: 312 (code=exited, status=1/FAILURE)

gru 18 13:49:39 gentoorulz systemd[1]: Starting Apply Kernel Variables...

gru 18 13:49:39 gentoorulz systemd-sysctl[312]: Couldn't write 'fq_codel' to 'net/core/default_qdisc': Input/output error

gru 18 13:49:39 gentoorulz systemd[1]: systemd-sysctl.service: Main process exited, code=exited, status=1/FAILURE

gru 18 13:49:39 gentoorulz systemd[1]: systemd-sysctl.service: Failed with result 'exit-code'.

gru 18 13:49:39 gentoorulz systemd[1]: Failed to start Apply Kernel Variables.

```

What does that mean?

----------

## Hu

Is NET_SCH_FQ_CODEL enabled in your kernel?  If not, I expect that trying to set fq_codel as a scheduling algorithm would fail.  Do you want this algorithm set or do you just want the error to go away?

----------

## Althorion

It was not, thank you. Don’t really know why it unset, since I copy current kernel configuration every time, but oh well. Thank you very much for your help.

----------

## Mikkl

I've been hit by this issue, too. I ask myself, if this shouldn't be enabled by the gentoo systemd kernel option (CONFIG_GENTOO_LINUX_INIT_SYSTEMD)? I also remember that pre-merge check of systemd caused a warning for some kernel option not being set, though I do not exactly remember what it was, something with cgroups?

----------

## Hu

No, it shouldn't necessarily be enabled by the Gentoo default configuration.  Users might not want to use fq_codel, in which case there is no reason to force them to enable it in the kernel.  OP did want to use it (or at least chose to solve the problem by enabling it, rather than disabling the configuration file that tried to use it), so enabling it was the right solution for him.

----------

## Mikkl

OK, I looked where the need for fq_codel comes from and it is in "/usr/lib/sysctl.d/50-default.conf". I'm really not an systemd expert (or even amateur) but as I read it in the file one would have to copy this file to e.g. "/etc/sysctl.d/90-override.conf" and comment out the line "net.core.default_qdisc = fq_codel" if you don't want it? Then again fq_codel seems to be a reasonable thing so is there any reason why I would not want it? The "bufferbloat" problem that is mentioned in the file and is said to be addressed by fq_codel seems to be a problem mainly affecting network equipment like routers etc?

----------

## Hu

I don't think that's the right way to disable it.  If you comment it out, why would systemd notice or care?

You might not want it if it's inappropriate to your network topology, or if you wanted a minimal kernel configuration.  For network topology, you might be better served by some other algorithm if you could trust that your uplink device was managing queues intelligently.  I grant that it is arguably useful for the Gentoo kernel configuration to default it on if systemd defaults try to use it.  However, my understanding of the Kconfig language is that it's a bit inconvenient (though not impossible) to default it on only for systemd users and allow them to disable it while keeping all the other systemd-recommended settings enabled.

----------

## papandreoos

i have the same issue but no specific configuration to blame.

this is my output of

```
systemctl status systemd-sysctl.service
```

```
● systemd-sysctl.service - Apply Kernel Variables

   Loaded: loaded (/lib/systemd/system/systemd-sysctl.service; static; vendor preset: disabled)

   Active: failed (Result: exit-code) since Mon 2017-12-25 19:43:25 IST; 17min ago

     Docs: man:systemd-sysctl.service(8)

           man:sysctl.d(5)

  Process: 174 ExecStart=/lib/systemd/systemd-sysctl (code=exited, status=1/FAILURE)

 Main PID: 174 (code=exited, status=1/FAILURE)

Dec 25 19:43:25 Mamadoosh systemd[1]: Starting Apply Kernel Variables...

Dec 25 19:43:25 Mamadoosh systemd[1]: systemd-sysctl.service: Main process exited, code=exited, status=1/FAILURE

Dec 25 19:43:25 Mamadoosh systemd[1]: systemd-sysctl.service: Failed with result 'exit-code'.

Dec 25 19:43:25 Mamadoosh systemd[1]: Failed to start Apply Kernel Variables.

```

----------

## papandreoos

well it seems that its the same error.

if i do:

```
sysctl --system
```

i get besides other things that it dont find (or don't exist) net/core/default_qdisc...

so i commented out the line:

```
net.core.default_qdisc = fq_codel
```

from the file:

```
/usr/lib/sysctl.d/50-default.conf
```

and after restarting the RED error message was gone.

thanks to iamben from #gentoo  :Smile: 

----------

