Posted: . At: 9:24 AM. This was 4 years ago. Post ID: 14149
Page permalink. WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters.
These cookies expire two weeks after they are set.


How to install a very minimal Ubuntu system in a partition.


There is a very minimal Ubuntu release I have found. This is as bare-bones as it can be. This could be the basis of a custom Linux distribution.

Download a copy here: http://cdimage.ubuntu.com/ubuntu-base/releases/19.10/release/ubuntu-base-19.10-base-amd64.tar.gz.

I had a spare 35 Gigabyte Linux partition, so I unpacked the contents of the tarball into the partition so that it looks as shown below.

root@Yog-Sothoth:/# ls -hula
total 56K
drwxr-xr-x  17 root root 4.0K Mar 11 21:50 .
drwxr-xr-x  17 root root 4.0K Mar 11 21:50 ..
lrwxrwxrwx   1 root root    7 Mar 11 21:50 bin -> usr/bin
drwxr-xr-x   2 root root 4.0K Mar 11 21:50 boot
drwxr-xr-x  22 root root 5.1K Mar 12  2020 dev
drwxr-xr-x  31 root root 4.0K Mar 11 21:56 etc
drwxr-xr-x   2 root root 4.0K Mar 11 21:50 home
lrwxrwxrwx   1 root root    7 Mar 11 21:50 lib -> usr/lib
lrwxrwxrwx   1 root root    9 Mar 11 21:50 lib32 -> usr/lib32
lrwxrwxrwx   1 root root    9 Mar 11 21:50 lib64 -> usr/lib64
lrwxrwxrwx   1 root root   10 Mar 11 21:50 libx32 -> usr/libx32
drwxr-xr-x   2 root root 4.0K Mar 11 21:50 media
drwxr-xr-x   2 root root 4.0K Mar 11 21:50 mnt
drwxr-xr-x   2 root root 4.0K Mar 11 21:50 opt
dr-xr-xr-x 304 root root    0 Mar 12  2020 proc
drwx------   2 root root 4.0K Mar 11 21:50 root
drwxr-xr-x   4 root root 4.0K Mar 11 21:50 run
lrwxrwxrwx   1 root root    8 Mar 11 21:50 sbin -> usr/sbin
drwxr-xr-x   2 root root 4.0K Mar 11 21:50 srv
dr-xr-xr-x  13 root root    0 Mar 12  2020 sys
drwxrwxrwt   2 root root 4.0K Mar 11 21:50 tmp
drwxr-xr-x  13 root root 4.0K Mar 11 21:50 usr
drwxr-xr-x  11 root root 4.0K Mar 11 21:50 var

Then I needed to access the command line of the installed distribution. So, I needed to chroot into it.

Firstly, I needed to unmount the partition, and then mount it to a folder under /mnt. Where /dev/sdb3 is the device we are installing to.

root@Yog-Sothoth:~# mount /dev/sdb3 /mnt/fedora-root/

This paves the way for the rest of this process.

Then I needed to mount the /proc folder properly.

root@Yog-Sothoth:~# mount -t proc proc /mnt/fedora-root/proc/

And the /sys folder.

root@Yog-Sothoth:~# mount -t sysfs sys /mnt/fedora-root/sys

Finally, the /dev folder needs to be mounted properly.

root@Yog-Sothoth:~# mount -o bind /dev /mnt/fedora-root/dev/

If everything worked, you can chroot into the folder to actually use the Linux system.

root@Yog-Sothoth:~# chroot /mnt/fedora-root/ /bin/bash

Now I can install packages in the chroot just as in my main OS.

root@Yog-Sothoth:~# apt install mc vim nano nmap
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  file libblas3 libexpat1 libglib2.0-0 libglib2.0-data libgpm2 libicu63 liblinear3 liblua5.3-0 libmagic-mgc libmagic1
  libmpdec2 libpcap0.8 libpython3.7 libpython3.7-minimal libpython3.7-stdlib libreadline8 libslang2 libsqlite3-0 libssh2-1
  libssl1.1 libxml2 lua-lpeg mc-data mime-support nmap-common readline-common shared-mime-info unzip vim-common vim-runtime
  xdg-user-dirs xxd xz-utils
Suggested packages:
  gpm liblinear-tools liblinear-dev arj catdvi | texlive-binaries dbview djvulibre-bin epub-utils genisoimage gv
  imagemagick libaspell-dev links | w3m | lynx odt2txt poppler-utils python python-boto python-tz xpdf | pdf-viewer zip
  spell ncat ndiff zenmap readline-doc ctags vim-doc vim-scripts
The following NEW packages will be installed:
  file libblas3 libexpat1 libglib2.0-0 libglib2.0-data libgpm2 libicu63 liblinear3 liblua5.3-0 libmagic-mgc libmagic1
  libmpdec2 libpcap0.8 libpython3.7 libpython3.7-minimal libpython3.7-stdlib libreadline8 libslang2 libsqlite3-0 libssh2-1
  libssl1.1 libxml2 lua-lpeg mc mc-data mime-support nano nmap nmap-common readline-common shared-mime-info unzip vim
  vim-common vim-runtime xdg-user-dirs xxd xz-utils
0 upgraded, 38 newly installed, 0 to remove and 0 not upgraded.
Need to get 32.5 MB of archives.
After this operation, 144 MB of additional disk space will be used.
Do you want to continue? [Y/n]

This is very useful, it is a minimal system, but after running apt update && apt upgrade, it works just fine.

root@Yog-Sothoth:~# df -Hla
Filesystem      Size  Used Avail Use% Mounted on
/dev/sdb3        34G  495M   32G   2% /
proc               0     0     0    - /proc
sys                0     0     0    - /sys
udev            6.2G     0  6.2G   0% /dev

I guess this could be very useful for testing various things. A very nice testing environment. I guess it could be possible to remove Systemd and install another init system, but it might be tied into the operating system packages too much, like many Ubuntu packages used to be. You used to try and remove OpenOffice and it would take half the system with it.

But this is a very interesting project and well worth trying out.

I updated GRUB on my host system and it found the installation on /dev/sdb3, so it might even be bootable.

4.4 Thu Mar 12 jason@Yog-Sothoth 0: $ sudo update-grub
1) All commands run with root privileges are always dangerous.
2) Never run commands on an environment you are not willing to destroy, or able to restore.
3) Do not become root until you know what you are going to do.
4) Be sure of your command and what is going to be affected by it.
[sudo] password for jason: 
Sourcing file `/etc/default/grub'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.15.0-91-generic
Found initrd image: /boot/initrd.img-4.15.0-91-generic
Found linux image: /boot/vmlinuz-4.15.0-89-generic
Found initrd image: /boot/initrd.img-4.15.0-89-generic
Found linux image: /boot/vmlinuz-4.15.0-87-generic
Found initrd image: /boot/initrd.img-4.15.0-87-generic
Found linux image: /boot/vmlinuz-4.15.0-76-generic
Found initrd image: /boot/initrd.img-4.15.0-76-generic
Found linux image: /boot/vmlinuz-4.15.0-75-generic
Found initrd image: /boot/initrd.img-4.15.0-75-generic
Found linux image: /boot/vmlinuz-4.15.0-74-generic
Found initrd image: /boot/initrd.img-4.15.0-74-generic
Found memtest86+ image: /boot/memtest86+.elf
Found memtest86+ image: /boot/memtest86+.bin
Found Windows 8 on /dev/sdb1
Found Ubuntu 19.10 (19.10) on /dev/sdb3
done

Install this package to get the Linux kernel and associated packages installed.

root@Yog-Sothoth:/# apt install linux-generic

Then, I chose to install GRUB on /dev/sda3 and it added my other partitions to it.


Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.