Solved

linux

Posted on 2011-03-14
9
342 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
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
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

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

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 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…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Suggested Courses

739 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