View previous topic :: View next topic |
Author |
Message |
Zucca Moderator
Joined: 14 Jun 2007 Posts: 3893 Location: Rasi, Finland
|
Posted: Mon Jan 13, 2025 5:32 pm Post subject: |
|
|
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 |
|
|
grknight Retired Dev
Joined: 20 Feb 2015 Posts: 1994
|
Posted: Mon Jan 13, 2025 5:46 pm Post subject: |
|
|
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 |
|
|
Fulgurance Veteran
Joined: 15 Feb 2017 Posts: 1249
|
Posted: Mon Jan 13, 2025 6:57 pm Post subject: |
|
|
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.
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 |
|
|
Fulgurance Veteran
Joined: 15 Feb 2017 Posts: 1249
|
Posted: Wed Jan 15, 2025 3:05 am Post subject: |
|
|
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 |
|
|
pjp Administrator
Joined: 16 Apr 2002 Posts: 20582
|
Posted: Wed Jan 15, 2025 3:48 am Post subject: |
|
|
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 |
|
|
GDH-gentoo Veteran
Joined: 20 Jul 2019 Posts: 1797 Location: South America
|
Posted: Wed Jan 15, 2025 12:50 pm Post subject: |
|
|
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 |
|
|
Fulgurance Veteran
Joined: 15 Feb 2017 Posts: 1249
|
Posted: Wed Jan 15, 2025 1:10 pm Post subject: |
|
|
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 |
|
|
GDH-gentoo Veteran
Joined: 20 Jul 2019 Posts: 1797 Location: South America
|
Posted: Wed Jan 15, 2025 3:50 pm Post subject: |
|
|
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 |
|
|
Fulgurance Veteran
Joined: 15 Feb 2017 Posts: 1249
|
Posted: Wed Jan 15, 2025 4:34 pm Post subject: |
|
|
GDH-gentoo wrote: | 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. |
No, I mean even I press CTRL+ALT+number, I stay on the same screen. And when I loggin, it don't mention on which tty I am. It's like there only one tty.
So how can I run multiple aggetty process at the same time ? I mean in bash for example ? _________________ 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 |
|
|
Fulgurance Veteran
Joined: 15 Feb 2017 Posts: 1249
|
Posted: Wed Jan 15, 2025 7:51 pm Post subject: |
|
|
I find how to do ! But you need openvt
Thanks a lot guys ! _________________ 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 |
|
|
Fulgurance Veteran
Joined: 15 Feb 2017 Posts: 1249
|
Posted: Thu Jan 16, 2025 11:16 am Post subject: |
|
|
I have one last question guys.
One of my function in my init is made to print a text character by character, but with a bit of delay (just to play an animation)
I tried on my laptop on a TTY and it work fine. But when I boot my minimal init via the bash script I shown you in the previous posts, it doesn't work properly. It's like the sleep function don't work properly
The text is print after few times, not character by character but in one time.
Code: |
def progressivePrint(text : String, speed = 20)
text.each_char do |character|
sleep(Time::Span.new(nanoseconds: speed*1000000))
print character
end
end
|
I suspect something is missing at the start, like a missing mountpoint or running service, but I don't know what.
It's like maybe the time isn't calculate properly ? _________________ 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 |
|
|
|