Linux busybox built in shell

Ubuntu 15.10 — «BusyBox built-in shell (initramfs)» on every boot

Every time we reboot the Ubuntu PC, it’s showing this screen, and not going anywhere, even when we typed exit. How to get rid of this nightmare permanently, so that it never ever happens?

BusyBox v1.17.1 (Ubuntu 1:1.17.1-10ubuntu1) built-in shell (ash) Enter 'help' for a list of built-in commands (initramfs) 

3 Answers 3

I’ve the same issue and I found the solution that worked for me at Initramfs Prompt When Ubuntu Boots.

exit BusyBox v1.17.1 (Ubuntu 1:1.17.1-10ubuntu1) built-in shell (ash) Enter 'help' for a list of built-in commands (initramfs) exit 

You’ll get something like this:

/dev/sda1: Unexpected … fsck exited …. The root filesystem on /dev/sda1 requires manual fsck. 

And after, use the following command:

If you are dropped into initramfs, it means that the boot flow stop at the stage of mounting your root filesystem, which is usually in somewhere of your hard disk.

To understand the above statement, you need to know the knowledge about the booting flow, which in general is:

  1. BIOS
  2. Boot loader (e.g. grub for Ubuntu)
  3. Kernel and initial ram file system (initramfs, yeah where you are)
  4. root file system (your target system)

The root causes to make you stop at initramfs could vary. I get used to solve this kind of issue by the following steps:

  1. Prepare a Ubuntu live USB stick
  2. Use this live USB to boot up your PC
  3. If 2nd step works (means you could boot into live desktop and begin to use the Ubuntu system), it means your PC is supported by Ubuntu (for basic usage at least)
  4. (optional) dump the system and hardware information. use the information to ask for help (for example, paste them on askubuntu.com) Generally please paste the output of these command in a terminal at least:
lspci -nnvv mount dmesg dpkg -l 

Источник

Что делать если при запуске выскакивает надпись BusyBox v1.30.1 (Debian 1:1.30.1-4) built-in shell (Bash) Enter ‘help’ for a list of built-in commands

Проблема в том, что не получается смонтировать корневую файловую систему. Чтобы лучше понять причину, нужно ответить на вопрос: До этого система работала или эта ошибка сразу после установки?

Если раньше система работала, а потом перестала

Если раньше система работала, а потом перестала, значит по каким-то причинам повредилась файловая система — нужно выполнить проверку диска.

Для этого в консоли наберите

BusyBox v1.17.1 (Ubuntu 1:1.17.1-10ubuntu1) built-in shell (ash)
Enter 'help' for a list of built-in commands
(initramfs) exit

После этого будет показано что-то вроде:

/dev/sda1: Unexpected …

fsck exited ….

The root filesystem on /dev/sda1 requires manual fsck.

После этого используйте следующую команду:

Обратите внимание, что если у вас другое имя раздела или его номер, то замените данные на свои. Например на /dev/sdb1 или /dev/sdc1.

Если система не загружается сразу после установки

Если система не загружается сразу после установки, значит в загрузчики просто неправильно указано название диска.

Установить правильный диск можно изменив параметры загрузки ядра, но для этого нужно знать, какой именно диск указывать.

и посмотрите, какой диск система пытается загрузить.

Затем измените параметры загрузки ядра. Для этого:

1. Начните перезагружать систему.

2. Чтобы прервать загрузку GRUB (первый шаг) во время запуска компьютера нажмите и удерживайте клавишу SHIFT.

3. Затем нажмите клавишу «e» и вы перейдёте к редактированию настроек загрузки.

4. Если на экране отсутствует нужная нам строка, пролистните курсорными клавишами вниз и найдите строку, начинающуюся с linux.

5. Найдите строку, содержащую root=/dev/sdxX. В этой строке sdxX должна быть вашим /, то есть корневым разделом. Вам нужно исправить текущее значение на верное, которое мы узнали чуть ранее. Если вы совершенно не представляете, какая буква и какой номер у вашего раздела, то попробуйте варианты:

  • root=/dev/sda1
  • root=/dev/sdb1
  • root=/dev/sdc1
  • root=/dev/sdd1
  • root=/dev/sda2
  • root=/dev/sdb2
  • root=/dev/sdc2
  • root=/dev/sdd2

6. Когда всё готово нажмите Ctrl+x или F10, чтобы загрузка продолжилась с установленными опциями.

После успешной загрузки в систему поменяйте имя загружаемого диска. Например, в моём случае имя диска оказалось /dev/sdс1 (с буквой c). Тогда команда для изменения загрузочного диска будет выглядеть так:

sudo grub-install --recheck /dev/sdc
sudo grub-mkconfig -o /boot/grub/grub.cfg

Вместо /dev/sdc подставьте имя вашего диска или флэшки.

Источник

How to use BusyBox on Linux

BusyBox is an open source (GPL) project providing simple implementations of nearly 400 common commands.

bash logo on green background

It’s easy to take Linux commands for granted. They come bundled with the system when you install Linux, and we often don’t question why they’re there. Some of the basic commands, such as cd , kill , and echo aren’t always independent applications but are actually built into your shell. Others, such as ls , mv , and cat are part of a core utility package (often GNU coreutils specifically). But there are always alternatives in the world of open source, and one of the most interesting is BusyBox.

What is BusyBox in Linux?

BusyBox is an open source (GPL) project providing simple implementations of nearly 400 common commands, including ls , mv , ln , mkdir , more , ps , gzip , bzip2 , tar , and grep . It also contains a version of the programming language awk , the stream editor sed , the filesystem checker fsck , the rpm and dpkg package managers, and of course, a shell ( sh ) that provides easy access to all of these commands. In short, it contains all the essential commands required for a POSIX system to perform common system maintenance tasks as well as many user and administrative tasks.

In fact, it even contains an init command which can be launched as PID 1 to serve as the parent process for all other system services. In other words, BusyBox can be used as an alternative to systemd, OpenRC, sinit, init, and other launch daemons.

BusyBox is very small. As an executable, it’s under 1 MB, so it has gained much of its popularity in the embedded, Edge, and IoT space, where drive space is at a premium. In the world of containers and cloud computing, it’s also popular as a foundation for minimal Linux container images.

Minimalism

Part of the appeal of BusyBox is its minimalism. All of its commands are compiled into a single binary ( busybox ), and its man page is a mere 81 pages (by my calculation of piping man to pr ) but covers nearly 400 commands.

As an example comparison, here’s the output of the shadow version of useradd —help :

 -b, --base-dir BASE_DIR base directory for home -c, --comment COMMENT GECOS field of the new account -d, --home-dir HOME_DIR home directory of the new account -D, --defaults print or change the default config -e, --expiredate EXPIRE_DATE expiration date of the new account -f, --inactive INACTIVE password inactivity -g, --gid GROUP name or ID of the primary group -G, --groups GROUPS list of supplementary groups -h, --help display this help message and exit -k, --skel SKEL_DIR alternative skeleton dir -K, --key KEY=VALUE override /etc/login.defs -l, --no-log-init do not add the user to the lastlog -m, --create-home create the user's home directory -M, --no-create-home do not create the user's home directory -N, --no-user-group do not create a group with the user's name -o, --non-unique allow users with non-unique UIDs -p, --password PASSWORD encrypted password of the new account -r, --system create a system account -R, --root CHROOT_DIR directory to chroot into -s, --shell SHELL login shell of the new account -u, --uid UID user ID of the new account -U, --user-group create a group with the same name as a user

And here’s the BusyBox version of the same command:

 -h DIR Home directory -g GECOS GECOS field -s SHELL Login shell -G GRP Group -S Create a system user -D Don't assign a password -H Don't create home directory -u UID User id -k SKEL Skeleton directory (/etc/skel)

Whether or not this difference is a feature or a limitation depends on whether you prefer to have 20 options or ten options in your commands. For some users and use-cases, BusyBox’s minimalism provides just enough for what needs to be done. For others, it’s a good minimal environment to have as a fallback or as a foundation for installing more robust tools like Bash, Zsh, GNU Awk, and so on.

Installing BusyBox

On Linux, you can install BusyBox using your package manager. For example, on Fedora and similar:

On Debian and derivatives:

On macOS, use MacPorts or Homebrew. On Windows, use Chocolatey.

You can set BusyBox as your shell using the chsh —shell command, followed by the path to the BusyBox sh application. I keep BusyBox in /lib64 , but its location depends on where your distribution installed it.

$ which busybox /lib64/busybox/busybox $ chsh --shell /lib64/busybox/sh

Replacing all common commands wholesale with BusyBox is a little more complex, because most distributions are «hard-wired» to look to specific packages for specific commands. In other words, while it’s technically possible to replace init with BusyBox’s init , your package manager may refuse to allow you to remove the package containing init for fear of you causing your system to become non-bootable. There are some distributions built upon BusyBox, so starting fresh is probably the easiest way to experience a system built around BusyBox.

Try BusyBox

You don’t have to change your shell to BusyBox permanently just to try it. You can launch a BusyBox shell from your current shell:

Your system still has the non-BusyBox versions of commands installed, though, so to experience BusyBox’s tools, you must issue commands as arguments to the busybox executable:

~ $ busybox echo $0 sh ~ $ busybox ls --help BusyBox vX.YY.Z (2021-08-25 07:31:48 NZST) multi-call binary. Usage: ls [-1AaCxdLHRFplinshrSXvctu] [-w WIDTH] [FILE]. List directory contents -1 One column output -a Include entries that start with . -A Like -a, but exclude . and .. -x List by lines [. ]

For the «full» BusyBox experience, you can create symlinks to busybox for each command. This is easier than it sounds, as long as you use a for-loop:

$ mkdir bbx $ for i in $(bbx --list); do \ ln -s /path/to/busybox bbx/$i \ done

Add your directory of symlinks at the start of your path, and launch BusyBox:

Get busy

BusyBox is a fun project and an example of just how minimal computing can be. Whether you use BusyBox as a lightweight environment for an ancient computer you’ve rescued, as the userland for an embedded device, to trial a new init system, or just as a curiosity, it can be fun reacquainting yourself with old familiar, yet somehow new, commands.

Command line prompt

20 essential Linux commands for every user

From new user to power user, here are 20 Linux commands that will make your life easier.

Источник

Читайте также:  Linux cd rom repository
Оцените статью
Adblock
detector