Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 13
I read this thing Add the following to /etc/sysctl.conf: kernel.panic=20 Is this for is there is a GPU failure for whatever reason, it will auto-restart the whole rig? Until I ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jan 2014
    Posts
    10

    Auto-restart with kernel panic


    I read this thing

    Add the following to /etc/sysctl.conf:
    kernel.panic=20

    Is this for is there is a GPU failure for whatever reason, it will auto-restart the whole rig? Until I figure out whats wrong, I need to at least have it auto-restart when something fails, because restarting does fix it, and rarely needs a hard reboot.

    The only thing is, if this is all the code I need, I did it but it doesnt seem to be working. I actually put a 7 in there like this

    kernel.panic=7

    but that shouldnt matter right? And I put it in the last line of the file at the very bottom, with a line break after the last #:

    Code:
    #
    
    kernel.panic=7
    (Not sure how anal Linux is but the space of lack of on either side of the "=" couldnt possibly matter right?)

    And then what is the easiest way to create a "soft" panic to test if its working and not wait for one?

    Thanks.
    Last edited by Dathaeus; 01-31-2014 at 07:34 AM.

  2. #2
    Linux Engineer
    Join Date
    Dec 2013
    Posts
    1,293
    To make changes to sysctl.conf active you need t execute:
    Code:
    sysctl -p
    (as root)

    I know of a way to cause a kernel panic but haven't tried it myself - I've heard it's safe but I'd suggest a web search. /dev/zero is a device used for clearing memory and /dev/mem is a memory map of your physical memory so :
    Code:
    cat /dev/zero > /dev/mem
    run as root will stop the computer. Otherwise it's easy to cause a kernel panic with an error in a module - but creating the module is a bit involved.

  3. #3
    Just Joined!
    Join Date
    Jan 2014
    Posts
    10
    Quote Originally Posted by gregm View Post
    To make changes to sysctl.conf active you need t execute:
    Code:
    sysctl -p
    (as root)
    Sorry dont understand... my changes did save, but u saying it really didnt?

    I type
    Code:
    sysctl -p
    in the terminal window, then make the change to sysctl.conf, and then reboot?

  4. #4
    Linux Engineer
    Join Date
    Dec 2013
    Posts
    1,293
    After you make a change in sysctl.conf you run (as root) that command and sysctl will pick up the change. Alternatively you reboot and it reads it then. Sysctl isn't monitoring that file for changes.

  5. #5
    Just Joined!
    Join Date
    Jan 2014
    Posts
    10
    Quote Originally Posted by gregm View Post
    After you make a change in sysctl.conf you run (as root) that command and sysctl will pick up the change. Alternatively you reboot and it reads it then. Sysctl isn't monitoring that file for changes.
    Ok when I input that command it immediately listed the kernel.panic=20 line right after, so is that confirming it recognize the change in the file?

    I assume that all files are refreshed when you reboot, is this not true with all linux files/folders?

    I found a thing searching:

    Code:
    
    #ifdef __KERNEL__
    
    /* Makefile :
    obj-m := force_panic.o
    KDIR := /lib/modules/$(shell uname -r)/build
    PWD := $(shell pwd)
    
    default:
    $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
    */
    
    #include [linux/module.h]
    #include [linux/kernel.h]
    
    static int __init panic_init(void)
    {
    panic("force-panic");
    return 0;
    }
    
    static void __exit panic_exit(void)
    {
    }
    
    module_init(panic_init);
    module_exit(panic_exit);
    
    #endif
    But I have no idea what to do with it.... do I make a brand new file, then how do I run it, etc...

  6. #6
    Linux Engineer
    Join Date
    Dec 2013
    Posts
    1,293
    Yes, it's acknowledging the change and yes, upon rebooting the file is reloaded.

    That's a kernel module. You compile it and load it into the kernel and, along with some other code that is missing, it provides the functionality to cause a panic. I don't think you want to mess with it.

  7. #7
    Just Joined!
    Join Date
    Jan 2014
    Posts
    10
    Quote Originally Posted by gregm View Post
    Yes, it's acknowledging the change and yes, upon rebooting the file is reloaded.

    That's a kernel module. You compile it and load it into the kernel and, along with some other code that is missing, it provides the functionality to cause a panic. I don't think you want to mess with it.
    You're right, I would need my hand held to execute that so I dont make mistakes, but anyways...

    That kernel panic still didnt work after all that.... is this such guesswork or am I missing something? I just want my system to restart on some any failure. My system failed like 5 times today, and no reboots at all.

    A simpler solution maybe... is there a way to write in a forced restart query anywhere that will reboot the system say, every 30 minutes no matter what? I feel like this is a cheap way to get this more up to my speed, although its not a permanent fix, but until I try different things I cant have my system going down at night and then several times a day. Rebooting always helps.

  8. #8
    Linux Engineer
    Join Date
    Dec 2013
    Posts
    1,293
    "cat /dev/zero > /dev/mem" didn't cause a kernel panic? I'm surprised.

    You can restart from the command line with:
    Code:
    shutdown -r now
    You can use the utility called cron to run it but if something is causing a kernel panic you'd be better off trying to fix the problem. Given that the tradeoff in mining is between cost of computing time and coin value you will be greatly reducing your profit by rebooting like this - and the kernel panic might still happen.

    Here's a link to cron: Schedule Tasks on Linux Using Crontab | kvz.io

  9. #9
    Linux Engineer
    Join Date
    Dec 2013
    Posts
    1,293
    "cat /dev/zero > /dev/mem" didn't cause a kernel panic? I'm surprised.

    You can restart from the command line with:
    Code:
    shutdown -r now
    You can use the utility called cron to run it but if something is causing a kernel panic you'd be better off trying to fix the problem. Given that the tradeoff in mining is between cost of computing time and coin value you will be greatly reducing your profit by rebooting like this - and the kernel panic might still happen.

    Here's a link to cron: Schedule Tasks on Linux Using Crontab | kvz.io

  10. #10
    Just Joined!
    Join Date
    Jan 2014
    Posts
    10
    Quote Originally Posted by gregm View Post
    You can use the utility called cron to run it but if something is causing a kernel panic you'd be better off trying to fix the problem. Given that the tradeoff in mining is between cost of computing time and coin value you will be greatly reducing your profit by rebooting like this - and the kernel panic might still happen.

    Here's a link to cron: [kvz.io/blog/2007/07/29/schedule-tasks-on-linux-using-crontab/]Schedule Tasks on Linux Using Crontab | kvz.io
    K, I am totally hoping this is remotely correct, to run coldreboot every 10 minutes:

    Open root terminal and just type:
    Code:
    crontab */10 * * * * * coldreboot
    Press ENTER and done, that simple?
    (Do I need a full path for "coldreboot"? I have no idea where that might be located)
    (Should there be a space between each asterisk?)

Page 1 of 2 1 2 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •