Ubuntu Core cannot find 'writable' partition


#1

I created an Ubuntu Core image with a custom kernel snap. The kernel was build using the following:

git clone https://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/bionic
git checkout Ubuntu-4.15.0-28.30

I apply the below patches to the snapcraft.yaml file to fix build issues:

I then run sudo snapcraft in the repo and successfully built the kernel snap.

Then after I create the ubuntu core image using the extra kernel snap:
ubuntu-image snap --debug -o ubuntu-core.bin --extra-snaps my-built-kernel.snap

When booting the Ubuntu Core image I receive the following error:

I cannot execute any commands in BusyBox. I have not had this problem when using the standard pc-kernel snap provided by Canonical. Any input is greatly appreciated!


About findfs: unable to resolve 'LABEL=writable'
#2

I am booting from a USB (temporary not long term solution). It looks like I may need to include eMMC support based upon this post: Why snap_core and snap_kernel in boot cmdline but I have not found a good snapcraft.yaml example yet.


#3

If you use USB you should make sure usb storage support is built into your kernel or add usb-storage to your kernel-initrd-modules entry in snapcraft.yaml

https://docs.snapcraft.io/reference/plugins/kernel

(and i’m not sure if 4.15 includes ext4 and vfat as modules or if they are built-in … if they are modules you will need to add them additionally to that snapcraft.yaml entry)


#4

On a side note, I can see the same issue while attempting to launch ubuntu-core from virtual box (not a USB boot), I can run commands in the (initramfs) console as well. I execute the below command:

(initramfs) findfs LABEL=writable
findfs: unable to resolve ‘LABEL=writable’

#5

what’s the output of lsblk --fs?


#6

It looks like it does not exist:

(initramfs) lsblk --fs
/bin/sh: lsblk: not found

I can however, execute the following:

(initramfs) cat /proc/partitions
major minor #blocks name
11            0         1048575 sr0

About findfs: unable to resolve 'LABEL=writable'
#7

you are definitely missing a controller driver here, ake a look at:

it is likely that one of them will allow you to find the disk in /dev/disk/by-label and with findfs, include it in your kernel-initrd-modules in snapcraft.yaml.


#8

Hi @ogra, thanks for the info. I added those modules to the kernel-initrd-modules looks like it has some issues finding the squashfs. Do I need to make a specific source reference to these modules? See below trace:

make -j2 bzImage modules
make -j2 CONFIG_PREFIX=/home/lopezem/Projects/bionic/parts/kernel/install modules_install INSTALL_MOD_PATH=/home/lopezem/Projects/bionic/parts/kernel/install
Generating driver initrd for kernel release: 4.15.18+
Parallel unsquashfs: Using 2 processors
2 inodes (34 blocks) to write

[=================================================================|] 34/34 100%

created 1 files
created 6 directories
created 1 symlinks
created 0 devices
created 0 fifos
25956 blocks
Sorry, Snapcraft ran into an error when trying to running through its
lifecycle that generated the following traceback:
Traceback (most recent call last):
  File "/usr/bin/snapcraft", line 9, in <module>
    load_entry_point('snapcraft==2.42.1', 'console_scripts', 'snapcraft')()
  File "/usr/lib/python3/dist-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3/dist-packages/click/core.py", line 1037, in invoke
    return Command.invoke(self, ctx)
  File "/usr/lib/python3/dist-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3/dist-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/usr/lib/python3/dist-packages/snapcraft/cli/_runner.py", line 79, in run
    ctx.forward(lifecyclecli.commands['snap'])
  File "/usr/lib/python3/dist-packages/click/core.py", line 552, in forward
    return self.invoke(cmd, **kwargs)
  File "/usr/lib/python3/dist-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/snapcraft/cli/lifecycle.py", line 135, in snap
    project_options, directory=directory, output=output)
  File "/usr/lib/python3/dist-packages/snapcraft/internal/lifecycle/_packer.py", line 46, in snap
    execute('prime', project_options)
  File "/usr/lib/python3/dist-packages/snapcraft/internal/lifecycle/_runner.py", line 79, in execute
    _Executor(config, project_options).run(step, part_names)
  File "/usr/lib/python3/dist-packages/snapcraft/internal/lifecycle/_runner.py", line 191, in run
    self._run_step(step, part, part_names)
  File "/usr/lib/python3/dist-packages/snapcraft/internal/lifecycle/_runner.py", line 236, in _run_step
    getattr(part, step)()
  File "/usr/lib/python3/dist-packages/snapcraft/internal/pluginhandler/__init__.py", line 438, in build
    self._runner.build()
  File "/usr/lib/python3/dist-packages/snapcraft/internal/pluginhandler/_runner.py", line 97, in build
    self._builddir)
  File "/usr/lib/python3/dist-packages/snapcraft/internal/pluginhandler/_runner.py", line 160, in _run_scriptlet
    scriptlet_name, function_call.strip())))
  File "/usr/lib/python3/dist-packages/snapcraft/internal/pluginhandler/_runner.py", line 208, in _handle_builtin_function
    function(**function_args)
  File "/usr/lib/python3/dist-packages/snapcraft/plugins/kbuild.py", line 258, in build
    self.do_install()
  File "/usr/lib/python3/dist-packages/snapcraft/plugins/kernel.py", line 465, in do_install
    self._make_initrd()
  File "/usr/lib/python3/dist-packages/snapcraft/plugins/kernel.py", line 293, in _make_initrd
    os.link(src, dst)
FileNotFoundError: [Errno 2] No such file or directory: 'squashfs' -> '/home/lopezem/Projects/bionic/parts/kernel/build/initrd-staging/../../../squashfs'

Here is my snapcraft.yaml file:

name: pc-kernel
version: null
version-script: |
    . debian/debian.env
    dpkg-parsechangelog -l $DEBIAN/changelog -S version
summary: The Ubuntu generic Linux kernel
description: This Ubuntu generic Linux kernel
grade: stable
confinement: strict
type: kernel

parts:
  kernel:
    plugin: kernel
    source: .
    source-type: git
    kconfigflavour: generic
    kconfigs:
      - CONFIG_DEBUG_INFO=n
    kernel-initrd-modules:
      - squashfs
      - ahci
      - libahci
      - usb-storage
      - nls_iso8859-1
      - virtio_scsi
      - sdhci
      - sdhci-pci
      - sdhci-acpi
      - mmc-block
      - hv_storvsc
      - hv_vmbus
    override-build: |
      cp debian/scripts/retpoline-extract-one \
        $SNAPCRAFT_PART_BUILD/scripts/ubuntu-retpoline-extract-one
      snapcraftctl build
    kernel-with-firmware: false
  firmware:
    plugin: nil
    stage-packages:
      - linux-firmware
    organize:
      lib/firmware: firmware
    prime:
      - -usr
      - -lib
    build-packages:
      - cpio
      - libssl-dev

#9

squashfs is apparently built into this kernel config, just drop it from the list (i guess most of these modules are useless anyway for you, sdhci* and mmc* are for SD cards, just drop them as well if you dont boot from MMC or SD… if the build still fails with hv_* drop these as well)


#10

Perfect, this allows me to fully boot on a USB device. SD Card won’t work.

I added the below initrd modules:

kernel-initrd-modules:
      - usb-storage
      - sdhci
      - sdhci-pci
      - sdhci-acpi
      - mmc-block
      - hv_storvsc
      - hv_vmbus

Also, it appears that I am having the below issues as well.

1.) For the TPM I have on board I assume I would need to add that in the snapcraft definition (not sure which stanza)? See below:

lopezem@localhost:~$ sudo grep -rin "tpm" /var/log/syslog
268:Jul 19 17:21:22 localhost kernel: [    0.000000] ACPI: TPM2 0x0000000079E6B170 000034 (v03        Tpm2Tabl 00000001 AMI  00000000)
726:Jul 19 17:21:22 localhost kernel: [    0.778276] ima: No TPM chip found, activating TPM-bypass! (rc=-19)
821:Jul 19 17:21:22 localhost kernel: [   27.472041] tpm tpm0: A TPM error (378) occurred get tpm pcr allocation

2.) I keep getting the following mounting/unmounting message (it is in an endless loop), thus none of the other snaps are being mounted and will not run.

lopezem@localhost:~$ sudo grep -rin "Mount unit for core" /var/log/syslog
973:Jul 19 17:21:36 localhost systemd[1]: Mounting Mount unit for core, revision 4917...
975:Jul 19 17:21:36 localhost systemd[1]: Mounted Mount unit for core, revision 4917.
985:Jul 19 17:21:37 localhost systemd[1]: Unmounted Mount unit for core, revision 4917.
1003:Jul 19 17:21:44 localhost systemd[1]: Mounting Mount unit for core, revision 4917...
1007:Jul 19 17:21:44 localhost systemd[1]: Mounted Mount unit for core, revision 4917.
1023:Jul 19 17:21:45 localhost systemd[1]: Unmounted Mount unit for core, revision 4917.
1037:Jul 19 17:21:52 localhost systemd[1]: Mounting Mount unit for core, revision 4917...
1039:Jul 19 17:21:52 localhost systemd[1]: Mounted Mount unit for core, revision 4917.
1048:Jul 19 17:21:54 localhost systemd[1]: Unmounted Mount unit for core, revision 4917.
1062:Jul 19 17:22:05 localhost systemd[1]: Mounting Mount unit for core, revision 4917...
1064:Jul 19 17:22:05 localhost systemd[1]: Mounted Mount unit for core, revision 4917.
1073:Jul 19 17:22:07 localhost systemd[1]: Unmounted Mount unit for core, revision 4917.

3.) After rebooting I am back into the (initramfs) menu and can no longer boot.


#11

I am also facing this issue with Core18 and PC-kernel=18 in x86 environment.
Do you have any workaround for this.

Thanks
Muthiah