> On Mon, 28 Oct 2019 at 19:06, MR ZenWiz <[hidden email]> wrote:
> > Is it possible to build the ubuntu 18.04 kernel such that it will run
> > effectively with 64MB or less?
> Kernel, yes.
> Desktop, no.
> But a bare install of Ubuntu Server or JeOS would probably work.
> > While I personally have no need for this, someone asked on Quora and
> > I'm curious now.
> Oh? Where's that? Can't find it.
"B. Generated configuration
Tip: Plug in all devices that you expect to use on the system if using
Since kernel 2.6.32, the localmodconfig command will create a .config
file for the custom kernel by disabling any and all options not
currently in use by the running kernel at the time. In other words, it
will only enable the options currently being used.
While this minimalist approach will result in a highly streamlined and
efficient configuration tailored specifically for your system, there
are drawbacks, such as the potential inability of the kernel to support
newer hardware, peripherals, or other features. Note: Again, ensure
that all devices you expect to use have been connected to (and detected
by) your system before running the following command
You probably want to fine tune the generated config. Do you want a slim
kernel that is still compatible with Ubuntu defaults? If yes, you
probably want to care that apparmor is enabled, if not you probably
want to disable audit, which results in apparmor disabled, too. There
might be other important config settings, too and perhaps even relevant
Ubuntu specific patches.
Assuming the kernel should just work with Ubuntu installs, but needs
not to support something such as apparmor (e.g. keep "snappy" in mind
before you decide if it's needed or not), you still should think about
to add one or the other hardware support manually to the config.
In short, it is possible to build very slim kernels, but you need to
read up on what is required for the infrastructure of the distro you
are using, if it still should be full compatible, OTOH you might not
need compatibility to the full infrastructure of the distro.
You also won't run "make olddefconfig" if you upgrade your kernel,
using the tailored config, instead you perhaps could run
"make oldconfig" and to reply to each question manually.
Even running "make oldconfig" might be suboptimal, since it still would
add some new features with upstream defaults.
To stay close to the original Ubuntu kernel configs, you could copy
such a config and run "make menuconfig", to disable everything you
don't need manually, but to stay with defaults, such as maybe some
selected Hz, PREEMPT or mitigation or what ever else settings. Note
Ubuntu provides different kernels by official repositories, the most
likely default all to the same mitigation settings, all most likely
support apparmor, but some might come with different Hz and PREEMPT
settings. The Ubuntu lowlatency kernel for example automatically boots
On Mon, 28 Oct 2019 22:49:06 +0100, Liam Proven wrote:
>On Mon, 28 Oct 2019 at 19:06, MR ZenWiz <[hidden email]> wrote:
>> Is it possible to build the ubuntu 18.04 kernel such that it will run
>> effectively with 64MB or less?
Indeed, probably parts of a base install could be kept very small,
especially when removing translations, header files, licenses, man
pages and maybe by reducing the amount of icons and fonts, maybe no
wallpaper at all, searching for the smallest possible init system,
installing only some libs of e.g. gcc or gtk. There's a big difference
between firefox and qutebrowser, fltk and gtk2 and while a Windows XP
alike environment such as jwm also has a very slim dependency chain,
the chain already is relatively bloated. Small solutions such as
busybox probably can't be used to replace dependencies of a graphical
environment. An example for installing sizes without a complete base
infrastructure and without all needed dependencies, but with headers,
translations and one or the other file that could be removed, followed
by the dependency tree of jwm:
(it doesn't matter what distro is used, the example is listed for Arch,
since it's closer to upstream, by not splitting packages in a way it's
done by Ubuntu, so it's easier to get an overview of complete sizes of
upstream projects, but the dependencies are still missing, too)
Am Montag, den 28.10.2019, 11:02 -0700 schrieb MR ZenWiz:
> Is it possible to build the ubuntu 18.04 kernel such that it will run
> effectively with 64MB or less?
> While I personally have no need for this, someone asked on Quora and
> I'm curious now.
> I don't think this is feasible, but....
it definitely is ... even without recompiling the ubuntu kernel you
should be able to boot it in 64MB RAM ... the problem here isnt the
kernel but userspace bits required during boot.
most modern linux installs use an initramfs, this means you load a
small ramdisk into memory alongside the kernel before switching to your
originally this was designed to be able to load all controller user
space bits (raid tools, controller modules etc) to find your disk. back
then even an initramfs could still fit into 64MB RAM along your
ubuntu is designed to be generic and to run on as many hardware
combinations as possible in a stable way, so you need to ship a lot
more drivers and user space tools alongside the kernel itself than a
system tailored for a single purpose on just one hardware setup would
over time new features showed up. people want to encrypt their disks so
you need to add (usb) keyboard support, key maps, some basic language
support and all the bells and whistles to enable them to type in a pass
phrase... someone wants to net boot the rootfs from a remote server. so
you need a networking stack and all the possible NIC drivers included
... then there are boot-splashes to make your screen for pass phrase
typing prettier, show a progress bar during boot etc etc
i guess nowadays the initramfs itself is even bigger than a complete
server install was 15y ago but if you are able to adjust the initrd to
be exactly tailored for your hardware to only do the very simple task
of just mounting your rootfs on this one machine you should be able to
get through the boot to a running rootfs even on 64MB.
later in the boot process the system will also load modules and
firmware into ram, here you have again a lot of generic stuff ... say
your system has USB support, the kernel might load some generic bits
into ram for potential use cases (i.e. usb-storage support in case you
want to plug in an usb stick eventually) all these bits will eat up
your ram right *after* the boot, so you need to tailor the
configuration on the rootfs to avoid this.
each tty login prompt that idles on your system eats ram, so you want
to disable them ... bash uses up ~5MB of ram when running, you want to
make your login shell dash, ash or busybox which were designed for low
ram usage. turn off all non-existential services that could occupy ram.
now ... even if you got to a login prompt and can log in the one
question remains: what exactly do you want to run on this system that
has only enough ram to barely boot it, can you even find software for
the task you plan for this system that is small enough to fit into the
remaining ram ?
with the snap based Ubuntu Core (very often used for single purpose
tasks (Wifi APs, routers, IoT gateways, digital signage displays) on
dedicated hardware) which is very cut down but still ships some bits
for the generic parts described above i can easily boot in 128MB (i
guess even 96MB would work), but after boot just the idling processes
of the OS itself use up ~48MB. that leaves very low space for running
any additional software.
so yes, i guess booting in 64MB RAM is still possible, but requires
jumping through a lot of hoops and that you have a lot of basic
knowledge about what you are doing when modifying it.