Welcome! Log In Create A New Profile

Advanced

Upgrading to Debian stretch

Posted by bodhi 
Upgrading to Debian stretch
July 18, 2017 10:59PM
Ugrading to Debian stretch

This is a brief instruction about how to upgrade to Debian stretch from jessie. It also applicable to all other Debian version upgrade, i.e wheezy to jessie, stretch to the future Debian stable version.

I assume you are currently running one of my customed kernel release linux-image-xx.xx.xx-kirkwood-tld-xx from this thread. This is the reason for this post, since upgrading to the next Debian release while running a customed kernel could potentially cause some out-of-sync in the boot files. The following are 2 sections, one of them might be applicable to your system. And also see Note (section 3) at the end for how to solve possible error during upgrade. If needed in the furture, I will add more sections to this post to cover some special cases.

1. Have installed only my released kernel images

Your system is running only my released kernel linux-image-xx.xx.xx-kirkwood-tld-xx. It has never been upgraded to mainline kernel or previously running mainline kernel. Usually because you started with my released rootfs from this thread.

Back up your rootfs before starting the following steps.

a. Update the apt source list to stretch. Your source should look like the following. Note that it is a good idea to adjust the repo to near your locale, and use ftp where available.

cat /etc/apt/sources.list

deb http://ftp.us.debian.org/debian stretch main
deb-src http://ftp.us.debian.org/debian stretch main

deb http://security.debian.org/ stretch/updates main contrib non-free
deb-src  http://security.debian.org/ stretch/updates main contrib non-free

deb     http://http.debian.net/debian stretch-updates main contrib
deb-src http://http.debian.net/debian stretch-updates main contrib


b. Run full upgrade (or you can choose to do minimal upgrade with step c).

apt-get update
apt-get dist-upgrade


c. Skip this if you've chosen step b. Run minimal upgrade if you want to do it slow, and then update to stretch for certain packages in the future when necessary. This is OK to do if you don't care much about having your system running every latest Debian package versions (there are a lot of packages that you might never use).

apt-get update
apt-get upgrade

d. Check fstab before rebooting. Debian stretch now has stricter rules, and rejects the old syntax in fstab. So if your rootfs still has the old entry like this
/dev/root      /               ext3    noatime,errors=remount-ro 0 1

Then edit /media/sdb1/etc/fstab entry for root device to the new syntax to use the rootfs label:
LABEL=rootfs    /               ext3    noatime,errors=remount-ro 0 1

e. Usually a distribution upgrade like this would result in a new initramfs. So regenerate the uInitrd boot file. See section 4 in my kernel/rootfs installation for how to recreate uInitrd. It should look like this example:

cd /boot
mkimage -A arm -O linux -T ramdisk -C gzip -a 0x00000000 -e 0x00000000 -n initramfs-4.11.3-kirkwood-tld-2 -d initrd.img-4.11.3-kirkwood-tld-2 uInitrd


2. Have installed a mix of my released kernel images and mainline kernel images

Your system is running my released kernel linux-image-xx.xx.xx-kirkwood-tld-xx, and also you had previously installed and run some mainline kernel in this system. Usually because you started with a Debian installation (e.g. Debian netboot, Debian CD,…).

Back up your rootfs before starting the following steps.

a. Update the apt source list to stretch. Your source should look like the following. Note that it is a good idea to adjust the repo to near your locale, and use ftp where available.

cat /etc/apt/sources.list

deb http://ftp.us.debian.org/debian stretch main
deb-src http://ftp.us.debian.org/debian stretch main

deb http://security.debian.org/ stretch/updates main contrib non-free
deb-src  http://security.debian.org/ stretch/updates main contrib non-free

deb     http://http.debian.net/debian stretch-updates main contrib
deb-src http://http.debian.net/debian stretch-updates main contrib

b. Remove all mainline kernels that have been installed. Check for previous versions:

dpkg -l | grep -i linux-image

and purge each of these linux-image when you found them. The image name would indicate a mainline kernel when there is no -kirkwood-tld-xx postfix.

dpkg —purge linux-image-xx.xx.xx

c. Run full upgrade (or you can choose to do minimal upgrade with step c).

apt-get update
apt-get dist-upgrade

d. Skip this if you've chosen step b. Run minimal upgrade if you want to do it slow, and then update to stretch for certain packages in the future when necessary. This is OK to do if you don't care much about having your system running every latest Debian package version (there are a lot of packages that you might never use).

apt-get update
apt-get upgrade

e. Check fstab before rebooting. Debian stretch now has stricter rules, and rejects the old syntax in fstab. So if your rootfs still has the old entry like this
/dev/root      /               ext3    noatime,errors=remount-ro 0 1

Then edit /media/sdb1/etc/fstab entry for root device to the new syntax to use the rootfs label:
LABEL=rootfs    /               ext3    noatime,errors=remount-ro 0 1

f. Usually a distribution upgrade like this would result in a new initramfs. So regenerate the uInitrd boot file. See section 4 in my kernel/rootfs installation for how to recreate uInitrd. It should look like this example:

cd /boot
mkimage -A arm -O linux -T ramdisk -C gzip -a 0x00000000 -e 0x00000000 -n initramfs-4.11.3-kirkwood-tld-2 -d initrd.img-4.11.3-kirkwood-tld-2 uInitrd


3. Note:

a. Public Key error because of old Debian keyring.

If you encountered key error while running apt-get update:

Quote

W: There is no public key available for the following key IDs:

So install new keyring for stretch:

apt-get install debian-keyring debian-archive-keyring

And then resume the upgrade with apt-get update again.


b. Rootfs mounting syntax change in fstab cause problem during booting.

See section 1d or 2e above, if you encounters problem mounting rootfs.


c. NFS rootfs booting problem.

Debian stretch has a behavioral change in NFS server: it will not provide NFS V2 protocol by default, and u-boot had always been using NFS V2 to load the kernel from the rootfs. The later u-boot versions in 2017 has finnally got V3 capability (It will be available when I release new u-boots for 2017).

See tsunulukai's solution about how to set the nfs server to accept NFS v2:
http://forum.doozan.com/read.php?3,12261,35307#msg-35307

-bodhi
===========================
Wiki
latest Kirkwood kernel builds and rootfs
latest u-boot-kirkwood builds
latest Oxnas kernel builds and rootfs
latest u-boot-oxnas builds
latest MVEBU Armada kernel builds and rootfs
U-Boot & Kernel Booting process
bodhi's u-boot GitHub
bodhi's corner



Edited 3 time(s). Last edit at 08/07/2017 05:16PM by bodhi.
Re: Upgrading to Debian stretch
July 19, 2017 06:55AM
Thanks @bodhi :)

Don Charisma ... because anything is possible with Charisma

My blog - http://DonCharisma.org
Our commercial site - http://DonCharisma.com
Armin
Re: Upgrading to Debian stretch
July 20, 2017 12:28AM
Hello bodhi, will you release a stretch rootfs?
Re: Upgrading to Debian stretch
July 20, 2017 01:23AM
Armin Wrote:
-------------------------------------------------------
> Hello bodhi, will you release a stretch rootfs?

I will, sometime in the next few days!

-bodhi
===========================
Wiki
latest Kirkwood kernel builds and rootfs
latest u-boot-kirkwood builds
latest Oxnas kernel builds and rootfs
latest u-boot-oxnas builds
latest MVEBU Armada kernel builds and rootfs
U-Boot & Kernel Booting process
bodhi's u-boot GitHub
bodhi's corner
Re: Upgrading to Debian stretch
July 23, 2017 04:47AM
I've seen that during several updates from Debian Jessie to Stretch and later "/var/cache/man" isn't accessible so the following should be done
before "apt(-get) upgrade":

rm -fr /var/cache/man

The man page db gets recreated /rebuilt during update so there is no harm
Re: Upgrading to Debian stretch
July 23, 2017 11:36PM
Re: Upgrading to Debian stretch
July 26, 2017 06:53PM
There might some problem with NFS rootfs, after all. I've posted here in the kernel thread:

http://forum.doozan.com/read.php?2,12096,35646#msg-35646

The upgraded new nfs-server seems to have some behavioral changes that could cause problem with older u-boot "nfs" command. If you use tftp command to load the kernel then it seems to be OK.

So if you are seeing problem with u-boot loading kernel from NFS rootfs after a reboot, this might be it.

-bodhi
===========================
Wiki
latest Kirkwood kernel builds and rootfs
latest u-boot-kirkwood builds
latest Oxnas kernel builds and rootfs
latest u-boot-oxnas builds
latest MVEBU Armada kernel builds and rootfs
U-Boot & Kernel Booting process
bodhi's u-boot GitHub
bodhi's corner
Re: Upgrading to Debian stretch
July 26, 2017 09:55PM
I think the problem is that Debian stretch has changed the default to NFS v3. We need to add a switch to tell it to accept NFS v2 (which is what older u-boot used).

-bodhi
===========================
Wiki
latest Kirkwood kernel builds and rootfs
latest u-boot-kirkwood builds
latest Oxnas kernel builds and rootfs
latest u-boot-oxnas builds
latest MVEBU Armada kernel builds and rootfs
U-Boot & Kernel Booting process
bodhi's u-boot GitHub
bodhi's corner
Re: Upgrading to Debian stretch
July 27, 2017 02:30AM
Re: Upgrading to Debian stretch
August 07, 2017 05:05PM
I've revised step 1d and 2e in the 1st post. Also added tsunulukai's solution for NFS rootfs booting problem after upgrading to stretch.

-bodhi
===========================
Wiki
latest Kirkwood kernel builds and rootfs
latest u-boot-kirkwood builds
latest Oxnas kernel builds and rootfs
latest u-boot-oxnas builds
latest MVEBU Armada kernel builds and rootfs
U-Boot & Kernel Booting process
bodhi's u-boot GitHub
bodhi's corner
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: