Skip to content

Instantly share code, notes, and snippets.

@Tookmund
Last active April 5, 2024 20:20
Show Gist options
  • Star 16 You must be signed in to star a gist
  • Fork 7 You must be signed in to fork a gist
  • Save Tookmund/abfc4cbd803915264e0c to your computer and use it in GitHub Desktop.
Save Tookmund/abfc4cbd803915264e0c to your computer and use it in GitHub Desktop.
Install Debian or Ubuntu like Arch

This guide is a best-effort to configure a system with just debootstrap.

It has been updated so as not to be actively incorrect as of June 2022, when I realized it was still being used, but it was first written in 2015 and I can't guarantee that it's not missing essential parts of the process.

If it breaks, you get to keep both pieces

  1. Download a Debian live standard CD: https://cdimage.debian.org/cdimage/release/current-live/amd64/bt-hybrid/
  2. Login with user:live (if needed, it will probably automatically login)
  3. Check that you have internet with ip a. If you're using ethernet it should already be connected, otherwise you'll need to configure interfaces(5) and probably wpa_supplicant(8)
  4. Setup and mount disks at /mnt. Arch Linux has a good guide to this: https://wiki.archlinux.org/index.php/Partitioning
  5. Install and run debootstrap
    • sudo apt-get update
    • sudo apt-get install debootstrap
    • Replace RELEASE below with the name of the release you want to install, like bullseye or focal
    • Debian: sudo debootstrap RELEASE /mnt http://deb.debian.org/debian
    • (If Ubuntu) sudo apt-get install ubuntu-archive-keyring
    • Ubuntu: sudo debootstrap RELEASE /mnt http://archive.ubuntu.com/ubuntu
      • You may be able to get away with installing more recent versions of Ubuntu by creating new symlinks, but you may just as likely run into errors
      • E.g. jammy won't install with bullseye's debootstrap due to using unsupported zstd compression
      • Check to see what current debootstrap uses and then copy it: https://salsa.debian.org/installer-team/debootstrap/-/tree/master/scripts
      • cd /usr/share/debootstrap/scripts && ln -sf gutsy jammy
  6. Copy your networking configuration to the new install
    • sudo cp /etc/network/interfaces /mnt/etc/network/interfaces
    • Also copy over your wpa_supplicant.conf if you made one
    • If you're installing Ubuntu, you'll need to instead configure netplan: https://netplan.io/examples
  7. Edit /mnt/etc/fstab: https://wiki.archlinux.org/index.php/Fstab
    • Alternatively you can generate an fstab file with genfstab
    • sudo apt-get install arch-install-scripts
    • genfstab /mnt > /mnt/etc/fstab
  8. Mount filesystems and chroot into your new system:
    • Alternatively you can use arch-chroot
      • sudo apt-get install arch-install-scripts
      • sudo arch-chroot /mnt
    • sudo mount --bind /dev /mnt/dev
    • sudo mount -t proc none /mnt/proc
    • sudo mount -t sysfs sys /mnt/sys
    • sudo chroot /mnt /bin/bash
  9. Set root password with passwd
  10. Set hostname with: echo HOSTNAME > /etc/hostname
  11. Set timezone with dpkg-reconfigure tzdata
  12. Generate Locales
    • apt-get install locales
    • dpkg-reconfigure locales
  13. Install a Linux kernel
    • Locate the appropriate one with: apt-cache search linux-image
    • Install it with apt-get install KERNELNAME
    • You probably want something to the effect of linux-image-ARCH e.g. linux-image-amd64 (or linux-image-generic for Ubuntu)
    • Ubuntu will pull in grub as part of this step and prompt for grub installation, allowing you to skip the next three steps
  14. Install Grub
    • BIOS: apt-get install grub-pc
    • UEFI: apt-get install grub-efi
  15. Install Bootloader with grub-install /dev/DEVICENAME
  16. Configure Grub with update-grub
  17. Exit Chroot with: exit
  18. Umount everthing with sudo umount -R /mnt
  19. Reboot with sudo shutdown -r now
  20. Remove installation media
  21. Enjoy!
@binarydepth
Copy link

You're missing useradd or adduser

@matinvic
Copy link

it should be Edit /etc/locale.gen instead of Edit /etc/locales.gen

@LinuxDragon57
Copy link

LinuxDragon57 commented Apr 27, 2021

Maybe use dpkg-reconfigure locales and dpkg-reconfigure tzdata for configuring locales and time zones, respectively?

@LinuxDragon57
Copy link

Oh yeah, arch-install-scripts is a package that is available in Ubuntu Groovy (idk about earlier versions of Ubuntu or Debian), and it provides Arch's genfstab script which is nice when debootstrapping the system.

@LinuxDragon57
Copy link

LinuxDragon57 commented Apr 27, 2021

Apparently, arch-install-scripts also includes arch-chroot

https://packages.debian.org/sid/admin/arch-install-scripts

@milasudril
Copy link

Hmm, the chroot has no network, thus step 11 fails for me

@Baraccc
Copy link

Baraccc commented Aug 28, 2022

consider switching from debstrap to mmdestrap.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment