Solved

linux

Posted on 2011-03-14
9
340 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
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
LVL 5

Expert Comment

by:sreedhar2u
ID: 35126783
0
 
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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

I am a long time windows user and for me it is normal to have spaces in directory and file names. Changing to Linux I found myself frustrated when I moved my windows data over to my new Linux computer. The problem occurs when at the command line.…
How many times have you wanted to quickly do the same thing to a list but found yourself typing it again and again? I first figured out a small time saver with the up arrow to recall the last command but that can only get you so far if you have a bi…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

808 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