[General Questions and Answers] MrinmoyJK:
sysctl.conf not working

Hi, I am using Invincible custom rom on Micromax A56. It is an Android 2.3.5 based rom.

I have the following sysctl.conf file:

vm.page-cluster=3
vm.drop_caches=3
vm.oom_kill_allocating_task=0
vm.panic_on_oom=0
vm.dirty_background_ratio=80
vm.dirty_ratio=90
vm.overcommit_memory=1
vm.min_free_order_shift=4
vm.laptop_mode=0
vm.oom_dump_tasks=1
vm.min_free_kbytes=4096
fs.file-max=65536
fs.inotify.max_queued_events=32000
fs.inotify.max_user_instances=256
fs.inotify.max_user_watches=10240
fs.lease-break-time=10
kernel.msgmax=64000
kernel.msgmni=2048
kernel.panic=0
kernel.random.read_wakeup_threshold=128
kernel.random.write_wakeup_threshold=256
kernel.sem='500 512000 64 2048'
kernel.shmmax=268435456
kernel.threads-max=525810
net.core.rmem_max=524288
net.core.wmem_max=524288
net.ipv4.tcp_rmem='6144 87380524288'
net.ipv4.tcp_wmem='6144 87380524288'
net.ipv4.tcp_timestamps=0
net.ipv4.tcp_sack=1
net.ipv4.tcp_congestion_control=cubic
net.ipv4.tcp_window_scaling=1
net.ipv4.tcp_tw_recycle=1
net.ipv4.tcp_tw_reuse=1
fs.nr_open=1053696
kernel.sched_compat_yield=1
kernel.panic_on_oops=0
kernel.shmmni=4096
kernel.shmall=2097152
kernel.sched_features=24189
kernel.hung_task_timeout_secs=30
kernel.sched_latency_ns=18000000
kernel.sched_min_granularity_ns=1500000
kernel.sched_wakeup_granularity_ns=3000000
kernel.sched_shares_ratelimit=256000
kernel.sched_child_runs_first=0
vm.swappiness=0
fs.nr_open=1053696
fs.inotify.max_queued_events=32000
fs.inotify.max_user_instances=256
fs.inotify.max_user_watches=10240
fs.lease-break-time=10
fs.file-max=165164
kernel.threads-max=525810
kernel.random.write_wakeup_threshold=256
kernel.random.read_wakeup_threshold=128
kernel.sched_compat_yield=1
kernel.panic=5
kernel.panic_on_oops=1
kernel.msgmni=2048
kernel.msgmax=64000
kernel.shmmni=4096
kernel.shmall=2097152
kernel.shmmax=268435456
kernel.sem=500 512000 64 2048
kernel.sched_features=24189
kernel.hung_task_timeout_secs=30
kernel.sched_latency_ns=18000000
kernel.sched_min_granularity_ns=1500000
kernel.sched_wakeup_granularity_ns=3000000
kernel.sched_shares_ratelimit=256000
kernel.sched_child_runs_first=0
fs.lease-break-time=10
fs.file-max=65536
vm.dirty_ratio=90
vm.dirty_background_ratio=80
vm.oom_kill_allocating_task=1
vm.overcommit_memory=1
vm.page-cluster=3
vm.drop_caches=3
vm.min_free_kbytes=4096
vm.panic_on_oom=0
vm.dirty_expire_centisecs=1000
vm.dirty_writeback_centisecs=2000
vm.oom_kill_allocating_task=0
vm.vfs_cache_pressure=10
vm.min_free_order_shift=4
vm.laptop_mode=0
vm.block_dump=0

init.d scripts are working. I checked with this. I have the following script named "01sysctl" in init.d folder with 0755 permission:

#!/system/bin/sh
sysctl -p

But the settings in sysctl.conf does not load after reboot. If I run "sysctl -a | grep vm" in adb shell, it shows following:

vm.overcommit_memory = 1
vm.panic_on_oom = 0
vm.oom_kill_allocating_task = 0
vm.oom_dump_tasks = 1
vm.overcommit_ratio = 50
vm.page-cluster = 3
vm.dirty_background_ratio = 80
vm.dirty_background_bytes = 0
vm.dirty_ratio = 90
vm.dirty_bytes = 0
vm.dirty_writeback_centisecs = 500
vm.dirty_expire_centisecs = 200
vm.nr_pdflush_threads = 0
vm.swappiness = 60
vm.lowmem_reserve_ratio = 32
vm.drop_caches = 3
vm.min_free_kbytes = 4096
vm.min_free_order_shift = 4
vm.percpu_pagelist_fraction = 0
vm.max_map_count = 65530
vm.laptop_mode = 0
vm.block_dump = 0
vm.vfs_cache_pressure = 100
vm.mmap_min_addr = 4096
vm.scan_unevictable_pages = 0
sysctl: error reading key 'net.ipv4.route.flush': Permission denied
sysctl: error reading key 'net.ipv6.route.flush': Permission denied

If I run "echo 0 > /proc/sys/vm/swappiness" from adb shell it works. I tried to execute the sysctl.conf script with root privilege while the phone is running, and it showed all the commands are not found like this:

/system/etc/sysctl.conf: line 1: vm.page-cluster=3: command not found
/system/etc/sysctl.conf: line 2: vm.drop_caches=3: command not found
/system/etc/sysctl.conf: line 3: vm.oom_kill_allocating_task=0: command not found
/system/etc/sysctl.conf: line 4: vm.panic_on_oom=0: command not found
........
........
/system/etc/sysctl.conf: line 47: vm.swappiness=0: command not found
........
........
/system/etc/sysctl.conf: line 87: vm.min_free_order_shift=4: command not found
/system/etc/sysctl.conf: line 88: vm.laptop_mode=0: command not found
/system/etc/sysctl.conf: line 89: vm.block_dump=0: command not found

So, please tell me what is the cause and how to fix it?