- Init bin bash не работает
- Kernel panic: Request init /bin/bash failed (error -2)
- Почему Linux разрешает init = / bin / bash?
- Arch Linux
- #1 2021-01-11 17:36:32
- Error and no keyboard response with init=/bin/bash
- #2 2021-01-11 22:00:56
- Re: Error and no keyboard response with init=/bin/bash
- #3 2021-01-12 15:46:25
- Re: Error and no keyboard response with init=/bin/bash
- #4 2021-01-13 12:33:52
- Re: Error and no keyboard response with init=/bin/bash
- #5 2021-01-13 20:24:52
- Re: Error and no keyboard response with init=/bin/bash
- #6 2021-01-13 23:13:09
- Re: Error and no keyboard response with init=/bin/bash
- #7 2021-01-21 00:54:07
- Re: Error and no keyboard response with init=/bin/bash
- #8 2021-01-21 08:15:59
- Re: Error and no keyboard response with init=/bin/bash
- #9 2021-01-26 18:25:33
- Re: Error and no keyboard response with init=/bin/bash
Init bin bash не работает
Всем привет. Пытаюсь получить bash сразу после загрузки ядра. Данная опция (init=/bin/bash) в grub не помогла. Загружается ядро, распаковывается initrd и на этом загрузка останавливается. В чем может быть проблема? Попутный вопрос: bash — это bash из busybox из initrd-образа?
Заранее спасибо
| Оглавление |
|
| Сообщения по теме | [Сортировка по времени, UBB] |
| 1. «grub: init=/bin/bash» | |
| Сообщение от onorua | |
| Высказать мнение | Ответить | Правка | Наверх | Cообщить модератору |
| 2. «grub: init=/bin/bash» | |
| Сообщение от pavel_simple | |
Источник Kernel panic: Request init /bin/bash failed (error -2)Люди, прошу, помогите Выдает сабж. В grub редактировалпункт меню, к строке дописывал init=/bin/bash теперь это. Что посоветуете? ОС Arch linux Убери из строки то, что дописал. Выдели пункт меню, нажми клавишу «e», сотри из строки параметров ядра дописанное, затем нажми клавишу «b» или F10 для загрузки, в общем там написано. Собственно написал я это туда не просто так. Без этого Kernel panic — not syncing: No working init found. Try passing init= option to kernel Вестимо, если в archlinux нет ссылки /sbin/init -> /usr/lib/systemd/systemd, то у вас это работать не будет. Верните туда то, что было. Если это ваша первая установка Arch Linux, то следуйте согласно wiki странице установки, если это вообще ваш первый Linux, то начните с чего-нибудь проще, например Ubuntu или Fedora. А так, могу быть нюансы, всё зависит от того где находится корневая файловая система. Читайте соответствующую wiki страницу и не бездумно копируйте оттуда, а разбирайтесь что и почему сделано так. очевидно, что что-то с диском/ФС, по крайней мере она не монтируется. или пуста, или повреждена. устройство правильное указываешь? и каким образом? порядковые номера разделов могут меняться, используй UUID или метки.
но она есть, и баш тем более. так что проблема явно не в этом. Значит, скорее всего, ТС ставит на lvm, raid или ещё какой-либо контейнер. В любом случае в шапке ничего не сказано о конфигурации. Нет, можно конечно устроить гадание на кофейной гуще, но ТС лучше всё же всё описать нормально.
Нет, тогда сообщение о панике было бы другое («VFS: Unable to mount root fs on unknown-block»). Но, вообще говоря, если у ТС даже init=/bin/bash не срабатывает, то у него что-то очень не так с системой. Может, он libc испортил? В любом случае, ТС вообще не написал, после чего и почему у него начались проблемы. Да. Может быть, что-то случилось с симлинками /lib64 -> /usr/lib. Прошу прощенте за столь скудное описание. Первый раз столкнулся с КР и не знал даже, что написать о конигурации. Ни lvm, ни raid не использую. Случилось после апдейта pacman -Syn Утром запустил liveCD. Обнаружил, что пусты папки /dev/ (наверное так и должно быть при выключенной системе?), /proc/, /run/, /sys/. Симлинки /lib/ -> /usr/lib/, /lib64/ -> /usr/lib/ есть Это норма. Только не папки, а каталоги. Прошу прощения за «папки» 🙂 Монтирую, делаю chroot все функционирует. Надо сделать export LD_LIBRARY_PATH=«/lib»? Вечером проверю Если в chroot всё работает, то не нужно уже ничего делать — система функционирует. Возможно, с ядром проблемы. Источник Почему Linux разрешает init = / bin / bash?Недавно я обнаружил, что если я редактирую GRUB перед загрузкой и добавляю, rw init=/bin/bash я получаю корневую оболочку. Находясь в состоянии, когда я хочу понять все, я хотел бы знать, почему это происходит. Я имею в виду, это ошибка? это особенность? это поможет администраторам исправить положение вещей, поскольку оно работает только при наличии физического доступа к компьютеру? Это предусмотрено GRUB или реальным ядром? Это функция, которая используется для обслуживания системы: она позволяет сисадмину восстанавливать систему из испорченных файлов инициализации или менять забытый пароль.
Вы говорите ядру Linux запускать / bin / bash как init, а не как системный init. [. ] Таким образом, вы ничего не используете, вы просто используете стандартную функцию ядра. Кроме того, как отмечено в комментарии, этот rw флаг отделен от него init= , он просто указывает системе монтировать корневую файловую систему в режиме «чтение-запись» (например, вы можете отредактировать неверно сконфигурированный файл или изменить пароль). Ваша система имеет механизмы для запуска и отладки (например, параметр init) и, вероятно, имеет механизмы безопасности, которые не позволяют нежелательным пользователям воспользоваться ими. Это особенности, а не ошибки. Загрузчик отвечает за запуск ОС. Безопасность ОС явно не применяется в этот момент. Вы можете просто загрузить другое ядро, initrd, root fs или установить другие параметры (например, путь инициализации). Если вы хотите, чтобы пользователи не делали этого, это должно быть сделано в загрузчике. Ваша система (вероятно, ПК, поэтому BIOS) загружает загрузчик, и, очевидно, безопасность загрузчика не распространяется на него. Если вы хотите помешать пользователям загружать биос с USB или тому подобное, вам нужно сделать это на этом уровне. Ваша система может быть где-то на столе. Если вы хотите, чтобы пользователи не открывали компьютер и не переключали жесткий диск на свой собственный или не извлекали диск для установки его на своих машинах, вам нужно сделать это на физическом уровне. И это не помешает им взять весь стол и уехать на своем фургоне . Такова безопасность. Слоны все время вниз. Когда компьютер запускается, он запускает программу с именем «init», обычно находящуюся в /bin/init или /sbin/init . Эта программа отвечает за весь запуск системы и создание удобной среды. Указание init=/bin/bash указывает ядру работать /bin/bash вместо него (который является оболочкой). Указание rw указывает ядру загружаться с жесткого диска в режиме чтения-записи вместо режима только для чтения. Традиционно ядро запускается с диска в режиме «только чтение», а затем процесс проверяет целостность диска перед переключением на чтение и запись. Источник Arch LinuxYou are not logged in. #1 2021-01-11 17:36:32Error and no keyboard response with init=/bin/bashI’m thinking of trying to boot a system with just the kernel and maybe a bootloader, and a single process of my own creation. As a first step, I’m just trying to set init for the kernel with in the bootloader on my current full-fledged system (arch with I think either gummiboot or systemd-boot). Unfortunately I get an error and I can’t interact in any way (not even key echoing) (copied by hand, so it may not be correct character for character) Searching the internet I found these: But it’s not clear to me exactly what’s going on in my case or how to fix it. Are /dev/console and /dev/tty set up by the kernel or init? Where do the virtual consoles Ctrl-Alt-F# fit into the process? It sounds like init=/bin/bash is a fairly common thing to do, for example to fix a forgotten root password, so I’m wondering if this issue is more with a (usb) keyboard detection or driver. Are the keyboards typically set up with systemd/udev and I’m bypassing that? Do I need to add a keyboard driver to my initramfs? Does anyone know what’s going on? Thank you Last edited by iith4ahm (2021-01-11 17:38:10) #2 2021-01-11 22:00:56Re: Error and no keyboard response with init=/bin/bashThe input likely fails because no sysfs/dev/devpts is setup (see the init script in the gentoo thread) #3 2021-01-12 15:46:25Re: Error and no keyboard response with init=/bin/bashThe input likely fails because no sysfs/dev/devpts is setup (see the init script in the gentoo thread) Thanks Seth. What do you mean by «no sysfs/dev/devpts» is setup? I leaned that I can run commands in the init script and they will show on the screen — I just can’t interact with the keyboard. /dev, /sys, and /proc seem to be populated when the script is run. Does that mean they are «set up»? If I run (from the gentoo script, but I swapped out an echo command for tty) I get the original output with the addition of Running the bash program and redirecting stdin, stdout and stderr to /dev/tty7 got rid of the bash error, but I still could not do anything. I tried doing the same thing and running it in the background with but that caused a «kernel panic — not syncing: Attempted to kill init!». I’m guessing init is not supposed to finish. Also, if it could be related to what’s going on: Last edited by iith4ahm (2021-01-12 15:47:04) #4 2021-01-13 12:33:52Re: Error and no keyboard response with init=/bin/bashWhat do you mean by «no sysfs/dev/devpts» is setup? When I boot my system up normally, it doesn’t go right into a display manager or a console. It leaves me with the output of the kernel and/or systemd. I can’t type anything. If I press Ctl-Alt-1 it does nothing just like when I run my custom init. However, if I first press Ctl-Alt-2 I do get a virtual terminal, and then when I press Ctl-Alt-1 gnome starts up. Could be either an entropy issue or the GPU stalls. (do NOT fork the command!) #5 2021-01-13 20:24:52Re: Error and no keyboard response with init=/bin/bashwith the same unresponsive keyboard. If I try to run that command with init= instead of from a bash script I get Again with no ability to interact. I’m assuming the kernel would have needed a full path name. Could be either an entropy issue or the GPU stalls. Do you think this could be the cause of everything? There are a lot of yellow NVIDIA message in journalctl. I will update below: Do you think if I sort out these driver/X issues my init=/bin/bash problem will take care of itself? But why are X and systemd running in the first place? Aren’t they in userspace, and I’m bypassing them by passing the init kernel parameter? -Oh, since I’m using systemd-boot, does that let systemd start doing its thing right away and not wait for the kernel to start it? If I switch bootloaders should I get a systemd/X free system, and maybe the kernel will get me a responsive tty? Last edited by iith4ahm (2021-01-13 21:13:05) #6 2021-01-13 23:13:09Re: Error and no keyboard response with init=/bin/bashIt should rid you of the error message? About the keyboard: you could have the script print «lsmod» and compare that to a normal session (in case you rely on some explicitly loaded modules for the keyboard) Is this an integrated keyboard or an external one? Do you have a replacement option (ie. another keyboard to attach)? #7 2021-01-21 00:54:07Re: Error and no keyboard response with init=/bin/bashI installed Arch Linux in virtualized QEMU drive, and I can set init=/bin/bash just fine and the keyboard works (although I still get the errors from bash about inappropriate ioctl). So I’ll blame the root problem on some driver/nvidia issue. If I try to set init=/home/init (my custom script) I get an error about the file not existing and ls shows the following. /dev/sda2 (I think my main partition) is mounted to /new_root instead of /. Is this expected? Also, follow up question: Even the base installation of arch (or presumably most distros) has tons of files. This makes me feel like I don’t understand everything that my system does. Is it reasonable to compile or find some binaries for bash, pam, sshd, nginx, and python and a few others, to have a web server with only a kernel and a few binaries? Then a simple init script to start them? Would this be worth it for a simple secure server I can wrap my head all the way around, or am I better off just using debian and «apt upgrade»ing regularly and not worrying about if I understand it all? Last edited by iith4ahm (2021-01-21 03:23:42) #8 2021-01-21 08:15:59Re: Error and no keyboard response with init=/bin/bash/home is probably on an extra mount? The failing input could be due to a missing kernel module that requires explicit loading. About the keyboard: you could have the script print «lsmod» and compare that to a normal session (in case you rely on some explicitly loaded modules for the keyboard) Can you enter commands blindly (and just not get a visual reaction)? Is it reasonable to compile or find some binaries for bash, pam, sshd, nginx, and python and a few others, to have a web server with only a kernel and a few binaries? You probably want busybox in that case, but «it depends». We’re kinda close to violating board rules, but I’d rather take a look at sth. like alpinelinux before trying to invent YAD (yet another distro) — unless you have a *very* specific and unique usecase. #9 2021-01-26 18:25:33Re: Error and no keyboard response with init=/bin/bashThank you again seth. If it’d be helpful for others, or if someone knows how to go about fixing it I welcome continuing this thread, but otherwise the virtualization solution is satisfactory for me for now. If that is the case is it best to mark as solved? As mentioned before, In the virtualization solution I can’t run scripts in my home directory. Perhaps this has to do with the bootloader/kernel/init process here: https://www.kernel.org/doc/html/latest/ … nitrd.html Maybe init is getting called on the initrd instead of the root filesystem. Perhaps /bin/bash may still exist in the initrd and that’s why that works but not /home/. /init. Perhaps the kernel is trying to call my init script from the initrd, which does not have my home directory. If I use an initrd maybe I need to put a «primer» init there which calls pivot_root and then sets up my home init script to run. I don’t understand why I don’t have this problem on my non-virtualized system. Perhaps again something to do with the drivers. Computers are complicated. Regarding previous questions: Can you enter commands blindly (and just not get a visual reaction)? As far as I know, no. I tried to carefully type «touch /home/. /asdfghjkl» with no luck checking after rebooting. . unless it was in the initrd or something. to be honest I’m not sure I have it all straight. But if there’s a command in my /home/. /init script and I set the kernel parameter to run the script, the standard output gets put to screen. About the keyboard: you could have the script print «lsmod» and compare that to a normal session . Is this an integrated keyboard or an external one It is an external usb keyboard. lsmod put in an init script returns But when booted up all the way returns much more. We’re kinda close to violating board rules I’m going to assume you’re refering to keeping the forms arch-only. Источник |