LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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-28-2019, 10:11 AM   #1
davecan
Member
 
Registered: Nov 2019
Posts: 45

Rep: Reputation: Disabled
Why aren't the various package housecleaning steps included in their install scripts?


Many of the sections in the LFS book require some housekeeping steps after installation of a particular component. Some of these are repetitive. For example, 6.25 through 6.27 each require us to manually move a lib to a target dir and then create a symlink. 6.22 and 6.24 each require several specific housecleaning steps to move/link compiled artifacts and those steps are specific to those sections.

Why don't the package authors include these housecleaning steps in their make install targets?

Since I'm not a longtime Linux user or GCC expert, is it normal to have to do these housecleaning activities when not using a package manager in a non-LFS Linux environment? If we download source code and compile in a "normal" non-LFS distro would we be expected to either magically know the steps required to get each package installed or figure them out from reading the docs / source code?

Or are these issues rather specific to LFS and not something we would encounter normally?

Last edited by davecan; 12-28-2019 at 10:12 AM.
 
Old 12-28-2019, 11:48 AM   #2
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,658
Blog Entries: 19

Rep: Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480
Package formats in binary distros like Slackware or Debian typically include a shell script to carry out jobs like moving the odd library or making extra links. Therefore the user does not notice them. In LFS, there is no provision for such scripts so you have to do it yourself.

Moving libraries around is the commonest LFS operation because makefiles have a single destination (usually /usr/lib if the configure prefix was /usr) for all their installed libraries, but sometimes one or two of these are important enough to need to be moved to /lib instead, leaving a symlink in /usr/lib just in case. Remember that if programs in /bin or /sbin need a particular library, it has to be in /lib.

Last edited by hazel; 12-28-2019 at 11:53 AM.
 
Old 12-28-2019, 01:49 PM   #3
davecan
Member
 
Registered: Nov 2019
Posts: 45

Original Poster
Rep: Reputation: Disabled
Thanks again hazel. So my question really is, if a file is important enough to be in /lib, why doesn't the install target for the Makefile of that package as written by the package author actually move the file to /lib by default?

I'm assuming this comes down to many of these software packages being more universal than even just different flavors of Linux i.e. they need to work across multiple *nix architectures potentially going back decades with potentially very different filesystem layouts -- is that a correct assumption? But even then I would think the author could add a check to try to determine what type of Unix/Linux it is installing on and take appropriate default steps, or maybe use a ./configure switch or check an env var that could be passed specifying where those files should be moved. That way the installer does it automatically. We are already passing command line options to configure and make throughout LFS so clearly they already do that to some extent.

Or is there some other reason I'm not thinking of?
 
Old 12-28-2019, 11:21 PM   #4
TheRealGrogan
Member
 
Registered: Oct 2010
Location: Ontario, Canada
Distribution: Slackware, LFS, Manjaro (for gaming)
Posts: 570

Rep: Reputation: 413Reputation: 413Reputation: 413Reputation: 413Reputation: 413
The "make install" scripts have nothing to do with "LFS" and upstream defaults these days favour the "usr merge" scheme that most distributions have been coerced into adopting. Most distributions these days dump EVERYTHING in /usr, and /bin, /sbin, /lib etc. are symbolic links to catch non compliant installs. Some distros have even gotten rid of libexec. Want to mount /usr off onto a separate partition? Too bad for you, they'll say that's "no longer supported".

To some extent the targets are configurable, for example with autoconf based builds you can set --prefix=/usr and then --bindir, --sbindir and --libdir and stuff separately. The problem comes, for example, when you don't want ALL the binaries in /bin, hence manual moving.
 
Old 12-29-2019, 10:03 AM   #5
davecan
Member
 
Registered: Nov 2019
Posts: 45

Original Poster
Rep: Reputation: Disabled
Yep I get that the installation scripts aren't related to LFS.

What I'm wondering though is WHY the LFS text contains some of these commands. In some cases it is explained but in others it's not. What is the reasoning behind selecting the commands we are told to run after an install is complete?

For example, 6.29 (Psmisc) includes a couple of mv commands at the end and the text states they are moved to comply with FHS. Ok got that, the reason for these commands is explained clearly.

But then 6.25 - 6.27 each include a mv and link with this explanation:

Quote:
The shared library needs to be moved to /lib, and as a result the .so file in /usr/lib will need to be recreated
Ok so I can see why there could be a need to create the link because of the move, but why move the file in the first place? It isn't explained, we are just told "move this file."

6.22 (Bzip2) has a similar one, where we run make install but then it has a series of steps requiring us to:

Quote:
Install the shared bzip2 binary into the /bin directory, make some necessary symbolic links, and clean up
What is the "WHY" behind the LFS text selecting those specific commands to run after the install is complete? WHY is the binary moved to /bin? WHY are the symlinks "necessary"? Etc.

