Difference between /etc/init and /etc/inittab in linux file system - linux

I am a newbie to Linux. I am going through the file system in Linux. Though there are many links in Google stating the difference between /etc/init and /etc/inittab, I am really confused between both. Can anyone give me a clear explanation exactly what is the difference between these both.

Inittab is a file that controls everything that happens when a system is rebooted. (http://www.itworld.com/operating-systems/103722/unix-how-to-linux-etcinittab-file)
Init is the first process that boots when booting or rebooting the system and is the parent of every other process, direct or indirect. (https://en.wikipedia.org/wiki/Init)

Related

Programmatically, how can I tell on LINUX that the system is rebooting?

There is a lot about the "procedure" LINUX undertakes when a reboot or 'imminent shutdown' is underway. I wish to understand, programmatically, and react to, that a REBOOT IS IMMINIENT.
My application gets sent TERM and HUP signals which is all good and understood.
How can I tell the difference between a signal for immediate REBOOT reasons or just from another user?
CONTEXT:
If the system is 100% rebooting then my application will SAVE IT's STATE for LOAD on BOOT.
If however, a user, even "root" arbitrately kills my application then I DO NOT WISH to save the STATE.
I am using RedHat if it makes a difference.
I have attempted to research this quite extensively but so far I have not got the solution.
So you know... calling STACK OVERFLOW!
Thank you in-advance.

Edit Debian 8 Boot file in sysresccd

My dedicated server uses debian 8 but he cant boot anymore, now i started the rescue system (sysresccd) and my question is, is it possible to edit some files on the debian drive to fix the boot problems without any data losts?
Please be more specific regarding booting issue as "not booting anymore" may have many causes.
Please post any error that appears on the screen during booting process.
To be generic, you can use this command to see all volumes:
fdisk -l
You need to mount volume containing /boot directory but without knowing particular issue it' impossible to advice further.

Starting Gnome 3 in a read-only environment

First off, my intention is to create a portable, bootable USB drive containing a GNU/Linux distribution. Specifically, I want to use Arch Linux with a squashfs read-only root filesystem.
The squashfs image is based on a snapshot of a working VM. The base system with it's services like ssh work out of the box as expected. But when trying to launch gnome via systemd (systemctl start gdm), all I see is a black screen (supposedly the X-Server started but gdm fails to load). I already tried to figure out whats happening, but failed to identify the exact problem.
Home directories are writeable
/tmp is writeable
/var/log is writeable
/var/run & /run are writeable anyway
/var/log/gdm gets created but stays empty.
Which modules may require write access to any other files? Is there any documentation? What would make sense to strace or similar?
My desire is to know the root of the problem and fix it, instead of using workarounds like unionfs. Thanks for any help or hints!
Although it's not relevant, for those who might wonder why I want to do this, here are some points to consider:
Stability - as you cannot modify system files, you cannot mess up the system (unless you write bogus directly to the drive of course)
Storage - as files are compressed, more data fits on the drive
Performance - as I/O on most USB drives is slow, compression gives you higher I/O speed
Portability - no special treatment for read-only storage, you might copy it on a CD or any other read-only technology and it will still work the same way as it would on a writeable disk
Update
I figured out that the problem was actually at /var/lib/gdm. GDM tried to access files in there an (silently) failed doing so giving me a black screen.
I figured out that the problem was actually at /var/lib/gdm. GDM tried to access files in there an (silently) failed doing so giving me a black screen.
journalctl was the debugging command i was missing in the first place.

Debugging the Linux Kernel on Boot

I have compiled the Linux kernel with configuration options for ROOT_NFS. My problem now is the screen prints to fast for me the see the error and I cannot find any documentation on the best approach to solve this problem. I am performing this in VirtualBox.
There is Documentation/serial-console.txt you could look into. Serial console has traditionally been used for debugging linux boot problems, where you then can save all of the screen capture on a different pc. This should be possible for a virtualbox use case as well, although I do not know how difficult it will be to configure serial access.
The dmesg command prints the kernel's circular log buffer. Your messages may be in there.

Run .exe with daemon or better solutions to get something similar to windows service (mac and linux)?

I was wondering if i can run a exe with daemons in mac and linux or do you have any other solutions to do something similar to a windows service that is a scheduler ? I know i can use crontab but i was wondering if there was other way to do it.
Thx
On OS X, the preferred way of doing things like this is with launchd daemons. You create a .plist file with information about what program to run, parameters to pass it, and what conditions to start it under (i.e. at certain times, when a network connection is received on a certain port, or just run always), and various other options. Lingon provides a handy GUI for creating the .plist, or just read the Apple LAUNCHD docs and create it yourself. Put the .plist in /Library/LaunchDaemons, and either reboot or activate it with sudo launchctl load /Library/LaunchDaemons/whatever.plist.
A warning about using launchd: most daemon-type programs for unix will "daemonize" themselves -- they drop into the background, and generally detach themselves from the program that started them. Launchd doesn't like this. It wants to keep watch over its children, so that it can monitor their status, relaunch them if necessary, etc. So you may either need to tell the program not to daemonize, or add an option to the .plist to tell launchd not to freak out if the program appears to quit.
Linux alternative to windows NT services are daemons. You can read a little more about it
here.
You also start executables by scripts located in "/etc/init.d" Just look at one of those scripts for reference. If you want to make a task or executable start at a given time use a crontab. It is made for this purpose and I don't see why use something else.
If you have a mono executable probably the easiest way is just to make a script in "init.d" if you want to start when system starts or make a crontab entry. It is realy easy. Here you can find a simple reference.

Resources