Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Kernel & Hardware
  • Search

Why do I get errors for init=/bin/bash linux boot option?

Kernel not recognizing your hardware? Problems with power management or PCMCIA? What hardware is compatible with Gentoo? See here. (Only for kernels supported by Gentoo.)
Post Reply
Advanced search
12 posts • Page 1 of 1
Author
Message
colag
Tux's lil' helper
Tux's lil' helper
Posts: 105
Joined: Sat Sep 26, 2009 1:43 pm

Why do I get errors for init=/bin/bash linux boot option?

  • Quote

Post by colag » Tue Jan 17, 2023 8:48 am

It have compiled and installed linux kernel, bash, coreutils from source. I have added init=/bin/bash to linux boot option. During boot I get two errors:

Code: Select all

bash: cannot set terminal process group (-1): inappropriate ioctl for device
bash: no job control in this shell
Bash is running, but how can I solve these errors? Why do these errors occur?
Top
Zucca
Administrator
Administrator
User avatar
Posts: 4710
Joined: Thu Jun 14, 2007 10:31 pm
Location: Rasi, Finland
Contact:
Contact Zucca
Website

  • Quote

Post by Zucca » Tue Jan 17, 2023 9:44 am

You probably need more than just init=/bin/bash.
You most probably need to set up few things before bash can fully act as your init.
[b]JdeBP[/b] @ unix.stackexchange wrote:As I said at https://unix.stackexchange.com/a/197472/5132, init=/bin/sh doesn't get "API" fileystems mounted, crashes in an ungainly fashion with no cache flush when one types exit (https://unix.stackexchange.com/a/195978/5132), and in general leaves it to the (super)user to manually do the actions that make the system minimally usable.

One of those actions (if you want to use a job control shell, as you apparently do) is acquiring a controlling terminal. /dev/tty isn't an actual terminal device. It's a device that redirects to whatever the opening process' controlling terminal is. If it does not have one, as process #1 does not to begin with (and usually all of the time when a real system manager program is being run as process #1), then opening the device fails.

Your system is too minimal. You need to run a program that sets up a controlling terminal, initializes a proper session, and probably does some of the bare minima of system management such as shutting down properly and cleanly, that then runs your job control shell.
Are you using/creating your custom initramfs?
..: Zucca :..

Code: Select all

0100100100100000011000010110110100100000
0100111001100001010011100010000100100000
0100100100100000011000010110110100100000
0110000100100000011011010110000101101110
00100001
Top
colag
Tux's lil' helper
Tux's lil' helper
Posts: 105
Joined: Sat Sep 26, 2009 1:43 pm

  • Quote

Post by colag » Tue Jan 17, 2023 10:08 am

What are the other things I need to set up?
No, I am not using initramfs.
Top
Zucca
Administrator
Administrator
User avatar
Posts: 4710
Joined: Thu Jun 14, 2007 10:31 pm
Location: Rasi, Finland
Contact:
Contact Zucca
Website

  • Quote

Post by Zucca » Tue Jan 17, 2023 10:39 am

You'll need to have /dev, /sys and /proc.

Why are you having /bin/bash as init anyway? Do you plan this as an alternative boot option to have a rescue shell?
..: Zucca :..

Code: Select all

0100100100100000011000010110110100100000
0100111001100001010011100010000100100000
0100100100100000011000010110110100100000
0110000100100000011011010110000101101110
00100001
Top
Goverp
Advocate
Advocate
User avatar
Posts: 2404
Joined: Wed Mar 07, 2007 6:41 pm

  • Quote

Post by Goverp » Tue Jan 17, 2023 10:52 am

Does the kernel have DEV_TMPFS support? Without it, you get no terminal device for the init program; you might be able to work around it by creating nodes at the start, but it's easier to use the DEV_TMPFS setup.
Greybeard
Top
NeddySeagoon
Administrator
Administrator
User avatar
Posts: 56108
Joined: Sat Jul 05, 2003 9:37 am
Location: 56N 3W

  • Quote

Post by NeddySeagoon » Tue Jan 17, 2023 12:40 pm

colag,

