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 01-12-2019, 12:55 PM   #1
Luridis
Member
 
Registered: Mar 2014
Location: Texas
Distribution: LFS 9.0 Custom, Merged Usr, Linux 4.19.x
Posts: 616

Rep: Reputation: 167Reputation: 167
Lightbulb Anyone tried a completely static LFS?


I'm just curious. Has anyone tried removing LD from the picture all together? How did it run? Performance? Memory usage?

I try different setups on occasion. In fact, years ago (mid 2000's), even before people started ranting about it on the internet, I started building my LFS with a merged /usr and have never went back. (Yes, even with sysvinit...) It reduced so much complexity, especially during the build. Basically, my systems look like this:
Code:
/bin   -> /usr/bin
/sbin  -> /usr/sbin
/lib   -> /usr/lib
/lib64 -> /usr/lib64
It gets rid of all those library symlinks /lib/*.so{,.*} -> /usr/lib and more than a few from the bin directories. I've never had a need for the split user and commercial Unixes got rid of that stuff in the 90's. (Why its existence confused me on Linux.)

Last edited by Luridis; 01-12-2019 at 12:57 PM.
 
Old 01-12-2019, 03:17 PM   #2
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,292

Rep: Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322
To answer your question on behalf of others, I think the answer is no, they didn't. I did mistakenly not transfer in chapter 6 from the old toolchain of the host OS to the newly built system, and that came unstuck, forcing me back.

Yes, you are correct, there is no need for a separate / & /usr partition these days. It was a good idea originally, but memory and disk space have increased beyond all imagining over the decades.

As for doing everything statically, yes, you can do it, and probably get away with it too. But what's the benefit of every program holding chunks of the same libraries. Show me the advantage.

Johnny Cash had a song about a shoplifting factory worker at GM who gradually shoplifted a car
Quote:
I got it one piece at a time
And it didn't cost me a dime
So he had a model '48,'49,'540,'51-->64(?) car. Modern pcs are sufficiently forgiving to stand up an OS like Johnny Cash's car, but I fail to see the improvement. The symlinks in most cases are to the same dir, unless someone's been hacking the system already. Then you might get lib -->/usr/lib or vice versa
 
Old 01-13-2019, 11:00 AM   #3
Luridis
Member
 
Registered: Mar 2014
Location: Texas
Distribution: LFS 9.0 Custom, Merged Usr, Linux 4.19.x
Posts: 616

Original Poster
Rep: Reputation: 167Reputation: 167
Quote:
Originally Posted by business_kid View Post
As for doing everything statically, yes, you can do it, and probably get away with it too. But what's the benefit of every program holding chunks of the same libraries. Show me the advantage.
You've never really thought about it, have you? Let just say that there would be many implications; some good, some bad, and many that would surprise you.

Here is one example: Suppose I created an app that used say... 5 or 6 different libraries in addition to libc on a current Arch Linux system. When compiling I chose static linking and the flags -march=x86-64 -mtune=generic. That binary's only requirements are only: an amd64+ processor, a Linux kernel > 3.2 (or compatible ABI), a recent glibc and a posix shell (assuming it uses one). Whether or not you have those 5 other libraries is unimportant, what versions of them you have is unimportant. Them having optional cross linked features is unimportant. (example: mesa-cairo-gl build loop) The application will run regardless.

In recent years I've seen a number of people talking about static linking in container apps for just this reason. This however, is not a new idea, look up something called slinky if you're curious. That said, with memory getting cheaper and on-die caches getting larger. I wonder how long until people decide that building in such a way, regardless of the extra runtime resource requirements, is worth it. Because, it reduces a ton of complexity in the system. i.e. ABI over API.
 
Old 01-13-2019, 02:14 PM   #4
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,292

Rep: Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322
Received wisdom is that it's not a good idea. People most often cite memory, but that's increasingly a moot point.
Your point about containerized apps makes sense, but only in the case of malicious libs loaded on your hd, which implies a write on your system using root permissions has been accomplished, and your own system cannot be relied on. That's a Windoze type issue, not a linux one, surely?
VMs are in common use containerizing apps on servers. Hack the app, and all you get is an empty OS. A static system doesn't offer that level of protection. Admittedly, Meltdown & Spectre opened issues there, but Intel, AMD, & ARM seem well on the way to closing them.

Why don't you ignore the naysayer (me), build the system, and find out? Back up, disconnect the disk, Drop the firewall, and get the nasty guys in to have a go?
 
Old 01-15-2019, 07:15 AM   #5
bryan_S
Member
 
Registered: Aug 2014
Location: N. Florida
Distribution: LinuxfromScratch, OpenSuse, Slackware
Posts: 107

Rep: Reputation: Disabled
I use a similar filesystem layout except lib64/ is a directory on rootfs as per book and no lib64 in /usr. This greatly reduces the number of instructions to complete chapter 6. And, it has the added benefit you actually have to think about what those post-install 'adjustment' commands are doing and either omit them or adjust for your own layout (e.g. ncurses and bzip2 come to mind).

I've been having similar thoughts about other deviations from the book. I think that is the whole point - once you are proficient and actually using your system - think about how to 'break the book' (and not trash your system). There are a lot of --disable-static commands in B/LFS. I use Crux pkgutils for package management and looking at their build scripts, they usually build the static libs as well.
 
  


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
Has anyone heard of ROBOLINUX? I tried going there but no replies from anyone rusty377 Linux - Newbie 14 07-21-2018 08:54 AM
[SOLVED] LFS 6.7 : $LFS/sources and $LFS/tools folders missing prakashsince92 Linux From Scratch 5 12-09-2010 02:26 PM
Has anyone tried to use package management conary to build LFS? jery_wang2002 Linux From Scratch 1 05-31-2005 06:30 PM
my ps/2's wheel doesn't work. tried and tried but failed. Choey Linux - Hardware 5 09-17-2003 06:47 PM
I have tried and tried, I really have! Ewen Linux - General 13 01-14-2003 11:31 PM

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

All times are GMT -5. The time now is 10:44 PM.

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