LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-15-2016, 10:40 PM   #1
fabe856
Member
 
Registered: Apr 2012
Posts: 115

Rep: Reputation: Disabled
Default boot changed to Fedora. How to restore it to windows?


I have Fedora 23 and Windows 7 installed on a system. The system used to boot to windows 7 by default. To add Hibernate option to Fedora 23, I executed following code
#!/bin/bash
# Enable hibernation
# Using info from:
# https://psohny.wordpress.com/2015/08/13/fedora_hiber/

# Enable recovery in the /etc/default/grub
sed -i -e 's|^\(GRUB_DISABLE_RECOVERY="\)true"|\1false"|' /etc/default/grub

#Find the swapdevice
SWAPDEVICE=`grep -e '^[^#].*swap' /etc/fstab | head -n 1 | cut -d ' ' -f 1`
echo "Using SWAPDEVICE=${SWAPDEVICE} for hibernation"

#add "resume=swapdevice" to the GRUB_CMDLINE_LINUX=
sed -i -e "s|^\(GRUB_CMDLINE_LINUX=".*\)"|\1 resume=${SWAPDEVICE}"|" /etc/default/grub

#Regenerate the grub config
/sbin/grub2-mkconfig -o /boot/grub2/grub.cfg

and rebooted the system.
This however changed my default boot to fedora and also added two more boot options (both for fedora).
How can I change the default boot to windows again?

Last edited by fabe856; 12-15-2016 at 11:22 PM.
 
Old 12-15-2016, 11:14 PM   #2
TheEzekielProject
Member
 
Registered: Dec 2016
Distribution: arch
Posts: 668

Rep: Reputation: 190Reputation: 190
open /etc/default/grub find GRUB_DEFAULT='windows goes here'this can be defined by numbers or names. Note where Windows is in your boot order, subtract 1, and put that number after =. Or search your /boot/grub/grub.cfg for "windows". The line should begin with menuentry 'windows name here'
 
Old 12-15-2016, 11:26 PM   #3
fabe856
Member
 
Registered: Apr 2012
Posts: 115

Original Poster
Rep: Reputation: Disabled
I used following to check number for windows
grep menuentry /boot/grub2/grub.cfg
if [ x"${feature_menuentry_id}" = xy ]; then
menuentry_id_option="--id"
menuentry_id_option=""
export menuentry_id_option
menuentry 'Fedora (4.2.3-300.fc23.x86_64) 23 (Workstation Edition)' --class fedora --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-4.2.3-300.fc23.x86_64-advanced-51417380-1146-41ee-8864-c37bc52b8ac5' {
menuentry 'Fedora (4.2.3-300.fc23.x86_64) 23 (Workstation Edition) (recovery mode)' --class fedora --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-4.2.3-300.fc23.x86_64-recovery-51417380-1146-41ee-8864-c37bc52b8ac5' {
menuentry 'Fedora (0-rescue-6baab59859bc4b6486ae8773ff8787cc) 23 (Workstation Edition)' --class fedora --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-0-rescue-6baab59859bc4b6486ae8773ff8787cc-advanced-51417380-1146-41ee-8864-c37bc52b8ac5' {
menuentry 'Fedora (0-rescue-6baab59859bc4b6486ae8773ff8787cc) 23 (Workstation Edition) (recovery mode)' --class fedora --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-0-rescue-6baab59859bc4b6486ae8773ff8787cc-recovery-51417380-1146-41ee-8864-c37bc52b8ac5' {
menuentry 'Windows 7 (loader) (on /dev/sda1)' --class windows --class os $menuentry_id_option 'osprober-chain-84EE9735EE971F0C' {

Then I changed it using
[root@host223 gr]# gedit /etc/default/grub

(gedit:4957): dconf-WARNING **: failed to commit changes to dconf: The connection is closed

(gedit:4957): dconf-WARNING **: failed to commit changes to dconf: The connection is closed
Error creating proxy: The connection is closed (g-io-error-quark, 18)
Error creating proxy: The connection is closed (g-io-error-quark, 18)
Error creating proxy: The connection is closed (g-io-error-quark, 18)
Error creating proxy: The connection is closed (g-io-error-quark, 18)
Error creating proxy: The connection is closed (g-io-error-quark, 18)

(gedit:4957): dconf-WARNING **: failed to commit changes to dconf: The connection is closed

(gedit:4957): dconf-WARNING **: failed to commit changes to dconf: The connection is closed

(gedit:4957): dconf-WARNING **: failed to commit changes to dconf: The connection is closed

** (gedit:4957): WARNING **: Set document metadata failed: Setting attribute metadata::gedit-spell-enabled not supported

** (gedit:4957): WARNING **: Set document metadata failed: Setting attribute metadata::gedit-encoding not supported

However, there is no change?

Last edited by fabe856; 12-15-2016 at 11:28 PM.
 
Old 12-15-2016, 11:38 PM   #4
TheEzekielProject
Member
 
Registered: Dec 2016
Distribution: arch
Posts: 668

Rep: Reputation: 190Reputation: 190
You dont have anything other than gedit errors after you attempted to open the file. Did you make sure your changes saved and did you run update-grub?
 
Old 12-16-2016, 01:38 AM   #5
fabe856
Member
 
Registered: Apr 2012
Posts: 115

Original Poster
Rep: Reputation: Disabled
After saving changes, I get
(gedit:4957): dconf-WARNING **: failed to commit changes to dconf: The connection is closed

(gedit:4957): dconf-WARNING **: failed to commit changes to dconf: The connection is closed
Error creating proxy: The connection is closed (g-io-error-quark, 18)
Error creating proxy: The connection is closed (g-io-error-quark, 18)
Error creating proxy: The connection is closed (g-io-error-quark, 18)
Error creating proxy: The connection is closed (g-io-error-quark, 18)
Error creating proxy: The connection is closed (g-io-error-quark, 18)

(gedit:4957): dconf-WARNING **: failed to commit changes to dconf: The connection is closed

(gedit:4957): dconf-WARNING **: failed to commit changes to dconf: The connection is closed

(gedit:4957): dconf-WARNING **: failed to commit changes to dconf: The connection is closed

** (gedit:4957): WARNING **: Set document metadata failed: Setting attribute metadata::gedit-spell-enabled not supported

** (gedit:4957): WARNING **: Set document metadata failed: Setting attribute metadata::gedit-encoding not supported

How can I run update-grub
 
Old 12-16-2016, 01:50 AM   #6
TheEzekielProject
Member
 
Registered: Dec 2016
Distribution: arch
Posts: 668

Rep: Reputation: 190Reputation: 190
Code:
sudo update-grub
 
Old 12-16-2016, 03:27 AM   #7
fabe856
Member
 
Registered: Apr 2012
Posts: 115

Original Poster
Rep: Reputation: Disabled
[gr@host223 ~]$ sudo update-grub
sudo: update-grub: command not found
 
Old 12-16-2016, 03:37 AM   #8
TheEzekielProject
Member
 
Registered: Dec 2016
Distribution: arch
Posts: 668

Rep: Reputation: 190Reputation: 190
try
Code:
sudo update-grub2
 
Old 12-16-2016, 05:08 AM   #9
fabe856
Member
 
Registered: Apr 2012
Posts: 115

Original Poster
Rep: Reputation: Disabled
# sudo update-grub2
sudo: update-grub2: command not found


Solved using
grub2-mkconfig > /boot/grub2/grub.cfg

However there are now 7 boot options (6 for fedora and only one for windows). Can I remove some of them? If yes how?

Last edited by fabe856; 12-16-2016 at 05:09 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
'Operating system not found' Any operating system installed wont work. TechniSlave Linux - Newbie 55 02-09-2009 11:02 AM
Default user accounts in Unix Operating system srihariv Linux - General 2 03-31-2008 06:43 AM
changed bios to USB hard drive as #1 option - boots "Missing operating system" Elendrael Linux - Newbie 4 09-12-2007 08:48 PM
How to set the default boot operating system at the boot menu Niceman2005 Linux - General 2 04-12-2006 09:46 PM
how to change default operating system boot-up malb Linux - Newbie 5 07-26-2005 01:22 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:56 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration