Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Unsupported Software
  • Search

Question about init conception

This forum covers all Gentoo-related software not officially supported by Gentoo. Ebuilds/software posted here might harm the health and stability of your system(s), and are not supported by Gentoo developers. Bugs/errors caused by ebuilds from overlays.gentoo.org are covered by this forum, too.
Post Reply
Advanced search
36 posts
  • Previous
  • 1
  • 2
Author
Message
Zucca
Moderator
Moderator
User avatar
Posts: 4685
Joined: Thu Jun 14, 2007 10:31 pm
Location: Rasi, Finland
Contact:
Contact Zucca
Website

  • Quote

Post by Zucca » Mon Jan 13, 2025 5:32 pm

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 :..

Code: Select all

init=/sbin/openrc-init
-systemd -logind -elogind seatd
I am NaN! I am a man!
Top
grknight
Retired Dev
Retired Dev
Posts: 2556
Joined: Fri Feb 20, 2015 9:36 pm

  • Quote

Post by grknight » Mon Jan 13, 2025 5:46 pm

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
Top
Fulgurance
Veteran
Veteran
User avatar
Posts: 1287
Joined: Wed Feb 15, 2017 4:31 pm
Contact:
Contact Fulgurance
Website

  • Quote

Post by Fulgurance » Mon Jan 13, 2025 6:57 pm

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: Select all

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: Select all

#!/bin/bash 
needs shared libraries.

Code: Select all

 $ 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: Select all

#!/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: Select all

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
Top
Fulgurance
Veteran
Veteran
User avatar
Posts: 1287
Joined: Wed Feb 15, 2017 4:31 pm
Contact:
Contact Fulgurance
Website

  • Quote

Post by Fulgurance » Wed Jan 15, 2025 3:05 am

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
Top
pjp
Administrator
Administrator
User avatar
Posts: 20668
Joined: Tue Apr 16, 2002 10:35 pm

  • Quote

Post by pjp » Wed Jan 15, 2025 3:48 am

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: Select all

$ cat /proc/sys/kernel/pty/nr 
12
Quis separabit? Quo animo?
Top
GDH-gentoo
Advocate
Advocate
User avatar
Posts: 2111
Joined: Sat Jul 20, 2019 7:02 pm
Location: South America

  • Quote

Post by GDH-gentoo » Wed Jan 15, 2025 12:50 pm

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 :)
Top
Fulgurance
Veteran
Veteran
User avatar
Posts: 1287
Joined: Wed Feb 15, 2017 4:31 pm
Contact:
Contact Fulgurance
Website

  • Quote

Post by Fulgurance » Wed Jan 15, 2025 1:10 pm

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
Top
GDH-gentoo
Advocate
Advocate
User avatar
Posts: 2111
Joined: Sat Jul 20, 2019 7:02 pm
Location: South America

  • Quote

Post by GDH-gentoo » Wed Jan 15, 2025 3:50 pm

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 :)
Top
Fulgurance
Veteran
Veteran
User avatar
Posts: 1287
Joined: Wed Feb 15, 2017 4:31 pm
Contact:
Contact Fulgurance
Website

  • Quote

Post by Fulgurance » Wed Jan 15, 2025 4:34 pm

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
Top
Fulgurance
Veteran
Veteran
User avatar
Posts: 1287
Joined: Wed Feb 15, 2017 4:31 pm
Contact:
Contact Fulgurance
Website

  • Quote

Post by Fulgurance » Wed Jan 15, 2025 7:51 pm

I find how to do ! But you need openvt

Thanks a lot guys ! :D
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
Top
Fulgurance
Veteran
Veteran
User avatar
Posts: 1287
Joined: Wed Feb 15, 2017 4:31 pm
Contact:
Contact Fulgurance
Website

  • Quote

Post by Fulgurance » Thu Jan 16, 2025 11:16 am

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: Select all

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
Top
Post Reply

36 posts
  • Previous
  • 1
  • 2

Return to “Unsupported Software”

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