You need at least /dev/console and /dev/null as device special files.
/proc and /sys are handy too.

With init=/bin/bash/, its a very lonely place to be. Just you and bash on a read only root filesystem.
The rest of /dev missing makes life more challenging too.

What will you use it for?
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Top
colag
Tux's lil' helper
Tux's lil' helper
Posts: 105
Joined: Sat Sep 26, 2009 1:43 pm

  • Quote

Post by colag » Tue Jan 17, 2023 1:30 pm

I have /dev, /sys, /proc folders. /dev has tty0, tty1... and console. /sys and /proc folders are empty. How can I populate /sys and /proc?
Top
NeddySeagoon
Administrator
Administrator
User avatar
Posts: 56108
Joined: Sat Jul 05, 2003 9:37 am
Location: 56N 3W

  • Quote

Post by NeddySeagoon » Tue Jan 17, 2023 1:45 pm

colag,

When you get to the bash shell, mount them.

Code: Select all

mount -t proc proc /proc
mount -t sysfs sys /sys
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Top
colag
Tux's lil' helper
Tux's lil' helper
Posts: 105
Joined: Sat Sep 26, 2009 1:43 pm

  • Quote

Post by colag » Tue Jan 17, 2023 2:30 pm

NeddySeagoon wrote:colag,

When you get to the bash shell, mount them.

Code: Select all

mount -t proc proc /proc
mount -t sysfs sys /sys
I have added proc and sys in /etc/fstab. What else should I do?
Top
pietinger
Administrator
Administrator
Posts: 6640
Joined: Tue Oct 17, 2006 5:11 pm
Location: Bavaria

  • Quote

Post by pietinger » Tue Jan 17, 2023 2:36 pm

colag wrote:I have added proc and sys in /etc/fstab. What else should I do?
This does not help because you boot into a "naked" bash ... then ALL RC-startup-scripts will not be started ... and THEY do the job of reading /etc/fstab and mounting all. For example:
/etc/init.d/sysfs usually mounts your sysfs (in "sysinit"; if you use OpenRC). You must mount it manually if you boot into a bash.

Again the question from @Zucca: Why are you having /bin/bash as init anyway?

Maybe you want to use an initramfs for your needs ? If so, then read first this:
https://wiki.gentoo.org/wiki/User:Pieti ... s_Overview
and then all linked articles.
Top
colag
Tux's lil' helper
Tux's lil' helper
Posts: 105
Joined: Sat Sep 26, 2009 1:43 pm

  • Quote

Post by colag » Tue Jan 17, 2023 3:15 pm

I have installed shadow, sysvinit. I removed init=/bin/bash boot option. Now after booting, I can see a login prompt. After typing root then Enter, it does not prompt for password. Waiting for sometime, it shows the login prompt again to enter user. I get no prompt for password. Why is this?
Top
GDH-gentoo
Advocate
Advocate
User avatar
Posts: 2117
Joined: Sat Jul 20, 2019 7:02 pm
Location: South America

  • Quote

Post by GDH-gentoo » Tue Jan 17, 2023 3:36 pm

colag wrote:I have installed shadow, sysvinit.
What are you doing, assembling a Linux From Scratch-like operating system piece by piece?
colag wrote:Now after booting, I can see a login prompt. After typing root then Enter, it does not prompt for password. Waiting for sometime, it shows the login prompt again to enter user. I get no prompt for password. Why is this?
Hard to say without more knowledge about what you have installed so far and what state it currently is in. It is not a Gentoo system, is it?

Yes, doing init=/bin/sh is a valid, but extreme, way of booting when e. g. the init system is damaged. Or nonexistent in this case? Who knows.

And the error in the OP is unavoidable but harmless, the cause is the one mentioned in Zucca's first reply, i. e. a shell process running as process 1 does not have a controlling terminal; a shell process spawned in the usual way does (e. g. because the agetty program provides one).
Ionen wrote:As a packager I just don't want things to get messier with weird build systems and multiple toolchains requirements though :)
Top
Post Reply

12 posts • Page 1 of 1

Return to “Kernel & Hardware”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic