Linux From ScratchThis Forum is for the discussion of LFS.
LFS is a project that provides you with the steps necessary to build your own custom Linux system.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Stoat... I sense a very positive for us coming soon. Don't you?
I'm not exactly certain myself, but it appears to be they're creating some type of process state handle between /dev/null and getty-1. Did you get the usual No Job Control message?
Edit:
New updated WIP file included to mark our progress.
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,156
Rep:
I can confirm that the script works with a bit of a correction the getty should be agetty like so
Code:
! type agetty &>/dev/null || exec chpst -P agetty tty5 linux
exec agetty 38400 tty5 linux
Tried this in a virtual machine I will now try it in a proper one and post back, and yes I am happy to host any files you want just let me know, may be best to pm me or email me direct rather than clog the forums up with that sort of stuff.
The first bit of the line "type" is a bash built in which basically does the same as which ( it get the path to aggety ) if it succeeds it run s the second statement (exec chpst ...), in which case the 3rd statement doesn't get run, if type fails the 3rd statment runs, which is pretty redundant as if type can't find agetty then trying to run it in line 3 will fail anyway, so this code can be cleaned quite a lot.
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,156
Rep:
YAAY!! It works!
Well done Reaper!
I changed the actual file to this
Code:
#!/bin/sh
exec chpst -P /sbin/agetty tty2 linux
Of course replace the tty number to suit.
As the test for agetty is redundant because if it fails to find 'agetty' the original script just tries to run 'agetty' which it won't find anyway!
I am now going to install a full desktop and then work on the runscripts.
Stoat can you post or send me your dbus scripts as I will definitely need them.
Last edited by Keith Hedger; 05-06-2014 at 06:02 AM.
I already feel very positive about Runit so far, if that's what you meant. But I also think this will become a hobby for me (take a while to perfect). But I don't mind that. I just need you and Keith to remind me every now and then why I'm doing this. I mean, I liked SysVinit and had no issues with it (that I know about).
Quote:
Originally Posted by Keith Hedger
...the getty should be agetty like so...
That worked nicely. Thanks. Ctrl-C works everywhere and both of those bash warnings on the console login screen are now gone. One more thing-to-do has been checked off.
Quote:
Originally Posted by Keith Hedger
...pm me or email me direct rather than clog the forums up with that sort of stuff.
I don't think we should worry about that. We never know who is lurking and following along. They may want all of this information. This thread is becoming our main working thread. If the project continues, it will become one of those long messy threads that most people will never read, but so what. The work-in-progress and final product can be kept in an organized state in the hint and hint attachments hosted at linuxfromscratch.org. IMO, that is.
Quote:
Originally Posted by Keith Hedger
...can you post or send me your dbus scripts as I will definitely need them.
I'm still fiddling with the D-Bus thing for some annoying messaging and for stopping it. I am trying to use /sbin/killall in several of the finish scripts, but I'm not sure yet if that is a good idea or even working. Anyway, at the moment...
Code:
mkdir -pv /etc/sv/dbus
mkdir -pv /etc/sv/dbus/log
tee /etc/sv/dbus/run << "EOF"
#!/bin/sh
#Start the message bus.
exec 2>&1
if [ ! -d /var/run/dbus ]; then
mkdir -p /var/run/dbus
chown messagebus /var/run/dbus
chgrp messagebus /var/run/dbus
fi
/usr/bin/dbus-uuidgen --ensure
exec chpst -umessagebus /usr/bin/dbus-daemon --nofork --nopidfile --config-file=/etc/dbus-1/system.conf
#End /etc/sv/dbus/run
EOF
tee /etc/sv/dbus/finish << "EOF"
#!/bin/sh
#Stop the message bus.
/bin/killall -q /usr/bin/dbus-daemon > /dev/null 2>&1
rm -f /run/dbus/system_bus_socket /run/dbus/pid > /dev/null 2>&1
#End /etc/sv/dbus/finish
EOF
tee /etc/sv/dbus/log/run << "EOF"
#!/bin/sh
#Start logging for the message bus.
exec /usr/sbin/svlogd -tt /var/log/dbus
#End /etc/sv/dbus/log/run
EOF
chmod -v +x /etc/sv/dbus/{run,finish,log/run}
mkdir -pv /var/log/dbus
ln -svf /etc/sv/dbus /var/service
All advice or help will be appreciated. My feelings are not in play for this project.
============ UPDATE ==========
Currently, I'm working on the Stage 2 run script for ntpd. I'm stuck but working on it. Just FYI where I am.
Also, some of the logs are filling up with stuff I will never need. Like gpm for example. Huge-ish log file in the making there. LFS doesn't log gpm stuff. It's kinda the same for network. I wonder if I can just omit the logging for stuff like that if the service or app is working well.
Okay, we can always trim out logs that aren't needed. The agetty script fixes will be added to the next hint release tonight when I have time, but for now we have our working model, and yes, one more problem solved.
I do want to trim down the start script in stage 1 to maybe move sysklogd into stage 2, but for now LFS is always a fairly fast booting distribution anyways.
I've been digging through every database I could find looking for their Runit scripts and so far, we have from them, almost every matchable Runit script equivalent sysvinit script, so maybe soon, we can get a working model of the scripts tarballed and posted for Bruce to tinker with. I don't want to say this could ever get put in the book, but this was a step in the best direction for Linux on the whole, and this work can be easily reduplicated.
I should be able to find all we'll need script wise and I can start posting stuff here for scripts that we can check off.
It still works. I still can communicate with CUPS. I have only two success lines logged for dbus...
Code:
2014-05-06_14:10:04.32378 dbus[496]: [system] Activating service name='org.freedesktop.ColorManager' (using servicehelper)
2014-05-06_14:10:04.92386 dbus[496]: [system] Successfully activated service 'org.freedesktop.ColorManager'
I like this better so far. Just FYI.
UPDATE:
The /sbin/ifup and /sbin/ifdown scripts (installed from lfs-bootscripts) that I have been using in my network run script source the LFS init-functions file. The result is LFS messaging from the console (including those cursor color, repostioning, asterisk prefixes, [ OK ] suffices, etc.) going to the network log file. I would like to log only stuff about bringing the network interface up or down. I will try to pick out from ifup and ifdown what I need and put that in the network run script. I'm trying not to call any of the LFS scripts. And I'm trying not to rely on any messaging from them either.
Okay, GPM log is cut (yes this was a HUGE log that was not necessary)
I added Stoat's start, finish, and log scripts for CUPS and DBus.
Cleaned up stage 1 with Keith's suggestion. Very streamlined. I did add back the random number generator script but with an if trigger.
As long as D-Bus is actually running, I'm confident we'll be okay, unless it becomes an actual problem then we can worry about it then, right now, onward and upward.
There is always going to be a "why are we doing this?" question raised.
The answer is simple. SysV needs a true successor that is easy to use, reliable, stable, and 100% backwards compatible with SysV scripts and scripting techniques, but isn't bloating to the system, isn't a hard dependency, and isn't a large single point of failure.
Runit might not be a perfect successor to SysV, but it is, for now at least, the best possible choice to keep it stupidly simple, sane and sound, and in accordance to the UNIX philosophy.
Keith, question, when you use your script to startup, did you change anything to the shutdown sequence? I'd like to know if this could be streamlined as well.
I spent today looking through the LFS network scripts which are sort of a tortuous mess going from init and rc to network to ifup to ifconfig.eth0 to init-functions to ipv4-static and back again. I guess they are that way for some reason. Anyway, I wrote for myself new runit network scripts for run, finish, and logging. They work nicely for me and print a reasonable amount of log messages. I tried to make them have the same functionality as the LFS scripts, but I didn't spend a lot of time testing all kinds of network possibilities. I renamed the sv and var folders from eth-0 to network since interfaces could be named anything and more than one can exist.
On another front today, I replaced the calls to LFS scripts in runit/3 with the commands in those scripts. All were only one or two lines each. It cleans up the console some at shutdown. I attached that snippet from my stuff FYI. You know, the LFS init-functions stuff does make the console look pretty at boot and shutdown, but I find that skipping that with these runit scripts seems to speed booting some.
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,156
Rep:
Quote:
Originally Posted by ReaperX7
...Keith, question, when you use your script to startup, did you change anything to the shutdown sequence? I'd like to know if this could be streamlined as well...
No I left stage 2/3 scripts alone I did think about it, it could even be combined into one script and depending what name it was started with would either run startup or shutdown, I'll have little look later on today, just having a bit of trouble with dbus/scanning.
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,156
Rep:
Been banging my head against a wall to get a mysql script working, started fine but wouldn't run the finish script, realized I HAD to use exec to start it other wise sv don't run the finish script, just a little gotcha.
Anyway been putting the service scripts from the hints into individual installer scripts to make it easier,they are available like so:
Couple of minor things with the latest hint:
Line 451/2
mkdir -pv /etc/sv/gpm
mkdir -pv /etc/sv/gpm/log
Only the second mkdir is needed as gpm will be created as well.
Line 413
mkdir -pv /etc/sv/eth-0
If you make it mkdir -pv /etc/sv/eth-0/log then the mkdir at line 430 is not needed, same reason as above.
Line 484/5
mkdir -pv /etc/sv/dhclient
mkdir -pv /etc/sv/dhclient/log
Same
Line 507/8
mkdir -pv /etc/sv/dhclient
mkdir -pv /etc/sv/dhclient/log
Same
Line 535/6
mkdir -pv /etc/sv/openssh
mkdir -pv /etc/sv/openssh/log
Same
Line 561
Needs a mkdir like so:
mkdir -vp /etc/sv/dbus/log
Line 597
Needs a mkdir like so:
mkdir -vp /etc/sv/cups/log
Line 624
Needs a mkdir like so:
mkdir -vp /etc/sv/iptables
Line 715
Needs a mkdir like so:
mkdir -vp /etc/sv/kdm/log
I know these are very minor points
Last edited by Keith Hedger; 05-09-2014 at 05:51 AM.
Reason: added link
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.