Install Ubuntu with debootstrapOctobre 2016
How to create a bootable fully functional Ubuntu from debootstrap ?We are here to install a full functional (and bootable) Ubuntu from deboostrap. Two remarks :
- First of all : make your backup.
If you are not familiar with things like
/dev/XXXyou should not read this page.
Formating the partition and installing the base system
Now you have a minimal system in
sudo mkfs.ext4 /dev/XXX sudo mount /dev/XXX /ubuntu sudo debootstrap --arch i386 xenial /ubuntu
/ubuntu, but this is not bootable.
source.list and fstab
Here is what you need in your new
sudo cp /etc/apt/sources.list /ubuntu/etc/apt/sources.list sudo vim /ubuntu/etc/fstab
where you have to replace
pMqroc /proc proc nodev,noexec,nosuid 0 0 UUID=SLASH_UUID / ext4 errors=remount-ro 0 1 UUID=SWAP_UUID none swap sw 0 0
SLASH_UUIDby the UUID of the partition that will be the root of your new system. This is the one which is now mounted in
in order to know the uuid.
chrootIn order to be able to make the requested manipulation in your new system by chroot, you need to mount some repertories. Here you are :
and you can chroot to you new system :
sudo mount --bind /dev /ubuntu/dev sudo mount --bind /proc /ubuntu/proc sudo mount --bind /sys /ubuntu/sys
The first thing to do is an update :
# apt update # apt full-upgrade
Some configurationHere is the most tricky part, because there are some manipulations to be done before to make your new system bootable.
- Localization. You may not need this step.
# apt instal language-pack-fr language-pack-li
- Keyboard configuration. You may not need this step.
# dpkg-reconfigure keyboard-configuration
# locale-gen fr_FR && locale-gen fr_FR.UTF-8 && dpkg-reconfigure locales && update-locale LANG=fr_FR.UTF-8
Packages installationWe first install the needed packages :
One remark : when you are asked where to install the boot-stuff, you only select the drive you want :
# apt install linux-image-generic cryptsetup libpam-mount vim grub-pc grub2-common bash-completion
sdb, ... you don't select the specific partitions. You can now launch the installation of the packages you need. Here is a part of my list :
unity-greeter kubuntu-desktop linux-image-generic grub-pc grub2-common grub-splashimages grub2-splashimages cryptsetup libpam-mount
bash-completion htop verbiste verbiste-gnome pdftk git git-core qgit debootstrap pavucontrol pavumeter konqueror tor torbrowser-launcher
vim-latexsuite vim-gnome vim-addon-manager
vim-gnomeis requested even if you want to use plain
Vimis the terminal because without
vim-gnome, the options
--servernamedo not exist.
- French use
ispell aspell-fr hunspell-fr wfrench ifrench aspell-it aspell-en myspell-en-gb myspell-it hyphen-fr hyphen-it mythes-fr mythes-it thunderbird-locale-fr firefox-locale-fr language-pack-gnome-fr language-pack-fr-base language-pack-kde-fr language-pack-fr kde-l10n-fr thunderbird-locale-fr libreoffice-help-fr
compiz compizconfig-settings-manager compiz-plugins-extra marble plasma-wallpapers-addons
gstreamer1.0-plugins-bad libgstreamer-plugins-bad1.0-0 gstreamer1.0-libav gstreamer1.0-plugins-bad-videoparsers gstreamer1.0-plugins-bad-faad youtube-dl cdrdao libdvd-pkg
libqt5qml-graphicaleffects libboost-all-dev libboost1.58-all-dev
default-jre default-jdk jgit-cli libjgit-ant-java libjgit-java libjgit-java-doc maven pandoc
terminology elementary-icon-theme libelementary-bin
While you are making your big
apt install you can make some other configurations. Lines that begin with
# are to be typed in the chroot.
In order to have the right time zone :
# dpkg-reconfigure tzdata
Create the user. Here I create my users taking care of their UID.
# adduser --uid 1002 --home /interniste interniste # adduser --uid 1001 --home /home/moky moky # adduser moky sudo # adduser moky lp # adduser interniste sudo
- I do not use UID 1000. My wife has user 1000 because having an other number sometimes brings permissions problems using USB keys that are formated in ext4.
- Adding my principal user to the group
lpis mandatory to be able to install printers (I really wonder why)
- It is interesting to have a "dummy" user which have super user privileges because it enables you to make a
fsck.ext4on your home partition (well, this is not mandatory, but it makes things clearer).
If you understood correctly, it was a bad idea to make a reboot before to arrive at this point.
In your current OS (not the chroot to the new one), install grub :
sudo grub-install --root-directory=/ubuntu /dev/sdQUOI sudo cp /etc/default/grub /ubuntu/etc/default/grub
Update grub; the following has to be done in the chroot :
Once again in the current OS :
sudo dpkg-reconfigure grub-pc
If your home is encrypted and if the encryption's password is the same as your user'one, you can make the partition to be automatically mounted and decrypted (in the sense
/dev/mapper/... to be created and that directory to be mounted as your home) at login. The file
/ubuntu/etc/security/pam_mount.conf.xml has to contain the line
< volume user="moky" fstype="crypt" path="/dev/disk/by-uuid/HOME_UUID" mountpoint="/home/moky" options="fsck,relatime" />
VimI'm making this :
# apt install vim-gnome vim-latexsuite vim-addon-manager # vim-addons -w install latex-suite matchit
# sudo dpkg-reconfigure libdvd-pkg