Monday, May 27, 2019

Initial Software Install

So today I am preparing to actually install LFS.

I decided I was going to go ahead and support Dual-Boot with Windows 10.  This will allow me to continue to take breaks and do some gaming prior to getting Looking Glass working.  Since Microsoft installers are still not friendly towards multi-boot systems, I installed Windows 10 Pro first, carving about half of the WD Black 500G SSD from the secondary NVMe.  Now that the Win10 partitions have been reserved, and the Windows boot loader installed, I can configure my LFS partitions and boot settings around it.

The next decision to make is which set of instructions I should follow.
  • The standard stable version, ver. 8.4 from Feb 28 2019, can be found here.
    • Standard system based on the conventional Sys V init system. 
  • The current systemd stable, ver 8.4 from Feb 28 2019, can be found here
    • Based on the standard, but revised to support systemd.
  • The standard development version, the daily render is here.
    • Can change daily.
    • Available via subversion to re-render the book as patches to the system are made.
    • Could have instructions that are temporarily broken.
    • Not recommended for inexperienced LFS'ers. 
    • May use newer versions of packages.
  • The systemd development version, the daily render is here.
    • All the same caveats of the standard development version, but revised to support systemd.
With decades of Linux experience under my belt I am not daunted by the development versions not being recommended for inexperienced LFS'ers.  This may be my first attempt on installing a LFS system, but over the years I have performed many of the tasks listed in the book to either repair or customize other Linux distros.  In addition I plan on heavily customizing the base system to fit my needs for ZFS and virtualization server.  The patches/errata/hints on some of these changes/additions are woefully out-of-date or incomplete, so I will be experimenting, and perhaps even contributing back to the project with updated information on these features.

With the development branch chosen, that only leaves the question of which edition: init or systemd.  My friends over the last couple of years have heard me complain loudly about upstart and/or systemd making everything more difficult... I am sorely tempted to use the standard init edition, just because of my familiarity with init.  In the end I decided to use the systemd edition.  More and more modern distros are standardizing on systemd.  Intellectually I understand and like the benefits that a modern unit based dependency system  provides.  It is just me being a crotchety old man, yelling "Get Off My Lawn", wanting the old easy comforts of a classic init system.  Choosing the systemd edition will include additional growing pains, and hopefully in learning how to configure systemd from scratch will make life easier in the future with other distros.

So now the initial 'install'.  The first thing I need is to allocate some permanent working space on my Live Gentoo USB for instructions, source, and tools I will need along the way.  The default live Gentoo image does not appear to support a persistent change file across reboots.  I know, with a bit of effort and customization I *could* fix this to be more like an Ubuntu live usb, with persistent storage.  Instead I am going to just proceed with creating some loop-back "device" files in the free space on the underlying flash drive.  I am using a SanDisk Ultra 32GB USB 3.0 flash disk.  The Live Gentoo system is using about 2GB  of that up, leaving a little over 25 GB free:

$ df -h /dev/sda

Since this USB is a UEFI boot device it is limited to being FAT32.  The FAT32 file system will only support maximum file sizes of 4GB, so I will have to work around that if I need additional space with multiple mounts. I went ahead and created my initial faux device:

$ sudo mkdir -p /mnt/cdrom/scratch/LFSBootstrap/
$ sudo dd if=/dev/zero of=/mnt/cdrom/scratch/LFSBootstrap/disk1.img bs=4MB count=1000
$ ls -l /mnt/cdrom/scratch/LFSBootstrap/disk1.img
$ ls -lh /mnt/cdrom/scratch/LFSBootstrap/disk1.img


And now to find the best available files system supported by the Gentoo live image for my persistent data:

$ cat /proc/filesystems

WOW, I did not expect this.  It has been a while since I last used a live Gentoo DVD, so I had no idea... Out of the box my Live image supports ZFS!!! I was totally expecting that I would have to bootstrap my ZFS support by building the kernel modules and tools from source.  The fact that Gentoo supports ZFS out of the box is going to save me a bit of time.  It also simplifies the decision on my persistent storage AND I will have the ability to add additional files to the pool as I work if the first 4GB is not enough.

So onto creating my LFS documentation and source repository space.  I will be using the following options and features of ZFS on this pool:
  • cachefile
    • The default pool cache info is typically written to /etc, which would go away on each reboot.  I will be providing a persistent path on the mounted usb filesystem to ensure that I can easily re-import my bootstrapping pool.
  • comment
    • Just a good practice to specify, especially if you manage a lot of pools, from different systems.
  • async_destroy
    • Allows the pool to reclaim space in the background after destroying a ZFS filesystem.  Since I am working off of a USB flash drive, IO can be very slow.  I don't want a long downtime while I wait for the zpool to free the space.
    • UNFORTUNATELY, although the Gentoo  man page 'zpool-features' lists this feature as being available, the ZFS subsystem and/or zpool command does not appear to have been compiled with this feature...
  • empty_bpobj
    • Improves size and performance on filesystems with lots of snapshot.  I tend to treat the snapshot feature as a form of version control, and tend to work in small incremental steps.  Overtime this can create lots of snapshots, so I typically enable this feature when it is available on the target system's version of ZFS
    • UNFORTUNATELY, although the Gentoo  man page 'zpool-features' lists this feature as being available, the ZFS subsystem and/or zpool command does not appear to have been compiled with this feature...
  • lz4_compress
    • Should improve both size and performance on this pool.  This is a fast real-time compression algorithm, that will transparently compress the underlying data.  My new workstation has lots of spare CPU, and the bootstrap pool I am creating is on a slow IO device.  In addition this pool will mostly contain source code which should compress significantly, reducing the total number of blocks and IO operations to the device.
    • UNFORTUNATELY, although the Gentoo  man page 'zpool-features' lists this feature as being available, the ZFS subsystem and/or zpool command does not appear to have been compiled with this feature...
This leaves me with the following command
$ sudo /sbin/zpool create -o cachefile=/mnt/cdrom/scratch/zfs_bootstrap.cache -o comment="GentooLive  bootstrap for LFS"  gentooScratch /mnt/cdrom/scratch/LFSBootstrap/disk1.img

As always, check the pool after creation:
$ sudo /sbin/zpool status

Now onto file system creation, I typically make descendant file systems for each sub-project or use:

$  sudo /sbin/zfs create gentooScratch/sources
$  sudo /sbin/zfs create gentooScratch/sources/lfs_book
$  /sbin/zfs list
$  sudo chown -R gentoo:users /gentooScratch/sources
$  cd /gentooScratch/sources/lfs_book/
$  ls -al; df -h .

So according to the LFS download site, I need to perform the following:











$ svn co svn://svn.linuxfromscratch.org/LFS/trunk/BOOK
Subversion of course will list all the files as it goes, and it looks like I checked out revision 11610.  No screenshot provided since there were so many files and scroll for the command... Now to attempt to build my LFS instruction book.

$ cd BOOK
$ make REV=systemd
This resulted in the following output:

gentoo@livecd /gentooScratch/sources/lfs_book $ cd BOOK
gentoo@livecd /gentooScratch/sources/lfs_book/BOOK $ make REV=systemd
Creating and cleaning /home/gentoo/tmp
Processing bootscripts...
Adjusting for revision systemd...
Validating the book...
Validation complete.
Generating profiled XML for XHTML...
Generating chunked XHTML files at ~/lfs-systemd/ ...
Copying CSS code and images...
Running Tidy and obfuscate.sh...
/bin/bash: line 1: tidy: command not found

...
Lots and Lots of "/bin/bash: line 1: tidy: command not found" error lines.
...
Generating consolidated wget list at ~/lfs-systemd/wget-list ...
Generating consolidated md5sum file at ~/lfs-systemd/md5sums ...



So it looks like I need to first see about getting the tidy utility into my gentoo live system.  For now that is the work that has been done; however before I sign-off/reboot the system their is one last task I need to perform.  The gentooScratch pool needs to be unmounted and exported, so I can cleanly import on my next attempt at LFS.

$ sudo /sbin/zpool export gentooScratch 

No comments:

Post a Comment