Giter VIP home page Giter VIP logo

rebooter's Introduction

Rebooter - an HTTP server to reboot on a new image

Rebooter is a small HTTP server written in Go whose purpose is to install a new kernel image on the current machine and reboot on that image using GRUB. The second next reboot will select the default image again, so that rebooter can be reused without needing to SSH on the machine.

Usage

On the server:

sudo ./rebooter <disk-device> <menu-entry>
# e.g.: sudo ./rebooter /dev/sdb myOS

And from a client:

curl http://<server-url>:8080/ --data-binary @<path-to-kernel-image>

Prerequisites

  • A GNU/Linux distribution, e.g. Ubuntu, with GRUB.
  • A free disk or partition to use for the image.
  • A GRUB menu entry corresponding to the target disk device must be created.

Adding a new menu entry:

Menu entries can be added by editing one of the files under /etc/grub.d (e.g. 40_custom in ubuntu), and then running update-grub to regenerate /boot/grub/grub.cfg.

For instance, this will add a "myOS" menu entry booting on the second hard drive (GRUB starts from hd0), i.e. /dev/hdb in Linux parlance.

menuentry "myOS" {
    set root="(hd1)"
    chainloader +1
}

Start rebooter on Linux boot

With systemd:

Create a file /etc/systemd/system/rebooter.service and add the following content:

[Unit]
Description=Start the rebooter HTTP server

[Service]
Type=oneshot
ExecStart=/bin/sh -c "/path/to/rebooter <disk-device> <menu-entry>"

[Install]
WantedBy=multi-user.target

Then enable the service

sudo systemctl enable --now rebooter.service

See stack-overflow question.

WARNING

Be very careful about which disk to target, this disk content will get overwritten!

rebooter's People

Contributors

charlycst avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.