What is diskless booting?

Diskless booting is using a remote system or systems to store the kernel and the filesystem that will be used on other computer(s).

Why do it?

Imagine my case I admin about 25 public workstations for a local library, if they want something changed across the board I can either go sit at each PC and spend X minutes on it, adding up to who knows how many hours, or I can simply make the change at any one of the 25 systems and have it affect every system equally. The same goes for updates and many other operations. It really eases support issues.

How is this different than ThinClientHowto?

Thin clients use some of the same principles but they also connect to a remote X session, which means everything runs on the remote server – all applications will consume the servers resources, such as RAM and CPU cycles.

Diskless Booting simply uses the remote server for storage and still runs all applications on the local client station. This works better if you have full powered PC's to work with, and are working with a large number of clients that would require too much CPU and RAM to run all their applications on one server.

It is different enough to have multiple machines mounting the same root filesystem as opposed to simply being a remote monitor and keyboard to warrant a separate how-to I think.

Oliver Grawert says :- you could have achieved this easier by following the thin client howto, remove the ltsp-client package from the chroot and install ubuntu-desktop (or whatever desktop you want) there, would save you a lot of configuration work 😉

How does it work?

There are a lot of parallels to ThinClientHowto, diskless booting requires a DHCP server which a bootable PXE network card will query to get its configuration and location of the file to tftp from the server, after booting the PXE image the client will tftp and boot the kernel image(with args specified in the pxe config), those args will tell the kernel how to configure itself, and the path to mount the NFS share where its / directory is located.


  • An Ubuntu system with (preferably) nfs-kernel-server and tftpd server (the server)
  • At least one PXE-bootable system (the client)
  • It helps to have the client set up in its final configuration before you start
  • Enough disk space on the server to hold the client filesystem
  • A fast network connection between the client and the server
  • A DHCP server which is capable of supporting PXE clients, or a separate network segment where you can run a dedicated DHCP server
  • A good understanding of Linux

Getting Started

Naming Conventions

Client: A diskless system that you wish to boot via a network connection
Server: An always-on system which will provide the neccesary files to allow the client to boot over the network

Set up your Server

  1. Install the required packages
    1. Ubuntu 14.04
      • sudo apt-get install isc-dhcp-server tftpd-hpa syslinux nfs-kernel-server initramfs-tools

    2. Ubuntu 14.10 and after
      • sudo apt-get install isc-dhcp-server tftpd-hpa syslinux pxelinux nfs-kernel-server initramfs-tools

  2. Configure your DHCP server

    You need to set up the DHCP server to offer /tftpboot/pxelinux.0 as a boot file as a minimum. You also assign a fixed IP to the machine you want to boot with PXE (the client). A range of other options are also available but are beyond the scope of this article. Your /etc/dhcp/dhcpd.conf might look like this assuming your subnet is

    allow booting; allow bootp;  subnet netmask {   range 192.168.2.xxx 192.168.2.xxx;   option broadcast-address;   option routers 192.168.2.xxx;   option domain-name-servers 192.168.2.xxx;    filename "/pxelinux.0"; }  # force the client to this ip for pxe. # This is only necessary assuming you want to send different images to different computers. host pxe_client {   hardware ethernet xx:xx:xx:xx:xx:xx;   fixed-address 192.168.2.xxx; }

    NOTE 1: You will need to replace the 'xx:xx:xx:xx:xx:xx' and the '192.168.2.xxx' with your own values
    NOTE 2: the filename is a relative path to the root of the tftp server.

    Restart DHCP Server using the command

    sudo service isc-dhcp-server restart

  3. Configure the TFTP Server

    We need to set tftp-hpa to run in daemon mode and to use /tftpboot as its root directory.
    Here is an example /etc/default/tftpd-hpa file

    #Defaults for tftpd-hpa RUN_DAEMON="yes" OPTIONS="-l -s /tftpboot"

  4. Configure your tftp root directory
    1. Create directories
      sudo mkdir -p /tftpboot/pxelinux.cfg

    2. Copy across bootfile
      1. Ubuntu 14.04:
        • sudo cp /usr/lib/syslinux/pxelinux.0 /tftpboot

      2. Ubuntu 14.10 and after:
        • sudo cp /usr/lib/PXELINUX/pxelinux.0 /tftpboot sudo mkdir -p /tftpboot/boot sudo cp -r /usr/lib/syslinux/modules/bios /tftpboot/boot/isolinux

    3. Create default configuration file /tftpboot/pxelinux.cfg/default
      LABEL linux KERNEL vmlinuz-2.6.15-23-686 APPEND root=/dev/nfs initrd=initrd.img-2.6.15-23-686 nfsroot= ip=dhcp rw

      NOTE1: your nfs server IP address, kernel name, and initrd name will likely be different. If you have a preconfigured system the names should be the names of the kernel and initrd (see below) on the client system
      NOTE2: to find the vmlinuz type uname -r
      NOTE3: There are more options available such as MAC or IP identification for multiple config files see syslinux/pxelinux documentation for help.
      NOTE4: Newer distributions might require that you append “,rw” to the end of the “nfsroot=” specification, to prevent a race in the Upstart version of the statd and portmap scripts.

    4. Set permissions
      sudo chmod -R 777 /tftpboot

      NOTE:If the files do not have the correct permissions you will receive a “File Not Found” or “Permission Denied” error.

    5. Start the tftp-hpa service:
      sudo /etc/init.d/tftpd-hpa start

  5. Configure OS root
    1. Create a directory to hold the OS files for the client
      sudo mkdir /nfsroot

    2. configure your /etc/exports to export your /nfsroot
      /nfsroot             192.168.2.xxx(rw,no_root_squash,async,insecure)

      NOTE: The '192.168.2.xxx' should be replaced with either the client IP or hostname for single installations, or wildcards to match the set of servers you are using.

      Note: In versions prior to Ubuntu 11.04 the option ',insecure' is not required after async.

    3. sync your exports
      sudo exportfs -rv

