How to Specify what to run on Restart - Ubuntu

This is a discussion on How to Specify what to run on Restart - Ubuntu ; When I select the Restart option (Logoff, Shutdown, Switch User etc) I would like to have the option to select "Restart and Run XP" and then have grub invoke the specified entry. Does anything like that exist? Any suggestions (about ...

+ Reply to Thread
Results 1 to 9 of 9

Thread: How to Specify what to run on Restart

  1. How to Specify what to run on Restart

    When I select the Restart option (Logoff, Shutdown, Switch User etc) I
    would like to have the option to select "Restart and Run XP" and then
    have grub invoke the specified entry.

    Does anything like that exist? Any suggestions (about how to do that)?
    Thanks

  2. Re: How to Specify what to run on Restart

    On 2008-07-07, Frans van Duinen wrote:
    > When I select the Restart option (Logoff, Shutdown, Switch User etc) I
    > would like to have the option to select "Restart and Run XP" and then
    > have grub invoke the specified entry.
    >
    > Does anything like that exist? Any suggestions (about how to do that)?
    > Thanks


    No. But I would like a menu option to "restart and remove XP". Maybe
    we can e-mail the developers together and try to get both...


    --
    Joe - Linux User #449481/Ubuntu User #19733
    joe at hits - buffalo dot com
    "Hate is baggage, life is too short to go around pissed off all the
    time..." - Danny, American History X

  3. Re: How to Specify what to run on Restart

    On Sun, 06 Jul 2008 21:12:32 -0400, Frans van Duinen wrote:

    > When I select the Restart option (Logoff, Shutdown, Switch User etc) I
    > would like to have the option to select "Restart and Run XP" and then
    > have grub invoke the specified entry.
    >
    > Does anything like that exist? Any suggestions (about how to do that)?
    > Thanks


    You could put together some sort of kludge for that:

    $ cd /boot/grub
    $ sudo cp menu.lst menu.lst.lin
    $ sudo cp menu.lst menu.lst.win

    edit the menu.lst.win to change the "default 0" line to "default n" where
    n is the entry for Windows.

    Then create 2 shell scripts:

    (reboot.win)
    #!/bin/sh
    sudo cp /boot/grub/menu.lst.win /boot/grub/menu.lst
    sudo shutdown -r now

    (reboot.lin)
    #!/bin/sh
    sudo cp /boot/grub/menu.lst.lin /boot/grub/menu.lst
    sudo shutdown -r now

    You could also skip the sudo commands in there and make the files
    executable/readable by root only then you can use sudo to run them. You
    can also put launchers on a panel (or wherever if not using GNOME).

    A caveat: When you get a new kernel in an update you will need to
    re-create your .lin & .win files as the original menu.lst will have been
    modified. If you accidentally overwrite a newly modded menu.lst then don't
    worry, you can add the new kernel in at the top of the file manually, just
    copy and paste the first two blocks and replace the version numbers, e.g.
    swap "2.6.24-19-generic" for "2.6.24-20-generic" for the next one, you'll
    see the kernel modules in /boot to get exact filenames if they jump up to
    ..25-release.

    --
    A Freudian slip is when you say one thing but mean your mother.



  4. Re: How to Specify what to run on Restart

    Frans van Duinen wrote in alt.os.linux.ubuntu
    () on Montag 07 Juli 2008 03:12:

    > When I select the Restart option (Logoff, Shutdown, Switch User etc) I
    > would like to have the option to select "Restart and Run XP" and then
    > have grub invoke the specified entry.
    >
    > Does anything like that exist? Any suggestions (about how to do that)?
    > Thanks


    In my Kubuntu 7.10, if I press the restart button for ~1 sec I get a list
    of boot entries to boot to.

    Failing that, maybe
    http://www.cyberciti.biz/tips/force-...cified-os.html
    (http://tinyurl.com/6r9znf) will work for you.

    --Reinhold

  5. Re: How to Specify what to run on Restart

    Reinhold Rumberger wrote:
    > Frans van Duinen wrote in alt.os.linux.ubuntu
    > () on Montag 07 Juli 2008 03:12:
    >
    >> When I select the Restart option (Logoff, Shutdown, Switch User etc) I
    >> would like to have the option to select "Restart and Run XP" and then
    >> have grub invoke the specified entry.
    >>
    >> Does anything like that exist? Any suggestions (about how to do that)?
    >> Thanks

    >
    > In my Kubuntu 7.10, if I press the restart button for ~1 sec I get a list
    > of boot entries to boot to.
    >
    > Failing that, maybe
    > http://www.cyberciti.biz/tips/force-...cified-os.html
    > (http://tinyurl.com/6r9znf) will work for you.
    >
    > --Reinhold

    That is the type of thing I had in mind. Not sure I want to switch from
    Gnome to Kubuntu yet... I may end up taking the approach Trevor described.

    Thanks to all

  6. Re: How to Specify what to run on Restart

    On Tue, 08 Jul 2008 11:06:17 -0400, Frans van Duinen wrote:

    > Reinhold Rumberger wrote:
    >> Frans van Duinen wrote in alt.os.linux.ubuntu
    >> () on Montag 07 Juli 2008 03:12:
    >>
    >>> When I select the Restart option (Logoff, Shutdown, Switch User etc) I
    >>> would like to have the option to select "Restart and Run XP" and then
    >>> have grub invoke the specified entry.
    >>>
    >>> Does anything like that exist? Any suggestions (about how to do that)?
    >>> Thanks

    >>
    >> In my Kubuntu 7.10, if I press the restart button for ~1 sec I get a list
    >> of boot entries to boot to.
    >>
    >> Failing that, maybe
    >> http://www.cyberciti.biz/tips/force-...cified-os.html
    >> (http://tinyurl.com/6r9znf) will work for you.
    >>
    >> --Reinhold

    > That is the type of thing I had in mind. Not sure I want to switch from
    > Gnome to Kubuntu yet... I may end up taking the approach Trevor described.


    Flattered :-) But I think Reinhold's suggestion of the grub-reboot command
    might be just the thing, more or less does what I suggested only slicker.

    --
    A Freudian slip is when you say one thing but mean your mother.



  7. Re: How to Specify what to run on Restart

    Trevor Best wrote in alt.os.linux.ubuntu
    () on Dienstag 08 Juli 2008
    20:19:

    > On Tue, 08 Jul 2008 11:06:17 -0400, Frans van Duinen wrote:
    >
    >> Reinhold Rumberger wrote:




    >>> In my Kubuntu 7.10, if I press the restart button for ~1 sec I get a
    >>> list of boot entries to boot to.
    >>>
    >>> Failing that, maybe
    >>>

    http://www.cyberciti.biz/tips/force-...cified-os.html
    >>> (http://tinyurl.com/6r9znf) will work for you.
    >>>
    >>> --Reinhold

    >> That is the type of thing I had in mind. Not sure I want to switch from
    >> Gnome to Kubuntu yet... I may end up taking the approach Trevor
    >> described.


    I was trying to explain how it works in KDE, not try to make you
    switch. ;-)
    I haven't actually tried this using Kubuntu, but it worked in SUSE 9.2, so
    there must be a way to get it to work. I have little to no experience with
    Gnome, so I can't suggest anything there...

    IIRC my google query was "linux grub reboot to windows". Perhaps if you
    added "gnome" near the beginning, you would be able to find something more
    specific.

    > Flattered :-) But I think Reinhold's suggestion of the grub-reboot
    > command might be just the thing, more or less does what I suggested only
    > slicker.


    Let's see:


    reini60gb ~ > sudo grub-reboot 0
    [sudo] password for reini:
    Searching for GRUB installation directory ... found: /boot/grub
    Probing devices to guess BIOS drives. This may take a long time.

    [ Minimal BASH-like line editing is supported. For
    the first word, TAB lists possible command
    completions. Anywhere else TAB lists the possible
    completions of a device/filename. ]
    grub> savedefault --once --default=0
    grub> quit

    Do you want to reboot now? [y/N]


    This only works if you set the 'default' entry in the menu.lst to 'saved'.
    Also, the '--once' bit doesn't seem to work, so it will keep rebooting to
    the specified entry until another entry is selected. (I just tested it to
    see how it actually works.)
    SUSE somehow managed to change the default entry for the next boot only,
    and with default in menu.lst set to '0'. AFAICT, this is how it is
    supposed to work, only in 7.10 it doesn't seem to.
    Strange... :-S

    IOW, while your change is permanent, the command is supposed to make only
    temporary changes. I don't seem to have the info pages for grub installed,
    so I can't do any further research. (Gee, shouldn't have replied. Now I
    want to find out what's wrong... :-P )

    --Reinhold

  8. Re: How to Specify what to run on Restart

    Reinhold Rumberger wrote:
    > Trevor Best wrote in alt.os.linux.ubuntu
    > () on Dienstag 08 Juli 2008
    > 20:19:
    >
    >> On Tue, 08 Jul 2008 11:06:17 -0400, Frans van Duinen wrote:
    >>
    >>> Reinhold Rumberger wrote:

    >
    >
    >
    >>>> In my Kubuntu 7.10, if I press the restart button for ~1 sec I get a
    >>>> list of boot entries to boot to.
    >>>>
    >>>> Failing that, maybe
    >>>>

    > http://www.cyberciti.biz/tips/force-...cified-os.html
    >>>> (http://tinyurl.com/6r9znf) will work for you.
    >>>>
    >>>> --Reinhold
    >>> That is the type of thing I had in mind. Not sure I want to switch from
    >>> Gnome to Kubuntu yet... I may end up taking the approach Trevor
    >>> described.

    >
    > I was trying to explain how it works in KDE, not try to make you
    > switch. ;-)
    > I haven't actually tried this using Kubuntu, but it worked in SUSE 9.2, so
    > there must be a way to get it to work. I have little to no experience with
    > Gnome, so I can't suggest anything there...
    >
    > IIRC my google query was "linux grub reboot to windows". Perhaps if you
    > added "gnome" near the beginning, you would be able to find something more
    > specific.
    >
    >> Flattered :-) But I think Reinhold's suggestion of the grub-reboot
    >> command might be just the thing, more or less does what I suggested only
    >> slicker.

    >
    > Let's see:
    >
    >
    > reini60gb ~ > sudo grub-reboot 0
    > [sudo] password for reini:
    > Searching for GRUB installation directory ... found: /boot/grub
    > Probing devices to guess BIOS drives. This may take a long time.
    >
    > [ Minimal BASH-like line editing is supported. For
    > the first word, TAB lists possible command
    > completions. Anywhere else TAB lists the possible
    > completions of a device/filename. ]
    > grub> savedefault --once --default=0
    > grub> quit
    >
    > Do you want to reboot now? [y/N]
    >

    >
    > This only works if you set the 'default' entry in the menu.lst to 'saved'.
    > Also, the '--once' bit doesn't seem to work, so it will keep rebooting to
    > the specified entry until another entry is selected. (I just tested it to
    > see how it actually works.)
    > SUSE somehow managed to change the default entry for the next boot only,
    > and with default in menu.lst set to '0'. AFAICT, this is how it is
    > supposed to work, only in 7.10 it doesn't seem to.
    > Strange... :-S
    >
    > IOW, while your change is permanent, the command is supposed to make only
    > temporary changes. I don't seem to have the info pages for grub installed,
    > so I can't do any further research. (Gee, shouldn't have replied. Now I
    > want to find out what's wrong... :-P )
    >
    > --Reinhold

    Thanks Reinhold. Sorry you now have more work. I'll try to set aside
    some time to work on this and will post my results.

  9. Re: How to Specify what to run on Restart

    Frans van Duinen wrote in alt.os.linux.ubuntu
    (<344b7$48761c2a$cf705e14$343@PRIMUS.CA>) on Donnerstag 10 Juli 2008
    16:31:

    > Reinhold Rumberger wrote:




    >> so I can't do any further research. (Gee, shouldn't have replied. Now I
    >> want to find out what's wrong... :-P )


    > Thanks Reinhold. Sorry you now have more work. I'll try to set aside
    > some time to work on this and will post my results.


    You shouldn't be sorry, I wouldn't do it unless I thought it was fun...
    Anyway, the smiley was meant to imply that I wasn't serious. ;-)

    You might find http://wiki.debian.org/GrubReboot quite interesting.

    Also, this might do what you want:
    http://www.dcheng.members.sonic.net/.../pub/bootnext/
    (found in http://ubuntuforums.org/showthread.php?t=394967 )

    I'm not sure if this will work for you, and seems a pretty dirty way of
    doing it. It seems you also have to set a low timeout value for that one,
    so I'm not sure whether it's not just some graphical frontend to what I
    was doing.

    Judging from what I read, "savedefault --once --default=X" should
    circumvent the boot menu. I'm not sure why it doesn't on Ubuntu, but I
    guess they patch their grub in a different way (from how SUSE patched it).


    --Reinhold

+ Reply to Thread