Skip to main content

LFS 12.2 systemd desde Ubuntu 24.04 x64

Para la práctica se hace uso del LFS versión https://www.linuxfromscratch.org/lfs/view/12.2-systemd

El hardware asignado a la VM es de:

  • 04 cpus
  • 08 gb de memoria ram
  • 30 gb de disco duro (donde residirá sistema LFS, importante que sea SATA)
    • 28 gb para partición root
    • 02 gb para partición swap

Esto no intenta ser para nada una guía, para ello ya está el libro de LFS, simplemente un post con las imágenes de cada output

Capítulo 2

2.2 Host Requirements

Iniciando en https://www.linuxfromscratch.org/lfs/view/12.2-systemd/chapter02/hostreqs.html, ejecutando el script de host system requirements se encuentra que hay paquetes que no está instalados y que el sistema shell sh no es bash.

Instalando los paquetes necesarios

sudo apt install bison gawk gcc make g++ texinfo

Haciendo que sh sea bash. Comprueba a donde apunta la shell sh (el cual es un link simbolico).

ls -l /usr/bin/sh

Como puedes ver... apunta a dash y no a bash. Por lo tanto elimina el link sh y crealo de nuevo.

sudo rm /usr/bin/sh
sudo ln -s /usr/bin/bash /usr/bin/sh

Ejecuta de nuevo el comando

ls -l /usr/bin/sh

Ahora podrás ver que apunta a bash.

Volviendo a ejecutar el script ahora indicará que todo es correcto.

2.5 Creating a File System on the partition

Al añadir un disco duro en el sistema virtual seguramente le habrá dado el identificador sda. Por lo que ahora es necesario crear mínimo 2 particiones (root y swap). Estas particiones pueden ser creadas con gparted, fdisk o la herramienta que más cómoda te sea.

El motivo que se haya dado solo 2gb a la particion swap es que para el sistema LFS que se le va a dar en la asignatura es suficiente y más teniendo 8gb de ram... en la actualidad el 1=1 en ram swap no se suele cumplir, porque hay ram suficiente... cosa que antes no pasaba.

Ejecutando los comandos que indica, reemplazando los datos por el nombre de la partición

mkfs -v -t ext4 /dev/sda1

y para la swap

mkswap /dev/sda2

2.6 Setting the $LFS variable

En este apartado se va a configurar la variable LFS que se va a usar durante TODA la práctica. Como recomendacion es mejor hacer toda la práctica en una misma terminal, en caso de que el usuario quiera abrir varias terminales tendrá que tener en cuenta que ha de configurar la variable LFS en todas aquellas que vaya a usar para la práctica.

2.7 Mounting the new partition

A continuación hay que crear la carpeta para ello es necesario hacerlo con permiso de sudo ya que si no, no dejará crearla.

A continuación se monta el disco en la carpeta creada

Finalmente activar la swap en la partición definida para la swap. En este caso sda2.

Capítulo 5

En este cápitulo, tal y como se indica en

https://www.linuxfromscratch.org/lfs/view/12.2-systemd/partintro/generalinstructions.html

por cada paquete y salvo que se indique lo contrario, se ha de descomprimir el tar, entrar, configurar, compilar, instalar, subir al directorio sources y eliminar la carpeta descomprimida.

No seguir estos pasos puede conllevar a errores en la creación de LFS y tener que volver a empezar desde cero.

5.2 Binutils 2.43.1 Pass 1

Output del make install

y tal y como se indica en los requisitos generales... subimos a la carpeta sources y eliminamos la carpeta extraida del paquete.

5.3 GCC-14.2.0 Pass 1

Output del configure

Output del make

Output del make install

5.4 Linux-6.10.5 API Headers

5.5 Glibc-2.40

Output configure

Output make

Output make install

Output de la comprobación

y efectivamente si todo ha ido bien... así sale

5.6 Libstdc++ from GCC-14.2.0

Tal como indica, se ha de descomprimir el paquete gcc de nuevo ...

Output del configure de libstdc++

Output del make

Output del make install

Output comando remove

Capítulo 6

6.02 - M4-1.4.19

Output configure

Output make

Output make install

6.03 - Ncurses-6.5

Output Preconfigure

Output configure

Output make

Output make install y los otros comandos

6.04 - Bash-5.2.32

Output configure

Output make

Output make install

6.05 - Coreutils-9.5

Output configure

Output make

Output make install

Output move

6.06 - Diffutils-3.10

Output configure

Output make

Output make install

6.07 - File-5.45

Output preconfigure

Output configure

Output make

Output make install

Output remove libtool

6.08 - Findutils-4.10.0

Output configure

Output make

Output make install

6.09 - Gawk-5.3.0

Output configure

Output make

Output make install

6.10 - Grep-3.11

Output configure

Output make

Output make install

6.11 - Gzip-1.13

Output configure

Output make

Output make install

6.12 - Make-4.4.1

Output configure

Output make

Output make install

6.13 - Patch-2.7.6

Output configure

Output make

Output make install

6.14 - Sed-4.9

Output configure

Output make

Output make install

6.15 - Tar-1.35

Output configure

Output make

Output make install

6.16 - Xz-5.6.2

Output configure

Output make

Output make install

Remove liblzma

6.17 - Binutils-2.43.1 Pass 2

Output configure

Output make

Output make install

Remove libtool files

6.18 - GCC-14.2.0 Pass 2

Output preconfigure

Output configure

Output make

Output make install

Capítulo 7

Puedes ver que no deja cambiar la carpeta mnt/lfs/lib64, esto es porque lo hemos ejecutado desde lfs... y esto pasa por no haber leido el mensaje!

Escalamos a root, comprobamos que tenemos seteada la variable LFS y si no la tenemos ... la seteamos!

volvemos a ejecutar el comando anterior. Verificamos que todas las carpetas están como root!

Llegados al 7.6 el output debería ser

7.07 - Gettext-0.22.5

Ahora vuelve el compilar paquetes, pero ahora no tenemos la variable LFS puesto que ya estamos dentro del chroot! Por lo tanto /sources será la anterior /mnt/lfs/sources.

Output configure

Output make

Output install msgfmt...

7.08 - Bison-3.8.2

Output configure

Output make

Output make install

7.09 - Perl-5.40.0

Output configure

Output make

Output make install

7.10 - Python-3.12.5

Output configure

Output make

Output make install

7.11 - Texinfo-7.1

Output configure

Output make

Output make install

7.12 - Util-linux-2.40.2

Output configure

Output make

Output make install

Capítulo 8

8.03 - Man-pages-6.9.1

Output remove

Output make install

8.04 - Iana-Etc-20240806

No hay output si ha funcionado bien

8.05 - Glibc-2.40

Output Preconfigure

Output configure

Output make

Output make check, tal como dice la documentación algunos test fallarán pero es normal.

Output make install

Output locales

Output nsswitch & timezone

8.06 - Zlib-1.3.1

Output configure

Output make

Output make check

Output make install

8.07 - Bzip2-1.0.8

Output patch + sed commands

Output make makefile & make clean

Output make

Output make install

Output cp & remove commands

8.08 - Xz-5.6.2

Output configure

Output make

Output make check

Output make install

8.09 - Lz4-1.10.0

Output configure

Output make -j1 check

Ouput make install

8.10 - Zstd-1.5.6

Output make

Output make check

Output make install & rm

8.11 - File-5.45

Output configure

Output make

Output make check

Output make install

8.12 - Readline-8.2.13

Output configure

Output make

Output make install

Output install

8.13 - M4-1.4.19

Output configure

Output make

Output make check

Output make install

8.14 - Bc-6.7.6

Output configure

Output make

Output make test

Output make install

8.15 - Flex-2.6.4

Output configure

Output make

Output make check

Ouput make install

8.16 - Tcl-8.6.14

Output configure

output make & sed

Output make test

Output make install

8.17 - Expect-5.45.4

Output python

Output configure

Output make

Output make test

Output make install & ln

8.18 - DejaGNU-1.6.3

Output configure

Output make check

Output make install

8.19 - Pkgconfg-2.3.0

Output configure

Output make

Output make install

8.20 - Binutils-2.43.1

Output configure

Output make

Output make check

Tal como indica, está pensado que 12 test fallen, al ejecutar el comando grep que indica posterior al make check, se puede visualizar que son 12 los que fallan, por lo tanto se puede continuar.

Output make install & rm

8.21 - GMP-6.3.0

Output configure

Output make & make html

Output make check

En la documentación se indica que hay 199 test, al ejecutar el comando awk se puede ver que 199 han pasado correctamente, por lo que se puede continuar con el make install

Output make install

8.22 - MPFR-4.2.1

Output configure

Output make & make html

Output make check

Si se hace un poco de scroll hacia arriba, sale el resultado de los test, se deben pasar 198 correctamente.

Output make install & make install html

8.23 - MPC-1.3.1

Output configure

Output make

Output make check

Output make install & install html

8.24 - Attr-2.5.2

Output configure

Output make

Output make check

Output make install

8.25 - Acl-2.3.2

Output configure

Output make

Output make install

8.26 - Libcap-2.70

Output make

Output make test

Output make install

8.27 - Libscrypt-4.4.36

Output configure

Output make

Output make check

Output make install

El paso de make distclean tal y como indica en la documentación es solo por si nosotros disponemos de una aplicación que necesite esa API, pero el LFS no la necesita.

8.28 - Shadow-4.16.0

Output configure

Output make

Output make install

Enbable shadowed password pwconv & grpconv

Enable root password

8.29 - GCC-14.2.0

Output configure

Output make