Creating your NFS installation

There are a few ways you can go about this:

  • debbootstrap (as outlined at Installation/OnNFSDrive)

  • copying the install from your server
  • install [lk]ubuntu on the client from CD, after you've got your system installed and working on the network mount the /nfsroot and copy everything from your working system to it.

This tutorial will focus on the last option. The commands in this section should be carried out on the client machine unless it is explicitly noted otherwise. You should ensure that the following package is installed on the client nfs-common

  1. Copy current kernel version to your home directory.
    • uname -r will print your kernel version, and ~ is shorthand for your home directory.

    sudo cp /boot/vmlinuz-`uname -r` ~

  2. Create an initrd.img file
    1. Change the BOOT flag to nfs in /etc/initramfs-tools/initramfs.conf

      # # BOOT: [ local | nfs ] # # local - Boot off of local media (harddrive, USB stick). # # nfs - Boot using an NFS drive as the root of the drive. #  BOOT=nfs

    2. Change the MODULES flag to netboot in /etc/initramfs-tools/initramfs.conf

      # # MODULES: [ most | netboot | dep | list ] # # most - Add all framebuffer, acpi, filesystem, and harddrive drivers. # # dep - Try and guess which modules to load. # # netboot - Add the base modules, network modules, but skip block devices. # # list - Only include modules from the 'additional modules' list #  MODULES=netboot

      NOTE: if you have anything in /etc/initramfs-tools/conf.d/driver-policy, this line will be ignored.

    3. Check which modules you will need for your network adapters and put their names into /etc/initramfs-tools/modules (for example forcedeth , r8169 or tulip)
    4. Run mkinitramfs
      mkinitramfs -o ~/initrd.img-`uname -r`

  3. Copy OS files to the server
    mount -t nfs -onolock /mnt cp -ax /. /mnt/. cp -ax /dev/. /mnt/dev/.

    NOTE: If the client source installation you copied the files from should remain bootable and usable from local hard disk, restore the former BOOT=local and MODULES=most options you changed in /etc/initramfs-tools/initramfs.conf. Otherwise, the first time you update the kernel image on the originating installation, the initram will be built for network boot, giving you “can't open /tmp/net-eth0.conf” and “kernel panic”. Skip this step if you no longer need the source client installation.

  4. Copy kernel and initrd to tftp root.

    Run these commands ON THE SERVER

    sudo cp ~/vmlinuz-`uname -r` /tftpboot/ sudo cp ~/initrd.img-`uname -r` /tftpboot/

  5. Modify /nfsroot/etc/network/interfaces

    When booting over the network, the client will already have carried out a DHCP discovery before the OS is reached. For this reason you should ensure the OS does not try to reconfigure the interface later.
    You should set your network interface to be “manual” not “auto” or “dhcp”. Below is an example file.

    # This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5).  # The loopback network interface auto lo iface lo inet loopback  # The primary network interface, commented out for NFS root #auto eth0 #iface eth0 inet dhcp iface eth0 inet manual

    NOTE: For Ubuntu 7.04 (Feisty Fawn) it seems the /etc/network/interfaces needs a little tweak, in order *not* to have the NetworkManager fiddle with the interface since it's already configured (see also bug #111227 : “NFS-root support indirectly broken in Feisty”)
    NOTE: If you use dnsmasq for your boot client (instead of dhcp), you will need to provide nameserver(s) information in /etc/resolvconf/resolv.conf.d/base. For instance,
    nameserver 192.168.0.xxx (You will need to replace the '192.168.0.xxx' with your own values.)

  6. Configure fstab

    /nfsroot/etc/fstab contains the information the client will use to mount file systems on boot, edit it to ensure it looks something like this ('note no swap')

    # /etc/fstab: static file system information. # # <file system> <mount point>   <type>  <options>       <dump>  <pass> proc            /proc           proc    defaults        0       0 /dev/nfs       /               nfs    defaults          1       1 none            /tmp            tmpfs   defaults        0       0 none            /var/run        tmpfs   defaults        0       0 none            /var/lock       tmpfs   defaults        0       0 none            /var/tmp        tmpfs   defaults        0       0 /dev/hdc        /media/cdrom0   udf,iso9660 user,noauto 0       0

    NOTE: if you have entries for other tmpfs that's fine to leave them in there

  7. Disable Grub update

    Since diskless systems don't need grub to boot, disable update scripts to prevent glitches during further software updates. Comment out exec update-grub in /etc/kernel/postinst.d/zz-update-grub

Impactos: 0

How to Boot Ubuntu 20.04 into Text / Command Console

How to Boot Ubuntu 20.04 into Text / Command Console

Need to do some work in the black & white command line console? You can press Ctrl+Alt+F3 on keyboard to switch from the current session to tty3 text console, and switch back via Ctrl+Alt+F2.

From the startup grub boot-loader menu entry, you may select the Advanced Options > recovery mode > Drop to root shell prompt to get into text mode. However you need to run command mount -o rw,remount / to get file system write permission.

If you want to make Ubuntu automatically boot into the text mode, configure grub settings by doing following steps one by one:

1. Open terminal and run command to backup the configuration file:

sudo cp -n /etc/default/grub /etc/default/grub.backup

2. Edit the configuration file via command:

sudo gedit /etc/default/grub

When the file opens, do:

  • disable GRUB_CMDLINE_LINUX_DEFAULT="quiet splash" by adding # at the beginning.
  • remove # from the line GRUB_TERMINAL="console" to disable graphical terminal.

3. Save the file and apply changes by running command:

sudo update-grub

4. One more command is required as Ubuntu now uses systemd:

sudo systemctl set-default multi-user.target

How to Restore:

To restore changes, simply move back the backup file via command:

sudo mv /etc/default/grub.backup /etc/default/grub

And run sudo update-grub to apply change.

Also change the setting back in systemd via command:

sudo systemctl set-default graphical.target

Impactos: 0

Cómo instalar la CPU XMR STAK para Monero Mining en Ubuntu 16.04

Cómo instalar la CPU XMR STAK para Monero Mining en Ubuntu 16.04

¡Monero Mining es para todos!

