Slashdot Mirror


Automagical Kernel Update Utils?

Eric^2 asks: "I'm fairly new to the linux OS but I managed to get my Gateway Solo 9100 running Mandrake. After seeing how often the kernel gets updated, I was wondering if there are any GUI tools available to automatically download, compile, and update the linux kernel. I know this sounds a lot like Microsoft Windows Update (which is terribly slow and fails about half the time), but it would be really nice to tell my laptop "go get this kernel and install it tonight at 11:30 and if anything fails, go back to my current kernel" and be done with it instead of having to download a patch or full version, backup, compile, and so on. There's just too much for a novice like myself to *$@% up. Suggestions? " Something like this will be necessary if Linux is to successfully move to the desktop. The masses must have an easy way to update there systems for things like bug fixes or new features. Remember: Joe User doesn't necessarily know how to compile, even if it is as simple as "configure; make; make install" (and to be honest, it isn't 100% there yet).

11 comments

  1. RPM / Shell Script by Anonymous Coward · · Score: 0

    Occasional updates are available from the Mandrake FTP site in RPM format (Red Hat also does this). These are pre-compiled, and GnoRPM makes them easy to install (ie. point & click). Unless you need to compile your own kernel, this is the easiest way to upgrade.

    If you need to compile it, you could probably write a shell script (have cron run this at night). This might work (you'll need the "wget" program):

    #!/bin/sh
    cd ~/

    # replace this with the correct URL
    wgethttp://www.XX.kernel.org/pub/linux/kernel/v2.2 /linux-2.2.12.tar.bz2

    bzcat linux-2.2.12.tar.bz2 | tar xv
    rm -f linux-2.2.12.tar.bz2
    cd ~/linux

    # will this work?
    cp /usr/src/linux/.config .

    make dep
    make bzImage
    make modules
    make modules_install

    This will download Linux 2.2.12 and decompress it into the "~/linux" directory (be sure to replace www.XX.kernel.org with your kernel.org mirror). This script doesn't do any error checking, you might want to add some simple checks before using it.

    You'll need to configure the kernel before you compile, I don't whether copying an old ".config" file will work. Assuming this can be done, a new kernel would be ready when you get up the next morning. You'd still need to install it.

    1. Re:RPM / Shell Script by Anonymous Coward · · Score: 0
      You'll need to configure the kernel before you compile, I don't whether copying an old ".config" file will work.

      I thing that copying ".config" and doing make oldconfig should work. I don't know if questions are asked though about new compilation options, though.

    2. Re:RPM / Shell Script by Anonymous Coward · · Score: 0

      "make oldconfig" does ask about new options, so it wouldn't work unless you were at the computer.

    3. Re:RPM / Shell Script by lazlo · · Score: 2

      OK, here are some thoughts:

      make oldconfig does ask questions, however it should be pretty easy to write a small expect script to run make oldconfig for you, and answer yes to everything. I'm not suggesting that this will make a more stable kernel, but it will make one. Chances are you could even have the script call up the help on each option, and have that as output from the program, which would in turn get mailed back to you by cron. In the morning check and see if the answers made sense, if they did reboot, if they didn't recopy .config, make oldconfig again, and answer the questions the way you think they should be answered.

      Now, as for the script itself... I have a few (lame) suggestions:

      #!/bin/sh
      cd ~/

      # replace this with the correct URL
      wget http://www.XX.kernel.org/pub/linux/kernel/v2.2/lin ux-2.2.12.tar.bz2

      #I don't know about wget. It would be nice to be able to have it first look for
      #LATEST-IS-* and then get linux-(whatever).tar.bz2
      #or even better, have your script add one to uname -r and try
      #to get that file. If it doesn't exist, exit.

      # bzcat linux-2.2.12.tar.bz2 | tar xv
      # rm -f linux-2.2.12.tar.bz2
      # cd ~/linux
      #I would suggest as an alternative keeping /usr/src/linux as a link to /usr/src/linux-{ver}

      rm /usr/src/linux
      mkdir /usr/src/linux-`uname -r {+1}` #this doesn't work, I just forgot how to add.
      ln -s /usr/src/linux-`uname -r {+1}` /usr/src/linux
      rm oldlinux
      ln -s /usr/src/linux-`uname -r` /usr/src/oldlinux
      bzcat linux-{version}.tar.bz2 | tar x

      # will this work?
      # not quite
      # cp /usr/src/linux/.config .
      cp /usr/src/oldlinux/.config /usr/src/linux
      /usr/local/bin/some-expect-script-that-calls-mak e-oldconfig

      make dep
      make bzImage
      make modules
      make modules_install
      # and then
      cp /boot/vmlinux.new /boot/vmlinux.old
      cp /usr/src/linux/arch/i386/boot/compressed/vmlinux /boot/vmlinux.new
      lilo



      Then you have a lilo.conf that looks like this:



      # LILO configuration file
      # generated by 'liloconfig'
      #
      # Start LILO global section
      boot = /dev/sda
      append = "ether=0,0,eth1"
      #compact # faster, but won't work on all systems.
      delay = 50
      vga = normal # force sane state
      # ramdisk = 0 # paranoia setting
      # Linux bootable partition config begins
      image = /vmlinuz.new
      root = /dev/sda1
      label = lin
      read-only # Non-UMSDOS filesystems should be mounted read-only for checking
      # Linux bootable partition config ends
      # Linux bootable partition config begins
      image = /vmlinuz.old
      root = /dev/sda1
      label = backup
      read-only # Non-UMSDOS filesystems should be mounted read-only for checking
      # Linux bootable partition config ends
      # Linux bootable partition config begins
      image = /vmlinuz.reallystable
      root = /dev/sda1
      label = original
      read-only # Non-UMSDOS filesystems should be mounted read-only for checking
      # Linux bootable partition config ends
      # End LILO global section
      horizon:~#

      have cron run this every night, and every once in a while you'll wake up and find e-mail telling you that you've got a new kernel. If everything looks OK, just reboot and it's active.

      --
      Pound! Bang! Bin! Bash! is this a shell script or a Batman comic?
  2. Re:AutoUpdate by Anonymous Coward · · Score: 0

    of course bsd has something like this. how could you admin a high profile server without it? it's called cvs, and linux has it too (although i don't personally know of any linux cvs servers, it certainly has the software to support it). crontab entries are nice, but that's a rig compared with what cvs can do. however, when you combine crontabs with cvs, you can get a system even more automagic than microsoft's, but that you have full controll over.

  3. Autorpm will collect the rpms for you by jawildman · · Score: 1

    Check out http://www.kaybee.org/~kirk/html/linux.html for information on autorpm. It is pretty handy for keeping track of which rpms need to be updated. It comes configured for RedHat, but it can be pointed at any ftp sites that you want, so it should be usable with Mandrake as well

    --
    Jim Wildman jim@rossberry.com
  4. First ask yourself... by kuro5hin · · Score: 1
    If this is really something that should be done. Generally, there are only 2 reasons I upgrade a working kernel:
    • Because a new kernel has new functionality I could use
    • Because I get a new device or something, and need to recompile the kernel anyway to add something. I'll generally just snag the latest if I have to re-kernel anyhoo.
    So, in either case, an auto-kernel-update thing wouldn't be much use, since I'd still have to make config and select new stuff to compile in. Overall point here, don't get too sucked in to updating the kernel whenever one comes out. If everyhting works, stick with it till you know you'll get some benefit from updating.

    Ok, that said, I can also see the coolness factor here :-). So here's how I'd do it, probably. First, I'd make sure there was a working .config file somewhere. Then, I'd whip up something that I could attach to a button on my gnome panel, probably in gtk/perl or tk/perl that asked a coupla basic questions: Where should I find the kernel/patch? When should I do this? Where's the config file?

    That little doo-dad would edit the crontab (have to be root's crontab) to run another perl script at xx:00 (whenever you said to run it). That second script would fetch the patch/source, config it with your pre-defined file, make dep, make clean, make install (and do some trickery w/lilo to keep the old kernel accessable-- maybe make install does this already? I forget.), make modules, make modules_install, then (this bit's important)-- I'd have it write a line into /etc/rc.d/rc.local that would run a third script on successful reboot. Then run /sbin/init 6, and wait till the box comes back up. On clean reboot, your third script would clean out the crontab, delete it's own calling line in rc.local, check out the system, and email some stats and a success report to root, or whoever.

    Now what if the new kernel bombed? Hmm. I don't know, honestly. To reboot into it, you'd have to set it as default in lilo, and if it died, there's no way a user app could regain control. I guess it'd sit there until you checked the next morning. But if it got all the way through the compile/install, then chances are slim the system wouldn't work at all. Wow. This ended up being really long. I guess I'll stop now. If anyone wants to write this, I'd probably help. Drop an email :-)

    --
    There is no K5 cabal.
    I am not the real rusty.
  5. duh.. by Zurk · · Score: 1

    thats what the crontab command is for. alternatively theres an auto updating rpm utility to do it somewhere on rufus.w3.org....if d/ling the kernel as an rpm. note that you need to save your configs between kernel version so a small script might help if youre using tar.gz

  6. Re:AutoUpdate by dlc · · Score: 1

    The FreeBSD project, and many other projects, keeps all their source code available from a CVS server. CVS is a source code control system, and a CVS server can be made available over the Internet. A FreeBSD user can log into a CVS server and download the source code or a patch or whatever is needed for a particular component (including the kernel).

    SysAdmin Magazine did an article on FreeBSD and CVS in the September 1999 issue. They also ran an article in June 1999 called 'The Linux Kernel: A Case Study for CVS', which unfortunately is not available online.

    A company called Cyclic does commercial support for CVS, and has some information available online.

    darren

    --
    (darren)
  7. Easy Kernel Updates by x00 · · Score: 1

    Linux's weakness is that its not easy to use. This is being rectified slowly though.. RPMs (althought they have their own problems), easier distribution installers, friendler desktops..
    Kernel updating though still isn't quite there though... but, then, does it have to be? For the average new-to-linux person, how often do they have update their kernel? If it is a security kernel fix, which major distribution doesn't put them into its own package format and put it on their ftp site...? And which which distribution doesn't have an easy to use package installer/upgrader tool?

    So, perhaps the question should be... does the user know where to look for these?

    --
    May contain traces of nut.
  8. AutoUpdate by calis · · Score: 1

    I use Red Hat Linux myself and I'm constanly updating stuff, but I heard that BSD has something that automatically updates the kernel. True?