5

I want to build a Linux based OS which is custom made for only one application and is totally light-weight and uses minimum system resources. How do I go about this?

Would stripping down an already existing OS such as Ubuntu be a good idea?

manatwork
  • 31,277
sreeraag
  • 169

4 Answers4

6

If you want to build a Linux based OS that runs only what's necessary for the computer to work, and if you have time for that you should have a look at LFS.
http://www.linuxfromscratch.org/
It is a book that explains everything you need to know about compiling the linux kernel. Of course it takes a lot of time but in the end it's always a good idea to have a look. After you made your custom Linux distribution, then you can read BLFS (Beyond Linux From Scratch) to add some applications.
In the process of creating your Linux distribution, you will see how to launch the applications at startup.

By the way, forking Ubuntu is the WORST idea ever. It's absolutely not light and runs a bunch of applications at startup. I would recommend you Archlinux. It's a lot lighter than Ubuntu. Hope it helps.

Archlinux Link : https://www.archlinux.org/ As the title says, it's a lightweight distribution, might be just what you look for. Instead of building your own distribution, just give a shot at Arch and make your application run at the startup, it's not that complicated.

Depado
  • 679
2

I have been thinking about it as well, as there are many ways a big application can fail in security, like a browser, as it always has bugs/vulnerabilities to be solved.

I believe you have to start compiling a kernel for a virtual machine emulator, drivers for that especific video card, drivers for just one ether card and no need for shadowed passwords, usb support, bluetooth, wireles drivers, filesystems and all exoteric stuff there is.

You also need the minimum amount of /bin/ /sbin/ /usr/ and the directory hierarchy files to boot the system.

So you end up creating a really thin system with none of the complexities a complete Linux system has.

Actually I believe there is a lot o people in need of such a distro and it would be very easy to keep updating it, I would definitely contribute to a project like that with money.

Separate the big and dangerous applications from the main system and run them isolated on a VM.

The bottom system could be a more security rigorous system such as OpenBSD or FreeBSD.

Plus, I wish there was a WORKSTATION OpenBSD distro as well (not a server OpenBSD distro) to run this pocket linux distros on OpenBSD with Qemu.

Why?! Because the base system for OpenBSD is audited and none of the linux code is, most of the time (not completely sure).

Lots of big and security risky apps could be running on that lightweight distro, like: gimp, libreoffice, all sorts of browsers (open and closed source), java ides, p2p apps of all sorts and many others.

Another thing is that the base distro could be distributed as an qemu image or with all other types of VM disk image formats, and also the application images, with all that is necessary to run that specific application like an image as well.

This way we will end up with a kernel, a base linux filesystem image and many application images and they can all be updated in separate.

The distro could be loaded with one image for the base linux distro in one virtual drive, the app image in another virtual disk drive and voilà!

Sand boxing, jailing and running securely all sorts of applications !

0

This one might be a kind of opposite answer.

Take a look at DSL(Damn Small Linux). This might be what you need. This one is actually built to be used on a system with low hardware configuration like low memory. It comes with basics components like just vim and nano editor, a browser, a remote-desktop viewer, and some other basic features. Checkout this wiki link for more info on it.

mtk
  • 27,530
  • 35
  • 94
  • 130
0

The basic idea would be to start your application as init (but be careful, process 1 is very special). Perhaps start with one of the mini-distributions, and work from there? Or even set up an initramfs with what is needed, and never leave it?

Also consider carefully if the savings of not having even a minimal userland available are worth the absolute impossibility of troubleshooting/tweaking.

vonbrand
  • 18,253