Devuan bootstrapping

NetInstall >
Using debootstrap is probably the fastest way to install a working Devuan-Debian system onto a hdd.

In fact, the netinstall CD uses debootstrap, with some automated scripts and package installs to select from, but running one's own scripts with it seems very limited and you still need to boot up the installed system or chroot into it to finish setting up, thus making extra steps.

Live-build uses it too but the end result is a live ISO to install to a CD or USB, that you also need to boot from (if it works!) before installing it to any device.

Using debootstrap directly from an installed system reduces the need for downloading and writing an ISO file and booting anything. Plus you can script the whole process to your liking, or make a task list, creating a new system ready to boot up in half an hour.

You could also run debootstrap from a live CD if you don't have an installed Linux to work from.

It is perhaps not for the complete novice however, although the process can be kept minimal and simplified to commands entered one by one.


The process in brief

  • format & mount a device
  • setup apt on target
  • Debootstrap a base system
  • write /etc/fstab
  • install Grub
  • setup locale
  • insall desktop packages
  • finish any jobs in chroot, such as copy system files over, setup sudoers for new user, add to fstab


  • Fist get it from repo...
     

    The basic debootstrap command looks like this for devuan:
     
    which translates to:
    debootstrap ARCH SUITE TARGET MIRROR

    Other suite names to use can be found in /usr/share/debootstrap/scripts/

    To run it you will need to format a device and mount it and include the mount point (target) in the debootstrap command.


    Scripting the process

    Scripting the whole process is much more fun, but the script has to be written with safety nets and well tested.

    And here's a script that I put together... it selects a device, runs debootstrap and enters chroot. It also copies over the apt cache to the target device.

    If the nework is good and debootstrap can retrieve the base packages and gpg keys OK, then the process will only take a few minutes. If GPG fails to read the keys then it will fail, no system directories will get created on the target device and mounting sys, proc and dev will not work - hence the findmnt command in the script checks to see if the right system directories get mounted on the target or not.

    Following that is another script that can be run in the chroot device.

     

    Another script here, to run commands in chroot.
     


    Finally, while the target device is miounted, I sync over system settings files from my running box