一、 我的电脑原来先装的Windows XP,后来由于工作需要,又装了一个Linux_Ubuntu 9.04,我设置了定时开机,但是总是默认启动到Ubuntu环境。 通过下面的操作把Windows XP改为默认启动系统: 启动ubuntu后,输入:sudo gedit /boot/grub/menu.lst 输入正确密码,打开menu.lst。 从第一行往下看,找到第一个开头没有#的行 default 0 继续往下看,找到所有以title开头的行(注意,以#开头的都不要理)。 我的文件中,以title开头的共(开头没有#)有7行,依次为: title Ubuntu 8.04.1, kernel 2.6.24-21-generic title Ubuntu 8.04.1, kernel 2.6.24-21-generic (recovery mode) title Ubuntu 8.04.1, kernel 2.6.24-16-generic title Ubuntu 8.04.1, kernel 2.6.24-16-generic (recovery mode) title Ubuntu 8.04.1, memtest86+ title Other operating systems: title Windows NT/2000/XP 这些行不是像这样连在一起的,它们分散在文件中。把这7行写一起,为的是让我们看得清楚些。事实上,除去每行前面的title,这7行就是我开机时出现的启动菜单项,系统在启动时读的就是该文件。 default 0 表示默认情况下启动以上菜单上第1行(0+1)的系统。 我们看到windows处于第7(6+1)行,所以现在把default的值改为6,保存文件,重启系统,默认启动的系统就改为Windows了。 二、在Ubuntu 10.04中,并没有menu.lst文件,文件名已经变成grub.cfg。 更改操作如下: 1、备份原文件为grub.cfg.bak 代码:sudo cp /boot/grub/grub.cfg /boot/grub/grub.cfg.bak 2、修改启动顺序 代码:sudo gedit /boot/grub/grub.cfg 在打开顶文件中找到set default="0",可以看出默认是第一项(从0开始计数)。 然后找到以menuentry开头的所有行,下面是我电脑上该文件的内容,一共7行,最后一行是Windows XP项。以我的文件内容为例,我只要set default="6(注意:从0开始计数)就可以把Windows XP改为默认启动系统。 menuentry 'Ubuntu,Linux 2.6.32-22-generic' menuentry 'Ubuntu,Linux 2.6.32-22-generic (恢复模式)' menuentry 'Ubuntu,Linux 2.6.32-21-generic' menuentry 'Ubuntu,Linux 2.6.32-21-generic (恢复模式)' menuentry "Memory test (memtest86+)" menuentry "Memory test (memtest86+, serial console 115200)" menuentry "Microsoft Windows XP Professional (on /dev/sda1)" 三、当系统“/boot/grub/ ”里根本没有“menu.lst”这个文件时,具体步骤如下: 1.用root身份登录Ubuntu 默认下是静止本地root登录的,解决方法是:系统-系统管理-登录窗口-安全-选择允许本地系统管理员登录;sudo passwd回车;输入你的密码;为root设定密码;重复;就可以登录root了。 2./boot/grub/目录下没有menu.lst这个文件,可以自己新建一个,然后把下面这些代码复制到新建的menu.lst这个文件里,将default的值改成4,保存即可。 开始: # menu.lst - See: grub(8), info grub, update-grub(8) # grub-install(8), grub-floppy(8), # grub-md5-crypt, /usr/share/doc/grub # and /usr/share/doc/grub-doc/. ## default num # Set the default entry to the entry number NUM. Numbering starts from 0, and # the entry number 0 is the default if the command is not used. # # You can specify 'saved' instead of a number. In this case, the default entry # is the entry saved with the command 'savedefault'. # WARNING: If you are using dmraid do not use 'savedefault' or your # array will desync and will not let you boot your system. default 0 ## timeout sec # Set a timeout, in SEC seconds, before automatically booting the default entry # (normally the first entry defined). timeout 10 ## hiddenmenu # Hides the menu by default (press ESC to see the menu) #hiddenmenu # Pretty colours #color cyan/blue white/blue ## password ['--md5'] passwd # If used in the first section of a menu file, disable all interactive editing # control (menu entry editor and command-line) and entries protected by the # command 'lock' # e.g. password topsecret # password --md5 $1$gLhU0/$aW78kHK1QfV3P2b2znUoe/ # password topsecret # # examples # # title Windows 95/98/NT/2000 # root (hd0,0) # makeactive # chainloader +1 # # title Linux # root (hd0,1) # kernel /vmlinuz root=/dev/hda2 ro # # # Put static boot stanzas before and/or after AUTOMAGIC KERNEL LIST ### BEGIN AUTOMAGIC KERNELS LIST ## lines between the AUTOMAGIC KERNELS LIST markers will be modified ## by the debian update-grub script except for the default options below ## DO NOT UNCOMMENT THEM, Just edit them to your needs ## ## Start Default Options ## ## default kernel options ## default kernel options for automagic boot options ## If you want special options for specific kernels use kopt_x_y_z ## where x.y.z is kernel version. Minor versions can be omitted. ## e.g. kopt=root=/dev/hda1 ro ## kopt_2_6_8=root=/dev/hdc1 ro ## kopt_2_6_8_2_686=root=/dev/hdc2 ro # kopt=root=UUID=04d0edaf-6a91-46c5-8bec-35a97eeaa27f ro ## default grub root device ## e.g. groot=(hd0,0) # groot=04d0edaf-6a91-46c5-8bec-35a97eeaa27f ## should update-grub create alternative automagic boot options ## e.g. alternative=true ## alternative=false # alternative=true ## should update-grub lock alternative automagic boot options ## e.g. lockalternative=true ## lockalternative=false # lockalternative=false ## additional options to use with the default boot option, but not with the ## alternatives ## e.g. defoptions=vga=791 resume=/dev/hda5 # defoptions=quiet splash ## should update-grub lock old automagic boot options ## e.g. lockold=false ## lockold=true # lockold=false ## Xen hypervisor options to use with the default Xen boot option # xenhopt= ## Xen Linux kernel options to use with the default Xen boot option # xenkopt=console=tty0 ## altoption boot targets option ## multiple altoptions lines are allowed ## e.g. altoptions=(extra menu suffix) extra boot options ## altoptions=(recovery) single # altoptions=(recovery mode) single ## controls how many kernels should be put into the menu.lst ## only counts the first occurence of a kernel, not the ## alternative kernel options ## e.g. howmany=all ## howmany=7 # howmany=all ## specify if running in Xen domU or have grub detect automatically ## update-grub will ignore non-xen kernels when running in domU and vice versa ## e.g. indomU=detect ## indomU=true ## indomU=false # indomU=detect ## should update-grub create memtest86 boot option ## e.g. memtest86=true ## memtest86=false # memtest86=true ## should update-grub adjust the value of the default booted system ## can be true or false # updatedefaultentry=false ## should update-grub add savedefault to the default options ## can be true or false # savedefault=false ## ## End Default Options ## title Ubuntu 9.04, kernel 2.6.28-11-generic uuid 04d0edaf-6a91-46c5-8bec-35a97eeaa27f kernel /boot/vmlinuz-2.6.28-11-generic root=UUID=04d0edaf-6a91-46c5-8bec-35a97eeaa27f ro quiet splash initrd /boot/initrd.img-2.6.28-11-generic quiet title Ubuntu 9.04, kernel 2.6.28-11-generic (recovery mode) uuid 04d0edaf-6a91-46c5-8bec-35a97eeaa27f kernel /boot/vmlinuz-2.6.28-11-generic root=UUID=04d0edaf-6a91-46c5-8bec-35a97eeaa27f ro single initrd /boot/initrd.img-2.6.28-11-generic title Ubuntu 9.04, memtest86+ uuid 04d0edaf-6a91-46c5-8bec-35a97eeaa27f kernel /boot/memtest86+.bin quiet ### END DEBIAN AUTOMAGIC KERNELS LIST # This is a divider, added to separate the menu items below from the Debian # ones. title Other operating systems: root # This entry automatically added by the Debian installer for a non-linux OS # on /dev/sda1 title Microsoft Windows XP Professional rootnoverify (hd0,0) savedefault makeactive chainloader +1 结束。 问题得到解决了吧!呵呵!
ubuntu双系统开机默认启动windows设置
精选 转载上一篇:ArcGIS10中文版配置过程
下一篇:我的友情链接
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
【IDEA】idea设置默认maven配置, 避免每次设置maven
【IDEA】idea设置默认maven配置, 避免每次设置maven
idea配置maven maven安装配置 -
在ubuntu中设置默认启动系统
新手修改开机默认启动系统项
快捷键 ubuntu grub 快捷启动