Missing initrd.img-core in os.snap
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Snapcraft |
Fix Released
|
Undecided
|
Paolo Pisati | ||
snapd |
Fix Released
|
Undecided
|
Sergio Cazzolato |
Bug Description
I'm puzzled by this new "behaviour" of the kernel plugin in snapcraft - it's reproducible in every version i tried (2.35...2.38).
$ cat snapcraft.yaml
name: kernel
version: 4.13.16+
summary: Linux kernel
description: The upstream Linux kernel
grade: stable
confinement: strict
type: kernel
parts:
kernel:
plugin: kernel
source: .
source-type: git
kernel-
$ cd linux-vanilla (any recent vanilla linux tree will work, i'm using stable/linux-4.13.y FWIW)
$ make defconfig
$ snapcraft
...
Generating driver initrd for kernel release: 4.13.16+
Parallel unsquashfs: Using 4 processors
2 inodes (2 blocks) to write
[======
created 0 files
created 4 directories
created 2 symlinks
created 0 devices
created 0 fifos
...
Traceback (most recent call last): [3252/9137]
File "/home/
obj=
File "/usr/lib/
return self.main(*args, **kwargs)
File "/usr/lib/
rv = self.invoke(ctx)
File "/usr/lib/
return Command.
File "/usr/lib/
return ctx.invoke(
File "/usr/lib/
return callback(*args, **kwargs)
File "/usr/lib/
return f(get_current_
File "/home/
ctx.
File "/usr/lib/
return self.invoke(cmd, **kwargs)
File "/usr/lib/
return callback(*args, **kwargs)
File "/home/
project_
File "/home/
execute(
File "/home/
_Executor(
File "/home/
self.
File "/home/
getattr(part, step)()
File "/home/
self.
File "/home/
self.
File "/home/
self.
File "/home/
initrd_
File "/home/
mime_type = mime_detector.
File "/home/
return str(r, 'utf-8')
TypeError: coercing to str: need a bytes-like object, NoneType found
so i added the following debug patch and snapped again:
diff --git a/snapcraft/
index c1e81e4..e388c2c 100644
--- a/snapcraft/
+++ b/snapcraft/
@@ -60,6 +60,7 @@ import glob
import logging
import magic
import os
+import pty
import shutil
import subprocess
import tempfile
@@ -248,6 +249,11 @@ class KernelPlugin(
# Make sure we're getting the mime type of the actual initrd, not
# a symbolic link.
+ logger.
+ myfile = os.path.
+ if not os.path.
+ logger.
+ pty.spawn(
if not mime_type:
$ snapcraft
...
created 0 files
created 4 directories
created 2 symlinks
created 0 devices
created 0 fifos
tmp_initrd_path: /tmp/tmp27aod6n
Missing initrd, spwaning a shell
$ find /tmp/tmp27aod6n
/tmp/tmp27aod6n
/tmp/tmp27aod6n
/tmp/tmp27aod6n
/tmp/tmp27aod6n
/tmp/tmp27aod6n
/tmp/tmp27aod6n
$ ls -la /tmp/tmp27aod6n
total 8
drwxr-xr-x 2 flag flag 4096 nov 30 18:38 .
drwxr-xr-x 3 flag flag 4096 nov 30 18:38 ..
lrwxrwxrwx 1 flag flag 29 nov 30 18:37 initrd.img-core -> ../../.
lrwxrwxrwx 1 flag flag 42 nov 30 18:37 initrd.
$ cat /tmp/tmp27aod6n
cat: /tmp/tmp27aod6n
Manually unsquashing os.snap, there's this:
$ unsquashfs -d foobar ./parts/
$ find foobar -name \initrd\*
foobar/
foobar/
foobar/
foobar/
foobar/
foobar/
foobar/
foobar/
foobar/
foobar/
foobar/
foobar/
$ ls -la foobar/
lrwxrwxrwx 1 flag flag 29 nov 30 18:37 foobar/
$ md5sum foobar/
e4b9d74334b4f40
Was initrd.img-core moved from usr/lib/
Changed in snapcraft: | |
assignee: | nobody → Paolo Pisati (p-pisati) |
status: | New → Fix Committed |
Changed in snapcraft: | |
status: | Fix Committed → Fix Released |
And indeed, the attached patch fixes it - can i have any confirmation about this?
And what do we want to do to avoid any future breakage like this? I think building a kernel snap should be part of the snapcraft and snapd test pipeline.