LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch
User Name
Password
Linux From Scratch This 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


Reply
  Search this Thread
Old 05-05-2014, 10:23 PM   #31
ReaperX7
LQ Guru
 
Registered: Jul 2011
Location: California
Distribution: Slackware64-15.0 Multilib
Posts: 6,558

Original Poster
Blog Entries: 15

Rep: Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097

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.

Last edited by ReaperX7; 04-07-2015 at 05:29 AM.
 
Old 05-06-2014, 05:14 AM   #32
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,156

Rep: Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857
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.
 
Old 05-06-2014, 05:39 AM   #33
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,156

Rep: Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857
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.
 
Old 05-06-2014, 07:59 AM   #34
stoat
Member
 
Registered: May 2007
Distribution: LFS
Posts: 628

Rep: Reputation: 185Reputation: 185
Quote:
Originally Posted by ReaperX7

I sense a very positive for us coming soon.
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
And for CUPS...
Code:
mkdir -pv /etc/sv/cups

tee /etc/sv/cups/run << "EOF"
#!/bin/sh
#Start the printer daemon.

exec 2>&1
exec /usr/sbin/cupsd -f

#End /etc/sv/cups/run
EOF

tee /etc/sv/cups/finish << "EOF"
#!/bin/sh
#Stop the printer daemon.

/bin/killall -q /usr/sbin/cupsd > /dev/null 2>&1
rm -f /run/cups/cups.* > /dev/null 2>&1

#End /etc/sv/cups/finish
EOF

chmod -v +x /etc/sv/cups/{run,finish}
ln -svf /etc/sv/cups /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.

Last edited by stoat; 05-15-2014 at 10:17 AM.
 
Old 05-06-2014, 08:21 AM   #35
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,156

Rep: Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857
Thanks for posting those scripts can't test them yet as I am installing a load of stuff in my eudev/runit system, I will get back ASPAP
 
Old 05-06-2014, 08:29 AM   #36
ReaperX7
LQ Guru
 
Registered: Jul 2011
Location: California
Distribution: Slackware64-15.0 Multilib
Posts: 6,558

Original Poster
Blog Entries: 15

Rep: Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097
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.
 
Old 05-06-2014, 08:41 AM   #37
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,156

Rep: Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857
Quote:
Originally Posted by ReaperX7 View Post
...I do want to trim down the start script in stage 1...
I have done this (based on some arch code)
Code:
cat > /etc/runit/1 << "EOF"
#!/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin

for i in /etc/runit/start/*
	do
		if [ -x "$i" ];then
			"$i" start
			if [ $? -ne 0 ];then
				echo "Problem running $i"
				/sbin/sulogin
				exit 1
			fi
		fi
	done

touch /etc/runit/stopit
chmod 0 /etc/runit/stopit

EOF

chmod +x /etc/runit/1

mkdir -vp /etc/runit/start
pushd /etc/runit/start
		ln -sv /etc/rc.d/init.d/mountvirtfs 00-mountvirtfs
		ln -sv /etc/rc.d/init.d/modules 02-modules
		ln -sv /etc/rc.d/init.d/udev 04-udev
		ln -sv /etc/rc.d/init.d/swap 06-swap
		ln -sv /etc/rc.d/init.d/setclock 08-setclock
		ln -sv /etc/rc.d/init.d/mountfs 10-mountfs
		ln -sv /etc/rc.d/init.d/udev_retry 12-udev_retry
		ln -sv /etc/rc.d/init.d/cleanfs 14-cleanfs
		ln -sv /etc/rc.d/init.d/console 16-console
		ln -sv /etc/rc.d/init.d/localnet 18-localnet
		ln -sv /etc/rc.d/init.d/sysctl 20-sysctl
		ln -sv /etc/rc.d/init.d/sysklogd 22-sysklogd
		ln -sv /etc/rc.d/init.d/network 24-network
popd
As it makes adding or changing the order of the start up scripts easier, just add/remove or rename the links, it seems to work pretty well.
 
Old 05-06-2014, 09:17 AM   #38
stoat
Member
 
Registered: May 2007
Distribution: LFS
Posts: 628

Rep: Reputation: 185Reputation: 185
This dbus run script line posted by me above has been producing some "not permitted" log messages related to dropping supplemental groups...
Code:
exec chpst -umessagebus /usr/bin/dbus-daemon --nofork --nopidfile --config-file=/etc/dbus-1/system.conf
I believe "chpst -umessagebus" was doing that. I read the various related man pages and decided to try simply this...
Code:
exec /usr/bin/dbus-daemon --nofork --nopidfile --config-file=/etc/dbus-1/system.conf
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.

Last edited by stoat; 05-15-2014 at 10:18 AM.
 
Old 05-06-2014, 06:57 PM   #39
ReaperX7
LQ Guru
 
Registered: Jul 2011
Location: California
Distribution: Slackware64-15.0 Multilib
Posts: 6,558

Original Poster
Blog Entries: 15

Rep: Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097
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've updated the hint as such:

Last edited by ReaperX7; 04-07-2015 at 05:29 AM.
 
Old 05-07-2014, 12:12 AM   #40
stoat
Member
 
Registered: May 2007
Distribution: LFS
Posts: 628

Rep: Reputation: 185Reputation: 185
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.
Attached Files
File Type: txt network_scripts.txt (5.3 KB, 26 views)
File Type: txt runit3.txt (574 Bytes, 25 views)

Last edited by stoat; 05-15-2014 at 10:03 AM.
 
1 members found this post helpful.
Old 05-07-2014, 05:06 AM   #41
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,156

Rep: Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857
Quote:
Originally Posted by ReaperX7 View Post
...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.
 
Old 05-07-2014, 09:12 AM   #42
stoat
Member
 
Registered: May 2007
Distribution: LFS
Posts: 628

Rep: Reputation: 185Reputation: 185
The pause applet works for things like alsa. It's like the network stuff. It will make runsv wait for TERM or KILL to run ./finish for alsa.

Last edited by stoat; 05-15-2014 at 10:02 AM.
 
Old 05-07-2014, 09:38 AM   #43
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,156

Rep: Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857
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:
Code:
wget https://dl.dropboxusercontent.com/s/4tve58sgl79qmtb/install-cups
wget https://dl.dropboxusercontent.com/s/9j3hhgo3pd5613d/install-dbus
wget https://dl.dropboxusercontent.com/s/pomhyoa12a7wisu/install-gpm
wget https://dl.dropboxusercontent.com/s/hgddw89hwzvvh6s/install-kdm
wget https://dl.dropboxusercontent.com/s/779stoxoz9eu0yx/install-mysql
wget https://dl.dropboxusercontent.com/s/9ie2qd4dj0ile7k/install-openssh
wget https://dl.dropboxusercontent.com/s/h1slvw0dzrmksbk/install-ntpd
wget https://dl.dropboxusercontent.com/s/978qbe7zvan00mj/install-network
wget https://dl.dropboxusercontent.com/s/avc3me90iricp3p/install-apache
wget https://dl.dropboxusercontent.com/s/cduimiaorrnco7w/install-postfix
wget https://dl.dropboxusercontent.com/s/qymjf9o2c3wgc1s/install-smartd
wget https://dl.dropboxusercontent.com/s/ho1yvpf4xm8vtv7/install-fcron
wget https://dl.dropboxusercontent.com/s/le4y4400w211zmb/install-iptables

chmod +x install-*
Or you can just go to the folder here:
https://www.dropbox.com/sh/lee5vh4ztt6jeox/1E1eGJZLpj

I will get the rest done soon.

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
 
Old 05-07-2014, 09:45 AM   #44
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,156

Rep: Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857
Quote:
Originally Posted by stoat View Post
...Am I right at this point to think that finish scripts are not needed for a lot of things...
You posted while I was typing, I had some problems with the finish script for mysql, but they are needed if you want to bring down a service manually
Code:
sv force-stop -w2 /etc/sv/mysql
Equivalent I suppose of the sysv scripts start/stop/restart options.
 
Old 05-07-2014, 10:54 AM   #45
stoat
Member
 
Registered: May 2007
Distribution: LFS
Posts: 628

Rep: Reputation: 185Reputation: 185
I should have read the man pages for the runit stuff earlier. I would have better understood how Runit works.

Last edited by stoat; 05-15-2014 at 09:42 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] S6 or Runit, not systemd san2ban Slackware 33 12-16-2017 06:29 PM
How to manually uninstall runit Sanva Linux - Newbie 5 09-26-2009 05:49 AM
runit on SuSE 10.1 tzbishop SUSE / openSUSE 2 10-09-2006 11:26 AM
runit problems deroB Linux - Software 3 01-17-2006 02:40 PM
xdm with runit? behmjose Linux From Scratch 0 05-22-2004 03:19 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch

All times are GMT -5. The time now is 12:30 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration