本页面讲述了如何使用 yum
来升级您的 Fedora 版本。
直接通过 yum 升级
当你使用 yum 更新时将无法从 FedUp 或 Anaconda 得到帮助,但是在一个典型系统中,你可以在有限的停机时间内通过 ssh 远程更新系统。(你仍需要重启系统使得新内核和系统库或服务运行)。
当遵循下面的建议时,在一个典型安装的系统中使用 yum 仍能得到很好的实时升级。
参与
如果你在使用 yum 升级的过程中遇到一般性依赖问题,请将它们归档至 http://bugzilla.redhat.com。但在提交 bug 前请阅读此页、所有相关页,搜索邮件列表归档。当然,确保此页最新。
如果你想参与使得实时更新平滑进行,加入 Live Upgrade Special Interest Group。
使用 yum 升级详解
1. 备份你的系统
备份所有个人数据到移动硬盘或其他机器。如果发生不可恢复的错误需要重新安装,你将不会丢失任何数据。
2. 阅读常见问题
向下拉这个页面会有具体版本通过 yum 升级常见问题的清单。其中一些问题需要在升级前关注。
升级 Fedora 的一般性建议可以查看 Upgrading 页面。你也可以阅读 Installation Guide 和 Release Notes 页面查找你计划升级到的版本——它们包含了关于升级问题的重要信息。最后,检查 Common bugs 列表。
3. Clean Stuff
Review and remove all .rpmsave and .rpmnew files before and after upgrading. (And if you have selinux enabled then remember to check security context if you move config files around.)
Now is a good time to remove packages you don't use - especially non-standard packages.
4. Do the upgrade
If you have 3rd party repositories configured, you may need to adjust them for the new Fedora version. If you switch from one Fedora release to another there is often nothing that needs to be done. If you switch to Rawhide from a standard Fedora release (or vice versa) then most of the time you will need to install the Rawhide release RPMs from the 3rd party repository as well (or the standard ones, if switching back).
Note that the upgrade is likely to fail if there are outdated dependencies from packages not backed by a yum repository or backed by a repository which isn't ready for the new version.
It is a good idea to do the upgrade outside the graphical environment. Log out of your graphical desktop and then
Go to a text console
ctrl + alt + F2
(or)
log in as root, and go into runlevel 3
init 3
Update yum to latest version available in your Fedora version
yum update yum
Install the new fedora gpg key for the version you are updating to
Keys you may find and verify at
https://fedoraproject.org/keys
or see a version specific update instructions at the bottom.
Clean the cache
Then remove all traces of the version you are leaving from the yum cache in /var/cache/yum
.
yum clean all
Upgrade all packages
yum --releasever=<release_number_you_want_to_sync_to> distro-sync
Note: While it is recommended to upgrade to intermediate releases if upgrading from an older release (for example upgrading from Fedora 12 to 13, then 13 to 14), depending on what version you are upgrading from, this step may fail with an error about GPG keys being in the wrong format. To overcome this, you can add the "--nogpgcheck" switch to the above yum distro-sync command.
5. Make sure Fedora is upgraded
Distro-sync will usually take care of upgrades for the third party repositories you have enabled as well. Confirm with
yum repolist
after the upgrade process is over. yum
might complain about conflicts or requirements. That is probably because you have used non-standard repositories or installed non-standard packages manually. Try to guess which packages cause the problem (or at least is a part of the dependency chain) - uninstall them and try again. Remember to install the packages again if they are essential.
Ensure that all (new) essential packages from the new version are installed with
yum groupupdate Base
You might want to update other groups too, see
yum grouplist
For example
yum groupupdate "GNOME Desktop Environment" \ "Development Tools" "Server Configuration Tools" \ "Hardware Support" "Sound and Video" \ "Graphical Internet" "Fonts" \ "Games and Entertainment" "Printing Software" \ "Administration Tools" "Office/Productivity" "System Tools"
6. Preparing for reboot
Before booting you should usually install the bootloader from your new grub by running
/sbin/grub-install BOOTDEVICE
- where BOOTDEVICE is usually /dev/sda
(If you get an error '/dev/sda does not have any corresponding BIOS drive' from that, then try /sbin/grub-install --recheck /dev/sda). For Fedora 16 and later, use /sbin/grub2-install
instead of /sbin/grub-install
. See below first for important information about upgrading to Fedora 16 from prior releases.
Also, the order of init scripts could have changed from the previous version. A command to reset the order is:
cd /etc/rc.d/init.d; for f in *; do /sbin/chkconfig $f resetpriorities; done
Again, run package-cleanup --orphans
to find packages that haven't been upgraded.
Version specific notes
From pre-release
If you are upgrading to a final release from an alpha, beta, preview, or other Rawhide release, please see Upgrading from pre-release to final.
To development version
yum update yum yum --releasever=rawhide distro-sync --skip-broken --nogpgcheck
Fedora 16 -> Fedora 17
First install the new Fedora 17 gpg key
rpm --import https://fedoraproject.org/static/1ACA3465.txt
Fedora 17 will locate the entire base operating system in /usr. The directories /bin, /sbin, /lib, /lib64 will only be symlinks:
/bin → /usr/bin /sbin → /usr/sbin /lib → /usr/lib /lib64 → /usr/lib64
Some reasoning behind this change is outlined here:
http://www.freedesktop.org/wiki/Software/systemd/TheCaseForTheUsrMerge
Currently installed systems need some manual steps to convert the current system to match the layout of Fedora 17. After that, the system can continue to be updated with YUM as usual.
Some RPM packages in Fedora 17 are carrying an RPM dependency guard, which will make sure, they can only be installed when /bin, /sbin, /lib, /lib64 are symlinks and not directories like in Fedora 16 and older.
The installed system’s base filesystem layout can not be safely altered, while the system itself is running on top of it. Dracut, the initramfs used to find and mount the root filesystem, can be instructed to convert the filesystem to match Fedora 17’s expectations.
If your system has a split-off /usr, a separate mount point, the dracut /usr mount conversion logic might not work. If /usr resides on the net, then ou should add "rd.neednet=1" and the network settings like "ip=dhcp" on the kernel command line. /usr on iSCSI, FCoE, NBD also is supported, as long as “netroot=...” is specified on the kernel command line for these disks (see man dracut.kernel(7)). If you have /usr on LVM, MD raid or DM raid, make sure the kernel command line has either all settings like "rd.lvm.lv=..." to ensure the /usr device is accessible in dracut or just remove all restrictions like "rd.lvm...", "rd.md...", "rd.dm...". Either way, you should probably use anaconda to update, if you are experiencing problems with a separate /usr.
Here are the steps to prepare your system, to convert it, and to be able to continue updating your installed system with yum:
Download and install the most recent dracut packages:
# yum update dracut
You should at least have dracut-009-14.fc15 for Fedora 15 or dracut-013-22.fc16 for Fedora 16.
Turn off any "hostonly" settings in /etc/dracut.conf*, if you turned on "hostonly".
Update the installed initramfs image for your current kernel, and instruct dracut to include the dracut module to convert your current filesystem:
# dracut --force --add convertfs
If your system has a split-off /usr, a separate mount point, and you don't know the kernel command line parameter to add, you can also try (dracut tries to generate them internally):
# dracut -H --force --add convertfs
If dracut detects ‘rd.convertfs’ on the kernel command line at bootup, it starts the filesystem conversion of the root filesystem. If it is already converted, it will just do nothing.
Change the following kernel commandline parameter directly in the bootloader
menu, which is shown during bootup, or edit the line in /etc/grub*.cfg
to remove ro and rhgb and append rw rd.info rd.convertfs enforcing=0
Explanation of the options:
- remove “ro” (read only) - append “rw” (read write) to let dracut mount your root filesystem writeable - remove “rhgb” (Red Hat graphical boot) to disable the graphical bootsplash - append “rd.info” to get a more verbose output from dracut - append “rd.convertfs” to enable the /usr-move conversion script in dracut - append “enforcing=0” to disable SELinux enforcement
During bootup, dracut will now convert your filesystem, and /lib, /lib64, /bin and /sbin should then all be symbolic links to the corresponding directories in /usr.
After the conversion, the system needs to be immediately updated to Fedora 17. No packages from Fedora 16 or Fedora 15, or older rawhide packages must be installed anymore. Make sure to disable any Fedora 15 and Fedora 16 repositories in yum!
Any files with conflicting names, which the conversion could not resolve, will be backed up to files named *.usrmove~ residing in /usr/lib, /usr/lib64, /usr/bin and /usr/sbin.
Verify that dracut really completed the conversion. The log messages, which dracut has generated during bootup, can be retrieved with:
# dmesg | grep dracut
After a successful conversion, revert the changes made to the kernel command line in the bootloader config file /etc/grub*.cfg.
Then run,
# yum --releasever=17 update rpm # rm -f /var/lib/rpm/__* # rpm --rebuilddb # yum --releasever=17 --disableplugin=presto --skip-broken distro-sync # fixfiles onboot
After upgrading, all should be set and done.
Have fun with your system and say “Good bye” to /bin, /sbin, /lib, /lib64 and meet them in /usr.
Fedora 15 -> Fedora 16
First install the new fedora 16 gpg key. You may wish to verify this package against https://fedoraproject.org/keys and the fedora ssl certificate.
rpm --import https://fedoraproject.org/static/A82BA4B7.txt
Next run chkconfig --list
and note the enabled services; you will need to re-enable these with systemctl enable xxxxx.service
after you reboot, as the sysvinit
settings aren't propagated into systemd
. See release notes for more details.
Upgrade all packages with
yum update yum yum clean all yum --releasever=16 --disableplugin=presto distro-sync
If your system uses a BIOS, or you installed Fedora via BIOS emulation mode on an EFI system (not native EFI mode), you can switch to Fedora 16's supported grub2 bootloader with the following instructions. If your system was installed by native EFI boot, do not switch to grub2, as its EFI support is still unreliable. Fedora 16's supported bootloader for native EFI installations is still grub-legacy, so you should simply continue to use the system without making any special changes to the bootloader configuration.
To switch to grub2, run the command su -c '/sbin/grub2-mkconfig -o /boot/grub2/grub.cfg'
, then proceed as described above with reinstalling the bootloader.
Known you upgrade -specific issues (for common problems, see references above):
- Bug 743022 - F15->F16 yum update fails with IMSM (BIOS) raid
Fedora 14 -> Fedora 15
First install the new fedora 15 gpg key. You may wish to verify this package against https://fedoraproject.org/keys and the fedora ssl certificate.
rpm --import https://fedoraproject.org/static/069C8460.txt
Upgrade all packages with
yum update yum yum clean all yum --releasever=15 --disableplugin=presto distro-sync
- Do not run this from within an X terminal. Testing shows that X might hang while updating bitmap font packages.
- There exist .drpms, but they don't match, due to a format change, so better disable the presto plugin by adding the option "--disableplugin=presto" (without quotes) when running yum.
- The F15
screen
client is not capable of attaching to F14screen
sessions. Thus, if you want to run the upgrade underscreen
, you should either upgradescreen
itself in a separate operation or make a separate copy ofscreen
to use throughout the process. - mysql 5.5.20 shipped with F15 uses InnoDB as default storage engine. After upgrading, mysqld could refuse to start-up with error Unknown/unsupported storage engine: InnoDB if argument skip-innodb is given on command line or configuration file /etc/my.cnf. Workarounds are removing the line (InnoDB will be run as default engine), or adding default-storage-engine command options specifying some other storage engine.
VirtualBox guest upgrades
The steps above work perfectly for upgrading a Fedora 14 guest to Fedora 15, but you also need to remove the Guest Additions. If you forget, F14 -> F15 upgrades will seem to fail after the first reboot. If that happens, log in to the console with CTRL+ALT+F2 and reinstall the guest additions manually:
mount /dev/cdrom /media # if /dev/cdrom does not exist, try: # mount /dev/sr0 /media /bin/sh /media/VBoxLinuxAdditions.run reboot
Fedora 13 -> Fedora 14
First install the new fedora 14 gpg key. You may wish to verify this package against https://fedoraproject.org/keys and the fedora ssl certificate.
rpm --import https://fedoraproject.org/static/97A1071F.txt
Upgrade all packages with
yum update yum yum clean all yum --releasever=14 distro-sync
- If using VirtualBox from the Oracle repository, you must remove the VirtualBox-3.1 package before upgrading. After the upgrade is finished, install VirtualBox-3.2.
If you are running SELinux you may be locked out of your machine and required to boot to single user mode to fix up your machine. Redhat bug 702865 describes a fix as:
setenforce 0
yum remove selinux-policy selinux-policy-targeted
rm -rf /etc/selinux/targeted
If, after upgrading you want selinux back:
yum install selinux-policy selinux-policy-targeted
fixfiles restore
reboot