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: 3871
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: 1245

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
Fulgurance
Veteran
Veteran


Joined: 15 Feb 2017
Posts: 1245

PostPosted: Wed Jan 15, 2025 3:05 am    Post subject: Reply with quote

Someone have an idea ?

Basically after I did a minimal setup with a bash script (for tests purpose at the moment), I would like to understand how I can start login session, but with the 7 virtual tty (when you can press CTRL+ALT+number of TTY)

Because when I use the command openvt with agetty, I can login, but can't switch to any other virtual tty.
How can I do this ?
_________________
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
pjp
Administrator
Administrator


Joined: 16 Apr 2002
Posts: 20575

PostPosted: Wed Jan 15, 2025 3:48 am    Post subject: Reply with quote

I believe you need kernel support. TTY, PTY, VT? I don't recall the details. Maybe it's in the handbook.

I believe 12 is the default.
Code:
$ cat /proc/sys/kernel/pty/nr
12

_________________
Quis separabit? Quo animo?
Back to top
View user's profile Send private message
GDH-gentoo
Veteran
Veteran


Joined: 20 Jul 2019
Posts: 1790
Location: South America

PostPosted: Wed Jan 15, 2025 12:50 pm    Post subject: Reply with quote

Fulgurance wrote:
Because when I use the command openvt with agetty, I can login, but can't switch to any other virtual tty.

Output of ps axf after you log in and get a shell prompt?
_________________
NeddySeagoon wrote:
I'm not a witch, I'm a retired electronics engineer :)
Ionen wrote:
As a packager I just don't want things to get messier with weird build systems and multiple toolchains requirements though :)
Back to top
View user's profile Send private message
Fulgurance
Veteran
Veteran


Joined: 15 Feb 2017
Posts: 1245

PostPosted: Wed Jan 15, 2025 1:10 pm    Post subject: Reply with quote

Thank you for your help.

So this is the result of first ps axf and then the content of /proc/sys/kernel/pty/nr (it return 0)

https://i.ibb.co/gZZjXf0/Screenshot-20250115-130556.png

So as you see, /proc/sys/kernel/pty/nr return 0

Lsmod return nothing actually, the list is empty. So I guess I missed a step
_________________
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
GDH-gentoo
Veteran
Veteran


Joined: 20 Jul 2019
Posts: 1790
Location: South America

PostPosted: Wed Jan 15, 2025 3:50 pm    Post subject: Reply with quote

Fulgurance wrote:
https://i.ibb.co/gZZjXf0/Screenshot-20250115-130556.png

When you say "I [...] can't switch to any other virtual tty", does it mean that you just see an empty screen with a blinking cursor when you press CTRL + Alt + number? You have only one single agetty process for /dev/tty1, so not surprising if that's the case. Were you expecting to be greeted with a login prompt on every virtual terminal?

Also, Gentoo's configuration file for sys-apps/sysvinit just runs agetty directly, I don't think that it's necessary to go through openvt.
_________________
NeddySeagoon wrote:
I'm not a witch, I'm a retired electronics engineer :)
Ionen wrote:
As a packager I just don't want things to get messier with weird build systems and multiple toolchains requirements though :)
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