snapd cannot refresh on some SD cards due to uboot bug
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
snapd |
Fix Released
|
High
|
Samuele Pedroni | ||
u-boot (Ubuntu) |
Fix Released
|
Medium
|
Łukasz Zemczak | ||
Bionic |
Fix Released
|
Medium
|
Unassigned | ||
Focal |
Fix Released
|
Medium
|
Unassigned |
Bug Description
Analysis of a specific Pi device resulted in mystery of failure to upgrade core18 or other snaps that require writes to FAT bootable partition.
This was finally reproduced with a fixed set of snaps:
- core18 - revision 1076
- pi - revision 17
- pi-kernel - revision 44
- snapd (current version may fail due to session.d bug) - revision 9731 (hard to seed without help)
This combination seems to suffer from:
- lack of fsck.vfat in core18 (fixed later)
- possible malfunction of snapd-specific shutdown helper
Refreshing core18 from this setup results in the following failure (as captured on the serial log), necessitating TWO power cycles to resolve:
U-Boot 2019.04-dirty (Jul 10 2019 - 09:50:40 +0000)
DRAM: 948 MiB
RPI 3 Model B+ (0xa020d3)
MMC: mmc@7e202000: 0, sdhci@7e300000: 1
Loading Environment from FAT... OK
In: serial
Out: serial
Err: serial
Net: No ethernet found.
Hit any key to stop autoboot: 0
switch to partitions #0, OK
mmc0 is current device
LOADBOOTENV
Running uenvcmd ...
ENVCMD
Saving Environment to FAT... wait_transfer_
mmc write failed
Error: writing directory entry
OK
previous command (24) not complete (EDM 00010807)
previous command (24) not complete (EDM 00010807)
previous command (24) not complete (EDM 00010807)
previous command (24) not complete (EDM 00010807)
previous command (24) not complete (EDM 00010807)
previous command (24) not complete (EDM 00010807)
** Can't read partition table on 0:0 **
** Invalid partition 1 **
previous command (24) not complete (EDM 00010807)
previous command (24) not complete (EDM 00010807)
previous command (24) not complete (EDM 00010807)
previous command (24) not complete (EDM 00010807)
previous command (24) not complete (EDM 00010807)
previous command (24) not complete (EDM 00010807)
** Can't read partition table on 0:0 **
** Invalid partition 1 **
previous command (24) not complete (EDM 00010807)
WARNING at drivers/
3314130 bytes read in 154 ms (20.5 MiB/s)
42079 bytes read in 36 ms (1.1 MiB/s)
Bad Linux ARM zImage magic!
Scanning mmc 0:1...
Scanning mmc 0:2...
starting USB...
USB0: scanning bus 0 for devices... 4 USB Device(s) found
scanning usb for storage devices... 0 Storage Device(s) found
Device 0: unknown device
lan78xx_eth Waiting for PHY auto negotiation to complete...... done
BOOTP broadcast 1
BOOTP broadcast 2
BOOTP broadcast 3
DHCP client bound to address 192.168.2.106 (757 ms)
*** ERROR: `serverip' not set
Cannot autoload with TFTPGET
missing environment variable: pxeuuid
missing environment variable: bootfile
Retrieving file: pxelinux.
lan78xx_eth Waiting for PHY auto negotiation to complete....... done
*** ERROR: `serverip' not set
missing environment variable: bootfile
Retrieving file: pxelinux.
lan78xx_eth Waiting for PHY auto negotiation to complete....... done
*** ERROR: `serverip' not set
missing environment variable: bootfile
Retrieving file: pxelinux.
lan78xx_eth Waiting for PHY auto negotiation to complete....... done
*** ERROR: `serverip' not set
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/C0A802
lan78xx_eth Waiting for PHY auto negotiation to complete....... done
*** ERROR: `serverip' not set
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/C0A80
lan78xx_eth Waiting for PHY auto negotiation to complete...
On the first power-cycle the logs say this:
U-Boot 2019.04-dirty (Jul 10 2019 - 09:50:40 +0000)
DRAM: 948 MiB
RPI 3 Model B+ (0xa020d3)
MMC: mmc@7e202000: 0, sdhci@7e300000: 1
Loading Environment from FAT... OK
In: serial
Out: serial
Err: serial
Net: No ethernet found.
Hit any key to stop autoboot: 0
switch to partitions #0, OK
mmc0 is current device
LOADBOOTENV
Running uenvcmd ...
ENVCMD
Saving Environment to FAT... wait_transfer_
mmc write failed
Error: writing directory entry
OK
previous command (24) not complete (EDM 00010807)
previous command (24) not complete (EDM 00010807)
previous command (24) not complete (EDM 00010807)
previous command (24) not complete (EDM 00010807)
previous command (24) not complete (EDM 00010807)
previous command (24) not complete (EDM 00010807)
** Can't read partition table on 0:0 **
** Invalid partition 1 **
previous command (24) not complete (EDM 00010807)
previous command (24) not complete (EDM 00010807)
previous command (24) not complete (EDM 00010807)
previous command (24) not complete (EDM 00010807)
previous command (24) not complete (EDM 00010807)
previous command (24) not complete (EDM 00010807)
** Can't read partition table on 0:0 **
** Invalid partition 1 **
previous command (24) not complete (EDM 00010807)
WARNING at drivers/
3314130 bytes read in 155 ms (20.4 MiB/s)
42079 bytes read in 54 ms (760.7 KiB/s)
Bad Linux ARM zImage magic!
Scanning mmc 0:1...
Scanning mmc 0:2...
starting USB...
USB0: scanning bus 0 for devices... 4 USB Device(s) found
scanning usb for storage devices... 0 Storage Device(s) found
Device 0: unknown device
lan78xx_eth Waiting for PHY auto negotiation to complete...... done
BOOTP broadcast 1
BOOTP broadcast 2
BOOTP broadcast 3
DHCP client bound to address 192.168.2.106 (758 ms)
*** ERROR: `serverip' not set
Cannot autoload with TFTPGET
missing environment variable: pxeuuid
missing environment variable: bootfile
Retrieving file: pxelinux.
lan78xx_eth Waiting for PHY auto negotiation to complete....... done
*** ERROR: `serverip' not set
missing environment variable: bootfile
Retrieving file: pxelinux.
lan78xx_eth Waiting for PHY auto negotiation to complete....... done
*** ERROR: `serverip' not set
missing environment variable: bootfile
Retrieving file: pxelinux.
lan78xx_eth Waiting for PHY auto negotiation to complete....... done
*** ERROR: `serverip' not set
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/C0A802
lan78xx_eth Waiting for PHY auto negotiation to complete...... done
*** ERROR: `serverip' not set
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/C0A80
lan78xx_eth Waiting for PHY auto negotiation to complete..... done
*** ERROR: `serverip' not set
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/C0A8
lan78xx_eth Waiting for PHY auto negotiation to complete....... done
*** ERROR: `serverip' not set
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/C0A
lan78xx_eth Waiting for PHY auto negotiation to complete....... done
*** ERROR: `serverip' not set
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/C0
lan78xx_eth Waiting for PHY auto negotiation to complete....... done
*** ERROR: `serverip' not set
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/C
lan78xx_eth Waiting for PHY auto negotiation to complete....... done
*** ERROR: `serverip' not set
missing environment variable: bootfile
Retrieving file: pxelinux.
lan78xx_eth Waiting for PHY auto negotiation to complete....... done
*** ERROR: `serverip' not set
missing environment variable: bootfile
Retrieving file: pxelinux.
lan78xx_eth Waiting for PHY auto negotiation to complete....... done
*** ERROR: `serverip' not set
missing environment variable: bootfile
Retrieving file: pxelinux.
lan78xx_eth Waiting for PHY auto negotiation to complete....... done
*** ERROR: `serverip' not set
Config file not found
lan78xx_eth Waiting for PHY auto negotiation to complete....
Finally on the second power cycle the logs contain:
U-Boot 2019.04-dirty (Jul 10 2019 - 09:50:40 +0000)
DRAM: 948 MiB
RPI 3 Model B+ (0xa020d3)
MMC: mmc@7e202000: 0, sdhci@7e300000: 1
Loading Environment from FAT... OK
In: serial
Out: serial
Err: serial
Net: No ethernet found.
Hit any key to stop autoboot: 0
switch to partitions #0, OK
mmc0 is current device
LOADBOOTENV
Running uenvcmd ...
ENVCMD
Saving Environment to FAT... wait_transfer_
mmc write failed
Error: writing directory entry
OK
previous command (24) not complete (EDM 00010807)
previous command (24) not complete (EDM 00010807)
WARNING at drivers/
6693376 bytes read in 304 ms (21 MiB/s)
3314130 bytes read in 148 ms (21.4 MiB/s)
42079 bytes read in 55 ms (747.1 KiB/s)
Kernel image @ 0x200000 [ 0x000000 - 0x662200 ]
## Flattened Device Tree blob at 02000000
Booting using the fdt blob at 0x2000000
Loading Ramdisk to 3ac19000, end 3af4c631 ... OK
Loading Device Tree to 3ac0f000, end 3ac18526 ... OK
Starting kernel ...
(boot proceeds normally)
Searching the web seems to suggest that uboot is waiting insufficiently for the FAT write to complete: https://<email address hidden>
CVE References
tags: | added: fr-850 |
Changed in snapd: | |
importance: | Undecided → High |
Changed in snapd: | |
status: | In Progress → Won't Fix |
status: | Won't Fix → Fix Released |
Fixing this issue is complicated by the unfortunate update of the pi/18 gadget for armhf to 256MB boot partition. Some devices in the field have 128MB partitions, other have 256MB, depending on just when the particular image was built.
This prevents us from updating the gadget / bootloader as the sanity check logic will refuse this update.
The second issue is that updating kernel and gadget separately is impossible. Updating the boot assets manually shows that the old kernel (revision 44) cannot boot correctly with gadget 74 (current stable). This requires the ability to update those in sync.