两年半前安装了Fedora11,之后升级到Fedora 12, Fedora 14,期间安装了大量的软件,系统越来越慢……固然有我个人懒惰不愿优化的原因,系统性能下降也与两年多来Fedora的复杂程度的增长有关。前天晚上禁不住诱惑升级到了Fedora 16,过程中没遇到问题,只是升级后发现:(1)Gnome 3的界面进不去,因为笔记本配置太低,没有独立显卡;(2)Classic Gnome with compiz也基本无法使用,尽管我已经装好了compiz;(3)KDE界面虽然花哨但速度较慢不甚喜欢;(4)无线网卡经常无法工作。

基于以上缺陷,我终于忍无可忍,决定更换系统到Ubuntu或者FreeBSD了。本来我更倾向于FreeBSD的,但是由于下载速度缓慢,不得不暂时放弃。

Ubuntu很快就下完。首先在Fedora下创建启动U盘,参照 How to create and use Live USB


  1. Check the size of your USB stick

    Many USB sticks indicate the size on the packaging or the outside of the stick.

    If you don't know the size of the stick, or want to check it for data, you should be able to auto-mount the USB stick by inserting it into a USB port. You can check the contents and size using the graphical file manager. In Linux, you can also use the command
    line:

    $ df -h
    Filesystem            Size  Used Avail Use% Mounted on
    /dev/mapper/VolGroup00-LogVol00
    143G   14G  122G  10% /
    /dev/sda1              99M   12M   82M  13% /boot
    tmpfs                1009M     0 1009M   0% /dev/shm
    /dev/sdb1             3.9G  4.0K  3.9G   1% /media/usbdisk

    USB drives are usually mounted in /media. In this case, the device is /dev/sdb1, has a 3.9GB capacity and is almost empty.

    Take note of "/dev/sdb1" or equivalent; you will be specifying the device name if you use the command line method.

  2. How to Partition

    Warning (medium size).png
    CAUTION 

    This will erase all data on the USB drive! Please read the instructions below carefully.

    If the drive has not been partitioned properly (or if you are unsure), use fdisk to
    repartition it.

    It is also possible to do a non-destructive installation of a LiveUSB image, if you have sufficient empty space. See How
    to install non-destructively
     below.

    The fdisk command must be run as root. Include
    only the drive name in the command, not the partition number. Be
    sure to select the correct disk, or you may erase important data!
     Check the output of "df -h" if you are unsure. For example, if your partition will be /dev/sdb1, do:

    $ /sbin/fdisk /dev/sdb

    If you don't have fdisk installed, run 

    yum install util-linux-ng

     as root.

    The following session output from fdisk shows
    the responses to give to the prompts. The line starting Last
    cylinder ...
     refers to the size of the flash drive, so may be different than in the example.

    Command (m for help): d
    Selected partition 1
    
    Command (m for help): n
    Command action
    e   extended
    p   primary partition (1-4)
    p
    Partition number (1-4): 1
    First cylinder (1-960, default 1): ↵
    Using default value 1
    Last cylinder or +size or +sizeM or +sizeK (1-960, default 960): ↵
    Using default value 960
    
    Command (m for help): t
    Selected partition 1
    Hex code (type L to list codes): 6
    Changed system type of partition 1 to 6 (FAT16)
    
    Command (m for help): a
    Partition number (1-4): 1
    
    Command (m for help): w
    The partition table has been altered!
    
    Calling ioctl() to re-read partition table.
    
    WARNING: If you have created or modified any DOS 6.x
    partitions, please see the fdisk manual page for additional
    information.
    Syncing disks.

    How to Format

    Warning (medium size).png
    CAUTION 

    This will erase all data on the USB drive! Please read the instructions below carefully.

    If your USB media has sufficient free space on a vfat file system already, you do not need to
    perform this step.

    To finish, the partition must be formatted with an actual file system using mkdosfs as
    the root user. Unmount the device before using mkdosfs.
    In the below example, /dev/USBPARTITIONNAME might be, for example, /dev/sdb1. Be
    sure to select the correct partition; formatting destroys all data on it!

    $ umount /dev/USBPARTITIONNAME
    $ /sbin/mkdosfs -F 32 -n usbdisk /dev/USBPARTITIONNAME

    If you don't have mkdosfs installed, run "yum install dosfstools" as root.

  3. 通过命令
    su -c "yum install liveusb-creator"

    安装了Fedora的liveusb-creator,但是发现Fedora的这个程序无法制作Ubuntu的启动盘快哭了无奈之下,试着把Ubuntu的iso文件复制到U盘里:

    sudo dd if=F12-Live-i686.iso of=/dev/sdX bs=8M

  4. 之后重启电脑,开机之后按c进入grub引导程序。尝试以往的通过kernel指定vmlinuz时失败,才发现Grub2中已经没有了kernel命令,尝试legacy_kernel和xnu_kernel,结果均遭失败。于是我尝试直接指定 initrd (hd1,4)/casper/initrd.gz,然后exit,没成想Ubuntu的安装界面竟然出现了!
  5. 安装Ubuntu的过程中竟然就已经支持了WIFI,着实令我欣慰,看来Ubuntu这么多年在用户友好性上改进不少。
  6. 安装完成后重启,结果Grub无法正常工作,进入grub rescue模式。用iPad百度之后,发现好文Ubuntu启动问题以及Grub Rescue修复方法,逐步去试,果然灵验。转载该文如下:

  • 问题:

之前系统是Windows7 64bit(C盘) + D,E盘(都是NTFS) + Ubuntu。

今天,在Windows7中删除了E盘,准备向其中安装RedHat 6。 重启Windows7之后发现Ubuntu的grub菜单不能启动。屏幕显示Invalid FileSystem。 (如果没有记错的话,呵呵)

  • 分析

由于在Windows下面更改了分区状态,删掉了Ubuntu之前的一个分区,造成Ubuntu的分区由sda5变为sda4了,这样找不到grub了,开机显示

grub rescue>

  • 解决

1.  先使用ls命令,找到Ubuntu的安装在哪个分区:     

grub rescue>ls

     会罗列所有的磁盘分区信息,比方说:

     (hd0,1),(hd0,5),(hd0,3),(hd0,2)

2. 然后依次调用如下命令: X表示各个分区号码     

grub rescue>ls (hd0,X)/boot/grub

     如果都找不到的话,需要查一下是否因为Linux版本差异,造成grub的路径不对,例如直接ls(hd0,X)/grub等等。

3. 假设找到(hd0,5)时,显示了文件夹中的文件,则表示Linux安装在这个分区。

4. 调用如下命令:

grub rescue>set root=(hd0,5)
grub rescue>set prefix=(hd0,5)/boot/grub
grub rescue>insmod /boot/grub/normal.mod

5. 然后调用如下命令,就可以显示出丢失的grub菜单了。

grub rescue>normal

6. 不过不要高兴,如果这时重启,问题依旧存在,我们需要进入Linux中,对grub进行修复。

    进入Linux之后,在命令行执行:    

sudo update-grub
sudo grub-install /dev/sda

(sda是你的硬盘号码,千万不要指定分区号码,例如sda1,sda5等都不对)

7. 重启测试是否已经恢复了grub的启动菜单? 恭喜你恢复成功!

Grub恢复成功后,开始安装常用软件。Ubuntu新的界面不像以前想象中那么难用,而且他们终于部分放弃了以前屎黄色的界面风格,最难得的是在我那破本本上速度还是很快滴!期待Ubuntu12.04早日发布,到时直接升级之。


【Update 2012-04-29】

恢复Grub2

升级Ubuntu 11.10到12.04后,开机报错“no partition found”,进入Grub后,输入"ls"命令,也报错“no partition found”。

于是我下载了UNetbootin,然后利用它在Win 7下制作Ubuntu自启动U盘。制作好之后,结果发现不会自动引导启动,需要在开机之后出现Thinkpad欢迎界面时按F12,然后选择U盘启动。然后选择U盘启动Ubuntu,进入Ubuntu后按照 How to
Fix Grub 2
中的方法安装Grub 2到硬盘。

To fix GRUB 2, you need an Ubuntu live CD from which you need to boot. Once you boot to the LIVE CD, open a terminal an and type these commands:


a) Firstly, you need to find out on which partition your Linux system is installed:

sudo fdisk -l

(in my case, it's "sda1")



b) Now, we must mount this partition:

sudo mount /dev/sda1 /mnt

Where "sda1" is the partition where you installed Ubuntu (or any other Linux distro). It could be "sda5", "sda6", etc. for you.



c) Install grub to the partition you've mounted:

sudo grub-install --root-directory=/mnt/ /dev/sda





Important: Please
notice that it's "/dev/sda", not "/dev/sda1". "sda" is the hard disk on which your Linux distribution is installed!



d) Restart your computer. As previous Grub 2 entries are removed, run the following command to restore them:

sudo update-grub

重启电脑进入Grub 2之后,输入命令

linux (hd0,X)/vmlinuz-3.2......
initrd (hd0,X)/initrd.img-3.2......
boot

Grub 2中已经不再支持kernel命令,需要用linux指定kernel。