Linux with only terminal

How to make a minimal bootable linux (only with terminal) from kernel source code? [duplicate]

I want to make a very minimal linux os which only have a terminal interface and basic commands/applications (busybox is my choice for commands/apps). I don’t want the installation option on my os. I just want it to be booted and run completely from RAM. I’m planning to use ISO-Linux as bootloader. No networking, no virtualization support, no unnecessary drivers, etc. I want it to be very very basic os. I’ve downloaded the latest stable kernel (v4.5) source code from kernel.org and the build environment ready. My one more confusion is that does a kernel by default has any user interface (shell, terminal, . ) where i can type commands and see output?

2 Answers 2

Technically you can achieve this. Though, kernel do not have any built-in user-interface.

You need to follow steps as:

1. Create a initramfs with static busybox and nothing else. This initramfs will have few necessary directories: like proc, sys, tmp, bin, usr, etc 2. Write a "/init" script, whose main job will be: a. mount the procfs,tmpfs and sysfs. b. Call busybox's udev i.e. mdev c. Install the busybox command onto virtual system by executing busybox install -s d. Calling /bin/sh 3. Source the initramfs directory while compiling the kernel. You can do so by flag: CONFIG_INITRAMFS_SOURCE 4. Compile your kernel. 5. Boot off this kernel and you will get the shell prompt with minimal things. 

Though, I write above notes in a very formal way. You can fine tune it the way you desire.

Follow this link for some guidelines.

Источник

Finding Linux distro with terminal only

If the application you want to run is a GUI program (a good example of why you can’t literally just run one application, since GUI apps require an X server), you can have an that looks like this; When you then , your program will be the only thing running, and it will be impossible to change desktops or start anything else, partially because there is no window manager or desktop environment (hence, there will be no window frame or titlebar either). I want it to test some shell script and I really don’t need a desktop environment because I want it to perform as best as possible.

Finding Linux distro with terminal only

I’n looking to download a linux distro that has nothing but a terminal, simply boot up the machine into a console/terminal that runs sh/bash. I want it to test some shell script and I really don’t need a desktop environment because I want it to perform as best as possible. If anyone knows anything like this let me know thanks!

I tried to look it up on google and YT and all I find is some lightweight distributions but with desktops.

I recommend you Arch Linux. It’s a lightweight and DIY distro. You don’t need a desktop environment to install it on your system

Читайте также:  Vnc viewer linux установка

Recommended Resources To Get Started With Terminal, I want to try to setting up a headless (terminal-only) Ubuntu Linux server, and am trying to find resources to get started. I’ve been a GUI Linux/Windows user for a while now, and have run through a tutorial to setup a server on an Ubuntu desktop (with the GUI), but the biggest hurtle I found was when I tried to only use the …

Command Line only UNIX/Linux OS

Does anybody know of any lightweight Linux/UNIX command-line only distros? I’m trying to look for one that’s less than 80MB if possible and comes with the minimum amount of required software included in the box. Any Linux/UNIX distros that can fit this would be greatly appreciated! If there aren’t any that can fit this then what are the alternatives that I can use instead?

I guess almost all Distros have a minimal version without GUI. Dont know any below 80MB, but I suggest the CentOS minimal, which is around 400MB.

But there are distros below 80MB but they include both GUI and CLI. So I guess if 80MB is your limit you can use them and simply not use the GUI.

You can Install «Ubuntu command-line system» and try Minimal CD .

The command-line version of Ubuntu is a sparse system without any graphical elements. It’s a text-only version of what lies underneath all the advanced graphical elements. It’s also the starting point for a minimal installation.

You can download following Ubuntu 32 or 64 bit minimal ISO images:

They are all smaller than 80 MB.

For more Information, Visit : this and this.

Setting up a new Linux distro (within Windows), Only moved to Windows full time like 2 years ago or less I think. Naturally, the Linux + Windows integration with WSL has been a godsend because I now have the best of both worlds. I can develop in a familiar Linux environment and have all my tools needed setup and then close the WSL terminal and be right …

Linux terminal based desktop

does anybody know, if there is a desktop environment for linux-distros, that is completely based on terminals, but still is able to let the commands create windows (e.g. a browser, an email-program, multimedia, . )?

Background is, that i want to use my old laptop again — but he is pretty slow and every little performance-saver would help a lot. Also i don’t need much besides the terminal, email und a browser.

My research only brought up solutions, where the basic desktop-environment still runs in the background and though still uses system capacity.

I read about fvwm2. I also used it ( though it needs Xorg if I remember correctly ). Very minimalistic. http://www.fvwm.org/

You must choose if you want a pure terminal (No X Server) and use apps like mutt for email and w3m for websurfing, or if you want a light desktop environment like openbox, i3wm, awesome.

You should look at MiniLinux distros, like DSL, or SliTaz

I have an old laptop which runs smoothly with SliTaz, but try and find which is best for you.

How to log in to general linux distro with no users (only, When you’re finished CTRL + ALT + F1 or CTRL + ALT + F7 should usually take you back to your graphical screen. As MichaelKjörling mentioned, some Linux distros restrict access to the root account. This can mean you’ll be forced to use a different TTY or prevent this method completely. GRUB

Читайте также:  Linux realtek wifi drivers

How to create a custom Linux distro that runs just one program and nothing else?

How I could go about creating my own «custom» Linux distro that will run just one program, pretty much exactly the same way as XBMCbuntu.

Minimal init hello world program step-by-step

Compile a hello world without any dependencies that ends in an infinite loop. init.S :

.global _start _start: mov $1, %rax mov $1, %rdi mov $message, %rsi mov $message_len, %rdx syscall jmp . message: .ascii "FOOBAR FOOBAR FOOBAR FOOBAR FOOBAR FOOBAR FOOBAR\n" .equ message_len, . - message 

We cannot use the exit system call, or else the kernel panics, the only way to exit gracefully from the init is to poweroff the machine with the reboot syscall.

mkdir d as --64 -o init.o init.S # assemble ld -o d/init init.o # link cd d find . | cpio -o -H newc | gzip > ../rootfs.cpio.gz ROOTFS_PATH="$(pwd)/../rootfs.cpio.gz" 

This creates a filesystem with our hello world at /init , which is the first userland program that the kernel will run. We could also have added more files to d/ and they would be accessible from the /init program when the kernel runs.

Then cd into the Linux kernel tree, build is as usual, and run it in QEMU:

git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git cd linux git checkout v4.9 make mrproper make defconfig make -j"$(nproc)" qemu-system-x86_64 -kernel arch/x86/boot/bzImage -initrd "$ROOTFS_PATH" 

And you should see a line:

FOOBAR FOOBAR FOOBAR FOOBAR FOOBAR FOOBAR FOOBAR 

on the emulator screen! Note that it is not the last line, so you have to look a bit further up.

You can also use C programs if you link them statically:

Dynamic linking would require setting up a the dynamic linker executable, the most common of which are part of C standard libraries like glibc.

You can run on real hardware with a USB on /dev/sdX and:

make isoimage FDINITRD="$ROOTFS_PATH" sudo dd if=arch/x86/boot/image.iso of=/dev/sdX 

Great source on this subject: Tech Tip: How to use initramfs | landley.net It also explains how to use gen_initramfs_list.sh , which is a script from the Linux kernel source tree to help automate the process.

Tested on Ubuntu 16.10, QEMU 2.6.1.

The next thing you want to do, is to setup BusyBox, see also: What is the smallest possible Linux implementation?

BusyBox implements basic POSIX-y CLI utilities, including a POSIX-y shell, which you allow you to more easily experiment with the system interactively.

Personally, at this point I prefer to just rely on Buildroot, which is an amazing set of scripts that automates building everything from source and making the root filesystem.

I have uploaded a highly detailed and automated helper for that at: https://github.com/cirosantilli/linux-kernel-module-cheat

I would not start messing with LFS, that is a garden path leading to some dark woods.

Start with a distro where you have a lot of control over the initial install, such as Arch, or a headless edition such as Ubuntu server. The point of this is not so much to save space as to delimit the complexity of the init configuration; starting from a headless distro, if the application you want to run requires a GUI, you can add what’s required for that without having to end up with a GUI login (aka. the display manager or DM) started by init, and a fullblown desktop environment to go with it.

Читайте также:  Linux mint аналог aida

You then want to learn how to configure the init system to your purposes — note that you cannot do without init, and it may be the best means of accomplishing your goal. The init system used on most linux distros now is systemd.

The point here is to minimize what init does at boot, and that is how you can create a system that will run a minimal amount of software to support the application you want to focus on — this is essentially how a server is set up, BTW, so it is a common task (note that you can’t literally have «just one» userland process running, at least not usefully).

If the application you want to run is a GUI program (a good example of why you can’t literally just run one application, since GUI apps require an X server), you can have an ~/.xinitrc that looks like this;

When you then startx , your program will be the only thing running, and it will be impossible to change desktops or start anything else, partially because there is no window manager or desktop environment (hence, there will be no window frame or titlebar either).

if you are little bit in programming and you want create it from scratch you can go with LFS i.e. Linux from Scratch http://www.linuxfromscratch.org/

if you want to customize ubutnu you can use ubunt-builder and if you want it on rpm base you can use SUsE-Studio,Suse studio will allow you to make custom suse linux

It is more about what your «one program» requires.

You can still have a good start of understand how to put things together by building an LFS (aka » Linux From Scratch «) . Then you will add things required by your program or go for a full distribution because building heavy sub-system like Gnome or KDE on LFS can be a real pain-in-the-ass.

Of course going backward may be easier at first, but removing things from a full distrib can be troublesome: do this in a VM and do copy of this VM at every step.

As pointed out by SecurityBeast instead of starting from a full distribution like CentOS or Ubuntu , you may also have a look at building distribution tools like:

Is there any only-terminal linux live usb distro?, While Ubuntu if not know for being a comand line only distro, they do offer information on how to change boot defaults ( like startx) you can get instructions here. On the one hand, nearly any Live ISO can be made to run in console only mode, with variations on the process from distro to distro.

Источник

Оцените статью
Adblock
detector