Solved

linux

Posted on 2011-03-14
9
341 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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…
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
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…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

735 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