I'll confess my issue may be lack of experience with Linux, this is my effort to learn more about it at a deeper level so I may be missing something fundamental here. I'm doing a lot of ancillary reading including looking up items in The Linux Programmer Interface text and multiple sources online too as I go. So I'm trying to gain a better understanding of why the LFS text chooses to run certain post-install commands that often aren't explained.

Thanks.

Last edited by davecan; 12-29-2019 at 10:05 AM.
 
Old 12-29-2019, 10:12 AM   #6
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,658
Blog Entries: 19

Rep: Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480
I explained this above. Essential libraries have to be in /lib, not in /usr/lib. Essential commands have to be in /bin or /sbin. This includes gzip and bzip2. gunzip and bunzip2 are symbolic links to these and are also required to be in /bin. Less essential variants of these programs such as zgrep and bzgrep can stay in /usr/lib where they were originally installed.

In the past, /usr was often a separate partition. Sometimes there was only one copy of it mounted on the office server and other machines mounted it remotely. If the network went down or if something went wrong with that drive, you needed to have all the essential tools on your root partition.

Last edited by hazel; 12-29-2019 at 10:20 AM.
 
Old 12-29-2019, 11:00 AM   #7
davecan
Member
 
Registered: Nov 2019
Posts: 45

Original Poster
Rep: Reputation: Disabled
Quote:
Essential libraries have to be in /lib, not in /usr/lib. Essential commands have to be in /bin or /sbin.
Ok got it. For some reason that wasn't clicking with me until now. I've read a bit about essential (for boot) vs non-essential programs & libs so I get the gist here.

So this sparks another related question (and hopefully I'm not too annoying!) -- how do we know if a particular program or library is "essential" to system function? I mean beyond "because it's in /bin or /sbin or /lib" which is circular -- since we are building LFS then there is prior knowledge required to determine which programs/libs are essential vs non-essential, but how did the LFS authors decide which programs are "essential" vs not?

Is there a master list somewhere of which programs and libs are "essential" to Linux? Or is it just a matter of trial and error experience over time?
 
Old 12-29-2019, 11:03 AM   #8
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,658
Blog Entries: 19

Rep: Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480
That's what the official file system hierarchy is for!

Last edited by hazel; 12-29-2019 at 11:05 AM.
 
Old 12-29-2019, 11:14 AM   #9
davecan
Member
 
Registered: Nov 2019
Posts: 45

Original Poster
Rep: Reputation: Disabled
Gah! I had looked at the FHS layout but never realized it actually defined the bins & libs needed.

This answers so many questions!

THANK YOU!!!
 
Old 12-29-2019, 11:35 AM   #10
davecan
Member
 
Registered: Nov 2019
Posts: 45

Original Poster
Rep: Reputation: Disabled
Ok so there's another question spawning from this...

The FHS standard entry for /lib doesn't really specify which files must be in /lib other than the C library and linker.

LFS 6.25 (Attr) has this post-install instruction: (also 6.26-6.27 and several others throughout the book IIRC)

Quote:
The shared library needs to be moved to /lib, and as a result the .so file in /usr/lib will need to be recreated
How do the LFS authors make this decision? If it is essential to boot why isn't it defined in the FHS? How do we go about determining if a particular library belongs in /lib other than "because the book says so"?

BTW this has been hugely helpful in boosting my understanding of what the LFS book is doing so I greatly appreciate the responses so far.

Last edited by davecan; 12-29-2019 at 11:36 AM.
 
Old 12-29-2019, 12:22 PM   #11
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,658
Blog Entries: 19

Rep: Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480
It has to be in /lib if programs in /bin or /sbin use it.
 
Old 12-29-2019, 03:21 PM   #12
davecan
Member
 
Registered: Nov 2019
Posts: 45

Original Poster
Rep: Reputation: Disabled
And that one sentence closes my knowledge gap. For some reason I was reading the statement in the FHS docs incorrectly and now rereading it its blatantly obvious.

Thank you again hazel you have been extremely helpful as always!

Last edited by davecan; 12-29-2019 at 03:22 PM.
 
  


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] No package 'x11' found No package 'xext' found No package 'xdamage' found No package 'xfixes' found No package 'x11-xcb' found Jigsaw Linux From Scratch 14 02-23-2021 08:35 PM
Seeking Summary of Features (Commands?) Included in the various options in Centos 7 install oldnsweet Linux - Newbie 2 04-26-2019 10:34 AM
[SOLVED] "log_fqdn on" and "logformat" aren't included in the conf. file ?‏ ngiw2012 Linux - Software 3 06-05-2014 12:36 AM
How to add features to a kernel, what steps and why these steps are taken. Siljrath Linux - General 1 03-30-2013 08:53 AM
Why swaret and slapt-get aren't doing their work properly...! gamehack Slackware 3 04-06-2004 05:23 PM

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

All times are GMT -5. The time now is 08:54 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