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.
The experiment to adapt Runit to LFS that was discussed often around here was a great success. I'm glad that I was allowed to participate in that. But I am still interested in other init schemes out there. Next for me was Busybox init. I found it to be simple in concept, small in size, and easy to install. Like most of Busybox's utilities, its init is a pared down init but still adequate for an LFS system. Anybody can look up Busybox, so there's no need to talk about the general features and uses of Busybox here.
Installation
I built Busybox to have only init support which produces an executable 17 KB in size. Installation consisted only of copying that busybox executable to /sbin and creating the four relevant symlinks to it: init, halt, reboot, poweroff. I did all of that manually instead of running "make install".
Configuration
Busybox init has a default internal inittab as a fallback when /etc/inittab does not exist. That obviously is not suitable for LFS. I created my own simple inittab from the example provided in the source tree. The Busybox inittab syntax has only a few differences from SysV's inittab (no runlevels meaning the runlevel field is ignored, the id field is for specifying ttys only, etc.).
Scripts
The inittab I created is configured to start the exact same initialization scripts that I use with Runit. I even used /1 and /3 almost "as is" (except for removing references to reboot, stopit, and sv). I didn't even bother to rename them. The /2 Runit script is of no use here, so I modified it to do something else (clear the console and print an ASCII graphic during shutdown). I also had to create some new initialization scripts for my daemons that had been started by run scripts in Runit, seven of them. I have the inittab start and stop those directly.
Service Supervision
I didn't think trying inittab's respawn for daemons was a good idea. So I'm using a custom script that is run as a recurring Fcron job for service supervision. That script detects if a service is not running and restarts it (if it was not intentionally stopped). It also can display the current status of the daemons. Sort of like Runit's runsv and sv.
Conclusion
This will not interest many people. Nevertheless, I like it for its simplicity. It's not hard to tell what it's doing at all times. The components are few in number and small in size, yet they still function well to start and shut down my LFS system. This method doesn't have runlevels (or the symlinks, the Ss, the Ks, and so on), but I don't need that stuff. The daemon supervision of Runit can be imitated with a bash script and Fcron. And finally, Busybox is well known and actively maintained. Anyway, after several days with it I can't find anything wrong with it.
P.S.: One of Busybox's included utilities is Runit. Ha.
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,150
Rep:
Nice one stoat!
Just given it a whirl and it all works nicely, at least after correcting a few typo's etc ( at my end ).
I used to use busybox a LOT when I was learning Linux, as I like to fiddle and was forever hosing my system, and a full statically linked busybox can get get you out of all sorts of brown sticky stuff! I'd forgotten all about busybox.
I'm gonna dig out the custom start up scripts I was writing at the beginning of the runnit cycle and have my own init system, who needs systemd! ( begin flame war now ).
BusyBox will flow faster through execution states as well. It's very optimized for embedded systems but you can use it on desktops very well. I've been tinkering with the mdev sections of CLFS to see if anything might be useful in B/LFS. BusyBox's init structure is more akin to a startup of sysvinit or bsdinit, but then switches over to Runit style for anything else. And yes, it's very underused in GNU/Linux. To be honest, it can serve as a damn good rescue system if you have it setup.
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,150
Rep:
Been running this init system for a few days now and I must say I like it, I have kept and tweaked the three main boot scripts from runit, 1 start's the system stuff as normal, 2 starts my services gpm, ssh etc, and 3 does all the shutdown stuff, rather than have all the shutdown commands in the inittab I decided to use the 3 script I already had as it keeps the inittab clean plus I have the advantage of just adding/changing/removing symlinks to to do different stuff.
As a bonus I can now shutdown/restart from xfce using the menu/pnale items instead of having to go to a shell and shutdown manually which I had to do with runnit, never could get xfce to play nicely with runnit!
Also I finally managed to fix a long running problem with not being able to remount / as read only on shutdown ( as I was fiddling with the boot/shutdown process anyway ), which meant I couldn't auto run cleanfs as / was not unmounted properly seems it was a couple of problems again related to xfce that tried to shutdown before closing x which was leaving some log files open, so just had to wait for x to exit and manually kill syslogd.
That's the mdev configuration script, but as far as how to use it with the bootscripts, I'm still working on that one. The CLFS bootscripts unfortunately were lost when the website went down.
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,150
Rep:
Unless mdev has had some major revamping since the last time I tried it, it is not really suitable f0r a full desktop system it was designed with embedded systems in mind with a small number of permantly attached devices, which is not the same as a desktop environment, that's not to say it can't be done but the extra fiddling with conf scripts is proably going to be beyond most normal users, and in my experience it's not worth the amount of time spent configuring it compared to eudev which is designed to be used with a full desktop.
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,150
Rep:
I actually use a wrapper script for shutdown instead of an alias like so:
Code:
#!/bin/sh
if [ "$1" = "-r" ];then
/sbin/reboot
fi
if [ "$1" = "-h" ];then
/sbin/poweroff
fi
I ignore the parameters passed to shutdown as I have never had to do a scheduled shutdown/reboot.
A wrapper script is more versatile than using an alias I find.
Gentoo got mdev working on their end and for desktop systems. I'm not sure how well it works as it tends to behave more akin to hotplug and devfs rather than udev, but it does sport some udev capabilities.
And maybe even use /etc/sysconfig/modules to load modules as well.
They also gave some pros and cons [edited for LFS]:
mdev unlike udev does not support auto-modules loading thus you will need to use /etc/sysconfig/modules and put there all the modules like you used to load (nvidia, wl etc.). Also, /etc/sysconfig/modules have own _args variables as it does not support /etc/modprobe.d. You may need to move your configuration there.
mdev -s does not create /dev/mapper nodes. You may need to manually create them or use 'dmsetup mknodes' from lvm2 (good idea is to add it after mdev -s in init script).
you should use mouse and kbd drivers for xorg inputs. evdev need udev to be built. Mousedrv (mouse) may conflict with synaptics driver, when both are loaded.
Kernel configuration option CONFIG_INPUT_EVDEV not only provides the keyboard and mouse as input device events, it will provide lid and buttons to acpid as well.
And maybe even use /etc/sysconfig/modules to load modules as well.
I have been working with mdev for several days now. It's been hard sledding so far. A bit like our initial work with Runit was. Anyway, you're right about having to provide for loading kernel modules when using mdev. In a traditional LFS system, the /etc/sysconfig/modules file should do the job. I'm using a clone of our Runit LFS system sans eudev to test all this mdev stuff, and the MODULES array in /etc/runit.conf loads all of the system's modules very well with mdev. I had to figure out some order-of-loading issues and some dependency issues, but it finally loads everything the same as the Runit system does with eudev.
Another important thing is providing for the keyboard and mouse in X. The evdev driver was not going to work without udev. All that was needed was to compile and install xf86-input-keyboard and xf86-input-mouse plus create some config files in /etc/X11/xorg.conf.d for those. But then Xterm and Eterm both don't work. Xterm just won't start, and Eterm starts but closes at the first attempt to type in it. At the moment I have to switch to a tty terminal to run commands. I will eventually get to the bottom of that, but if anybody already knows what the matter is then say it now please.
Ethernet worked fine from the moment the driver modules thing was sorted out.
Next and maybe last is figuring out how to get my USB HP Deskjet printer to work. It's probably obvious, but it's elusive to me at the moment. When that is done, I think everything will be working normally with Busybox init and mdev in charge.
So why would anyone want to do this? Well, for the adventure firstly. And to look deeper into a Linux system to understand it better for another maybe. But for me, I just wanted to know another way to do this business in case Eudev gives up and goes away leaving me with nothing but that other thing that the thundering herd charged off after.
Just a flying thought, but you might actually need to build HAL for some of the X stuff. I think the updated instructions we have should work.
The xterm issue turned out to be permission related. Root can start xterm and Eterm. For now the simplest thing that restores it to the situation ante-mdev is adding my user to the tty group. Is there anything particularly wrong with that?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.