Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[solved] custom initramfs: cannot start shell
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
zhak
n00b
n00b


Joined: 04 May 2015
Posts: 21

PostPosted: Mon Dec 28, 2015 6:46 pm    Post subject: [solved] custom initramfs: cannot start shell Reply with quote

Hi guys,

I have 4.1.12-gentoo amd64 kernel starting directly from ESP on a USB stick. What I need is a initramfs which I'm trying to create manually from sources, embedded to kernel.
I added bash and mount with required libraries and created an init script:

Code:
#!/bin/bash
export PATH=/bin:/sbin:/usr/bin:/usr/sbin
export HOME=/root

mount -t proc none /proc
mount -t sysfs none /sys
mount -t devtmpfs none /dev

echo '!!! INITRAMFS !!!'

bash


I also added console and tty devices to /dev (along with null, random, and urandom which I'll need later)

The problem is that bash throws errors:
Code:
bash: cannot set terminal process group (-1): Inappropriate ioctl for device
bash: no job control in this shell

then bash prompt appears
Code:
bash-4.3#

and the shell seems to work, however, initialization continues: hard disks and wireless adapter are being probed and various system messages appear from time to time

How to correctly add shell to initramfs so that it doesn't throw errors and kernel don't print its stuff when shell is entered? What could I be missing? Where to start looking at?
Thanks in advance!


Last edited by zhak on Mon Dec 28, 2015 7:54 pm; edited 1 time in total
Back to top
View user's profile Send private message
frostschutz
Advocate
Advocate


Joined: 22 Feb 2005
Posts: 2970
Location: Germany

PostPosted: Mon Dec 28, 2015 7:07 pm    Post subject: Reply with quote

for kernel to stop printing stuff you can `echo 0 > /proc/sys/kernel/printk`

any reason in particular why you are not using busybox or perhaps toybox instead?
Back to top
View user's profile Send private message
zhak
n00b
n00b


Joined: 04 May 2015
Posts: 21

PostPosted: Mon Dec 28, 2015 7:16 pm    Post subject: Reply with quote

The main reason is to learn how stuff works and how to do all manually without automated tools and the rest.
BTW I tried busybox, but sh throws a different error when I do 'exec sh':
Code:
sh: can't access tty; job control turned off

tried removing /dev/console, tried symlinking tty to console (based on suggestions from the Internet) - neither worked.
Not sure if it matters, EFI framebuffer device is enabled in kernel config.
Back to top
View user's profile Send private message
frostschutz
Advocate
Advocate


Joined: 22 Feb 2005
Posts: 2970
Location: Germany

PostPosted: Mon Dec 28, 2015 7:20 pm    Post subject: Reply with quote

https://wiki.gentoo.org/wiki/Custom_Initramfs#Job_control
Back to top
View user's profile Send private message
zhak
n00b
n00b


Joined: 04 May 2015
Posts: 21

PostPosted: Mon Dec 28, 2015 7:53 pm    Post subject: Reply with quote

Quote:
The lack of job control is usually not a problem, since /init is not supposed to be interactive.

Yes, that was the reason, bash also wanted to be interactive. Thanks a lot!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum