LFS Verion 9; Section 6.21.1 GCC check fails with "su: Cannot drop the controlling terminal"
Linux From ScratchThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
Distribution: LFS 9.0 Custom, Merged Usr, Linux 4.19.x
Posts: 616
Rep:
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.
Distribution: LFS 9.0 Custom, Merged Usr, Linux 4.19.x
Posts: 616
Rep:
Quote:
Originally Posted by rwx
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.
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.
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.
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.
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.
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).
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.