Sunday, June 2, 2019

LFS book steps through 2.4

So I have started reading through the book I produced at the end of my last session.

Step 1.1 'How to build an LFS System' says one will need an existing distribution or live system for the tools to prep the LFS system.  WaHOO!!! my last 3 blog posts on just getting a persistent gentoo live usb system should qualify for this step.  One step down... lots to go.

Step 1.2 is just the list of new features.  Since I am working from the SVN repo of the book, the most recent changes are about 2 weeks old.  I did note that one of the updated packages in this revision is E2fsprogs version.  Debating if I even need/want support for the ext family of filesystems.  I plan on going whole-hog with ZFS, which will require deviating from the instructions to support any way.  Two steps down... lots to go

Step 1.3 is the change log, I did review the change log and most of the track tickets.  Most appear to be updating to new minor revisions of the software from the last 'stable' version of the book.  Some are fixes to minor build issues.  Three steps down... lots to go.

Step 1.4 is resources, good to know, nothing to do.  Four steps down... lots to go.

Step 1.5 asking for help, also good to know, nothing to do.  Five steps down... lots to go.

Step 2.2 version checks of host system:
  • Bash 3.2 (/bin/sh should be a symbolic or hard link to bash)
    • bash --version 
    • GNU bash, version 4.3.46(1)-release (x86_64-pc-linux-gnu)                                                             
      Copyright (C) 2013 Free Software Foundation, Inc.                                                                     
      License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>                                         
                                                                                                                            
      This is free software; you are free to change and redistribute it.                                                    
      There is NO WARRANTY, to the extent permitted by law.     
      
    • ls -l /bin/sh
    • lrwxrwxrwx 1 root root 4 Jun 23  2016 /bin/sh -> bash 
      
  • Binutils-2.25 (Versions greater than 2.32 are not recommended as they have not been tested)
    • emerge --search binutils
    • *  sys-devel/binutils                                                                                                 
            Latest version available: 2.25.1-r1                                                                             
            Latest version installed: 2.25.1-r1                                                                             
            Size of files: 23616 KiB                                                                                        
            Homepage:      https://sourceware.org/binutils/                                                                 
            Description:   Tools necessary to build programs                                                                
            License:       || ( GPL-3 LGPL-3 )                    
      
  •  Bison-2.7 (/usr/bin/yacc should be a link to bison or small script that executes bison) 
    • yacc --version
    • bison (GNU Bison) 3.0.4
      Written by Robert Corbett and Richard Stallman.
      
      Copyright (C) 2015 Free Software Foundation, Inc.
      This is free software; see the source for copying conditions.  There is NO
      warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
      
      
    • ls ls -l `which yacc`
    • lrwxrwxrwx 1 root root 10 Oct 28  2015 /usr/bin/yacc -> yacc.bison
      
      
  • Bzip2-1.0.4
    • bzip2 --version
    • bzip2, a block-sorting file compressor.  Version 1.0.6, 6-Sept-2010.
         
         Copyright (C) 1996-2010 by Julian Seward.
         
         This program is free software; you can redistribute it and/or modify
         it under the terms set out in the LICENSE file, which is included
         in the bzip2-1.0.6 source distribution.
         
         This program is distributed in the hope that it will be useful,
         but WITHOUT ANY WARRANTY; without even the implied warranty of
         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
         LICENSE file for more details.
         
      bzip2: I won't write compressed data to a terminal.
      bzip2: For help, type: `bzip2 --help'.
      
      
  •  Coreutils-6.9 
    • emerge --search coreutils
    • 
      *  sys-apps/coreutils
            Latest version available: 8.25
            Latest version installed: 8.25
            Size of files: 5641 KiB
            Homepage:      https://www.gnu.org/software/coreutils/
            Description:   Standard GNU file utilities (chmod, cp, dd, dir, ls...), text utilities (sort, tr, head, wc..), and shell utilities (whoami, who,...)
            License:       GPL-3
      
      
  •  Diffutils-2.8.1
    • emerge --search diffutils 
    • *  sys-apps/diffutils
            Latest version available: 3.3
            Latest version installed: 3.3
            Size of files: 1170 KiB
            Homepage:      https://www.gnu.org/software/diffutils/
            Description:   Tools to make diffs and compare files
            License:       GPL-2
      
      
  •  Findutils-4.2.31
    •  emerge --search findutils
    • *  sys-apps/findutils
            Latest version available: 4.6.0-r1
            Latest version installed: 4.6.0-r1
            Size of files: 3692 KiB
            Homepage:      https://www.gnu.org/software/findutils/
            Description:   GNU utilities for finding files
            License:       GPL-3+
      
      
  •  Gawk-4.0.1 (/usr/bin/awk should be a link to gawk) 
    • awk --version
    • GNU Awk 4.1.3, API: 1.1
      Copyright (C) 1989, 1991-2015 Free Software Foundation.
      
      This program is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published by
      the Free Software Foundation; either version 3 of the License, or
      (at your option) any later version.
      
      This program is distributed in the hope that it will be useful,
      but WITHOUT ANY WARRANTY; without even the implied warranty of
      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      GNU General Public License for more details.
      
      You should have received a copy of the GNU General Public License
      along with this program. If not, see http://www.gnu.org/licenses/.
      
      
    • ls -l `which awk`
    • lrwxrwxrwx 1 root root 4 Oct 28  2015 /usr/bin/awk -> gawk
      
      
  •  GCC-5.2 including the C++ compiler, g++ (Versions greater than 9.1.0 are not recommended as they have not been tested) 
    • gcc --version
    • gcc (Gentoo 5.4.0 p1.0, pie-0.6.5) 5.4.0
      Copyright (C) 2015 Free Software Foundation, Inc.
      This is free software; see the source for copying conditions.  There is NO
      warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
      
      
    • g++ --version
    • g++ (Gentoo 5.4.0 p1.0, pie-0.6.5) 5.4.0
      Copyright (C) 2015 Free Software Foundation, Inc.
      This is free software; see the source for copying conditions.  There is NO
      warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
      
      
  •  Glibc-2.11 (Versions greater than 2.29 are not recommended as they have not been tested) 
    • emerge --search glibc
    • *  sys-libs/glibc
            Latest version available: 2.23-r2
            Latest version installed: 2.23-r2
            Size of files: 21241 KiB
            Homepage:      https://www.gnu.org/software/libc/libc.html
            Description:   GNU libc6 (also called glibc2) C library
            License:       LGPL-2.1+ BSD HPND ISC inner-net rc PCRE
      
      
  •  Grep-2.5.1a
    • grep --version
    • grep (GNU grep) 2.25
      Copyright (C) 2016 Free Software Foundation, Inc.
      License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
      This is free software: you are free to change and redistribute it.
      There is NO WARRANTY, to the extent permitted by law.
      
      Written by Mike Haertel and others, see <http://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>.
      
      
  •  Gzip-1.3.12
    • gzip --version
    • gzip 1.8
      Copyright (C) 2016 Free Software Foundation, Inc.
      Copyright (C) 1993 Jean-loup Gailly.
      This is free software.  You may redistribute copies of it under the terms of
      the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
      There is NO WARRANTY, to the extent permitted by law.
      
      Written by Jean-loup Gailly.
      
      
  •  Linux Kernel-3.2
    • uname -a 
    • Linux livecd 4.5.2-aufs-r1 #1 SMP Sun Jul 3 17:17:11 UTC 2016 x86_64 AMD Ryzen Threadripper 2950X 16-Core Processor AuthenticAMD GNU/Linux
      
      
  •  M4-1.4.10 
    • m4 --version 
    • m4 (GNU M4) 1.4.17
      Copyright (C) 2013 Free Software Foundation, Inc.
      License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
      This is free software: you are free to change and redistribute it.
      There is NO WARRANTY, to the extent permitted by law.
      
      Written by Rene' Seindal.
      
      
  •  Make-4.0
    • make --version 
    • GNU Make 4.2.1
      Built for x86_64-pc-linux-gnu
      Copyright (C) 1988-2016 Free Software Foundation, Inc.
      License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
      This is free software: you are free to change and redistribute it.
      There is NO WARRANTY, to the extent permitted by law.
      
      
  •  Patch-2.5.4
    •  patch --version
    • GNU patch 2.7.5
      Copyright (C) 2003, 2009-2012 Free Software Foundation, Inc.
      Copyright (C) 1988 Larry Wall
      
      License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
      This is free software: you are free to change and redistribute it.
      There is NO WARRANTY, to the extent permitted by law.
      
      Written by Larry Wall and Paul Eggert
      
      
  •  Perl-5.8.8 
    •  perl --version
    • 
      This is perl 5, version 24, subversion 0 (v5.24.0) built for x86_64-linux
      (with 28 registered patches, see perl -V for more detail)
      
      Copyright 1987-2016, Larry Wall
      
      Perl may be copied only under the terms of either the Artistic License or the
      GNU General Public License, which may be found in the Perl 5 source kit.
      
      Complete documentation for Perl, including FAQ lists, should be found on
      this system using "man perl" or "perldoc perl".  If you have access to the
      Internet, point your browser at http://www.perl.org/, the Perl Home Page.
      
      
      
  •  Python-3.4
    •  python --version
    • Python 3.4.4
      
      
  •  Sed-4.1.5 
    •  sed --version
    • sed (GNU sed) 4.2.2
      Copyright (C) 2012 Free Software Foundation, Inc.
      License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
      This is free software: you are free to change and redistribute it.
      There is NO WARRANTY, to the extent permitted by law.
      
      Written by Jay Fenlason, Tom Lord, Ken Pizzini,
      and Paolo Bonzini.
      GNU sed home page: <http://www.gnu.org/software/sed/>.
      General help using GNU software: <http://www.gnu.org/gethelp/>.
      E-mail bug reports to: <bug-sed@gnu.org>.
      Be sure to include the word ``sed'' somewhere in the ``Subject:'' field.
      
      
  •  Tar-1.22
    •  tar --version
    • tar (GNU tar) 1.29
      Copyright (C) 2015 Free Software Foundation, Inc.
      License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
      This is free software: you are free to change and redistribute it.
      There is NO WARRANTY, to the extent permitted by law.
      
      Written by John Gilmore and Jay Fenlason.
      
      
  •  Texinfo-4.7
    •  info --version
    • info (GNU texinfo) 6.1
      
      Copyright (C) 2016 Free Software Foundation, Inc.
      License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
      This is free software: you are free to change and redistribute it.
      There is NO WARRANTY, to the extent permitted by law.
      
      
  •  Xz-5.0.0
    •  xz --version
    • xz (XZ Utils) 5.2.2
      liblzma 5.2.2
      
      
After I get to the bottom of the list, manually verifying as I go, I note that the instructions include a script to verify that the host system has all the proper tools and versions.  The script is as follows:


cat > version-check.sh << "EOF"
#!/bin/bash
# Simple script to list version numbers of critical development tools
export LC_ALL=C
bash --version | head -n1 | cut -d" " -f2-4
MYSH=$(readlink -f /bin/sh)
echo "/bin/sh -> $MYSH"
echo $MYSH | grep -q bash || echo "ERROR: /bin/sh does not point to bash"
unset MYSH

echo -n "Binutils: "; ld --version | head -n1 | cut -d" " -f3-
bison --version | head -n1

if [ -h /usr/bin/yacc ]; then
  echo "/usr/bin/yacc -> `readlink -f /usr/bin/yacc`";
elif [ -x /usr/bin/yacc ]; then
  echo yacc is `/usr/bin/yacc --version | head -n1`
else
  echo "yacc not found" 
fi

bzip2 --version 2>&1 < /dev/null | head -n1 | cut -d" " -f1,6-
echo -n "Coreutils: "; chown --version | head -n1 | cut -d")" -f2
diff --version | head -n1
find --version | head -n1
gawk --version | head -n1

if [ -h /usr/bin/awk ]; then
  echo "/usr/bin/awk -> `readlink -f /usr/bin/awk`";
elif [ -x /usr/bin/awk ]; then
  echo awk is `/usr/bin/awk --version | head -n1`
else 
  echo "awk not found" 
fi

gcc --version | head -n1
g++ --version | head -n1
ldd --version | head -n1 | cut -d" " -f2-  # glibc version
grep --version | head -n1
gzip --version | head -n1
cat /proc/version
m4 --version | head -n1
make --version | head -n1
patch --version | head -n1
echo Perl `perl -V:version`
python3 --version
sed --version | head -n1
tar --version | head -n1
makeinfo --version | head -n1  # texinfo version
xz --version | head -n1

echo 'int main(){}' > dummy.c && g++ -o dummy dummy.c
if [ -x dummy ]
  then echo "g++ compilation OK";
  else echo "g++ compilation failed"; fi
rm -f dummy.c dummy
EOF

bash version-check.sh

So after reading through the script for hidden dangers (you should always audit scripts and source...) I put the contents of the 'version-check.sh' into /gentooScratch/scripts/host-version-check.sh, mark it is executable and obtained the following output:


gentoo@livecd /gentooScratch/scripts $ vi ./host-version-check.sh 
gentoo@livecd /gentooScratch/scripts $ ./host-version-check.sh 
bash, version 4.3.46(1)-release
/bin/sh -> /bin/bash
Binutils: (Gentoo 2.25.1 p1.1) 2.25.1
bison (GNU Bison) 3.0.4
/usr/bin/yacc -> /usr/bin/yacc.bison
bzip2,  Version 1.0.6, 6-Sept-2010.
Coreutils:  8.25
diff (GNU diffutils) 3.3
find (GNU findutils) 4.6.0
GNU Awk 4.1.3, API: 1.1
/usr/bin/awk -> /usr/bin/gawk
gcc (Gentoo 5.4.0 p1.0, pie-0.6.5) 5.4.0
g++ (Gentoo 5.4.0 p1.0, pie-0.6.5) 5.4.0
(Gentoo 2.23-r2 p4) 2.23
grep (GNU grep) 2.25
gzip 1.8
Linux version 4.5.2-aufs-r1 (root@jasmin) (gcc version 5.4.0 (Gentoo 5.4.0 p1.0, pie-0.6.5) ) #1 SMP Sun Jul 3 17:17:11 UTC 2016
m4 (GNU M4) 1.4.17
GNU Make 4.2.1
GNU patch 2.7.5
Perl version='5.24.0';
Python 3.4.4
sed (GNU sed) 4.2.2
tar (GNU tar) 1.29
texi2any (GNU texinfo) 6.1
xz (XZ Utils) 5.2.2
g++ compilation OK
gentoo@livecd /gentooScratch/scripts $ sudo zfs snapshot -r gentooScratch/scripts@host_versions_checked

So now my host system has passed all the prerequisites for building LFS. Six steps down... lots to go.

Section 2.3 discusses the state of the system, needing to be careful when restarting/rebooting.  Part of the reason I spent so much effort on setting up my Gentoo live USB persistent system was to make it easier to reconfigure any system environments needed for a perticular set of steps.  I will be making use of my /gentooScratch/scripts directory to record import environment info to allow me to reboot and get back to the proper state.  I will probably need to refer back to this section as I work.  Seven steps down... lots to go.

Section 2.4 'Creating a New Partition'.  I will be heavily deviating in this section.  For one I will be building a ZFS root pool, this will require an initramfs (advanced topic in the Note, typically not recommended for first time LFS users...).  In addition the instructions appear to be tailored to a BIOS based boot.  My new modern system is all EFI.  The old-tried-and-true amount of swap=2x available sounds a bit ridicules on my 64GB server, however since I do plan on running multiple VMs, some which may at time not be very active, and I have plenty of space on my nVME system drive I will over-provision the swap space at 128GB. Initially I will only activate 1/4 of the swap, untill I find additional need for swap latter. I will provide an overly large EFI partition for future kernels and other EFI boot utilities of 1200MB.  The section also lists convenience partitions:
  • /boot
    • Will not be creating this partition, my EFI partition will be mounted /esp (EFI System Partition)
  • /home
    • Will create a temporary zfs system on the root pool, will be migrated to my redundant zpool later, and will be the migrated data from my existing file server
  • /usr
    • Will create a zfs file system on the root pool.
  • /opt
    • Will crate a temporary zfs system on the root pool, will be migrated to my redundant zpool later.
  • /tmp
    • Will create a zfs mount point, but probably overlay with a tmpfs using ram.
  • /usr/src
    • Will create a temporary zfs system on the root pool, will be migrated to my redundant zpool later.
In addition I will be using the tool gdisk, not fdisk or cfdisk with the command:
sudo gdisk /dev/nvme0n1
After I layout my partitions, this is what the primary nVME boot device looks like


gentoo@livecd ~ $ sudo gdisk -l /dev/nvme0n1
GPT fdisk (gdisk) version 1.0.1

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.
Disk /dev/nvme0n1: 3750748848 sectors, 1.7 TiB
Logical sector size: 512 bytes
Disk identifier (GUID): C55485FA-4146-4D15-9E74-30036CAFF5C6
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 3750748814
Partitions will be aligned on 2048-sector boundaries
Total free space is 3228197485 sectors (1.5 TiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048         2459647   1.2 GiB     EF00  EFI System
   2         2459648        69568511   32.0 GiB    8200  Linux swap
   3        69568512       136677375   32.0 GiB    8200  Linux swap
   4       136677376       203786239   32.0 GiB    8200  Linux swap
   5       203786240       270895103   32.0 GiB    8200  Linux swap
   6       270895104       522553343   120.0 GiB   BF00  Solaris root


Seven steps down... lots to go. For now this will be a good stopping point.




No comments:

Post a Comment