Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Question about init conception
View unanswered posts
View posts from last 24 hours

Goto page Previous  1, 2  
Reply to topic    Gentoo Forums Forum Index Unsupported Software
View previous topic :: View next topic  
Author Message
Zucca
Moderator
Moderator


Joined: 14 Jun 2007
Posts: 3869
Location: Rasi, Finland

PostPosted: Mon Jan 13, 2025 5:32 pm    Post subject: Reply with quote

pingtoo wrote:
One of "init" duty for linux is reap zombie process.
Ok. I thought this was kernel's job. Is it really so? That would explain one oddity I have...
_________________
..: Zucca :..

My gentoo installs:
init=/sbin/openrc-init
-systemd -logind -elogind seatd

Quote:
I am NaN! I am a man!
Back to top
View user's profile Send private message
grknight
Retired Dev
Retired Dev


Joined: 20 Feb 2015
Posts: 1981

PostPosted: Mon Jan 13, 2025 5:46 pm    Post subject: Reply with quote

Zucca wrote:
pingtoo wrote:
One of "init" duty for linux is reap zombie process.
Ok. I thought this was kernel's job. Is it really so? That would explain one oddity I have...

Yes, it is init's job. See a simple example from openrc-init that catches SIGCHLD and reaps
Back to top
View user's profile Send private message
Fulgurance
Veteran
Veteran


Joined: 15 Feb 2017
Posts: 1243

PostPosted: Mon Jan 13, 2025 6:57 pm    Post subject: Reply with quote

NeddySeagoon wrote:
Fulgurance,

Lets back off a little.

You have a VM with a boot loader and a kernel and not much else.
What is in /dev is the VM root before anything is started.
You must have at least /dev/null and /dev/console or it all comes to a grinding halt.
The must be device special nodes too.

How does
Code:
mount --bind /run /run
work?
--bind makes an already mounted filesystem visible somewhere else ... but you have said nothing about mounting run anywhere.
The kernel has mounted root, then its all up to you.

/run is usually tmpfs, so that it can be rw, even an a read only root fs.

I don't know what the --rbind mounts do either, as those filesystems are not mounted anywhere yet.

Code:
#!/bin/bash
needs shared libraries.
Code:
 $ lddtree /bin/bash
/bin/bash (interpreter => /lib64/ld-linux-x86-64.so.2)
    libreadline.so.8 => /usr/lib64/libreadline.so.8
        libtinfow.so.6 => /lib64/libtinfow.so.6
    libtinfo.so.6 => /lib64/libtinfo.so.6
    libc.so.6 => /lib64/libc.so.6


Start off with a statically linked busybox

Where do you set $PATH ?
mount is actually /bin/mount, so it won't be found with an empty $PATH.

Hint: look at some initrd init scrips.


Thanks NeddySeagoon. Because of your comment, I realized my mount steps where wrong at some points, so I updated like this:

Code:

#!/bin/bash
mount -o remount rw /
mount -o nosuid,noexec,nodev /proc
mount -o nosuid,noexec,nodev /sys
mount -o mode=0755,nosuid /dev
mount /run
mkdir -p /run/lock
chmod 1777 /run/lock
mkdir -p /dev/shm
mount -o nosuid,nodev /dev/shm
mkdir -pv /sys/fs/cgroup
mount -o nosuid,noexec,nodev /sys/fs/cgroup
ln -sf /proc/self/fd/0 /dev/stdin
ln -sf /proc/self/fd/1 /dev/stdout
ln -sf /proc/self/fd/2 /dev/stderr
ln -sfn /proc/self/fd /dev/fd
ln -sf /proc/kcore /dev/core
. /etc/profile
exec zeroinit


This is the content of my /dev directory after my updated small init script (I exec /bin/bash instead of my init just to check what is mounted):

https://i.ibb.co/s60NPd6/dev.png

Now I have few questions:
-Do I miss something else vital, or do I have the minimum ?
-I understood I have to use openvt and agetty.

So I did this call:

Code:

openvt -f -w -c 1 -- /bin/sh -c "agetty - $TERM"


But why when I press CTRL+ALT+3 for example, I can't open another TTY ?
_________________
My actual project: https://github.com/Fulgurance/ISM

Ingenius Software Manager is a tool to build and manage a Linux system from scratch.
It will able to manage a linux installation just with a given path to the futur root path
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Unsupported Software All times are GMT
Goto page Previous  1, 2
Page 2 of 2

 
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