GNU Linux Debian - very fast and easy semi-automatic online install Debian 11 (non-free)

many users have/had macbooks.

what was/still is great: OSX can be reinstalled over internet! (no more searching for licence keys or setup sticks/DVDs/CDs/)

given the fact – that once installed – GNU Linux Debian can boot (almost) anywhere, the fastest and easiest way to “install” it is to simply 1:1 copy it on whatever the user wants to boot from (harddisk or usb stick (some sticks can not be made bootable, try at least 3 different vendors)).

So… this install script 1:1 copy installs Debian 11 (non-free) on any laptop/desktop/server (depending on internet speed) very fast & easy.

The process can be automated (on similar hardware or on hardware where /dev/sda is always the device the user wants to 1:1 overwrite).

This script install process is almost like OSX 🙂 but “semi-automatic” to double ask, not to overwrite the wrong (USB attached?) disk.

  • it comes with a full MATE Desktop and everything to get working (LibreOffice and Firefox and Thunderbird)
  • it has the “cosmos” slideshow (love it!) background enabled per default
  • the terminal comes with green on black for better readability
  • it does not have a swap partition enabled, so the user can easily with gparted 1) extend the harddisk to it’s full capacity 2) create a swap partition
  • English, Spanish, Chinese and German keyboard layout are active, should be possible to switch between them in the top right corner

todo: what is still missing

  • what is still missing is:
    • automatically calc (based on RAM size, would do as much swap as RAM) how much swap should be created
    • extend the /root partition to full harddisk capacity minus the swap space
    • create the swap partition and edit config files /etc/fstab and /etc/initramfs-tools/conf.d/resume for proper (as intended) functionality of the system
  • apply this
  • display a dancing penguin during first successfull boot and encourage user to do at least 5min of dancing to this funky music 🙂

WARNING!

  • make sure to disconnect all devices (external harddisks, usb sticks, sdcards)
    • less devices = less trouble and less accidentally overwriting a external harddisk or usb stick
  • if the target device /dev/sdX contains important data, backup it up !first! (all data will be overwritten)

WHY NON FREE?

it’s based on the non-free version, because it is intended to allow new users that never tested GNU Linux Debian (with a MATE Desktop) a “it just works” turnkey experience.

Is the Free version better?

If the user has concerns about surveillance/spying and needs maximum privacy than it is probably better to start with the defautl GNU Linux Debian free version and usually all network-cards/NICs work out of the box (free drivers available 🙂 (but maybe not the wifi cards)

new users: workaround for this pitfall:

https://dwaves.de/2022/01/21/gnu-linux-debian-11-2-network-stops-working-networking-stops-during-setup-bad-archive-mirror-how-every-os-setup-should-be/

Problems might arise with the free version and wifi: (notebooks)

because then the user will probably have to install the appropriate closed source (#evil!) drivers from the the non-free repository with all the spying backdoors that a intel wifi driver might have (after all a network card, is like a small computer, inside a computer, ideal! but then if the BIOS is not LibreBooted… the Intel ME can not be disabled… (some OS allow to permanently disable Intel ME!!!).

… the fight for more privacy and security – seems never ending and goes on.

requirements:

  • the laptop/desktop/server root harddisk/the target harddisk (/dev/sdX) should have at least 100GBytes of harddisk space
  • ideally boot from GNU Linux live usb stick with at least 3GBytes of free space
  • or alternatively: boot from read-only live DVD or image and when booted up, connect a ext4 or ext3 or fat32 or ntfs formatted USB stick or drive with at least 3GBytes of free space

    • there are many other desktop live flavours available (great! 🙂 : https://cdimage.debian.org/debian-cd/current-live/amd64/iso-hybrid/
    • when booted from live, cd into the external usb stick-drive
    • create the below script (copy content into a text file, name it name-of-script.sh)
    • <span style="color: #00ffff;">chmod +x name-of-script.sh</span>; # mark it runnable - <span style="color: #00ffff;">su - root</span>; # become root
    • <span style="color: #00ffff;">/name-of-script.sh /dev/sdX</span>; # run it, passing the device Debian 11 should be installed on - will download ~2.5Gbytes image.gz to current directory (the usb-stick-drive and store it there permanently for later re-use) - curl can resume interrupted downloads

usage:

# sdX is the device the user wants to install Debian 11 on
<span style="color: #00ffff;">/scripts/install_debian_from_image.sh /dev/sdX
</span>

process complete? reboot & “it just works”?

congratz! do 1min of wiggle dance!

[video width=”306″ height=”194″ mp4=”https://dwaves.de/wp-content/uploads/2022/01/happyness-drum-and-bass-dance-of-success.mp4″\]\[/video\]

post processing:

want to use the complete harddisk not just the 100GBytes? two possibilities:

what the script will do:

  • download a pre-installed Debian 11 image.gz and it’s sha512check-sum
  • sha512 check the image (check the image is unaltered and intact)
  • on the fly unpack and 1:1 write the image to /dev/sdX while showing a progress bar
<span style="color: #00ffff;">vim /scripts/install_debian_from_image.sh</span>

<span style="color: #ff6600;">#!/bin/bash

DEBIAN_IMAGE=debian11_amd64_non_free_drivers_mate_libre_firefox.img.gz
DOWNLOAD=https://dwaves.de/downloads/$DEBIAN_IMAGE

# define colors
RED='\033[0;31m'
WHITE='\033[0;37m'
YELLOW='\033[0;33m'
COLOR_OFF='\033[0m' # reset color to default

echo -e "${WHITE}=== download and 1:1 copy debian.img.gz to $1 ===${COLOR_OFF}\n"

if [ -z "$1" ]
  then
    echo "please pass device like this: /dev/sdx
          TARGET THE WHOLE DEVICE (sdb)
          NOT A PARTITION! (sdb1)"
  else


echo -e "${RED}this script is meant to be run from an live-cd or usb stick (so $1 should be an OFFLINE filesystem (not currently running)"
    echo "please read carefully, a mistake could overwrite critical data!!!"
    echo -e "physically disconnect all critical data-drives before procedure!!!${COLOR_OFF}\n"
    echo ""

    echo "========== do you want to copy the $DEBIAN_IMAGE image on device $1 ?"

    echo -e "${YELLOW}~3GBytes of disk space is needed in the current directory${COLOR_OFF}\n"
    pwd
    echo "=========== harddisk overview";
    echo "==== where is what";
    lsblk -o 'NAME,MAJ:MIN,RM,SIZE,RO,FSTYPE,MOUNTPOINT,UUID'
    smartctl -i $1;
    echo ""


echo -e "${YELLOW}"
read -p "CONTINUE? (y/n)" choice
case "$choice" in 
  y|Y ) echo "yes";;
  n|N ) echo "no";;
  * ) echo "invalid";;
esac

    echo "installing required software for fast multi threaded decompression of image (pigz)"
    echo "and showing progress during dd (pv)"

echo -e "${COLOR_OFF}\n"

    apt update
    apt install pv pigz curl

echo -e "${YELLOW}starting download of $DOWNLOAD... please stand by${COLOR_OFF}\n"
    curl -L -O -C - $DOWNLOAD;

echo -e "${YELLOW}starting download of checksum $DOWNLOAD.sha512sum.txt ... please stand by${COLOR_OFF}\n"

    curl -L -O -C - $DOWNLOAD.sha512sum.txt;

    echo "verify sha512sum..."

cat "./$DEBIAN_IMAGE.sha512sum.txt" | sha512sum -c

if [ $? != 0 ]; then
echo -e "${RED}Checksum failed. aborting script. maybe $DEBIAN_IMAGE corrupted during download. please try to re-run the script." >&2
echo -e "${COLOR_OFF}\n"
  exit 1
fi

echo -e "${YELLOW}starting write process...${COLOR_OFF}\n"
    umount $1*;

    dd if=./$DEBIAN_IMAGE of=$1 status=progress; sync;

    pigz -dc $DEBIAN_IMAGE | pv | dd bs=1M of=$1; sync;
    ## single core
    ### gunzip -c /path/to/image.img.gz | pv | dd of=$1; # write image to usb stick

echo -e "${YELLOW}the image $DEBIAN_IMAGE was written to stick $1. process finished. try booting it now :)${COLOR_OFF}\n"
fi

</span>

#linux #gnu #gnulinux #opensource #administration #sysops #gnu-linux #debian #osx #setup #installation #breeze #easy #fast #debian11 #bullseye

Originally posted at: https://dwaves.de/2022/01/28/gnu-linux-debian-very-fast-and-easy-semi-automatic-online-install-debian-11-non-free/

There are no comments yet.