LinuxQuestions.org
Help answer threads with 0 replies.
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-01-2014, 11:17 PM   #1
ReaperX7
LQ Guru
 
Registered: Jul 2011
Location: California
Distribution: Slackware64-15.0 Multilib
Posts: 6,558
Blog Entries: 15

Rep: Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097
Lightbulb LFS with Runit (without SysV)


After a few hours today of crunching enough data and writing a full completely new Hint that is currently unsubmitted to LFS, but licensed, I'm asking anyone willing to sacrifice an LFS build to test my LFS runit-alt-hint.

I'm asking for anyone daring enough to test this.

This work has been at least several weeks in the making, so as of now this is my first true public beta. ANY comments and suggestions are welcome that will help the project proceed onward.

This effort is a modernized and reworked hint originally started by Richard Downing who submitted his build-with-runit hint, but later abandoned it for reasons unclear. I've taken all the known information from his hint here at LFS:

http://www.linuxfromscratch.org/hint...with-runit.txt

as well as his last known webpage here:

http://www.langside.f2s.com/betterboot/

to construct this document from the ground up. It's in my hopes that Runit can be successfully tested enough to prove to be a viable alternative to SysV rather than systemd due to it's size and simplicity. Runit is available for many flavors of UNIX at the moment, though it can only boot a few currently. Runit is also highly compatible with sysvinit scripting and uses many of the same shell scripting techniques.

Give it a try and tell me how it goes...

and to all those who test this... Thank you. I want some good feedback before I submit this to Bruce.

Just a last minute note, but this document is ONLY geared to work with a completed LFS with at least Chapter 3 of BLFS completed and the software from LFS's Rebooting page completed also for thoroughness.

Also, due to how Runit works, I'd advise you build LFS with eudev as well.

Last edited by ReaperX7; 04-07-2015 at 05:29 AM.
 
Old 05-02-2014, 05:32 AM   #2
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
Question

I'm going to give this a whirl but I just need a minor clarification, should I install a complete LFS system including sysvinit and then install runnit over the top or replace the sysvinit part with this and then carry on with Tar, Texinfo ... etc.
 
Old 05-02-2014, 10:15 AM   #3
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
Well it mostly worked!

Couple of things with the hints:
line 333 ( just above cat > /etc/sv/getty-1/run << "EOF" ) added:
mkdir -vp /etc/sv/getty-1

line 354 ( just below for N in 2 3 4 5 6; do ) changed to:
mkdir -vp /etc/sv/getty-$N

The -p option just makes sure the parent directory's are created if they don't exist

Had an error on boot:
/etc/runit/1: line 56: /etc/rc.d/init.d/random: No such file or directory
- runit: leave stage: /etc/runit/1
- runit: enter stage: /etc/runit/2

And after login:
LFSDeepThought login: root
Password:
No mail.
-bash: no job control in this shell

Network didn't come up, but I use a static ip so didn't do the "Dhclient and dhcpcd" bit so will have to sort that out.

Also 'reboot' did a shutdown instead.

But pretty much ok, gpm worked, forgot to test ssh, will do so next time.
I will redo some bits and see what I can see, all good fun!
 
Old 05-02-2014, 11:06 AM   #4
stoat
Member
 
Registered: May 2007
Distribution: LFS
Posts: 628

Rep: Reputation: 185Reputation: 185
I intend to try this too, but I'm still in the reading phase.

The script that creates the other five gettys would do everything between do and done five times. It seems to me that each N loop needs to create only one run script and one finish script in one getty subdirectory. I think the for-do loop could be reduced to one set of cat commands for the run and finish scripts and use $N to number the getty subdirectories in each N loop.
 
Old 05-02-2014, 11:46 AM   #5
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
Got network working, I had to change this:
/etc/sysconfig/network-devices/ifup eth0
to this:
/etc/init.d/network start

In the "cat > /etc/sv/eth-0/run" end.

Oddly I don't seem to be able to quit an operation with Control-C like normal, the rest of the keyboard/mouse works fine.

Quickly installed xorg and that is OK as well.
Reboot worked properly this time.

I agree with stoat about the loop this would be better:
Code:
for N in 2 3 4 5 6; do
mkdir -vp /etc/sv/getty-$N
 
cat > /etc/sv/getty-$N/run << EOF
#!/bin/sh
exec /sbin/agetty 38400 tty$N linux
EOF
 
cat > /etc/sv/getty-$N/finish << EOF
#!/bin/sh
exec utmpset -w tty$N
EOF

chmod +x /etc/sv/getty-$N/*
ln -sf /etc/sv/getty-$N /var/service

done

Last edited by Keith Hedger; 05-02-2014 at 11:50 AM. Reason: Missed a bit
 
Old 05-02-2014, 11:57 AM   #6
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
No pain no gain on this one.

I had thought about using $N for the Gettys but it ran afoul and wrote $N actually in the scripts so making each on individually worked better. I missed the flags for mkdir. Small issue, but note worthy.

Random requires the BLFS-bootscripts for the Random Number generator in chapter 3, just comment it out if not available.

Network didn't come up... Okay there is a workaround so I can change the scripting to start the network in stage 1 rather than stage 2. The Eth-0 script is geared for dhcp probably. Minor problem but it can be fixed.

Try adding this after the random start flag in stage 1:

Code:
# Start the Network daemon
/etc/rc.d/init.d/network start
You'll need to add a stop handler in stage 3 also after localnet:

Code:
# Stop the network daemon
/etc/rc.d/init.d/network stop
Reboot shutting down... It should say init 6 for rebooting in the reboot script. Init 0 should shut down things. I probably should add that in by default anyway.

The no job control is something I've ran across as well. I've been reading up on it, and it seems to be an old bug, and I'm trying to find a repair for it, but details are leading to how things are setup...

http://stackoverflow.com/questions/1...his-shell-mean

Still trying to figure out a fix, so really it could be how LFS is setup. Check the .bash_profile, .bashrc, and .profile and they're universal system counterparts. I think Debian had a fix...

http://forums.debian.net/viewtopic.php?f=17&t=81789

Oh and for the install, it's more geared to be without the sysvinit package.

Last edited by ReaperX7; 05-02-2014 at 12:11 PM.
 
Old 05-02-2014, 01:15 PM   #7
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 had thought about using $N for the Gettys but it ran afoul and wrote $N actually in the scripts...
That's because you used quotes so:
Code:
cat >/etc/sv/getty-$N/run << "EOF"
treats $N as a literal.
Code:
cat >/etc/sv/getty-$N/run << EOF
does variable substitution, it's caught me a out a few times.

Quote:
Originally Posted by ReaperX7 View Post
...Network didn't come up...
Sorted, se my previous post, but I'll give your way a whirl as well.


Quote:
Originally Posted by ReaperX7 View Post
...Reboot shutting down... It should say init 6 for rebooting in the reboot script...
I may have just mucked that bit up the first time round as it worked OK the second time.

Quote:
Originally Posted by ReaperX7 View Post
...no job control...
I seem to remember this from my very early days of using Linux, can't remember how to fix it, would this be releated to not being able to break out of a program using Control-C?
 
Old 05-02-2014, 02:08 PM   #8
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
Just seen this:
Code:
cat > /etc/sv/getty-1/finish << "EOF"
#!/sbin/sh
exec utmpset -w tty1
EOF
Changed the #!/sbin/sh to #!/bin/sh
 
Old 05-02-2014, 02:41 PM   #9
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
Almost never noticed that Keith, thanks. Still testing stuff here too but making progress. I'm trying to see how LFS does it's Bash Profile, because, according to Debian, it has to be set a certain way, or Bash can't control jobs. So yes, it's an old bug that mostly centers around how Bash is profiled. I'm not sure why, but sysvinit somehow had a built-in workaround, but the real issue lies within the profile scripts.

Otherwise, the system is running well, and stuff is starting and stopping as it's supposed to.

The run files are still going to have to be looked at carefully, but Arch's database has been insightful. I think I can draft enough of a complete run script set using Arch, Gerrit, and Richard's notes. Maybe soon, all we'll need to do is download a package just for scripts and be done with it.

So far Runit has behaved itself very well. Much more so than other init systems that have been offered...

Last edited by ReaperX7; 05-02-2014 at 02:48 PM.
 
Old 05-02-2014, 02:57 PM   #10
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
What would be best to keep the sysv scripts and run them or create new dedicated scripts, eg start gpm as per your hint or start the existing scripts from the various runlevel scripts eg your suggestion about starting networking from stage 1?

I'm OK with scripting so if I can help with the start up scripts let me know but before I do any it would be best if we were all on the same page.
 
Old 05-02-2014, 03:06 PM   #11
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
My goal right now is to keep the initial bootscripts from LFS, as well as a few from BLFS, as is, and not replace them. Arch did their own start scripts just for Runit, but that seems overkill if the current scripts work fine as-is.

Next is to draft up stage 2 scripts to run the various other daemons from BLFS mainly. This goes as such with OpenSSH, GPM, dhcpcd, and dhclient. From here we can add things like dbus, xinetd, etc. creating a full set of run scripts.

Mostly, if anything BLFS bootscripts are the main ones being replaced, minus the Random Number Generator. However, I have left a hint in to run the SysV scripts in Runit's compatibility mode by linking the "sv" program to the /etc/rc.d/init.d directory with a link to match the SysV script such as this...

If you have dbus's sysvinit script installed as /etc/rc.d/init.d/dbus, you would use this link:

ln -s /usr/sbin/sv /etc/rc.d/init.d/dbus which would create a directory link. Gerrit wrote very little on this, so I'm not sure how well it works.

Last edited by ReaperX7; 05-02-2014 at 03:11 PM.
 
Old 05-02-2014, 03:41 PM   #12
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'll give this whirl over the next couple of days see ahow much can be automated.
 
Old 05-02-2014, 04:07 PM   #13
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
I'm going to be tracking down more run files as well and seeing if I can get them drafted for LFS as well. So far this been a bit to learn, but it's fairly straight forward at least.
 
Old 05-02-2014, 08:47 PM   #14
stoat
Member
 
Registered: May 2007
Distribution: LFS
Posts: 628

Rep: Reputation: 185Reputation: 185
My first try report...

1. I also have the Ctrl-C issue. Sort of a big deal when you ping Google to test the network. I had to reboot to stop that.

2. Some messages on the console screen...
Code:
-bash: cannot set terminal process group (441): inappropriate ioctl for device.
-bash: no job control in this shell.
3. This part of the hint remains confusing to me. The first two sentences are about the Stage 2 file, and I get that. But the third sentence, link example, and fourth sentence seem to be about some optional thing. I didn't do any links like the example. Can this somehow be made more clear?
Quote:
Originally Posted by runit-alt-hint.txt

Now we'll create Stage 2's script which will load all other services
using Runit. This section has to be created even if you haven't
actually created runscripts yet. It will allow the "sv" program to
load init scripts in parallel if symlinked into /etc/rc.d/init.d
using this moniker:

ln -s /usr/sbin/sv /etc/rc.d/init.d/<name of script>

This will however lack service management and is not recommended
unless for compatibility purposes only.
4. I, too, had the network run file execute the LFS network initscript. The hint's run file would probably have worked if it hadn't had /etc/sysconfig/network-devices as the path to the ifup script. It's /sbin/ifup, and that's what the LFS network initscript runs. But running the LFS initscript for gpm didn't work for some reason. I went back and copied the mouse stuff from the hint to the gpm run file and that worked. I haven't bothered trying to understand that, but it makes me think the idea of eventually making our own run scripts is a good idea. I hope it will be possible to use the LFS initscripts as guides to write new and maybe better Runit run files for all those.

5. I'm not having any problems related to SysVinit. The "problem" that I apparently have is that I still use SysVinit even after witnessing the whole freakin' world stampede off and disappear in a cloud of Systemd dust. But that's not the cure I want for my "problem". Maybe Runit will fix it. The Runit concept sounds good to me. The smarden.org site laid out the benefits well. The software is oldish, but it's brand new compared to SysV. The mailing lists have fairly recent threads discussing Runit. That s6 thing seems to get most attention nowadays. Anyway, I'm for pushing onward.

Last edited by stoat; 05-15-2014 at 10:13 AM.
 
Old 05-02-2014, 09:06 PM   #15
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
I'll be taking a weekend to I and my wife's anniversary but I'll have time Monday to look more into this.

I noticed that with s6 also. I haven't messed with it yet though.

As far as the hint... Its vague but its not documented well either.

Runit can run sysv scripts in Stage 2 using a symlink to "sv" placed as a named link in /etc/rc.d/init.d but not a lot of documentation is available on it.

Last edited by ReaperX7; 05-03-2014 at 01:03 AM.
 
  


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 09:53 AM.

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