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

kernel.printk is not a valid sysctl key #44

Open
samuraiii opened this issue Sep 18, 2020 · 11 comments
Open

kernel.printk is not a valid sysctl key #44

samuraiii opened this issue Sep 18, 2020 · 11 comments
Assignees

Comments

@samuraiii
Copy link

Hello,
I am having an issue with augeasproviders_sysctl.
It can't set the kernel.printk key in sysctl with the error:

Sysctl[kernel.printk]: Could not evaluate: Error: `kernel.printk` is not a valid sysctl key

Puppet is 6.17.0
Proof that kernel.printk is in sysctl:

#sysctl -a|grep printk
kernel.printk = 3       4       1       7
kernel.printk_delay = 0
kernel.printk_devkmsg = on
kernel.printk_ratelimit = 5
kernel.printk_ratelimit_burst = 10
kernel.tracepoint_printk = 0

Please let me know what info can I supply to get this fixed.
S

@raphink
Copy link
Member

raphink commented Sep 28, 2020

Hi,

Thanks for the report.

Does puppet resource sysctl list these keys?

@raphink raphink self-assigned this Sep 28, 2020
@samuraiii
Copy link
Author

Hello,
puppet resource sysctl fails with Error: Could not run: invalid byte sequence in UTF-8
The --debug flag shows nothing interesting.
I suspect sunrpc.transports = p���� from /usr/bin/sysctl -a.
I have not done nothing with sunrpc.transports, just for the record.
My system is Manjaro linux with kernel 5.8.6 and (I am not sure if this is relevant, but I can imagine it messing with sysctl) zfs 0.8.4.
I have actually set only following (in /etc/sysctl.conf and /etc/sysctl.d):

kernel.dmesg_restrict = 1
fs.inotify.max_user_watches = 16384
fs.inotify.max_user_watches = 300000
vm.swappiness = 10
vm.vfs_cache_pressure = 50
kernel.printk = 3 4 1 7
kernel.printk = 3 4 1 7
net.core.rmem_max = 4194304
net.core.wmem_max = 1048576
net.ipv4.ip_forward = 1
net.ipv4.conf.all.accept_redirects = 0
net.ipv4.conf.all.send_redirects = 0

@raphink
Copy link
Member

raphink commented Sep 29, 2020

Ah, I remember seeing this bug (maybe on Slack) some time ago.

So I guess we should adapt the code to deal with junk values and ignore them.

@samuraiii
Copy link
Author

That would be nice
But This seem to be a new bug.
I have not tried to run puppet before posting last post, I have just run puppet resource sysctl...
Because now puppet cmplains about non utf 8 junk:

Info: Using configured environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Retrieving locales
Info: Loading facts
Info: Caching catalog for host
Info: Applying configuration version '1601387190'
Error: Could not prefetch sysctl provider 'augeas': invalid byte sequence in UTF-8
Error: Failed to apply catalog: invalid byte sequence in UTF-8

@raphink
Copy link
Member

raphink commented Sep 29, 2020

I do believe it could be the same bug.

If prefetch fails, then Puppet won't have the known keys in cache, so it will not be able to validate the key you're requesting.

@samuraiii
Copy link
Author

samuraiii commented Sep 29, 2020

Ok and now it is back to previous state... (with reported error for kernel.printk)
I just wanted to run it with --debug to see what is happening.

It is actually one of both states and I do not see why...

@raphink
Copy link
Member

raphink commented Sep 29, 2020

I can't reproduce in tests. Puppet seems to be happy with unicode values when I pass them.

@raphink
Copy link
Member

raphink commented Sep 29, 2020

Which locale are you using?

@samuraiii
Copy link
Author

Its a bit complicated:

LANG=en_GB.UTF-8
LANGUAGE=en_GB:en
LC_CTYPE=cs_CZ.UTF-8
LC_NUMERIC=cs_CZ.UTF-8
LC_TIME=en_DK.UTF-8
LC_COLLATE=cs_CZ.UTF-8
LC_MONETARY=cs_CZ.UTF-8
LC_MESSAGES=en_GB.UTF-8
LC_PAPER=cs_CZ.UTF-8
LC_NAME=cs_CZ.UTF-8
LC_ADDRESS=cs_CZ.UTF-8
LC_TELEPHONE=cs_CZ.UTF-8
LC_MEASUREMENT=cs_CZ.UTF-8
LC_IDENTIFICATION=cs_CZ.UTF-8

@samuraiii
Copy link
Author

Ok the problem is that there were two kernel.printk identical entries in sysctl.conf (don't ask me why)

@op-ct
Copy link

op-ct commented Aug 25, 2022

This happened with a few different keys to me just now, and it was indeed due to duplicate keys in /etc/sysctl.conf. Once the duplicate entries were removed, the provider accepted those keys as valid.

Thanks for popping back and explaining what happened, @samuraiii 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants