I read that is possible to install Lubuntu on a 4 GB pendrive, so I would like to do the same on a 4GB virtual machine (on VirtualBox 5.2). The problem is that when I execute it, it says that there is no enough space and that 8GB are required. How can I install it?

EDIT: I'm asking a different question. How can I simulate the installation of Lubuntu on a 4GB pendrive on a virtual machine?

  • @Kulfy I'm asking a different question. How can I simulate the installation of Lubuntu on a 4GB pendrive on a virtual machine? – JimBelushi2 Jan 4 at 8:40
  • When you say I read that is possible to install Lubuntu on a 4 GB pendrive: Are you referring to a bootable usb or a persistent usb? They both are different things. – Kulfy Jan 4 at 8:50
  • I'm talking about installation like these where you can set 4GB as the amount space: askubuntu.com/questions/880080/… – JimBelushi2 Jan 4 at 8:55
  • 1
    A full installation on USB will also take 8GB min. Also you might like to read this answer to be more clear. – Kulfy Jan 4 at 9:02

Brute force installation from even mini.iso may fail because of not enough disk space during installation (as it needs it for both packages downloading into /var/cache/apt/archives and their extracting to root filesystem).

But you can get small viable system by proceeding with the following procedure:

  1. Install SSH server on the host

    sudo apt-get install ssh
  2. Create folder on the host for storing deb-archives inside home directory of your user (let's call him host-user)

    mkdir -p ~/Public/debs
  3. Download minimal Network Boot mini.iso

  4. Configure VM to use bridged adapter networking

    bridged networking

    and determine host IP with any method you like (from ifconfig or something).
    Let's assume it is

  5. Boot VM from mini.iso

  6. Proceed with minimal installation (make whole disk a single partition for rootfs, and do not select huge components on the taskel package selection) and reboot VM on finish
  7. Install SSHfs client into guest

    sudo apt-get install sshfs
  8. Mount /var/cache/apt/archives from outside the VM with SSHFS from host to guest

    sudo sshfs host-user@ /var/cache/apt/archives -o nonempty

    Note: change host-user to real username on host and to the IP of the host.

  9. Then install the Lubuntu flavor as usual by APT but without recommended parts (to save disk space)

    sudo apt-get install lubuntu-desktop --no-install-recommends
  10. Reboot and enjoy.

As the result you will get 1 Gb free and pretty small but usable system. Install Firefox and other stuff by hand.

1. Consider to use LTS version of the Ubuntu instead of 9-month regular version.
2. You can install almost any flavor by this method.

  • 1
    I got it working! Create a fat16 EFI partition with 10MB, EXT4 root 3990MB. EXT4 reserved blocks 1%. Remove swapfile from / and fstab. Change initramfs.conf to COMPRESS=xz and BUSYBOX=n. Remove: busybox-static grub-efi-amd64-signed linux-signed-generic shim-signed secureboot-db sbsigntool ubuntu-advantage-tools wamerican wbritish dictionaries-common emacsen-common mokutil shim intel-microcode. /etc/systemd/journald.conf SystemMaxUse=10MB. Install dependencies of lubuntu-desktop except: genisoimage plymouth-theme-lubuntu-logo plymouth-theme-lubuntu-text software-properties-qt. df / 87%. Cool :) – LiveWireBT Jan 4 at 12:55
  • @LiveWireBT If you have followed my method, you can vote for it. If you have adapted it - your are welcome to edit my answer and remove <s> tags :) Just curious - did SSHFS do a trick (it should save about 900 Mb on rootfs, I believe)? If this method is working we can vote for reopening also. – N0rbert Jan 4 at 13:17
  • I installed ssh for convenience of working with the terminal but I was lucky on first try without following your instructions using SSHFS and carefully looking at parts that I could chip away (dpkg -l). Edit: Also I prefer forwarding a host port in virtualbox to guest port 22 instead of bridged mode. may just be a habit. :) – LiveWireBT Jan 4 at 13:20
  • Got it installed flawlessly only with --no-install-recommends. Otherwise got no space left on device... – N0rbert Jan 4 at 13:37
  • 1
    @LiveWireBT Your comment on question seems legit. I've casted my reopen vote :) Saw this kind of installation first time. Looks interesting. I'll try this installation. +1 N0rbert :) – Kulfy Jan 4 at 17:39

