SEARCH

Enter your search query in the box above ^, or use the forum search tool.

You are not logged in.

#1 2013-06-26 15:13:36

stevo1977
Member
From: Gallifrey
Registered: 2013-02-13
Posts: 11

sysctl Issues

I think I've solved this, but I wanted to post about it here in case anyone else comes across a similar problem.

I recently installed Waldorf and have gotten everything working great. I realized I wanted to change the swappiness to 10 like I always used to in ubuntu. I added the line

vm.swappiness=10

to /etc/sysctl.conf.

But this will only take effect after the next boot (which hopefully isn't for a few months), so I tried to use the "sysctl" command which will change the value in runtime. But bash doesn't like it:

sysctl: command not found

I thought this was exceedingly weird, since as far as I know sysctl is a standard command on all *nix systems. So I searched for the command,

sudo find / -name sysctl

and sure enough, it's sitting right there in /sbin/sysctl. So why doesn't bash find the command?

I then was tipped off to check $PATH,

echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games

No trace of "/sbin"!

Finally, I added "/sbin" to $PATH:

export PATH=$PATH:/usr/local/bin:/usr/bin:/bin:/sbin:/usr/local/games:/usr/games

and "sysctl" works as it should.

EDIT: And the learning continues. I could have sworn that I tried "sudo sysctl", but evidently I did not. So today I learned that /sbin commands can only be accessed by the super-user. I removed /sbin from $PATH and now "sudo sysctl" works like it's supposed to. Many thanks to xaos to kindly continuing my education.

Cheers,
stevo

Last edited by stevo1977 (2013-06-26 17:18:27)


Eschew obfuscation.

Offline

Be excellent to each other!

#2 2013-06-26 15:27:13

xaos52
The Good Doctor
From: Planet of the @s
Registered: 2011-06-24
Posts: 4,602

Re: sysctl Issues

Adding /sbin to the users PATH is considered unsafe.
sysctl should be run as root - either with sudo or su.

Offline

#3 2013-06-26 15:46:12

CBizgreat!
#! Die Hard
Registered: 2011-07-27
Posts: 1,865

Re: sysctl Issues

Last edited by CBizgreat! (2013-06-26 16:13:26)

Offline

#4 2013-06-26 17:20:47

stevo1977
Member
From: Gallifrey
Registered: 2013-02-13
Posts: 11

Re: sysctl Issues

Thanks for pointing that out, xaos. I have corrected the issue on my system, and I have edited my original post to reflect this. I can't believe I made such a noob mistake like not trying the command with 'sudo'! Well, this is how we learn...

EDIT: Oh, and CBizgreat!, I tried that "echo" command, but even with 'sudo' bash told me that that was not allowed.

bash: /proc/sys/vm/swappiness: Permission denied

Cheers,
stevo

Last edited by stevo1977 (2013-06-26 17:23:34)


Eschew obfuscation.

Offline

#5 2013-06-26 18:20:20

xaos52
The Good Doctor
From: Planet of the @s
Registered: 2011-06-24
Posts: 4,602

Re: sysctl Issues

echo 10 | sudo tee /proc/sys/vm/swappiness

should work OK.

Offline

#6 2013-06-27 03:12:13

CBizgreat!
#! Die Hard
Registered: 2011-07-27
Posts: 1,865

Re: sysctl Issues

Bizarre ... thought you did something wrong and thus were wrong. So tried echo myself Stevo1977.

Oddly even with sudo it does say forbidden/etc. Tried it as root, make your user root w the cmd "sudo -i" and it worked as expected. Odd ... just thought it was worth mention.


Vll!

Last edited by CBizgreat! (2013-06-27 05:02:04)

Offline

Board footer

Powered by FluxBB

Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.
Server: bleh

Debian Logo