samedi 2 février 2013

Redémarrer automatiquement sous Windows - Automatically reboot with Windows

Ah oui? Et pourquoi?

Ben voilà, mon problème, c'est que mon imprimante laser (plutôt un petit photocopieur) Canon assez ancienne mais fonctionnant parfaitement malgré un usage intensif et le climat tropical et maritime, ne fonctionne que sous Windows... Donc, quelques fois, je suis obligé d'y aller pour quelques minutes qui me semblent interminables. Las, bien souvent, je fais "redémarrer" et comme de bien-entendu, j'oublie de surveiller Grub (3 secondes d'affichage) et mon ordi redémarre (rapidement heureusement) sous Linux (Debian CrunchBang Wheezy). Et re-belote...

J'ai donc trouvé sur l'excellent site www.webupd8.org un article en Anglais que je vous ai gentiment traduit en Français. C'était pour UBUNTU mais cela doit fonctionner sur pas mal d'autres Linux. J'ai donc aussi changé Ubuntu en Debian dans les deux textes.


HOW TO REBOOT IN WINDOWS FROM DEBIAN OR OTHERS (GRUB 2 only)
 
If you're dual-boot Debian and Windows, you can use a simple command (or create a menu shortcut for it) to easily restart in Windows from Debian. This should actually work with any Grub entry, not just Windows (so if you using multiple Linux distributions, it will work with that too).

Note: this will only work with GRUB 2.

This command will not change the GRUB menu entries order. When GRUB starts, the first entry in the menu list is highlighted - this command will highlight the menu entry you set and will boot it if you don't select a different option (so the GRUB menu will still be displayed if you've set a GRUB timeout higher than 0).

1. At next boot, in Grub Menu, note the line of the OS you want start
2. Edit /etc/default/grub:


sudo gedit /etc/default/grub


3. modify the "GRUB_DEFAULT=0" value (it should be located around the line 4) from "0" to "saved" (without the quotes) so that it looks like this:


GRUB_DEFAULT=saved

4. Save the file et close it.
5. Update GRUB:

sudo update-grub


6. Now to reboot from Debian in Windows or some other OS, run the following command:


sudo grub-reboot X 



where X is the menu entry position (starting with 0 as the first entry) of the OS you want to restart in from the GRUB menu. So if Windows is the 5th option in the GRUB menu, you would run "sudo grub-reboot 4".
You can also use the exact menu entry instead of the menuentry position (like "Windows 7 (on /dev/sda1)") but entering just a number should be easier to remember.
The grub-reboot will set the default boot entry for the next boot only.

7.Then simply restart your computer and it should boot in Windows or whatever GRUB menuentry choice you've entered for the above command.


8. (optional) For easy access, you can make a script which automatically makes your computer restart in predefined OS:





#!/bin/bash
gksu grub-reboot X
gksu reboot

Again change "X" for the GRUB menuentry number you want to boot in (counting from 0) and make a shortcut for this script on your panel for example.



Comment redémarrer Windows à partir de Debian ou autres (GRUB 2 seulement)
 

Comment redémarrer Windows à partir de Debian ou autres (GRUB 2 seulement)
 
Si vous êtes en dual-boot Ubuntu et Windows, vous pouvez utiliser une commande simple (ou créer un raccourci de menu pour cela) pour redémarrer facilement Windows depuis Linux. Cela devrait fonctionner avec n'importe quelle entrée Grub, et pas seulement Windows (si vous utilisez plusieurs distributions Linux, il pourra le faire aussi).

Note: ceci ne fonctionne qu'avec GRUB 2.

Cette commande ne modifie pas l'ordres des entrées dans Grub. Lorsque GRUB démarre, généralement c'est la première entrée dans la liste qui est sélectionnée - cette commande va surligner l'entrée que vous définissez et il démarrera dessus si vous ne sélectionnez pas une autre option (si le menu GRUB est encore affiché car vous avez réglé un délai d'affichage supérieur à 0)




1. Au prochain redémarrage, notez l'ordre de l'entrée de Windows par exemple: 5 ème ligne.
2. Editez le fichier /etc/default/grub:


sudo gedit /etc/default/grub


3. et modifiez "GRUB_DEFAULT = 0" (il devrait se trouver dans les toutes premières lignes)en "saved" (sans les guillemets) afin qu'il ressemble à ceci:

GRUB_DEFAULT=saved

4. Puis enregistrez le fichier et fermez l'éditeur.
5. Mettre à jour GRUB (important!):

sudo update-grub


6.  Maintenant pour redémarrer Ubuntu dans Windows ou un autre système d'exploitation, exécutez la commande suivante:


sudo grub-reboot X 



où X est la position de l'OS que vous voulez redémarrer dans le menu GRUB (la première entrée étant 0-zéro). Donc, si Windows est sur la 5 ème ligne dans le menu GRUB, vous devez exécuter la commande «sudo grub-reboot 4".
Vous pouvez également utiliser l'entrée de menu exact au lieu de la position menuentry (comme "Windows 7 (sur / dev/sda1)"), mais un simple numéro devrait être plus facile à retenir.
Le grub-reboot définira l'entrée de démarrage par défaut (pour le prochain démarrage seulement).


7. Il suffit ensuite de redémarrer votre ordinateur et il devrait démarrer sur l'OS que vous avez défini.
8. Optionnel: Pour un accès plus facile, vous pouvez créer un script qui fera redémarrer automatiquement votre PC sur une entrée prédéfinie:






#!/bin/bash
gksu grub-reboot X
gksu reboot


Encore une fois changez "X" pour le numéro d'entrée que vous souhaitez démarrer (en partant de 0) et faire un raccourci pour ce script sur votre tableau de bord par exemple.

Aucun commentaire:

Enregistrer un commentaire

Ajoutez un commentaire mais en bon Français ou éventuellement en bon Anglais. Les commentaires en langage SMS seront supprimés.