A diferencia de Etherum, puedes minar Monero con casi cualquier cosa, incluso con la CPU de tu portátil antiguo. Eso no producirá muchas ganancias, pero es una posibilidad. Además de eso, la minería de GPU no ofrece un aumento sustancial en el poder de minería como en Ethereum. Aquí, una GPU dedicada puede ofrecer solo 2 a 3 veces más hashrate que una nueva CPU, en lugar de 10 a 20 veces la de Ethereum. Esto significa que es mejor configurar todas sus computadoras portátiles antiguas en la mía que comprar una nueva GPU, a menos que, por supuesto, tenga la intención de configurar una granja completa.

También puedes minar con una CPU y una GPU al mismo tiempo. Tenga en cuenta que esto probablemente tenga un mayor consumo de energía, y debe calcular si lo que está haciendo es rentable. Veamos cómo minar usando solo una CPU.

Cómo instalar XMR-STAK-CPU – Herramienta de minería Monero

Recomiendo usar xmr-stak-cpu, una solución de código abierto muy rápida y rentable. En primer lugar, tendremos que instalar dependencias del programa. También tendremos que compilarlo, por lo que también necesitamos software para eso. Correr:

sudo apt install libmicrohttpd-dev libssl-dev cmake build-essential libhwloc-dev

Luego, descarga el minero:

wget https://github.com/fireice-uk/xmr-stak-cpu/archive/master.zip


unzip master.zip

Ingrese al nuevo directorio:

cd xmr-stak-cpu-master

Ejecute CMake:

cmake .

Una vez que hayas terminado, instala el minero:

make install

Debería crear una carpeta “bin”. Ingrese a la carpeta:

cd bin

Cómo configurar

Y edite el archivo de configuración. Por lo general, todo lo que necesita hacer es especificar la dirección de su grupo, la dirección de su billetera y la “contraseña del grupo”, que para el grupo que estamos usando es solo el nombre de la máquina y el correo electrónico. Aquí hay un ejemplo.

nano config.txt
„pool_address” : „pool.supportxmr.com:3333”, „wallet_address” : „yourmonerowalletaddresshere”, „pool_password” : „worker:name@email.com”,

Una vez que establezca el archivo de configuración, ejecute


¡Y su máquina comenzará a minar con su CPU!

Impactos: 0

¿Cómo evitar que un cron job me envíe un email cada vez que se ejecuta?

¿Cómo evitar que un cron job me envíe un email cada vez que se ejecuta?

1. Redirigir la salida

0   */2 *   *   *   /bin/sh /ruta/mi-script.sh >/dev/null 2>&1 

Esto lo que hace es redirigir la salida estándar y la salida de error al clásico colector de basura de unix /dev/null. Podrías eventualmente dejar la salida de error para que pase por el mail y desactivar solo la estándar:

0   */2 *   *   *   /bin/sh /ruta/mi-script.sh >/dev/null 

2. Quitar el MAILTO

Si tienes acceso a editar el archivo /etc/crontab puedes editar la variable MAILTO dejándola en blanco MAILTO=""

3. Configurar el demonio del cron para que la salida vaya a un log

Si puedes editar /etc/sysconfig/crond, podrías agregar el parámetro -s para redirigir la salida al log del sistema y -m off para deshabilitar el envío de mails

Ten en cuenta que las opciones 2 y 3 requieren reiniciar el demonio del cron.

Referencia: https://www.putorius.net/2015/03/stop-cron-daemon-from-sending-email-for.html

Impactos: 0

Instalar docker en Ubuntu 20.x


Primero, actualice su lista de paquetes existente:

sudo apt update

A continuación, instale algunos paquetes de requisitos previos que permitan a apt usar paquetes a través de HTTPS:

sudo apt install apt-transport-https ca-certificates curl software-properties-common

Luego, añada la clave de GPG para el repositorio oficial de Docker en su sistema:

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add –

Agregue el repositorio de Docker a las fuentes de APT:

sudo add-apt-repository “deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable”

A continuación, actualice el paquete de base de datos con los paquetes de Docker del repositorio recién agregado:

sudo apt update
Asegúrese de estar a punto de realizar la instalación desde el repositorio de Docker en lugar del repositorio predeterminado de Ubuntu:
apt-cache policy docker-ce

Si bien el número de versión de Docker puede ser distinto, verá un resultado como el siguiente:

Output of apt-cache policy docker-ce
Installed: (none)
Candidate: 5:19.03.9~3-0~ubuntu-focal
Version table:
5:19.03.9~3-0~ubuntu-focal 500
500 https://download.docker.com/linux/ubuntu focal/stable amd64 Packages

Observe que docker-ce no está instalado, pero la opción más viable para la instalación es del repositorio de Docker para Ubuntu 20.04 (focal).

Por último, instale Docker:

sudo apt install docker-ce

Con esto, Docker quedará instalado, el demonio se iniciará y el proceso se habilitará para ejecutarse en el inicio. Compruebe que funcione:

sudo systemctl status docker

El resultado debe ser similar al siguiente, y mostrar que el servicio está activo y en ejecución:

● docker.service – Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2020-05-19 17:00:41 UTC; 17s ago
TriggeredBy: ● docker.socket
Docs: https://docs.docker.com
Main PID: 24321 (dockerd)
Tasks: 8
Memory: 46.4M
CGroup: /system.slice/docker.service
└─24321 /usr/bin/dockerd -H fd:// –containerd=/run/containerd/containerd.sock

#docker #linux #Ubuntu

Impactos: 0

Copias de seguridad de MariaDB automatizadas



Primero instalar el cliente de mariadb


apt-get install -y mariadb-client

Crear el siguiente script y hacerlo ejecutable

cds=$pcds/copia_de_seguridad_$(date +%Y%m%dT%H.%M.%S).sql
mysqldump –all-databases –lock-tables > $cds
if [ $? -eq 0 ]
gzip $cds
limite=$(date +%Y%m%dT%H.%M.%S -d “-7 days”)
for i in $pcds/*.sql.gz
if [[ ${i:36:17} < $limite ]] && [[ -e $i ]]
rm $i
if [[ -e $cds ]]
rm $cds
source /root/.telegram_keysURL=https://api.telegram.org/bot$TOKEN/sendMessage
message=”No se ha podido hacer la copia de seguridad”
curl -s -X POST $URL -d chat_id=$CHANNEL -d text=”$message” >/dev/null 2>&1

y en el crontab crear las siguientes líneas:

30 23 * * * /mnt/mydatabasebackupscript.sh
0 4 * * * find /var/log/ -name *.gz -mtime +7 -exec rm {} \;
0 4 * * * find /mnt/copia/ -name *.gz -mtime +7 -exec rm {} \;


Impactos: 0

Monitoring access to Server SQUID

Monitoring On-line for command lineTo monitor any update, on-line, we can count on the parameter “-f” of the command “tail”, applying filters in accordance with its interest.

# tail -f /var/log/squid/access.log | awk ‘{print$3 ” ” $8 ” ” $7}’ wrochal http://www.linuxit.com.br/ wrochal http://www.linuxit.com.br/log.gif wrochal http://www.linuxit.com.br/banners/linuxmall.gif wrochal http://www.linuxit.com.br/parcerios/01.gif wrochal http://www.linuxit.com.br/parcerios/02.gif wrochal http://www.linuxit.com.br/parcerios/03.gif wrochal http://www.linuxit.com.br/parcerios/04.gif wrochal http://www.linuxit.com.br/google.html

Referencia: https://www.howtoforge.com/monitoring_squid

Impactos: 0

Enviar correos desde la línea de comandos con sSMTP y Gmail


Enviar correos desde la línea de comandos con sSMTP y Gmail

Impactos: 0

Buscar y borrar ficheros grandes desde el terminal


Buscar y borrar ficheros grandes desde el terminal

Buscar y borrar ficheros en Linux desde la linea de comandos es con el comando find y rm

Buscaremos fichero mayores de 500 MB

find /data -type f -size +500000k -exec ls -lh {} \;

Y los borraremos de una forma similar

find /data -type f -size +500000k -exec rm {} \;

Impactos: 0