Here is my version of how I approached the problem:

  1. Create a VM in VirtualBox if you haven't already.
    • Configure it to use EFI, that's just how I prefer to do things and it may also be easier copying the contents from the VM to a USB drive if you use only UEFI capable computers.
    • Configure port forwarding in the network settings, I forwarded host port 55222 to guest port 22. When you install OpenSSH server after the installation finished and rebooted into your new system you have the benefits of using features like copy and paste through SSH and displaying more content while you are without the GUI.
  2. Download minimal Network Boot mini.iso.
  3. Boot and follow the installer instructions. Create a GPT partition table and the following partitions:
    • Create a FAT16 EFI (mountpoint /boot/efi) partition with 10MB.
    • Create a EXTt4 root partition with 3990MB. Set EXT4 reserved blocks to 1% instead of 5%. It's generally not recommended, but if you want to make the most of the available space this an option you have.
  4. After the installation of the minimal system has been completed and you booted into the system the first time you can do the following:
    • Remove swapfile from / and fstab.
    • Remove plymouth package and replace splash with nosplash in /etc/default/grub, run update-grub. Removing plymouth from initramfs (happens in the next step) saves a few more MB.
    • Change to COMPRESS=xz and BUSYBOX=n /etc/initramfs-tools/initramfs.conf and run update-initramfs -u. This will boot a bit slower, but saves about 10MB of initramfs. You can save more (up to 25MB) with MODULES=dep, but at the risk of non-bootable OS on some systems.
    • Remove manpages package if you think you will never need them and rather look them up on http://manpages.ubuntu.com/.
    • If you are sure you can also remove these packages: busybox-static grub-efi-amd64-signed linux-signed-generic shim-signed secureboot-db sbsigntool ubuntu-advantage-tools wamerican wbritish dictionaries-common emacsen-common mokutil shim intel-microcode
    • Run apt autoremove.
    • Set SystemMaxUse=10MB in /etc/systemd/journald.conf.
  5. Install the desktop with sudo apt-get install lubuntu-desktop --no-install-recommends as suggested by N0rbert.

My previous approach was to look at the dependencies of lubuntu-desktop package and decide what I don't need. I came up with this list of packages I don't need: genisoimage plymouth-theme-lubuntu-logo plymouth-theme-lubuntu-text software-properties-qt.

So this is the list of packages I installed:

 alsa-base alsa-utils anacron arc-theme bc bluedevil breeze-cursor-theme ca-certificates dbus-x11 desktop-file-utils fcitx fcitx-frontend-qt5 fcitx-ui-qimpanel ffmpegthumbnailer fonts-dejavu-core fonts-freefont-ttf foomatic-db-compressed-ppds fwupdate ghostscript-x gvfs-backends gvfs-fuse inputattach kde-style-breeze libfm-modules libmtp-runtime libqt5svg5 libsasl2-modules libu2f-udev lubuntu-artwork lubuntu-default-settings lxqt-about lxqt-admin lxqt-core lxqt-openssh-askpass lxqt-powermanagement lxqt-sudo mobile-broadband-provider-info modemmanager network-manager nm-tray obconf-qt openbox openprinting-ppds oxygen-icon-theme papirus-icon-theme pavucontrol-qt pcmanfm-qt pinentry-qt printer-driver-gutenprint printer-driver-pnm2ppa pulseaudio pulseaudio-module-bluetooth qterminal qttranslations5-l10n rfkill sddm sddm-theme-lubuntu spice-vdagent ubuntu-drivers-common ubuntu-mono ubuntu-release-upgrader-qt unzip usb-creator-kde usb-modeswitch whoopsie wireless-tools wpasupplicant wvdial x11-utils xdg-user-dirs xkb-data xorg xscreensaver xz-utils zip

Adding the --no-install-recommends will save even more space.

My result (with recommends):

df -h

/dev/nvme0n1p2  3.6G  3.1G  495M  87% /

sudo apt clean

/dev/nvme0n1p2  3.6G  3.0G  593M  84% /

Yes I installed on NVME instead of SATA in VirtualBox, because you can with EFI. :)

I don't know of a good and small browser, installing Firefox or Chrome and attempting to use them as desktop browsers (or use electron apps, leave alone snaps of flatpaks) will create a lot or cache files. You could mount some directories in RAM if the data is not important and you have plenty of RAM, but you are going to hit the limitations of this setup soon I think.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.