Solved

linux

Posted on 2011-03-14
9
338 Views
Last Modified: 2012-05-11
hi,

i was trying to edit one file in linux os (/proc/sys/kernel/sem) through vi and after editing tried to save but it says the file has been changed since reading , do you want to write anyway, i seletcted yes but still

0
Comment
Question by:kurajesh
9 Comments
 
LVL 17

Expert Comment

by:k_murli_krishna
ID: 35126630
Once all work is over on the contents of the file, escape from insert mode by pressing Esc butting if it is in insert mode. Now type : and then wq!, it will save the file (maybe create and save if it is first time generated file) and exit back to shell prompt.
0
 
LVL 17

Expert Comment

by:k_murli_krishna
ID: 35126637
: means colon  and wq! means wq followed by exclamation mark (!) to make things more clearer.
0
 
LVL 11

Expert Comment

by:Pieter Jordaan
ID: 35126697
Hi

The correct way to make changes to that file, is to use echo "values" > file

use cat to read it first:

cat /proc/sys/kernel/sem

Then echo the values back in the same format, with your changes.

# echo SEMMSL_value SEMMNS_value SEMOPM_value SEMMNI_value > /proc/sys/kernel/sem
echo 250 32000 100 128 > /proc/sys/kernel/sem'
0
 
LVL 5

Expert Comment

by:sreedhar2u
ID: 35126783
0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
LVL 17

Expert Comment

by:Sikhumbuzo Ntsada
ID: 35126798
Make sure you are logged in as root account.
0
 
LVL 31

Expert Comment

by:farzanj
ID: 35127256
All the proc files are volatile.  They do NOT persist after reboot.  All the partition is blown away when you reboot.  It depicts the current state of your system.

To make it persist after reboot, you will have to cat the value and put it in the file

/etc/rc.d/rc.local

So vi /etc/rc.d/rc.local

and add the following line in it

echo  VALUE > /proc/sys/kernel/sem
0
 
LVL 12

Accepted Solution

by:
upanwar earned 500 total points
ID: 35127262
I would suggest you to modify kernel parameter through /etc/sysctl.conf instead of modify the file directoly and it is the best practice. Because If you will require to to come to the default value, you just need to comment the line in sysctl.conf instead of modifying the file again and again.



Please follow the steps to modify the value through sysctl.conf.

#  vi /etc/sysctl.conf

append the value in the file (Please replace the values as per your need).

kernel.sem = 250 256000  32 1024

Then save the file through pressing Esc key to quit from insert mode to escape mode and then type : and then wq!, it will save the file.

Then run the below given command at shell prompt to change the values on the fly without rebooting your box.

# sysctl -p

Then execute the below given command to check whether value has been updated or not.

# ipcs -l

it will show sothing similar to:

------ Semaphore Limits --------
0
 
LVL 12

Expert Comment

by:mccracky
ID: 35137812
As mentioned, you don't edit the files under /proc with vi.

If you want to change the file use "echo"

e.g.  

echo "file contents" > /proc/sys/kernel/sem
0
 
LVL 1

Author Closing Comment

by:kurajesh
ID: 35186796
#  vi /etc/sysctl.conf and kernel.sem = 250 256000  32 1024 entries modification worked fine, thanks upanwar
0

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
add a 1000 ms delay after each sending email operation 12 70
Is this bug still active in RHEL 2 50
Linux  Script File Attributes 5 53
High Available Storage based on linux 6 69
Using 'screen' for session sharing, The Simple Edition Step 1: user starts session with command: screen Step 2: other user (logged in with same user account) connects with command: screen -x Done. Both users are connected to the same CLI sessio…
Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now