0

I recently restored a pi 3 from a backup. Before the incident that required the restore I had it booting from a USB SSD hard drive. To restore the operating system I simply copied the root directory of the SD card (using rsync -a with --delete-during) to the USB drive.

Next I tried apt-get update and apt-get upgrade. All went smoothly until I got an error like this:

Preparing to unpack .../raspberrypi-bootloader_1.20181112-1_armhf.deb ... /boot appears to be NOOBS recovery partition. Applying fix. Could not determine root partition dpkg: error processing archive /var/cache/apt/archives/raspberrypi-bootloader_1.20181112-1_armhf.deb (--unpack): subprocess new pre-installation script returned error exit status 1 No diversion 'diversion of /boot/start.elf by rpikernelhack', none removed. No diversion 'diversion of /boot/start_cd.elf by rpikernelhack', none removed. No diversion 'diversion of /boot/start_db.elf by rpikernelhack', none removed. No diversion 'diversion of /boot/start_x.elf by rpikernelhack', none removed. No diversion 'diversion of /boot/fixup.dat by rpikernelhack', none removed. No diversion 'diversion of /boot/fixup_cd.dat by rpikernelhack', none removed. No diversion 'diversion of /boot/fixup_db.dat by rpikernelhack', none removed. No diversion 'diversion of /boot/fixup_x.dat by rpikernelhack', none removed. No diversion 'diversion of /boot/bootcode.bin by rpikernelhack', none removed. No diversion 'diversion of /boot/LICENCE.broadcom by rpikernelhack', none removed. Errors were encountered while processing: /var/cache/apt/archives/raspberrypi-bootloader_1.20181112-1_armhf.deb E: Sub-process /usr/bin/dpkg returned an error code (1) 

How can I fix this error and complete the upgrade?

When I made the restore from the SD card to the USB drive I used an rsync exclude file like this:

/proc/* /sys/* /dev/* /boot/* /tmp/* /run/* /mnt/* /media/* .bash_history /etc/fake-hwclock.data /var/lib/rpimonitor/stat/ 

But after this, I wasn't sure whether I needed to copy /boot, but decided to copy it over with sudo cp -r /boot/* /media/usbdrive/boot/.

Following this I set up my cmdline.txt and fstab etc to use the usb drive again instead of the SD after initial boot.

Some other things that might be relevant are

1) output of fdisk -l

pi@raspberrypi:~ $ sudo fdisk -l Disk /dev/ram0: 4 MiB, 4194304 bytes, 8192 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disk /dev/ram1: 4 MiB, 4194304 bytes, 8192 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disk /dev/ram2: 4 MiB, 4194304 bytes, 8192 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disk /dev/ram3: 4 MiB, 4194304 bytes, 8192 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disk /dev/ram4: 4 MiB, 4194304 bytes, 8192 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disk /dev/ram5: 4 MiB, 4194304 bytes, 8192 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disk /dev/ram6: 4 MiB, 4194304 bytes, 8192 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disk /dev/ram7: 4 MiB, 4194304 bytes, 8192 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disk /dev/ram8: 4 MiB, 4194304 bytes, 8192 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disk /dev/ram9: 4 MiB, 4194304 bytes, 8192 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disk /dev/ram10: 4 MiB, 4194304 bytes, 8192 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disk /dev/ram11: 4 MiB, 4194304 bytes, 8192 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disk /dev/ram12: 4 MiB, 4194304 bytes, 8192 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disk /dev/ram13: 4 MiB, 4194304 bytes, 8192 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disk /dev/ram14: 4 MiB, 4194304 bytes, 8192 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disk /dev/ram15: 4 MiB, 4194304 bytes, 8192 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disk /dev/mmcblk0: 14.9 GiB, 15931539456 bytes, 31116288 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0x0004e623 Device Boot Start End Sectors Size Id Type /dev/mmcblk0p1 8192 3279296 3271105 1.6G e W95 FAT16 (LBA) /dev/mmcblk0p2 3279297 31116287 27836991 13.3G 5 Extended /dev/mmcblk0p5 3284992 3350525 65534 32M 83 Linux /dev/mmcblk0p6 3350528 3491839 141312 69M c W95 FAT32 (LBA) /dev/mmcblk0p7 3497984 31116287 27618304 13.2G 83 Linux Disk /dev/sdb: 117.4 GiB, 126035288064 bytes, 246162672 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: gpt Disk identifier: 909F2695-EDB4-4CDE-A258-7EE27E75BD77 Device Start End Sectors Size Type /dev/sdb1 2048 246162638 246160591 117.4G Linux filesystem Disk /dev/sda: 230.5 GiB, 247510073344 bytes, 483418112 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0x00030033 Device Boot Start End Sectors Size Id Type /dev/sda1 * 2048 483409919 483407872 230.5G 83 Linux 

2) my fstab

pi@raspberrypi:~ $ cat /etc/fstab proc /proc proc defaults 0 0 /dev/mmcblk0p1 /boot vfat defaults 0 2 #PARTUUID=d96b7723-01 /boot vfat defaults 0 2 #PARTUUID=d96b7723-02 / ext4 defaults,noatime 0 1 # The USB SSD drive PARTUUID=712ae4a6-73d8-4aca-9ec6-b6e507c95f74 / ext4 defaults,noatime 0 1 # another USB flash drive UUID=978cc26c-be1f-4318-b4c3-6b0448333b02 /media/usbflash0 ext4 defaults,nofail,noatime 0 0 # a swapfile is not a swap partition, no line here # use dphys-swapfile swap[on|off] for that 

3) contents of /boot (on the usb drive, I copied this from sd card, should I have?)

pi@raspberrypi:~ $ ls /boot/ bcm2708-rpi-0-w.dtb bcm2708-rpi-b-plus.dtb bcm2709-rpi-2-b.dtb bcm2710-rpi-cm3.dtb defaults os recovery7.img recovery.elf recovery.img riscos-boot.bin bcm2708-rpi-b.dtb bcm2708-rpi-cm.dtb bcm2710-rpi-3-b.dtb BUILD-DATA INSTRUCTIONS-README.txt overlays recovery.cmdline RECOVERY_FILES_DO_NOT_EDIT recovery.rfs 

4) contents of sd card boot partition

pi@raspberrypi:~ $ sudo mkdir /media/sdboot pi@raspberrypi:~ $ sudo mount /dev/mmcblk0p6 /media/sdboot/ pi@raspberrypi:~ $ ls /media/sdboot/ bcm2708-rpi-0-w.dtb bcm2708-rpi-b-plus.dtb bcm2709-rpi-2-b.dtb bcm2710-rpi-cm3.dtb cmdline.txt cmdline.txt.usb COPYING.linux fixup.dat fixup_x.dat kernel7.img LICENCE.broadcom os_config.json start_cd.elf start.elf bcm2708-rpi-b.dtb bcm2708-rpi-cm.dtb bcm2710-rpi-3-b.dtb bootcode.bin cmdline.txt.orig config.txt fixup_cd.dat fixup_db.dat issue.txt kernel.img LICENSE.oracle overlays start_db.elf start_x.elf 

3) my cmdline.txt in the sd card boot partition

pi@raspberrypi:~ $ cat /media/sdboot/cmdline.txt dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=PARTUUID=712ae4a6-73d8-4aca-9ec6-b6e507c95f74 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait splash plymouth.ignore-serial-consoles max_usb_current=1 

EDIT 1

When I originally set up the system, I used instructions very similar to these. This left me with a working SD card. It is the original SD card I am using as my 'backup'. I backed up my user data elsewhere.

1 Answer 1

1

It is unclear from your question HOW you did a backup/restore but I suspect can-a-raspberry-pi-be-used-to-create-a-backup-of-itself

goldilocks answer does not make it clear, but you should use sudo on both backup/restore.

There are a few other caveats - the backup is ONLY for restoration to the SAME SD Card (or a card with the same Disk Id and partition structure), and ONLY if the firmware/kernel are identical.

It was NOT designed for NOOBS (which you appear to be using) - although applied carefully could work. In particular this needs to be restored to the correct partition - which would be /dev/mmcblk0p7. NOTE attempting restoration to a working partition is unwise - so it would be to partition 7 on whatever device is used.

Your /etc/fstab and cmdline.txt are nonsense 712ae4a6-73d8-4aca-9ec6-b6e507c95f74 is NOT a PARTUUID (at least for MBR)!

The boot partition for Raspbian on NOOBS IS NOT /dev/mmcblk0p1 - this is the NOOBS boot partition.

You are using a GPT partition scheme which AFAIK is NOT SUPPORTED for boot.

You then seem to have compounded you problems by copying boot (although exactly from or to is unclear).

The bottom line is no one is going to be able to tell you how to fix it, or even if this is possible.

Your best bet would be to make a fresh installation. You could use the backup to recover your files. And I strongly suggest you DO NOT use NOOBS.

4
  • Well the 'backup' was just the initial flash of the SD card, originally I created the USB dirive image from this SD card. Now I basically want to repeat this, and thought I had. I don't know why you are saying the fstab is nonsense because it worked perfectly before the incident which required the backup, and after before I attempted the apt-get update. The reason the restore is required btw, is because of this Commented Jan 18, 2019 at 15:14
  • Oh, and you also mention mmcblk0p1, but I don't reference that, I reference mmcblk0p6, which is the SD card boot partition. That's why I showed my mount command. Commented Jan 18, 2019 at 15:20
  • I added some info about how I set up the system to the question, with a link to the instructions, which also shows where the PARTUUID comes from. Commented Jan 18, 2019 at 15:40
  • I've just see that I do reference mmcblk0p1 in my fstab! Maybe this is the issue! Commented Jan 18, 2019 at 15:42

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.