Letters

Lazy Fully Scripted—Linux from Scratch

I really enjoyed Petros Koutoupis' article on building your own distro (see "DIY: Build a Custom Minimal Linux Distribution from Source" from the June 2018 issue). I have not had the time to build it yet, but I will. Also I'm very interested in building Fedora SPINS, mostly minimal because with adding PHP, NodeJS, Ruby, etc., it's very easy to eat up HDD space. I found a post from Alagappan Karthikeyan from India on building his own distro in three hours, based on Ubuntu.

But the video that impressed me the most was Tutorial: Linux from Scratch by Anton, and he has four videos on time lapse and successfully builds LFS. I got the book, but I never successfully did an installation.

I remember in one of my RHCE classes the instructor mentioned that everybody can copy/paste, and still it takes a good deal of time, but why not...so I put together a set of shell scripts to accomplish this task: https://github.com/dinooz/lfslfs/blob/master/lfslfs_get_started.sh. Requirements:

1) The scripts will be executed in the same order they are listed.

2) VirtualBox→Xubuntu Live CD and HDD with 10GB HDD.

3) As xubuntu:


wget https://raw.githubusercontent.com/dinooz/lfslfs/
↪master/lfslfs_get_started.sh
chmod 755 lfslfs_get_started.sh
./lfslfs_get_started.sh

4) All the needed shell scripts will be right there at your fingertips, executing one at a time, and will follow exactly as reading the online LFS.

5) Some scripts will be absolutely necessary to run as root and others as lfs, and the generic as xubuntu for generic OS checks.

I have a video that illustrates the first part of the scripts installing the temp system. Some notes are required for the second part because bash breaks the shell script, that's why I copy ... software2.sh to another script to continue the execution.

I'm happy to say that I've learned a lot from this first part. I'm looking forward to another script recipe for X, depending on the desired environment, and who knows, maybe a package manager. I just wanted to share this with you guys. Keep doing a great job.

—Dinooz

Petros Koutoupis replies: Bernardino (Dinooz), thank you very much for the encouraging words. Traditional LFS cookbooks are written to build custom and more fully featured distributions (that is, with more packages) on (and only for) your local machine. The recipes provided on the official website are a wonderful source of information. Unfortunately, not many individuals are able to operate in such an environment, which is why I decided to take the cross-compilation route. The general theme behind the cross-compiled and lightweight Linux distribution is centered around building your minimal distribution for whatever architecture on your local machine and in a sandboxed environment. Then take the final image and deploy it anywhere—physical or virtual machine.

I do appreciate you bringing this GitHub project to my attention. For those who wish to build a more fully featured Linux distribution from source, these scripts definitely can help without the headache of running each command one at a time (copied from the cookbook and pasted into the CLI). In the interim, I have noted your suggestions. Since the publication of that guide, many have requested a second part. I definitely can look into adding a graphical environment and building a minimal X equipped with a basic window manager. Package management may be a tricky one.

Thank you again!

PEP 572

Regarding Reuven M. Lerner's "Python and Its Community Enter a New Phase" in the August 2018 issue: I'm not a fan of Python primarily because of its significant whitespace feature and the 2 vs. 3 incompatibility, although the significant whitespace generally causes me more grief than does the 2 vs. 3 issues. But it's incredibly useful because of the large collection of modules available, so I find it invaluable for rapid prototyping.

From the perspective of a non-sophisticated user of Python, I can't see the reason for all this controversy and animosity for a change that lets code like this:


x = 5

while x := x - 1:

    print(f"x is {x}")

now work, while still allowing code like this not to work as before:


x = 5

while x = x - 1:

    print(f"x is {x}")

What am I missing that makes this a "big deal"? It's been a part of C forever.

However, the print function in the example looks strange to me, so I tested it in a Python 3.5.2 interactive session, and I got this:


>>> x=3
>>> print(f"x is {x}")
  File "<stdin>", line 1
    print(f"x is {x}")
                      ^
SyntaxError: invalid syntax

So is there a typo in the article? Or is it a Python 3.5.2 vs. newer version issue?

—wally

Reuven M. Lerner replies: Yes, "f-strings", as they're known, were introduced in Python 3.6. The leading "f" before the opening quote allows you to evaluate anything within curly braces in a string. Thus:


x = 5
y = 2
print(f"{x} + {y} = {x+y}")

Before version 3.6, this would give you an error, as you saw.

Erratum: #geeklife Article in the August 2018 Issue

As a motor-home camper for the last 16 years, I was very interested in Kyle Rankin's "#geeklife: weBoost 4G-X OTR Review". The problems are very familiar to those of us who spend extended time far from civilization. I was very interested in the review of the weBoost, although I assume the captions on the external antenna pictures were interchanged.

Keep up the good work on LJ.

—norm scherer

Yes, unfortunately those photos were accidentally switched during layout of that issue. It has been corrected on the website, so see the article here for the corrected photos/captions.—Ed.

Server Automation

Bravo for Adam McPartlan's "Easy SSH Automation" tip in the August 2018 issue of LJ.

This is by far the clearest recipe for setting up passwordless login that I've seen—a task I've done countless times, but each time with trepidation.

I'd love to see more server automation scripts from Adam and others.

—Lloyd

Adam McPartlan replies: Thanks for the feedback. There is an excellent article written by Kyle Rankin and published by Linux Journal regarding the use of the ssh-agent, which is worth reading to help make things a little more secure for you while maintaining a key exchange-based authentication: "Secret Agent Man".

Server automation is a big subject, and there are many great tools. Using the bash script method is a good exercise. I have done work for companies that refused to accept the new tools of the trade like Ansible, so it's nice to get a good understanding of how you can achieve similar results. Most of my server automation is derived from the script shared in the article. I have used it to reboot servers, install and configure software, restart services, copy files, query databases and pull reports.

I also recommend reading up on expect scripting. This can help with working on many different network devices deploying new vlans, updating ntp settings and adding radius servers. I'll be sure to share in due course.

From Social Media

Mike Malveaux @m_mlvx: Mike Malveaux Retweeted linuxjournal: A bit of context for Microsoft buying a seat on the Linux Foundation, and being a top-ten contributor to Linux.

Here be dragons.

linuxjournal @linuxjournal: Good Lockdown vs. Bad by @zackrobat: There's an ongoing series of skirmishes between corporations who want to sell products that users don't fully control and the kernel developers who want users to be the highest... https://www.linuxjournal.com/content/good-lockdown-vs-bad

Mr. Penguin @0pensource: Canonical shifted its emphasis to the #cloud a few years back mainly because of the failure of #Linux to establish itself on the desktop.

And, it may turn out to be one of the best things ever to have happened to #opensource.

Jim Hall @jimfhall: An older article, but a good read. I use my @Raspberry_Pi at home as a backup server, print server, and (soon) streaming music server. It's easy! via @linuxjournal Raspberry Pi: the Perfect Home Server https://www.linuxjournal.com/content/raspberry-pi-perfect-home-server

Keith Bennett @keithrbennett: Today I downloaded Linux-Journal-2018-08.pdf and was reminded of this exchange. 4 years ago I asked Linux Journal to give their issue filenames names more logical and helpful. To their credit, they took the suggestion. Kudos, @linuxjournal. Also, sometimes it pays to speak up.

hans marcus @hansoegaboega:

Blockchain

Joachim Nilsson @troglobit: FollowFollow @troglobit. Joachim Nilsson Retweeted linuxjournal: If you're a long-time Linux user like me, it's time to step up. Let's all subscribe to Linux Journal! Quality articles written by great journalists (unlike you and me), with interesting topics for both the n00b, intermediate and advanced user. #linux #opensource

Send LJ a Letter

We'd love to hear your feedback on the magazine and specific articles. Please write us here or send email to ljeditor@linuxjournal.com.

Photos

Send your Linux-related photos to ljeditor@linuxjournal.com, and we'll publish the best ones here.

LJ290-LJHouse