Upgrading Alpine Linux to a new release branch
Upgrading Alpine
This document describes how to replace an Alpine installation with a newer version.
The upgrade process consist of the following steps:
- Backup current setup
- Download new version of Alpine
- Replace packages
- Merge config
- Reboot
Backing up current config
Its recommended to make a backup of your config before you start. You can do that by simply replacing the floppy with a new floppy and keep the old one in case you will need to do a rollback. If you store config on USB you migh copy the config file (*apkovl*) to a safe place.
If you use the USB installation and not the CDROM, you can just create a directory on the USB called old and move everything to this dir.
mkdir /media/usb/old mv /media/usb/* /media/usb/old/
Note that this command will try to move the old directory into itself which will give an error message. You can safely ignore this.
If you need to rollback, simply move the contents in directory old back to the root of USB.
Download new Alpine
Download and burn the new ISO image on a separate computer. Replace the CDROM and mount it.
On USB installations you can just download and unpack the latest tar directly to /media/usb.
$ wget -C /media/usb -q -O - \ http://dev.alpinelinux.org/alpine/v1.7/usbdrive/alpine-1.7.6-i386.tar.gz \ | tar -zvx
Execute upgrade script
Execute the upgrade script found on root level on media. (/media/cdrom/upgrade or /media/usb/upgrade). Before actually upgrading packages it will give an overview what packages will be upgraded. It migh look something like this:
~ $ /media/usb/upgrade Upgrading from alpine-1.7.2 to alpine-1.7.6 Will try to upgrade packages from fetching usb://apks/INDEX.md5.gz Looking for new packages... The following packages will be updated: alpine-baselayout-1.4.1-r1 < needs updating (index has 1.6.0) alpine-conf-0.9 < needs updating (index has 1.0) bind-tools-9.4.1-r1 < needs updating (index has 9.4.1_p1) busybox-1.5.0-r1 < needs updating (index has 1.7.1) iproute2-2.6.19.20061214 < needs updating (index has 2.6.20.20070313) iptables-1.3.5-r4 < needs updating (index has 1.3.8-r1) libpcap-0.9.5 < needs updating (index has 0.9.7) openssh-4.5_p1-r1 < needs updating (index has 4.7_p1-r1) openssl-0.9.8d < needs updating (index has 0.9.8e-r2) openswan-2.4.8 < needs updating (index has 2.5.15) shorewall-3.4.3 < needs updating (index has 3.4.6) shorewall-doc-3.4.2 < needs updating (index has 3.4.6) tcpdump-3.9.5-r2 < needs updating (index has 3.9.7-r1) Press Enter to continue or Ctrl-c to abort.
Verify that it looks ok and press enter to start the upgrade.
As a first step the upgrade script will try to upgrade apk-tools, uclibc and busybox. Then it will upgrade all packages by running apk_add -u. It will look something like this:
apk-tools-0.13 is installed. Skipping apk-tools-0.13. uclibc-0.9.28.3 is installed. Skipping uclibc-0.9.28.3. fetching usb://apks/busybox-1.7.1.apk updating busybox-1.5.0-r1 to busybox-1.7.1 fetching usb://apks/alpine-baselayout-1.6.0.apk updating alpine-baselayout-1.4.1-r1 to alpine-baselayout-1.6.0 fetching usb://apks/alpine-conf-1.0.apk updating alpine-conf-0.9 to alpine-conf-1.0 fetching usb://apks/bind-tools-9.4.1_p1.apk updating bind-tools-9.4.1-r1 to bind-tools-9.4.1_p1 busybox-1.7.1 is installed. Skipping busybox-1.7.1. fetching usb://apks/iproute2-2.6.20.20070313.apk updating iproute2-2.6.19.20061214 to iproute2-2.6.20.20070313 fetching usb://apks/iptables-1.3.8-r1.apk updating iptables-1.3.5-r4 to iptables-1.3.8-r1 fetching usb://apks/libpcap-0.9.7.apk updating libpcap-0.9.5 to libpcap-0.9.7 fetching usb://apks/openssh-4.7_p1-r1.apk updating openssh-4.5_p1-r1 to openssh-4.7_p1-r1 fetching usb://apks/openssl-0.9.8e-r2.apk updating openssl-0.9.8d to openssl-0.9.8e-r2 fetching usb://apks/openswan-2.5.15.apk updating openswan-2.4.8 to openswan-2.5.15 fetching usb://apks/shorewall-3.4.6.apk updating shorewall-3.4.3 to shorewall-3.4.6 fetching usb://apks/shorewall-doc-3.4.6.apk updating shorewall-doc-3.4.2 to shorewall-doc-3.4.6 fetching usb://apks/tcpdump-3.9.7-r1.apk updating tcpdump-3.9.5-r2 to tcpdump-3.9.7-r1
When then apk_add application upgrades packages, it will detect that you have modified some config files. Instead of overwriting your config, it will install the new config with the suffix .apk-new. This way you are able to review and merge in changes from the default config to your own config file. Config files that are untouched will just silently be replaced.
The upgrade script will execute update-conf to assist you in merging the config files. It will first display a list of config files that you will need to take care of manually. Like this:
The following config files have been updated and need attention: /etc/profile /etc/modules /etc/inittab /etc/hosts /etc/shorewall/zones /etc/shorewall/tunnels /etc/shorewall/tos /etc/shorewall/shorewall.conf /etc/shorewall/rules /etc/shorewall/policy /etc/shorewall/params /etc/shorewall/masq /etc/shorewall/interfaces /etc/shorewall/hosts /etc/shorewall/accounting /etc/ipsec/ipsec.conf /etc/ipsec/ipsec.d/policies/private-or-clear /etc/ipsec/ipsec.d/policies/private /etc/ipsec/ipsec.d/policies/clear-or-private /etc/ipsec/ipsec.d/policies/clear /etc/ipsec/ipsec.d/policies/block /etc/ipsec/ipsec.d/examples/no_oe.conf /etc/ipsec/ipsec.d/examples/l2tp-psk.conf /etc/ipsec/ipsec.d/examples/l2tp-psk-orgWIN2KXP.conf /etc/ipsec/ipsec.d/examples/l2tp-cert.conf /etc/ipsec/ipsec.d/examples/l2tp-cert-orgWIN2KXP.conf /etc/ssh/sshd_config /etc/ssh/ssh_config /etc/init.d/ipsec /etc/init.d/sshd /etc/init.d/syslog /etc/init.d/networking /etc/init.d/modloop /etc/init.d/bootmisc.sh
Afterward it will step through every file, displaying a diff and give you options to act.
--- /etc/profile 2007-05-31 14:11:47 +0000 +++ /etc/profile.apk-new 2007-09-07 06:33:36 +0000 @@ -1,4 +1,3 @@ export PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin export PAGER=less umask 022 -export LBU_MEDIA=usb New /etc/profile available: Quit, Next, Show diff, Edit new, Zap new, Use new (q/n/s/e/z/u) [s]:
In this case we have added export LBU_MEDIA==usb so we don't need to specify the media to 'lbu. We want to keep our current file as it is so we just press z (and Enter) to zap the new config and keep the old.
Next is file is /etc/modules
--- /etc/modules 2007-05-09 16:02:31 +0000 +++ /etc/modules.apk-new 2007-09-07 06:33:36 +0000 @@ -1,4 +1,2 @@ deadline-iosched af_packet -xt_state -xt_tcpudp New /etc/modules available: Quit, Next, Show diff, Edit new, Zap new, Use new (q/n/s/e/z/u) [s]:
Also here we just keep the current config by pressing z since the modules are needed for our ipsec.
Next file is /etc/inittab:
--- /etc/inittab 2007-06-20 13:21:20 +0000 +++ /etc/inittab.apk-new 2007-09-07 06:33:36 +0000 @@ -4,7 +4,7 @@ ::wait:/etc/init.d/rcL # Set up a couple of getty's -::respawn:/sbin/cttyhack /sbin/getty - 9600 vt100 +::respawn:/usr/bin/cttyhack /sbin/getty - 9600 vt100 tty2::respawn:/sbin/getty 38400 tty2 tty3::respawn:/sbin/getty 38400 tty3 tty4::respawn:/sbin/getty 38400 tty4 New /etc/inittab available: Quit, Next, Show diff, Edit new, Zap new, Use new (q/n/s/e/z/u) [s]:
This time the change is not caused by us, but its a change in the default config. This is even related to where the login screen should appear so if we don merge this change in we might not be able to see the login screen! We choose u to use the new config.
Continue go through every config file. Sometimes you might want to edit the new file, or leave the upgrade process to take care of the config file manually by using option q. You can always resume later by either running the upgrade script again or by executing update-conf -i.