LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   how to answer linux bootup questions automatically (https://www.linuxquestions.org/questions/linux-general-1/how-to-answer-linux-bootup-questions-automatically-850161/)

golden_boy615 12-14-2010 09:26 AM

how to answer linux bootup questions automatically
 
hello
I have a some linux boxes that I want to managed them remotely.Some times I have to reboot them duo to some tasks but some times they stop on some boot up questions during boot time like fixing HDD or mount point problems that some body have to press F for example (before starting network and ssh daemons) now I have to wait for some body to access the desktop and press F or some other characters for other questions .
I wanted to know is there any config file or any trick to auto answer all the questions?

Thanks a lot.

kbp 12-14-2010 04:44 PM

No .. these problems may occur because the OS or partition is unavailable, they need to be fixed manually

golden_boy615 12-17-2010 09:23 AM

I know that it has to fixed manually but it should has some solution to answer those questions automatically . like making some answer file or something like that.

TB0ne 12-17-2010 10:41 AM

Quote:

Originally Posted by golden_boy615 (Post 4194778)
I know that it has to fixed manually but it should has some solution to answer those questions automatically . like making some answer file or something like that.

Again, "No, those problems have to be fixed manually".

And think about what you're asking: you're wanting a program to be run, BEFORE the disk is available, and the OS is loaded??? How do you think you'll be able to do that?

golden_boy615 12-18-2010 01:37 AM

Quote:

Again, "No, those problems have to be fixed manually".

And think about what you're asking: you're wanting a program to be run, BEFORE the disk is available, and the OS is loaded??? How do you think you'll be able to do that?
__________________
thank you for your reply but it shouldn't be a program to be run before OS it could be a configuration of that process which starts to check the disk or what ever like "Always yes" or "Always Fix" .... it does not to be a separate program. what a about if I want to check my disk every time that system restart without asking or ignoring? where is this configuration?

kbp 12-18-2010 05:13 AM

And what if your partition table is damaged? .. if you think it's possible to write some system diagnostic/self-healing code and fit it in the 446 bytes of the MBR along with the initial boot code, please go right ahead :)

phil.d.g 12-18-2010 10:47 AM

Quote:

Originally Posted by golden_boy615 (Post 4194778)
I know that it has to fixed manually but it should has some solution to answer those questions automatically . like making some answer file or something like that.

That's somewhat of a contradiction: "I know it has to be manual, but it should be automatic"

Sounds like what you really want is a KVM solution so you can access the console remotely. There are kvm solutions that allow you to use the same local monitor/keyboard/mouse for many machines, and there are also solutions that work over IP, so you can be remote but still access the local console.

TB0ne 12-18-2010 11:38 AM

Quote:

Originally Posted by golden_boy615 (Post 4195578)
thank you for your reply but it shouldn't be a program to be run before OS it could be a configuration of that process which starts to check the disk or what ever like "Always yes" or "Always Fix" .... it does not to be a separate program. what a about if I want to check my disk every time that system restart without asking or ignoring? where is this configuration?

You're still missing the point. Until you get the OS booted, and the disk(s) mounted YOU CANNOT ACCESS ANY FILES OR RUN ANY PROGRAMS. The 'configuration' is part of the boot process...kbp explained it well. You don't seem to understand how OS'es boot, but when you see messages like that, it means the boot process has failed normally, and it forks another built-in process, to allow you to salvage things.

And if you're getting messages about disks needing to be checked, etc., then chances are you're doing something very wrong when you're shutting the system down, and it's only a matter of time before you won't be able to recover things. Not a Linux problem either...yanking the plug over and over on a Mac or Windows box causes similar problems.

golden_boy615 12-18-2010 12:20 PM

thank you all of you because of your replies.
It seems that I can not solve my problem this way.
let me explain my problem then you suggest me what to do.
I made an remote automation system on Linux and run it on an embedded PC and putted it in a place that some times has a high voltage power . when this high voltage power occurs some thing bad happens and /var becomes read only after that mysql stops working the other related processes stop working too so the only way that I have found is to restarting the system but it stops on a simple question for fixing /var and mounting it again and so on ...
now what can I do to solve this problem .

Thanks a lot.

repo 12-18-2010 12:29 PM

Quote:

when this high voltage power occurs some thing bad happens and /var becomes read only after that mysql stops working the other related processes stop working too so the only way that I have found is to restarting the system but it stops on a simple question for fixing /var and mounting it again and so on ...
Can't you remount /var, restart mysql...?


Kind regards

PTrenholme 12-18-2010 01:45 PM

To boot your system, assuming you're using GRUB:
  1. Your BIOS reads and executes the MBR of some bootable disk.
  2. The MBR contains the "Stage 1" file which
    1. Briefly initializes the system.
    2. Detects the geometry and the accessing mode of the "loading drive".
    3. Loads the first sector of Stage 2.
    4. Jumps to the starting address of the Stage 2.
  3. The Stage 2 program:
    1. Loads the rest of itself to the real starting address, that is, the starting address plus 512 bytes. The block lists are stored in the last part of the first sector.
    2. Long jumps to the real starting address.
  4. If you're booting a Linux system, Stage 2 loads a memory resident Linux kernel (usually found in a vmlinuz file listed in the kernel line of the GRUB configuration file.)
  5. That kernel program, in turn, expands (if necessary) and runs the initial RAM system found the the file referenced by the initrd directive.

Now, the point in all this is that one of the files in the initrd referenced cpio archive is a script describing the steps to be taken to actually boot the system. So, if you uncompress the archive, you can (sometimes) tweak the boot process to do things differently for your system. Again, on most systems, there is a program, mkinitrd that you can use to rebuild your initial RAM disk image containing your tweaks. (See info mkinitrd for details.)

For your specific problem, which, from your description, sounds like it is the fsck program being run by your init script after your system has booted from stage 2, loaded your kernel, and started the "after boot" checks. If that's the case, perhaps you should look at your system's init script(s) (typically found in /etc/rc or /etc/rc.d/) to see where fsck is invoked, and change the parameters being used. (See info fsck and the file system specific checker that fsck will invoke for your system for specific options.)

golden_boy615 12-19-2010 08:33 AM

thanks a lot PTrenholme truly thank you because of your description.

PTrenholme 12-19-2010 10:04 AM

You're welcome, but I must confess that the boot description is just a minor paraphrase from the "hacking" section of the info grub file. So the real thanks should be to the GRUB documentation team, not me.

kbp 12-19-2010 04:45 PM

Quote:

when this high voltage power occurs some thing bad happens
The best way to move forward would be to solve the actual problem rather than try to cope with it's symptoms. Can you add some power filtering ? .. or a UPS ? .. or some shielding ?

golden_boy615 01-01-2011 08:11 AM

I founded by my self:
there is a file for auto answering it:
/etc/default/rcS
Quote:

cat /etc/default/rcS
#
# /etc/default/rcS
#
# Default settings for the scripts in /etc/rcS.d/
#
# For information about these variables see the rcS(5) manual page.
#
# This file belongs to the "initscripts" package.

TMPTIME=0
SULOGIN=no
DELAYLOGIN=no
UTC=yes
VERBOSE=no
FSCKFIX=no

it is enough to change FSCKFIX=no => FSCKFIX=yes


All times are GMT -5. The time now is 08:34 AM.