Upgrading Alpine

From Alpine Linux
Revision as of 15:38, 15 September 2008 by Mhavela (talk | contribs) (→‎Upgrade USB media: Changed Alpine version while editing)
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

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
  • Upgrade Alpine CD/USB
  • Execute upgrade script
  • Save changes
  • Reboot

Backing up current config

Its recommended to make a backup of your config before you start.
The idea is to save the (*apkovl*) from your media to a safe place.
If you need to rollback, simply revert to your old *apkovl.tar.gz*.

Backing up Floppy media

You could replace the existing floppy with a new (dos-formatted) floppy and then run the command:

lbu ci floppy

Backing up USB media

You can just create a directory on the USB called old and move your old config to this folder.

mkdir /media/usb/old
mv /media/usb/*apkovl.tar.gz /media/usb/old/

Download new Alpine

Download latest ISO image (or USB image).

Upgrade CD media

Burn the ISO on a blank CD and replace the existing CD with the new.

/etc/init.d/modloop stop
eject

Now you should insert the new media.

/etc/init.d/modloop start

Upgrade USB media

On USB installations you can just download and unpack the latest tar directly to /media/usb.

$ wget -C /media/usb -q -O - \
      http://distrib-coffee.ipsl.jussieu.fr/pub/linux/alpine/alpine/v1.7/usbdrive/alpine-1.7.22-i386.tar.gz \
      | tar -zvx

Execute upgrade script

The new media has a upgrade script found on root level on media (/media/cdrom/upgrade or /media/usb/upgrade).
Start by executing this script (in our example below we use CD media).

/media/cdrom/upgrade

Example on how a upgrade could look

Before actually upgrading packages it will get 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)
busybox-1.5.0-r1                    <  needs updating (index has 1.7.1)

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:

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

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/init.d/syslog
/etc/init.d/networking
/etc/init.d/modloop

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 dont merge this change, 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'.

Save changes

Now that all upgrades are done, we should save our settings to our media (which you hopefully have backed up).

lbu ci

Rebooting

In most cases you will need to reboot Alpine (specially if there are changes in the kernel):

kill 1

Note: If you know what you are doing, you might not need to reboot.
But make sure that all services affected by the upgrade are restarted.