Tuesday, December 29, 2020

Building "Linux From Scratch" and "JHALFS" Written by Thomas Seeling, February 2018

 Original from German blog:

Linux From Scratch blogspot German Lanuage post

 

 

I build a Linux as I like it - 1

For many years I have been an enthusiastic user of a very special Linux variant called " Linux from scratch ".

As the name suggests, a Linux system is built from scratch from scratch. The source texts are used to translate all the packages yourself and to equip a PC (or another computer system) with a Linux that can be started from the hard drive.

Of course, you have a chicken and egg problem: you need a Linux to build the new Linux. There are several possible solutions to this problem: On the one hand, the LFS can be assembled in a virtual machine. Alternatively, you can first set up a small partition with a different Linux on the target computer, start from there and then throw the LFS onto the free space on the hard drive. The Linux for building can then be kept as an emergency system afterwards, or the partition can be made into a swap partition or used for other purposes. For the very first ("bootstrap") Linux, a mini-partition of 8-16 GB is sufficient, and you can then install a Linux Mint or Fedora there, for example.

"Linux from Scratch" is not only a tutorial for a Linux to build yourself, but is mainly intended to gain experience in building Linux programs from the source code.

You learn a lot, namely the relationships between the various programs, configuration files, but also a lot about networks, and above all, of course, about the technical requirements, including the use of makefiles, and you learn to read log files to resolve problems to eliminate.

At "LFS" there are various ways to improve how you can make life difficult and exciting for yourself. You can build the basic system , then you "only" have a Linux command line.

Beyond Linux from scratch "(BLFS) it is possible to build a server with which you can, for example, build a firewall, a NAS, a web server, or much more. Or you build a desktop system with a graphical user interface, and at the end Then the self-compiled Firefox is displayed. Doesn't that sound cool?

One level of difficulty above is the automation of the construction process - and this is mainly what I want to write here. The instructions from "LFS" for a base system and for the "BLFS" are pretty good. If you stick to it, you have a good chance of manually creating a working system step by step. You go through all the chapters one after the other on the browser and carry out the individual steps according to the instructions. To be honest, that's a hassle the first time - I speak from experience ;-). On the other hand, it is exciting to see how the Linux system grows with every step and actually looks more and more like what you know as a Linux user.

The automation " Automated Linux from scratch " (ALFS), however, is in a README- The file is only sparsely described. Once you have internalized the system, you have a wonderful and very esoteric possibility to install updates or to completely regenerate the entire system at the push of a button.

In this way I built a Linux overnight - or better said: had it built that would be protected against Specter and Meltdown with the latest kernel 4.15 and C compiler gcc 7.3 . - If, yes, if my craft system would have been a 64-bit system (x86_64) and not 32-bit (i686). And if I had the feeling that I was really threatened by these vulnerabilities. But I think I have to write my own article on the subject of risk analysis.

And one step above you do not use the "stable" version of the books, but the LFS and BLFS books that are currently in development. The authors of the chapters are constantly busy integrating new versions of the packages and adapting the articles. If, for example, the procedure for a package changes how the package is compiled in an executable manner, this will be adopted extremely quickly in the "development" version of LFS or BLFS. This is exactly what happened to me while writing this article: I started the Makefile , and in the middle of it, the book switched to ncurses 6.1. As soon as I was finished, the developers released the new glibc version 2.27. This is how it works ...

To come back to "Meltdown" and "Specter" again: the LFS book recently started to contain brand new kernel and gcc versions that are supposed to fix these security holes. This is of course always "work in progress". The current status is that Specter V2 and Meltdown are fixed, and there is still some development work to be done for Specter V1. The old 32-bit processors are unfortunately lagging behind, for 64-bit (i.e. everything that is roughly less than 10 years old) all fixes should definitely be in progress.

So now, as promised, a more detailed description of the automation for LFS (ALFS). To do this, first download the current package . For historical reasons, the package name is " jhalfs "and honors the first developer of the process with his initials" jh ". 
 
In order for jhalfs to work, a few additional Linux packages must be installed on the guest system, because they are normally not required for end users the C compiler gcc and some auxiliary programs and libraries like bison , awk , ncurses etc. The nice thing is: when you start jhalfs, it checks what is still missing and complains, "Install Subversion to download the latest files from the version control system."

The automation actually starts with the very first steps that one would carry out according to the LFS book: creating a new Unix user "lfs" for compiling the packages, creating directories, etc. The only step that you have to carry out yourself is creating a hard drive partition and then mounting it so that the scripts can find it. Traditionally this is / mnt / lfs , but you can change it if you know what you are doing.

First a few words about the design of jhalfs: the authors create LFS and the other books in a special XML format called " DocBook "; turn it into tricky XSLT-Transformations then readable books into HTML, PDF or even TeX. jhalfs also uses XSLT transformations to filter out the command line instructions from the book and uses them to create a Makefile and installation scripts for each chapter, ie each package to be installed. Automation with ALFS is a two-step process: first, the commands for building are filtered out of the book and converted into a makefile with auxiliary scripts, and in a second step this list of commands is executed.

The authors also provide a complete list of the software packages with version numbers that you can either download yourself or that can be retrieved automatically if you have a reasonably fast internet connection. Roughly estimated, you have to download around 400 MB of packages for LFS and up to 2 GB for BLFS, depending on the size.

The packages should be stored in a directory / mnt / lfs / sources below the future LFS partition so that all packages can be found during the process. To do this, a Unix technique called "chroot" (change root) is used to simulate a running program with a different hard drive structure - effectively, this is used to pretend that it is already running in the "real" LFS environment.

The Makefile for LFS is created in a new subdirectory, into which you have to change after a few basic assumptions have been made. Just like / sources , this directory should be on the future LFS partition so that all scripts can also be accessed in the "chroot" environment. If you now start " make " there , after a few hours (depending on the speed of the computer *) you should have an almost bootable Linux on the new partition. Steps that can be automated, but not mandatory, are compiling a kernel and specifying the partitions to be mounted on startup.

*)As a rough guide, two comparative figures that I measured with the current LFS version. The package that takes by far the longest is the final step in compiling the C compiler. This takes 540 minutes on an old Pentium 4, and just under 230 minutes on a more recent i5-3350. An SSD instead of a hard drive is a great help in saving time.

The first step after unpacking the jhalfs package is to change to the directory and enter "make" there. If you have ever compiled a kernel yourself, you will immediately experience an aha effect: the configuration uses the same text interface for menu selection as the kernel for "make menuconfig". Here you can choose LFS / BLFS, "stable" or "development", whether the kernel should also be compiled automatically and a lot more. The basic settings are not that bad, and you should only change what you understand ;-)

After "exit" from this ALFS menu, the question arises whether you are satisfied with the configuration. If "yes", the already mentioned checks are carried out to determine whether all developer packages are available on the guest Linux and meet certain minimum requirements, such as gcc at least in version 4.6 (because earlier versions contain errors, so that the LFS would not work or packages are not compiled correctly, etc.). If all of this has been checked successfully, change to the new directory (as a user, not as root) and start " make " again there .

Cool socks take a look at the files below chapter04  05  in the subdirectory lfs-commands.  First start with the editor before you start make . With the files for chapter 7, in particular, you could directly get the idea of ​​editing the passages marked with ** EDITME ** ;-)

At the same time, it is advisable to open the same version of the book in a browser and to read the chapters that the automatism is currently trying to build. In the event of problems, you can read what is happening in the respective chapter.

It will probably not work completely successfully the first time; But that's not bad: if an error is reported, you can look at the log file for this step from the logs subdirectory , correct the error and then simply go back to it "make ". The make program is so clever that it continues at the same point. Some packages are built multiple times, for example the C compiler and some auxiliary programs. The purpose of this is to avoid accidentally building dependencies on the guest system If an important program were linked to the guest system's C library, it would no longer work after booting, so an "intermediate system" is built in a different path ( / tools ), which can then compile the final LFS.

A few general tips if the compilation of a package fails: gcc 7.3 is "bleeding edge", so brand new that you can cut your fingers when you use it ;-). I mean to say that there are so many changes in it, for example adjustments to the current C and C ++ standards, which have not yet reached most packages and the brains of developers. But: you want to use  gcc 7.3 and current binutils, because this is where the repair work for Meltdown and Specter takes place. Nevertheless the recommendation again: first build a "stable" LFS and then switch to "development" as an increase.

Typical compilation problem:
  • a C program uses data types that are now declared in a newly introduced include file <stdint.h> and no longer in <stdlib.h> . For the time being, you have to put the additional include command somewhere before the program can be compiled successfully. Make kindly tells you exactly where a problem has occurred.
  • when correcting a problem, files or directories were edited or edited as root. This leads to a subsequent error, because LFS wants to do everything with the user " lfs " and then it can be aborted due to authorization problems (I can do it all the time ).
    chown lfs: lfs is your friend.
What else I came across:
  • the internal gcc macro __sigemptyset no longer exists. You can use sigemptyset (without the underscores) instead.
  • the macros major and minor for Devices are now in <sys / sysmacros.h> to find .
  • grub cannot be compiled with binutils 2.30 on 32-bit systems. In addition to the configure switches in the LFS book , you have to specify the switch " --enable-64-bit-bfd ". Alternatively, use binutils 2.29.1 instead of 2.30 .
Two steps are described somewhat vaguely in the LFS book because they depend very much on your own PC: the configuration of the kernel and the bootable hard disk. If you have a Linux guest system with "kernelconfig" support, you can build your own tailor-made kernel with " make oldconfig ", which then uses exactly the settings that are current at the moment.

The only important point is that the file system format of the boot drive should be compiled in the kernel. It is of no use if the root file system is formatted with ext4 and the kernel should first learn the ext4 capability with a module that is on the ext4 hard drive - this is where the cat will bite its tail. Oh yes:make modules_install "and check it in / lib / modules !

For later educational and research purposes you can of course also provide an" initial ramdisk "(initrd) and store the required modules and other files there, but if you have a tailor-made kernel for this special PC generated, this is not necessary at first. You can do it later to activate microcode updates via "early load", but it is not essential for life. For intel processors there are the microcode files .

Before Reboot you should then look in the new / etc directory (which is currently still called / mnt / lfs / etc ) for files that contain "** EDITME **". There you can then incorporate the host name, IP address, name server, etc. that match your own environment (if you do not operate your own DNS server, the IP address of the DSL router that serves as a DNS forwarder for the requests The files can be found with a courageous " grep -l EDITME / mnt / lfs / etc / * ", and if you want to edit all of them in one go, you just throw the list of results to an editor: " vi $ (grep -l EDITME / mnt / lfs / etc / *) " .

The most important file here is / etc / fstab  which describes which partition of the hard disk has which purpose and where it belongs in the file system. A swappable partition should definitely be provided, even if the PC feels that it has enough RAM installed. A reason for this can be found here  (the author of the article works in a data center on Facebook). The re used to be a rule of "twice as much swap as RAM", but in principle I would allow between 2 and 8 GB of swap for normal desktop systems.

One thing you should definitely not forget: give the root user of the new LFS system a password before rebooting. Otherwise you can boot wonderfully, but not log in ;-)

In all honesty: the feeling is indescribable when the self-compiled Linux actually boots for the first time and you see the login prompt ;-)

If the new system does not want to boot, you have to investigate the cause. A "kernel panic" occurs if the root file system was not found. The kernel module for the file system in question is then probably missing. Or the information in /boot/grub/grub.cfg does not match which partition it is. Unfortunately, the spelling of grub and Linux differ a little here. "sda" for Linux is "hd0" in grub.

