Why Are Init Systems So Important?

hi guys,

i know what initialization systems are, and pretty much what they do.
lately everybody has been giving out about various distros changing to systemd...

firstly have i got this right?

init is pretty much retired and used on many older distros

debian used init then switched to upstart and now uses systemd...though you can keep using upstart but its difficult to get right.

slackware uses a hybrid type sysv with bsd like scripting...

centos 7 is using systemd by default

so what is the big fuss? why would a poor init system steer people away from a distro they have used for years.

can it really be this important? i mean how many times a day are you going to reconfigure start-up services etc...i dont understand this.


Similar Content



Systemd And Loading Init File

I recently changed from Debian 7 to 8 which now uses systemd as the default init.
I had a init file that worked fine (see below) and works fine when directly invoked
Code:
$ sudo /etc/init.d/iptables start

however fails when indirectly invoked
Code:
$ sudo service iptables start
Job for iptables.service failed. See 'systemctl status iptables.service' and 'journalctl -xn' for details.

Code:
$ systemctl status iptables.service
 iptables.service - LSB: Iptable setup
   Loaded: loaded (/etc/init.d/iptables)
   Active: failed (Result: exit-code) since Mon 2015-05-25 17:18:37 PDT; 5s ago
  Process: 4825 ExecStart=/etc/init.d/iptables start (code=exited, status=203/EXEC)

Code:
$ journalctl -xn
No journal files were found.

I don't understand the error except that it "failed" and is loaded.
I have disabled and re-enabled the service with these commands:

Code:
sudo systemctl disable iptables
sudo systemctl enable iptables

which completes successfully but did not fix the problem.


INIT file
Code:
### BEGIN INIT INFO
# Provides:          iptables
# Required-Start:    $network $remote_fs $syslog
# Required-Stop:     $network $remote_fs $syslog
# Should-Start:      $portmap
# Should-Stop:       $portmap
# X-Start-Befo     nis
# X-Stop-After:      nis
# Default-Start:     2 
# Default-Stop:      1
# X-Interactive:     false
# Short-Description: Iptable setup
# Description:       Sets iptable rules
#                    
### END INIT INFO

ipt=/sbin/iptables

loadrules() {

if [ -e /etc/iptables_ruleset ]; then iptables-restore < /etc/iptables_ruleset && exit 0; fi

$ipt -F
$ipt -X

# Policies and Chains
$ipt -P INPUT DROP
$ipt -P FORWARD DROP
$ipt -P OUTPUT ACCEPT
$ipt -N SSH
$ipt -N WEBSERVER

$ipt -A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
$ipt -A INPUT -i lo -j ACCEPT # Allow loopback

# Services
$ipt -A INPUT -p tcp -m multiport --dport 443,80 -j WEBSERVER # WEBSERVER chain 
$ipt -A INPUT -p tcp --dport 22 -m conntrack --ctstate NEW -j SSH # Jump to SSH chain
$ipt -A INPUT -p tcp -s 192.168.1.1/24 --dport 445 -j ACCEPT # samba

# Reject message for LAN
$ipt -A INPUT -s 192.168.1.1/24 -j REJECT

# WEBSERVER chain
$ipt -A WEBSERVER -p tcp -m multiport --dport 443,80 -m conntrack --ctstate NEW -j LOG
$ipt -A WEBSERVER -p tcp -m multiport --dport 443,80 -j ACCEPT

# SSH chain
$ipt -A SSH -p tcp --dport 22 -m recent --set --name SSH # Set SSH recent
$ipt -A SSH -p tcp --dport 22 -m recent --name SSH --update --seconds 10 --hitcount 2 --rttl -j LOG # Log if over counter
$ipt -A SSH -p tcp --dport 22 -s 192.168.1.1/24 -m recent --name SSH --update --seconds 10 --hitcount 10 --rttl -j REJECT # Reject from lan if over counter
$ipt -A SSH -p tcp --dport 22 ! -s 192.168.1.1/24 -m recent --name SSH --update --seconds 10 --hitcount 2 --rttl -j DROP # Drop if over counter
$ipt -A SSH -p tcp --dport 22 -j ACCEPT

iptables-save > /etc/iptables_ruleset
}

removerules() {
$ipt -P INPUT ACCEPT
$ipt -P FORWARD ACCEPT
$ipt -P OUTPUT ACCEPT
$ipt -F
$ipt -X
}

restartrules() {
rm /etc/iptables_ruleset
loadrules
}

case "$1" in
	start)
		loadrules
		;;
	stop)
		removerules
		;;
        restart)
                restartrules
                ;;
    	*)
        	echo "Usage: $0 start|stop|restart" >&2
        	exit 3
        	;;
esac

Edit:
Checking /var/log/daemon.log gives me this info:
Code:
May 25 19:13:29 hostname systemd[6004]: Failed at step EXEC spawning /etc/init.d/iptables: Exec format error
May 25 19:13:29 hostname systemd[1]: iptables.service: control process exited, code=exited status=203
May 25 19:13:29 hostname systemd[1]: Failed to start LSB: Iptable setup.
May 25 19:13:29 hostname systemd[1]: Unit iptables.service entered failed state.

Question About Run Level Programs And How The OS Know What To Run

Hey guys, I am a little confused about run level programs. (concerning centos)

I know when the system boots up the orders will be

bios
MBR
GRUB
kernel
init
runlevel

to my understanding - etc/init looks at /etc/inittab
then where is the run level located?
is it /etc/rc.d/rc0.d...
/etc/rc.d/rc1.d
/etc/rc.d/rc2.d
are these run level programs?

if so, what about /etc/init.d ? doesnt that also execute run level programs?

and how does it know what to start? where does it look

thanks guys just a bit confusing where what looks for what

Systemd Starting Services

hi all

I am learning systemd and how to add new services as part of the LFS201 course and I have a question about the services:
Code:
Lab 4.2: Adding a New Startup Service with systemd
For example a very minimal file named
/etc/systemd/system/fake2.service:
[Unit]
Description=fake2
After=network.target
[Service]
ExecStart=/bin/echo I am starting the fake2 service
ExecStop=/bin/echo I am stopping the fake2 service
[Install]
WantedBy=multi-user.target

Code:
root@ubuntu:/etc/systemd/system# systemctl start fake.service
root@ubuntu:/etc/systemd/system# systemctl status fake.service
 fake.service - fake
   Loaded: loaded (/etc/systemd/system/fake.service; disabled; vendor preset: enabled)
   Active: inactive (dead)

May 16 11:41:05 ubuntu systemd[1]: Started fake.
May 16 11:41:05 ubuntu systemd[1]: Starting fake...
May 16 11:41:05 ubuntu echo[1798]: I am starting the fake2 service
May 16 11:41:05 ubuntu echo[1800]: I am stopping the fake2 service
root@ubuntu:/etc/systemd/system# ps aux | grep fake*
root      1809  0.0  0.0  13688  2272 pts/8    S+   11:41   0:00 grep --color=auto fake.service
root@ubuntu:/etc/systemd/system#

as you can see the fake2 service is really only two lines. And when I grep for the service via ps I can't fine it. I guess it is because it has finished running. I am wondering how can I change it so that I can keep it running?

thanks

Deleted /sbin/init ... Recovered From Live CD, Still Will Not Boot?

Hi all,

Been messing around with my CentOS 6.6 VM trying to break stuff and learn with it. I thought it may be a good learning exercise to (ok, sounds a bit stupid, but purposely) delete /sbin/init to see how I could recover and learn.

I've booted into a recovery CD and recovered the /sbin/init file to my existing directory, however, I'm still having issues booting the machine.

Per Google suggestions, I have given the new init file 755 permissions but it still does not boot.

I apologize that I have not had more ideas, I am currently Googling solutions but am having a bit of trouble knowing where to start. Any suggestions would be greatly appreciated, thank you.

Install Package On Centos 7

I use Centos 7 and have just installed vsftpd to the server , I want to start vsftp service after install , when I tried the command "systemctl |grep vsftp" , it show nothing .

I use previous , all services keep at /etc/rc.d/init.d , what I need to do is /etc/rc.d/init.d/vsftpd start .

Please advise what I need to do for Centos 7 to start vsftpd ?

thanks

Changes In CentOS 7

Hi Team,

I have installed Centos 7 and I feel everything is totally changed.

I am able to see only 3 folders under /etc/init.d/......where as earlier versions have many other init scripts.

I tried installed Minimal & full installation, both have the same situation.

Cannot Execute Binary File

hello everyone,
I created a script file (info.sh) in linux centos 6.
location of file is '/etc/init.d/info.sh'
content of file is:

#!/bin/sh
#To get the MAC address
ifconfig | grep HWaddr
#To get the HDD serial no.
hdparm -I /dev/sd? | grep 'Serial\ Number'
#To get the HDD size
hdparm -I /dev/sda |grep "device size"

gave the permission by: chmod 777 /etc/init.d/info.sh
but when i run this file by: /etc/init.d/info.sh
it gives an error like...
-bash: /etc/init.d/info: cannot execute binary file

what should i do?? Actually i have to run this file during boot up..

thanks in advance..

/run Directory

in a linux mint installation should there be a /run directory?

Code:
 > ls /run
acpid.pid               initramfs           samba
acpid.socket            kerneloops.pid      sdp
alsa                    lock                sendsigs.omit.d
apache2                 mdm.pid             shm
avahi-daemon            mlocate.daily.lock  systemd
console                 motd.dynamic        tor
ConsoleKit              mount               udev
console-kit-daemon.pid  mysqld              udisks2
crond.pid               network             upstart-file-bridge.pid
crond.reboot            NetworkManager      upstart-socket-bridge.pid
cups                    plymouth            upstart-udev-bridge.pid
dbus                    pm-utils            user
dirmngr                 pppconfig           utmp
dirmngr.pid             resolvconf
gdm_socket              rsyslogd.pid

How To Edit Wifi Connections

Hi
I am not brand new to Linux but have been using a very popular Linux distro which has pretty much made everything easy for me in day to day use
I do distro hop quite a bit on my spare laptop and have tried many distros i came across Antix 13.2 which i really love and is a superb distro in terms of speed and increasing my learning curve in linux systems and was easyish to set up via wicd (just involved writing in wlan0) and that was it
One thing i can never get the hang of though and would love a complete idiots guide to is the wifi set up in some distros i have discarded because i just do not understand how to set it up
This evening i tried Sparky Linux on a usb and would love to have tried it but the wifi problem surfaced again
a box comes up re edit connections and from there i have no idea at all what to do what i normally do is disregard that distro and move on! But i would like to be able to input the info to get it working..any ideas please
Many Thanks

New To Linux *again* - I Have Some Questions About Making Better Distro Installs

I am a basic computer user as far as operating systems are concerned. I do a little programming here and there but nothing special yet.

I have tried Linux many times, but I'm always left to getting *another* distro, after I fail to properly install Linux. Basically I resort to simple installs and found that Linux Mint and Ubuntu, most of the time work out of the box. However, after an installation, ... here and there I get error messages and sometimes crashes and i understand that my installation is not stable, simply because I did not properly configure some conf file or similar.

Another even more important problem I have is device drivers. Working from the command prompt (console) and the GUI is very confusing to me. I'm not sure if I'm setting something right with one and then unsetting it with the other. So basically I'm here with some noob questions and a couple specific ones.

1. Can someone recommend a good distro to learn to correctly configure drivers with manually. Remember, that I understand that there are distros that work out of the box mostly, but I actually am not worried about complexity as far as someone can guide me through errors. Which will lead to more questions of course.

2. After an installation there are sometimes a dozen errors during bootup, but no stops. Since it all scrolls by fast (most distros), where can I check after bootup what I need to fix?

The Goal is an *error free* stable installation of a linux distro, with enough common sense learned to take it to other distros.