LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch
User Name
Password
Linux From Scratch This Forum is for the discussion of LFS.
LFS is a project that provides you with the steps necessary to build your own custom Linux system.

Notices


Reply
  Search this Thread
Old 12-04-2019, 09:31 PM   #1
rwx
LQ Newbie
 
Registered: Dec 2019
Location: Melbourne, Australia
Posts: 7

Rep: Reputation: Disabled
LFS Verion 9; Section 6.21.1 GCC check fails with "su: Cannot drop the controlling terminal"


Hi, I am going through the LFS book for the first time. I am attempting to install LFS on a partition. My host system is Ubuntu 18.04.

I have gotten to section 6.21.1 "Installation of GCC".

When I run the following command, I get the following error.

Observation 1:
su nobody -s /bin/bash -c "PATH=$PATH make -k check"
su: Cannot drop the controlling terminal

I have read and tried several suggestions on this and other forums. I have checked the mount points:

mount -v --bind /dev $LFS/dev

and

mount -vt devpts devpts $LFS/dev/pts -o gid=5,mode=620
mount -vt proc proc $LFS/proc
mount -vt sysfs sysfs $LFS/sys
mount -vt tmpfs tmpfs $LFS/run

I am unable to run mount in the root user mode. Not sure why that is the case. I can see files and subdirectories in each mount points and so I understand that the mount is okay.

One thing which doesn't sit right, I am forced to execute the mount commands from the lfs user space, ableit with sudo. The sudo requirement isn't listed in the book. However I am unable to run the mount commands without sudo (Observation 2).

I have also tried splitting up the check command, that is change user, and then run the make target. When I do a simple "su nobody", I get the following error: Unable to cd to '/dev/null' (Observation 3).

Can anyone offer any suggestions such taht I can progress past this point? I have a gut feeling that all the observations are related, which is why I included them.

Any help will be appreciated.
 
Old 12-04-2019, 11:54 PM   #2
Luridis
Member
 
Registered: Mar 2014
Location: Texas
Distribution: LFS 9.0 Custom, Merged Usr, Linux 4.19.x
Posts: 616

Rep: Reputation: 167Reputation: 167
There is one mount that you missed, and Debian based distros are the only one that use it, is this section...

Code:
if [ -h $LFS/dev/shm ]; then
  mkdir -pv $LFS/$(readlink $LFS/dev/shm)
fi
That may or may not be what's causing your problem. Personally, I doubt it. But, it's worth a try seeing is how /run/shm is involved in shared memory IPC. That said, Debian based distros are notorious for causing headaches when used as a Linux From Scratch build host. My personal recommendations to people is that Debian{,-based} is fine for running, but if you wish to do any kind of development, pick another distro.
 
1 members found this post helpful.
Old 12-05-2019, 01:43 PM   #3
rwx
LQ Newbie
 
Registered: Dec 2019
Location: Melbourne, Australia
Posts: 7

Original Poster
Rep: Reputation: Disabled
Thanks for post Luridis.

I had created that directory, but it hadn't affected the outcome.

Thanks for the info regarding Debian related distros, and the articles. They are interesting.

I will persist with Ubuntu for now though, as I don't want to veer off to another distro just yet. I do some of my other development on the host.
 
Old 12-05-2019, 11:54 PM   #4
Luridis
Member
 
Registered: Mar 2014
Location: Texas
Distribution: LFS 9.0 Custom, Merged Usr, Linux 4.19.x
Posts: 616

Rep: Reputation: 167Reputation: 167
Quote:
Originally Posted by rwx View Post
I am unable to run mount in the root user mode. Not sure why that is the case. I can see files and subdirectories in each mount points and so I understand that the mount is okay.

One thing which doesn't sit right, I am forced to execute the mount commands from the lfs user space, ableit with sudo. The sudo requirement isn't listed in the book. However I am unable to run the mount commands without sudo (Observation 2).
I just noticed this part when looking at your reply. This is what I do when I'm building LFS in a desktop terminal: I open the terminal and immediately su root --login. This is to give me a clean root shell with as much of the desktop environment dropped as possible. It also makes sure that permissions don't get changed on this in my user account's home directory. Next, I create the partitions, mount them, create /sources and populate it, then move on to the chapter 5 instructions. Just don't build in this root shell, never run a make command unless you see the prompt as lfs:~$ which is the lfs user, or (lfs chroot) root:~# which is inside the chroot of your future lfs system. Don't use sudo because it preserves too much of the host environment by default, nor should you modify your display manager to let you login to a desktop as root.
 
1 members found this post helpful.
Old 12-06-2019, 09:53 PM   #5
rwx
LQ Newbie
 
Registered: Dec 2019
Location: Melbourne, Australia
Posts: 7

Original Poster
Rep: Reputation: Disabled
Thanks Luridis.

I will give those instructions a try.

Your comments have got me thinking and I will also prepare another linux distro concurrently for development. I have looked at Elementary and Linux Mint, but it is based on Ubuntu. I think I will give Arch Linux a go.

Thanks
 
Old 12-19-2019, 04:42 AM   #6
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,650
Blog Entries: 19

Rep: Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480
Quote:
Originally Posted by rwx View Post
I am unable to run mount in the root user mode. Not sure why that is the case. I can see files and subdirectories in each mount points and so I understand that the mount is okay.

One thing which doesn't sit right, I am forced to execute the mount commands from the lfs user space, ableit with sudo. The sudo requirement isn't listed in the book. However I am unable to run the mount commands without sudo (Observation 2).
This looks to me like the source of all the problems. The whole of Chapter 6 needs to be carried out as root, not lfs. This includes the creation of the top-level directories,
Quote:
Originally Posted by LFS Chapter 5.36
Note:

The commands in the remainder of this book must be performed while logged in as user root and no longer as user lfs. Also, double check that $LFS is set in root's environment.
If you are having to do things as lfs, something has gone badly wrong at the beginning of chapter 6. The gcc problem is merely a symptom of bad ownership or permissions somewhere and cannot be fixed by itself.

I hope you obeyed the recommendation to back up your toolkit before starting chapter 6. If so, the solution is simple: save the sources to a convenient place, clear the partition, recreate $LFS/sources and $LFS/tools, restore the sources and unpack the saved toolkit into $LFS/tools. Then read carefully section 5.36 and start chapter 6 again.

Last edited by hazel; 12-20-2019 at 05:20 AM.
 
1 members found this post helpful.
Old 12-19-2019, 08:57 PM   #7
rwx
LQ Newbie
 
Registered: Dec 2019
Location: Melbourne, Australia
Posts: 7

Original Poster
Rep: Reputation: Disabled
Thanks Hazel.

Yes I think so too.

When I attempt to mount using root I get a "command not found" error. I guess this is the root error, or close to the root error. Using the user LFS to build is a consequence of this, and the error I see in GCC is in turn a consequence of the LSF user. Maybe it is a path issue that root can't find the mount tool.

I have not backed up my tools. I understood that the motive for that backup was as to use that toolset to building other LFS systems.
 
Old 12-20-2019, 01:50 AM   #8
Luridis
Member
 
Registered: Mar 2014
Location: Texas
Distribution: LFS 9.0 Custom, Merged Usr, Linux 4.19.x
Posts: 616

Rep: Reputation: 167Reputation: 167
Quote:
Originally Posted by rwx View Post
When I attempt to mount using root I get a "command not found" error.
When you SU to root, echo $PATH. It's possible that something is wrong with the system and/or root login scripts. You should see something like:

Code:
/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
If that looks fine, try booting without the GUI and logging directly into the console as root. You can do that by restarting the system and pressing the edit key for your bootloader and adding these to the kernel command line, before the /initrd statement.

Code:
consoleblank=0 systemd.unit=multi-user.target
Or replace the systemd.unit statement with just the number 3 if your system runs sysvinit. These should take you to a plain console login prompt.
 
Old 03-20-2020, 10:03 PM   #9
algray
LQ Newbie
 
Registered: Apr 2018
Posts: 19

Rep: Reputation: Disabled
Quote:
Originally Posted by rwx View Post
I am unable to run mount in the root user mode. Not sure why that is the case. I can see files and subdirectories in each mount points and so I understand that the mount is okay.

One thing which doesn't sit right, I am forced to execute the mount commands from the lfs user space, ableit with sudo. The sudo requirement isn't listed in the book. However I am unable to run the mount commands without sudo (Observation 2).

I have also tried splitting up the check command, that is change user, and then run the make target. When I do a simple "su nobody", I get the following error: Unable to cd to '/dev/null' (Observation 3).
Hi there, I've run into a similar error (but with a different response from "su nobody") I've opened a thread for it here: https://www.linuxquestions.org/quest...86#post6102786

In my case, I am using sudo su - to get to the root user and mount the partitions. So I never used the LFS user during Ch6. I'm not sure if that is the correct approach or not.
 
  


Reply



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
[SOLVED] lfs verion 8.4 read only file system percy_vere_uk Linux From Scratch 7 04-04-2019 07:51 AM
Zlib 1.2.11 Make Check Fails (LFS 8.2, Chapter 6, Section 6.11) vishhvak Linux From Scratch 4 11-12-2018 04:46 PM
[SOLVED] LFS: Error during GCC-4.7.1-Pass 1 (LFS 7.2, Section 5.5) erkant Linux From Scratch 7 11-28-2012 06:03 AM
[SOLVED] Problems in glibc section section 5.7.1 lfs 6.7 abhiklall Linux From Scratch 1 04-19-2011 02:42 AM
error using lfs while compiling lfs book's 6.12 (gcc-4.1.2) section aditya_gpch Linux From Scratch 3 04-24-2008 04:23 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch

All times are GMT -5. The time now is 02:57 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
Open Source Consulting | Domain Registration