A mistake I made once: all USB drivers were declared as modules and then not defined in / etc / modules . In this situation it becomes difficult for a USB keyboard to deliver its inputs :-).

In such situations, you boot the guest system again and mount the LFS partition again under / mnt / lfs and begins to repair.

When it boots up and you can log in, repairs are easier: the error messages, for example from the init scripts, are still on the screen, and you can correct everything you need to do step by step and set up the new, self-made Linux system. The LFS already has everything on board to translate and install packages independently.

After the successful LFS, the BLFS continues.
A few suggestions on how to make the LFS a little more convenient to use:
  • gpm (copy + paste with mouse in the text surface)
  • cpio (for building initrd)
  • openssl (ssl library)
  • openssh (ssh server and client)
  • dhcpcd (have the IP address set via DHCP)
  • nfs-utils (if you have a NAS, e.g. a Fritzbox, or want to build it yourself)
  • samba (if you want to build a NAS yourself or a Windows domain controller)
  • lm_sensors (hardware monitoring of CPU and fan)
  • lsusb (list USB devices)
  • lspci (list PCI devices)
  • ghostscript (for PDF)
  • cups (for printing)
  • Firefox (for cat videos on the internet)

 

Wednesday, December 9, 2020

Venpy GUI frontend to Ventoy multiple .ISO file booter from USB Flash Drive

Using Venpy GUI frontend to tool Ventoy

 

Start with tool Ventoy https://ventoy.net/en/index.html  

Download Ventoy tool and install per the directions of the English Start Document. https://ventoy.net/en/doc_start.html

For Linux install of Ventoy

Download the installation package, like ventoy-x.x.xx-linux.tar.gz and decompress it. 
Download directions directory  https://ventoy.net/en/download.html

Find the file name you need from the github releases  directory

https://github.com/ventoy/Ventoy/releases 

https://github.com/ventoy/Ventoy/releases/download/v1.0.31/ventoy-1.0.31-linux.tar.gz

Change to your user home directory and  and "wget -c" to download

Extract Ventoy files tree, here to user directory "~"  or to /opt/ventoy

cd ~

wget -c  https://github.com/ventoy/Ventoy/releases/download/v1.0.31/ventoy-1.0.31-linux.tar.gz

tar xvfz ventory-1.0.31-linux-tar.gz

./Ventoy2disk -i -g -r 3072 /dev/sdb


 Work In Progress (WIP)  more to come,  This should get you started.


 

 

 

 

Add some Python wrapper GUI  https://github.com/smth-0/Venpy/ 

Change directory to your users home folder

   cd ~/. 

Clone the Venpy software with the following command.

git clone https://github.com/smth-0/Venpy.git

Change directory to Venpy

    cd Venpy

Check that you are using Python 3 version

python --version

Python 3.8.5



Warning,  you USB Flash Disk is going to be overwritten, so check and copy information off the Flash Disk to a safe location.

Check the /dev/sdX   device name with either one of the 2 commands below:

lsblk   

blkid

Issue this CLI command to start Venpy as a root user

sudo python main.py



Sunday, June 14, 2020

GhostBSD, debugging boot startup

GhostBSD, debugging boot startup

Edit file /etc/rc.conf and add these two lines
rc_debug="YES"
rc_info="YES"

When given boot selection choice,  Select 4 or S for single user mode
then mount the ZFS file system for you to edit some boot files

WIP editing howto mount ZFS properly

Tuesday, May 12, 2020

GhostBSD, setup printing using HPLIP for an OfficeJet 4650 Multifunction Printer

Look at other Web resources for Linux & MacOS

https://wilsonmar.github.io/printing/   Great information resource

https://www.cyberciti.biz/faq/how-to-install-networked-hp-printer-and-scanner-on-ubuntu-linux/    How to install Networked HP Printer and scanner on Ubuntu Linux



HP does not provide telephone support for Linux printing. All support is provided online at the following web page: https://launchpad.net/hplip. On that page, click the "Ask a question" section.

  1. First use your OS software installation tool.  For GhostBSD 20.04 its "Software Station"  Search for  HPLIP    I found hplip version 3.19.12_3 27.1 Megabytes in size  Drivers and utilities for HP printers and All-in-One devices
  2.  Change to Root user.  "su"   issue your Password 
  3.  Use the HP Setup application hp-setup from a terminal command line window to start the process.
  4.  













     




Thursday, March 26, 2020

Descrição do PuppyLinux Fatdog64 em Português



Fatdog64: Uma distribuição potente para instalar no pen drive USB!

Com um arquivo de instalação de menos de 450MB, é possível instalar uma distribuição Linux leve e cheia de recursos úteis para estudantes e professores direto no pen drive USB, sem necessidade de instalação na máquina e alteração das instalações do Windows, Linux e macOS. O Fatdog64, originalmente um derivado do PuppyLinux, é uma das melhores distribuições nessa categoria de uso e pode ressuscitar aquele computador antigo que você pensava que não tinha mais utilidade. O Fatdog64 também é útil como um sistema de reserva para o caso de o teu computador não iniciar o sistema. Você pode inclusive testar o Fatdog64 na página Distro Test sem precisar baixar ou instalar nada (instruções mais adiante). Experimente hoje mesmo o Fatdog64!

Requisitos mínimos de sistema: CPU de 64 bits x8664/AMD64 e 1 GB de RAM. A maioria dos processadores Intel e AMD produzidos após 2008 suportam 64 bits (inclusive muitos Intel Atoms).

Página da Distro Test para experimentar o Fatdog64 versão 801 direto do teu navegador de internet, sem a necessidade de baixar ou instalar nada:  Fatdog64 versão 801 na Distro Test (em inglês)

Vídeo demonstrativo do Fatdog64 no YouTube:
https://youtube.com/watch?v=Nvg-JqttWiY

Instruções para a instalação do Fatdog64 no pen drive USB:
Obtenha o arquivo .ISO no endereço http://distro.ibiblio.org/fatdog/iso/Fatdog64-810.iso
(ou você pode acessar a lista de arquivos .ISO no endereço http://distro.ibiblio.org/fatdog/iso para obter uma versão mais atualizada). Depois use um programa para gravar essa imagem no pen drive; os programas recomendados são o Rufus (para Windows) e o BalenaEtcher (para Windows, macOS e Linux). No Linux também é possível usar o comando ‘dd’: “dd bs=4M if=Fatdog64-810.iso of=sdX” (sdX pode ser sdb, sdc ou sdd, conforme a configuração do teu sistema). Com estas instruções, você terá criado um pen drive USB que vai funcionar como se fosse um sistema instalado na tua máquina, porém sem necessidade de instalação. Teus arquivos e configurações caminharão sempre contigo no pen drive! Atenção: Como um pen drive é pequeno e fácil de perder, não se esqueça de fazer backup regularmente para não correr o risco de ficar sem teus arquivos importantes.

Com apenas 10 minutos, 2 transferências de arquivos, e 1 unidade USB disco você pode testar uma distribuição Linux à tua escolha sem precisar instalar no computador!  Experimente o Fatdog64 versão 810!

Caso o teu computador não consiga executar um sistema de 64 bits, experimente o BionicPup 8.0, que possui versão para 32 e 64 bits: Puppylinux.com  BionicPup 8.0.

Informações técnicas do Fatdog64 810:
O Fatdog64810 versão final foi lançado em 20 de janeiro de 2020.
O Fatdog64810 GNU/Linux é o quarto lançamento da série 800 do Fatdog64, a qual é baseada no Linux From Scratch 8.2/Cross Linux From Scratch 2017.07.
Esta é uma atualização de manutenção. As principais razões para a atualização são as falhas de segurança Intel ZombieLoad/DMS as quais requerem uma atualização do núcleo do sistema e do microcódigo da CPU, incluídas nesta atualização.

Outros endereços úteis para usuários do Fatdog64 (páginas em inglês):
Página dos lançamentos do Fatdog64
Fórum (em inglês) do Fatdog64 para as versões 810/802/801/800
Direto da mesa do James, as notas sobre o Fatdog64 801 (em inglês)
Notas de lançamento da última versão do Fatdog64
F
órum Murga-Linux com anúncios de novas versões do Fatdog64 (em inglês)
Instruções (em inglês) para instalar no disco rígido interno
Instruções (em inglês) para instalar em computadores UEFI e dual boot com o Windows 8
P
ágina do Puppy Linux (em inglês)
Fórum de Discussão do Puppy Linux (em inglês)
P
esquisa do Fórum de Discussão do Puppy Linux (em inglês)
Versão em inglês do meu blogpost sobre o Fatdog64 810

Tuesday, March 24, 2020

Upgrade your slow HOME computer with Zorin15

Upgrade your slow HOME computer with Zorin15 Linux or Puppy Linux operating system.


Yes, you might need to use all windows software to interact with your companies windows desktops.  In that case, you can dual boot your computer with both Windows and Linux.


Thereby needing to continue with Windows 10 Operating System software, but you might find that you can perform your work at home with a Linux Operating System and Linux application programs.
So If the local shop is fresh out of hardware to buy,  How does a free software download sound?  Good?

10 minutes, 2 downloads, 1 USB flash drive to give Linux a spin on this laptop in front of you.

If you feel your laptop could use a speed boost, but your wallet is sparsely populated with cash.  Test drive a live linux on your present Windows laptop hardware or desktop.

2nd option, consider purchasing a cheap 120GB  SSD SATA 2.5" drive to either install internally to replace the hard drive in your laptop  or connect externally via USB 2.0 or USB 3.0 cable to a USB 3.0 to SATA drive enclosure with the SSD placed inside.


120GB 2.5"  SATA SSDs



3rd option here is a 32GB, 64GB, or 128GB single USB 3.0 Flash Drive.

usb flash drive


https://opensource.com/article/20/3/open-source-working-home  Here are some tools you can use Free, from your work at home site. 

Google some of these next items, to find their website.
ZorinOS 15 Lite is a free download that you can try booting live from a USB flash drive. 
Fatdog64 Puppylinux can also be installed into a USB flash drive and booted from USB flash drive without changing a thing on your Windows Computer.  Just hit the F12, F10 or ESC   BIOS boot drive select key to select which disk drive to boot up from.  Choose the external USB Flash Disk.

So don't have a USB Flash Drive handy?
  Lick Installer .EXE file works on your present windows PC to install a puppylinux version 8.0  or Fatdog64 in a single file on your existing Windows C:\ disk.
http://puppylinux-or-pcbsd.blogspot.com/2019/11/ms-windows-users-consider-lick.html
http://puppylinux-or-pcbsd.blogspot.com/

Need more information and help. Check out the forums of your chosen Linux Distro.  Join a local Linux Users Group (LUG) in your neighborhood.  Join Telegram group,   t.me/linux4everyone and visit and ask questions.
google Linux4everyone linux4everyone.com ,   Listen to one of Jason Evangelho's podcasts.  Read his Linux Gaming articles at Forbes.com  https://www.forbes.com/sites/jasonevangelho/#7565da20d36f

Enjoy the software and hardware that you have now.  If you feel Windows is too slow when working remotely from home,  maybe changing over to ZorinOS Linux and a SSD SATA 2.5" inch drive will improve your work flow.  Maybe using PuppyLinux 8.0 or Fatdog64 810 (includes LibreOffice 6.1.2) from a USB flash drive will help you out.
10 minutes, 2 downloads, 1 usb flash drive is all that it requires.   You have the time and means now that you are home.

Give it a shot and explore the speed that is in your present laptop hardware.

Fred
Colton Oregon USA

$45 for ZorinOS 15.2 installed to a 16GB USB Flash drive.
https://paypal.me/KlikTel. Fred Finster Email me Here