LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux From Scratch (http://www.linuxquestions.org/questions/linux-from-scratch-13/)
-   -   lfs is not in sudoers file error in LFS 6.6 (http://www.linuxquestions.org/questions/linux-from-scratch-13/lfs-is-not-in-sudoers-file-error-in-lfs-6-6-a-813646/)

nkedz 06-11-2010 08:01 PM

lfs is not in sudoers file error in LFS 6.6
 
Hello all,

I started to work on my LFS system a few days ago and was impressed with everything going smoothly. However, I think I might have done something wrong. I thought I had followed the instructions in the book to the letter, but maybe someone can point me in the right direction?

I'm using Ubuntu 10.04 as a host system, LFS version 6.6, and am only somewhat new to Linux. If I can put anything else here that would help my question be answered, please let me know.

My problem is this: I have gotten all the way to section 5.4, and it's time to build Binutils-2.20. I am executing these commands as lfs, as specified. The first command is
Code:

mkdir -v ../binutils-build
and when I try it, it says permission denied. I try
Code:

sudo mkdir -v ../binutils-build
and enter my password when prompted, but then I get the error message "lfs is not in the sudoers file. This incident will be reported."

Where could I have gone wrong? I'm very sure I followed the instructions in the book to the letter. If additional details are needed, please let me know, and thanks in advance for any help, it is much appreciated!

crts 06-12-2010 03:03 AM

Hi,

check the permissions and owner of
Code:

$LFS/sources
$LFS/tools

They should both belong to lfs and should also have rwx permission. If necessary change permissions as needed.

Hope this helps.

smdaudhilbe 03-04-2013 04:47 AM

binutils problem
 
Mee too facing the same problem....

please share me any suggestion to get rid of such problem....

Not able to run the patch, of binutils....

thanks,
Audhil

spiky0011 03-04-2013 05:39 AM

Hi
What version of lfs are you building
what chapter are you on

druuna 03-04-2013 06:35 AM

Quote:

Originally Posted by smdaudhilbe (Post 4904212)
Mee too facing the same problem....

please share me any suggestion to get rid of such problem....

Not able to run the patch, of binutils....

There's not much to go on (see spiky0011's post).

Just to make sure: You also get the "lfs is not in the sudoers file. This incident will be reported." message?

If so, the solution is simple: You should not use sudo when building lfs, you need a full blown root account (su - ) and then start building lfs.

spiky0011 03-04-2013 08:54 AM

Post the output of version-check
also
Code:

ls -l /mnt/lfs
Code:

ls -l /mnt/lfs/source
Dont fotget post4

smdaudhilbe 03-04-2013 11:17 PM

binutils problem
 
I am building lfs version 7.2...

As per druuna's advice if I become root using su - command, if I may do anything wrong will cause me severe damage...For the sake of security I created (as per the direction given in LFS) a new user lfs to avoid such situations...

How to overcome..this..?

Please suggest me hints to add my new user lfs into sudoers config file, it will be very helpful... to me...

-Audhil...

druuna 03-05-2013 01:00 AM

Quote:

Originally Posted by smdaudhilbe (Post 4904824)
As per druuna's advice if I become root using su - command, if I may do anything wrong will cause me severe damage...For the sake of security I created (as per the direction given in LFS) a new user lfs to avoid such situations...

How to overcome..this..?

Please suggest me hints to add my new user lfs into sudoers config file, it will be very helpful... to me...

The use of sudo while building LFS is discouraged and the LFS book also points to using su -. I've seen too many posts were people used sudo and got stuck at some point during the build.

When you build an LFS system you do need the full power of the root user (only chapter 5 is done as the lfs user).

If you don't feel comfortable using root on the machine you do your daily routines I would suggest setting up a virtual machine, install a host and build LFS inside the VM. This way you can only foobar your VM session.

spiky0011 03-05-2013 02:04 AM

Hi

At what point/chapter are you using sudo? pls

smdaudhilbe 03-05-2013 04:46 AM

binutils problem
 
Hi,

After big research, I found solution to my problem....I followed these steps...

1) Earlier I found errors like this

lfs@boss:/media/LFS$ mkdir audhil
mkdir: cannot create directory `audhil': Permission denied
lfs@boss:/media/LFS$ sudo mkdir audhil
[sudo] password for lfs:
Sorry, try again.
[sudo] password for lfs:
lfs is not in the sudoers file. This incident will be reported. <-- I got this after entering my correct password of lfs user
lfs@boss:/media/LFS$

2) After, adding a line

%lfs ALL=(ALL) NOPASSWD: ALL

at bottom of /etc/sudoers file

It works pretty good,

lfs@boss:/media/LFS$ mkdir audhil
mkdir: cannot create directory `audhil': Permission denied
lfs@boss:/media/LFS$ sudo mkdir audhil
lfs@boss:/media/LFS$ ls
audhil lost+found sources tools
lfs@boss:/media/LFS$ rm audhil -R
rm: remove write-protected directory `audhil'? y
rm: cannot remove `audhil': Permission denied
lfs@boss:/media/LFS$ sudo rm audhil -R
lfs@boss:~$

But the problem is I need to enter sudo each and every time, even for a simple task as follows,

lfs@boss:/media/LFS$ sudo vim dummy.c
lfs@boss:/media/LFS$ gcc dummy.c
/usr/bin/ld: cannot open output file a.out: Permission denied
collect2: ld returned 1 exit status
lfs@boss:/media/LFS$ sudo gcc dummy.c
lfs@boss:/media/LFS$ ./a.out
jack and jill went upto hill

lfs@boss:/media/LFS$


For your information, /media/LFS is the partition which I used to mount it during LFS building process...

My query, whether is that safe to build LFS under this scenario...using much more 'sudos'?

-Audhil

druuna 03-05-2013 05:06 AM

Quote:

Originally Posted by smdaudhilbe (Post 4904970)
But the problem is I need to enter sudo each and every time, even for a simple task as follows,

lfs@boss:/media/LFS$ sudo vim dummy.c
lfs@boss:/media/LFS$ gcc dummy.c
/usr/bin/ld: cannot open output file a.out: Permission denied
collect2: ld returned 1 exit status
lfs@boss:/media/LFS$ sudo gcc dummy.c
lfs@boss:/media/LFS$ ./a.out
jack and jill went upto hill

lfs@boss:/media/LFS$

Once you become user lfs (end of chapter 4.3) the root user isn't used/needed. This lasts up to and including chapter 5.33.

All the other commands in the book must be done as root user.

I've already told you multiple times that you should NOT use sudo. If you still want to use sudo to build LFS then every command (except from 4.3 to 5.33) must be done using sudo <command> (or sudo su -).

BTW: good luck with that.....

druuna 03-05-2013 05:22 AM

@smdaudhilbe:
Quote:

As per druuna's advice if I become root using su - command, if I may do anything wrong will cause me severe damage...For the sake of security I created (as per the direction given in LFS) a new user lfs to avoid such situations...
The above doesn't hold any ground.

Warning: DO NOT TRY OUT THE BELOW EXAMPLE COMMANDS !!!!

The following command will do the same thing (and are as dangerous):
Code:

su -
rm -rf /

or
Code:

sudo rm -rf /
Warning: DO NOT TRY OUT THE ABVOE EXAMPLE COMMANDS !!!!


In most cases you do not want to be working as root user and using sudo to do the occasional command that needs root permissions is seen as a good thing, building LFS isn't one of those cases.

spiky0011 03-05-2013 05:33 AM

Hi

can you post the oitput ls -l mnt/lfs


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