LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-20-2012, 02:28 AM   #1
menjar07
LQ Newbie
 
Registered: Jul 2012
Posts: 1

Rep: Reputation: Disabled
Angry Fedora Linux help: How to add a command in /etc/rc.local file?


I am very new in Linux. I installed fedora in Virtual Box with host windows xp. I want to share file between host and guest. Someone suggest me to run the command in fedora #sudo mount -t vboxsf -o uid=1000,gid=1000 F_DRIVE /home/menjar/Desktop/xp where F_DRIVE is the F drive in xp I am sharing and 'xp' is the folder in fedora where I want to mount. Now It works but when I reboot, I can't see the contents of xp folder anymore. After goggling I find a suggestion that say to add the command in /etc/rc.local file. I am very new in linux so I want to know how do I do this. I have tried to do this by using vi editor by running #vi /etc/rc.local and I add the line sudo mount -t vboxsf -o uid=1000,gid=1000 F_DRIVE /home/menjar/Desktop/xp where F_DRIVE and save by pressing Esc and then :wq but after doing I couldn't see any result. It still doesn't work. So please explain how do I do this step by step ( I am very new and don't know anything about Linux)? Am I doing something wrong with the command? should I have to place a '#" in front of the command while placing the line in /etc/rc.local? Please explain how do I solve it in detail.. I am waiting for your answer.
 
Old 07-20-2012, 03:06 AM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 14,840

Rep: Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823
Fedora (unfortunately sometimes) is a very dynamic distro. Things are always changing - rc.local for instance.
Nowadays it's called /etc/rc.d/rc.local

You can simply rename ("mv" to a new name) your current file - but you should also remove the "sudo ", it's not needed when the command is issued in rc.local. As root do this to rename that file
Code:
mv /etc/rc.local /etc/rc.d/rc.local
 
Old 07-20-2012, 03:10 AM   #3
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
just add the line to fstab, there are already proper mechanisms for doing what you want. I expect the line:

F_DRIVE /home/menjar/Desktop/xp vboxsf uid=1000,gid=1000

will work fine. don't mess with rc.local if you don't need to.
 
Old 07-20-2012, 04:00 AM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 14,840

Rep: Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823

Yep, that should work for a normal (FSVO "normal") Fedora install.
I am so used to having /home on a separate partition - I have to use rc.local for this sort of thing.
 
Old 07-20-2012, 04:10 AM   #5
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
I'm forever answering the question, rather than solving the OP's problem, not always the same thing!

why does a separate /home necessitate using rc.local?
 
Old 07-20-2012, 04:21 AM   #6
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 14,840

Rep: Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823
It appears you can't guarantee the mount for /home completes before anything that needs to mount under a sub-directory of /home is initiated if both are in fstab. Last I checked (F16), it still applied.
I haven't chased it vigorously, I just found a work-around that works (for me).
 
Old 07-21-2012, 06:14 AM   #7
bsat
Member
 
Registered: Feb 2009
Posts: 347

Rep: Reputation: 72
Quote:
but after doing I couldn't see any result. It still doesn't work

Hope you restarted the system after adding the line as it will not take effect unless you don't restart.

And don't put a "#" before the command, that would comment out the command and it will not be executed
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to create a script to add sed command into a file Runicer Programming 4 04-08-2012 04:00 PM
Modified the /etc/rc.local file. Now fedora wont boot h8null Linux - General 6 07-27-2009 09:20 AM
CentOS: add SAN directory to local file system RobertSubnet Linux - Newbie 4 06-12-2009 01:32 PM
how can i add a local Folder on local Hard Disk as Yum Repository ?? vahid_p Fedora 4 02-22-2007 11:43 AM
How To Add user in Fedora Core 4 using the Command Line Interface regnox Linux - Newbie 9 08-22-2005 01:30 AM


All times are GMT -5. The time now is 07:00 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration