How to update kernel in official image

I’m trying to using official image on our x86 devices, but wifi and 4g do not work. so i want to build kernel (branch is master) and update kernel.but it report this error:

root@localhost:/home/cyndent# snap info pc-kernel_4.4.0-161.189_i386.snap 
path:       "pc-kernel_4.4.0-161.189_i386.snap"
name:       pc-kernel
summary:    The Ubuntu generic Linux kernel
version:    4.4.0-161.189 kernel
build-date: today at 08:10 UTC
license:    unset
description: |
  This Ubuntu generic Linux kernel
type: kernel
root@localhost:/home/cyndent# snap list
Name       Version        Rev   Tracking  Publisher   Notes
core       16-2.41        7712  stable    canonical✓  core
pc         16.04-0.10     34    stable    canonical✓  gadget
pc-kernel  4.4.0-157.185  259   stable    canonical✓  kernel
root@localhost:/home/cyndent# snap install pc-kernel_4.4.0-161.189_i386.snap --devmode --dangerous 
error: cannot perform the following tasks:
- Mount snap "pc-kernel" (unset) (cannot replace signed kernel snap with an unasserted one)

i use --devmode --dangerous to update kernel ,but it do not work.

If i need to make a new image by myself to update kernel?

Yes, AFAIK, you cannot switch between an signed kernel and an unsigned kernel, you will need to build a new image with the unsigned kernel in it.

if your original image was a local build using a locally built kernel as well, you can use snap install --dangerous <kernel snapfile> on the device… but as Ian said, this only works when your original image was already using a local kernel snap via the --extra-snaps option to ubuntu-image.

I think you can try “snap ack pc-kernel_4.4.0-161.189_i386.assert” first.

a locally built kernel snap will not have an .assert file, this gets generated only by the store on upload of a snap when the snap gets its gpg signature. snap ack ... only helps with official kernels downloaded from the store.

1 Like

Hi ogra,
I updated my local installed kernel.snap version 1.0 with new local kernel.snap version 2.0.
The difference between old and new kernel.snap is version 1.0 and 2.0 in snapcraft.yaml.
Kernel version updated from 1.0 to 2.0 if “snap list” to check after auto reboot.
But kernel version changed back to 1.0 after 10 mins without reboot.
Is it reasonable? And how to avoid this?

check with snap changes for errors … and look at error details with snap tasks <change ID>

1 Like