LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux From Scratch (https://www.linuxquestions.org/questions/linux-from-scratch-13/)
-   -   lfs is not in sudoers file error in LFS 6.6 (https://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

aashil16 10-17-2014 09:49 PM

Hi @spiky0011 I face the same error and here is the output of version check ls -l /mnt/lfs

total 24
drwx------ 2 root root 16384 Oct 5 22:14 lost+found
drwxrwxrwt 2 lfs root 4096 Oct 6 00:54 sources
drwxr-xr-x 2 lfs root 4096 Oct 6 00:57 tools

PS: I am compiling version 7.6 and I get this error at section 5.4.1 of the book.

spiky0011 10-18-2014 01:21 AM

aashil16
Hi can you start a new Thread Pls. Then can you post the output of the version-check from this page " To make sure your host is compliant." What host are you using?

http://www.linuxfromscratch.org/lfs/.../hostreqs.html

EDDY1 10-18-2014 01:36 AM

The reason for your problem is the command you used.
If you're already in lfs environment then there's no reason for sudo.
The command for entering environment would be
Quote:

su - lfs

oblo 10-18-2014 12:29 PM

I think this message is strange during lfs build, follow the previous advices.
I had this "problem" but in blfs and i solved with "visudo" and adding my user to wheel group.

aashil16 10-18-2014 01:30 PM

Quote:

Originally Posted by spiky0011 (Post 5255439)
aashil16
Hi can you start a new Thread Pls. Then can you post the output of the version-check from this page " To make sure your host is compliant." What host are you using?

http://www.linuxfromscratch.org/lfs/.../hostreqs.html

http://www.linuxquestions.org/questi...76#post5255676


All times are GMT -5. The time now is 04:23 AM.