Fedora Linux Support Community & Resources Center
  #1  
Old 28th June 2009, 04:43 AM
pedora Offline
Registered User
 
Join Date: Jul 2007
Posts: 312
fdisk issue

I change to root (su or sudo) and type:

# fdisk -l
bash: fdisk: command not found

What am I doing wrong? This is a Fedora thing? I don't have this issue in other distros.

I am searching the forums before/after I post this, trying to figure it out but...

If anyone can help explain what's going on, that would be great.

I don't know why I can't run this command.

I want to mount a hard drive in an enclosure that is connected via usb. Can I mount it automatically by editing fstab? But, right now, I would like to know how to do it manually. I believe I have before but now have this issue ('don't remember the solution).
Reply With Quote
  #2  
Old 28th June 2009, 04:47 AM
sdlor Offline
Registered User
 
Join Date: Mar 2008
Location: The Great Inland Northwest
Posts: 214
It's hard to tell with the font in this forum...That is a lower case L, correct?...On my monitor, it looks like an upper case i..
Reply With Quote
  #3  
Old 28th June 2009, 05:18 AM
mohaas05 Offline
Registered User
 
Join Date: Apr 2009
Posts: 68
You can only run fdisk as a superuser.

So either

su -c 'fdisk -l'

or

sudo fdisk -l
Reply With Quote
  #4  
Old 28th June 2009, 07:12 AM
bodhi.zazen Offline
Registered User
 
Join Date: Jul 2006
Location: Montana
Posts: 731
If you are running that command and you are gettign command not found, my guess is your path dows not include /sbin

as root

Code:
echo $PATH
did you change root's path in root's .bashrc or .profile ?
__________________
If it is not broken, tweak it... If you break Fedora you get to keep both pieces :p
Reply With Quote
  #5  
Old 28th June 2009, 09:51 PM
sidebrnz Offline
Registered User
 
Join Date: Oct 2007
Location: Freedonia
Age: 65
Posts: 2,616
If you're using sudo, try this:

sudo /sbin/fdisk -l

If you're using su, do the same, but leave off "sudo." Or, try this:

su -
(root password)
fdisk -l

That's because sudo lets you run one command that requires root access while keeping you in your own environment, and su changes your useerID to that of root (0) while changing nothing else, and /sbin probably isn't in your PATH, as commented above. "su -" logs you in as root, so that you not only have root's userID, you have the full root environment, including /sbin in your PATH. (It also changes your directory to /root, which can be a tad inconvenient at times.)
__________________
Registered Linux user #470359 and permanently recovered BOFH.

Any advice in this post is worth exactly what you paid for it.
Reply With Quote
  #6  
Old 28th June 2009, 11:25 PM
pedora Offline
Registered User
 
Join Date: Jul 2007
Posts: 312
Quote:
Originally Posted by sidebrnz View Post
If you're using sudo, try this:

sudo /sbin/fdisk -l

If you're using su, do the same, but leave off "sudo." Or, try this:

su -
(root password)
fdisk -l

That's because sudo lets you run one command that requires root access while keeping you in your own environment, and su changes your useerID to that of root (0) while changing nothing else, and /sbin probably isn't in your PATH, as commented above. "su -" logs you in as root, so that you not only have root's userID, you have the full root environment, including /sbin in your PATH. (It also changes your directory to /root, which can be a tad inconvenient at times.)
The last example is what I did and so I got the info, thanks! I found the explanation on another forum site but it is still confusing. THANKS for explaining it! I appreciate that and the rest of the responses. I still need to try and digest the concept, though. The 'path' requirement confuses me.

Is Fedora the only one to require this method?

It's still okay, I just didn't realize it.

I don't have to enter the path if you login to root using "su -"

What I read in the forum:
“That will get you root's environment which has /sbin in the path. Or, doing it the way you did you can type /sbin/fdisk.”

What I read in various places:

“The sbin path must be in the PATH environment

add :/sbin: to your $PATH var

To append /sbin to the end of your current path use:

export PATH=`echo $PATH`:/sbin

or

export PATH=$PATH:/sbin”

Any simplified way to explain?
Reply With Quote
  #7  
Old 29th June 2009, 01:11 AM
sidebrnz Offline
Registered User
 
Join Date: Oct 2007
Location: Freedonia
Age: 65
Posts: 2,616
Yes. Any Linux distro will look in certain directories for programs that you try to run. (This is also true for Unix, MS-DOS and Windows, BTW.) The directories are the ones in the environment variable known as PATH. DOS/Windows will always look in the current directory first, then in your path; Linux and Unix don't. /sbin has programs in it that are either used very early in the boot process, before the rest of the file system is mounted (and thus has to be on the same partition as /) or aren't normally used by regular users. It's not one of the directories on the default path for a user, but it is in root's path because root sometimes needs them.
__________________
Registered Linux user #470359 and permanently recovered BOFH.

Any advice in this post is worth exactly what you paid for it.
Reply With Quote
  #8  
Old 29th June 2009, 01:30 AM
pedora Offline
Registered User
 
Join Date: Jul 2007
Posts: 312
Quote:
Originally Posted by sidebrnz View Post
Yes. Any Linux distro will look in certain directories for programs that you try to run. (This is also true for Unix, MS-DOS and Windows, BTW.) The directories are the ones in the environment variable known as PATH. DOS/Windows will always look in the current directory first, then in your path; Linux and Unix don't. /sbin has programs in it that are either used very early in the boot process, before the rest of the file system is mounted (and thus has to be on the same partition as /) or aren't normally used by regular users. It's not one of the directories on the default path for a user, but it is in root's path because root sometimes needs them.
Cool! Thanks for the info! I really need to learn more. I think that is one of the things limiting me but I really like Fedora even if some of the differences confuse me. I don't hardly use Windows anymore, I usually just switch been Fedora and a Debian-based distro (usually K/Ubuntu and sidux).
Reply With Quote
  #9  
Old 29th June 2009, 03:25 AM
scottro Offline
Retired Community Manager -- Banned from Texas by popular demand.
 
Join Date: Sep 2007
Location: NYC
Posts: 8,142
I have a page on this at http://home.roadrunner.com/~computer...su/rhpath.html


However, as of F10, this should no longer be an issue (though if you upgraded from an earlier version, the path may have never been updated.)
__________________
--
http://home.roadrunner.com/~computertaijutsu

Do NOT PM forum members with requests for technical support. Ask your questions on the forum.


"I don't know why there is the constant push to break any semblance of compatibility" --anon
Reply With Quote
Reply

Tags
fdisk

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
mac-fdisk and fstab issue? Really frustrating prairie_dad Mac Chat 1 27th October 2008 04:45 PM
fdisk help? sli77 Using Fedora 11 5th April 2008 12:40 AM
fdisk shri19 Using Fedora 7 10th February 2008 02:26 PM
fdisk name_user Using Fedora 5 30th March 2006 02:26 PM
FDisk playaluv Installation, Upgrades and Live Media 3 15th September 2005 04:51 AM


Current GMT-time: 03:46 (Friday, 19-09-2014)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat