User avatar
DougieLawson
Posts: 36570
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: raspberrypi-bootloader (1.20190925-1) upgrade fails: /boot too small

Wed Oct 09, 2019 4:39 pm

I've upgraded lots of systems from Stretch to Buster with no problems.

Expanding the /boot partition is a monster pain in the tail-end. You can't just point gparted at it, set a move/resize going then grab a coffee.

This all needs to be done on a Linux system or your RPi booted from another SDCard.
1. Move / resize the root filesystem.
2. Destroy the /boot
3. Create /boot as FAT32 at 256MB
4. Restore all of the /boot contents and matching /lib/modules stuff from the booted system (or by re-installing in a chroot or (for the brave & foolhardy) with rpi-update in a chroot).
5. Swap cards and reboot
6. Swap back/reboot X times until you get the card at step 5 to boot with the right cmdline.txt and config.txt - this is the real pain
7. Give up and image a new card with a fresh copy of Raspbian 2019-09-26 (which you should have done before step 1)

Note: step 7 needs a backup of the parts you don't want to lose.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

nclmrc
Posts: 7
Joined: Thu Nov 15, 2012 12:55 am

Re: raspberrypi-bootloader (1.20190925-1) upgrade fails: /boot too small

Sat Oct 12, 2019 10:44 pm

can you better explain me the steps from 4 to 7?
thanks

Milliways
Posts: 476
Joined: Fri Apr 25, 2014 12:18 am
Location: Sydney, Australia

Re: raspberrypi-bootloader (1.20190925-1) upgrade fails: /boot too small

Sat Oct 12, 2019 11:45 pm

If you make a backup using the code in https://raspberrypi.stackexchange.com/a/103991/8697 then restore the new Image will have a 256MB boot partition. (This also fixes the problem with Buster images which actually have 256MB + 1 sector boot partition and a 4MB gap before the root partition).

NOTE Upgrading is still risky.

User avatar
bensimmo
Posts: 4187
Joined: Sun Dec 28, 2014 3:02 pm
Location: East Yorkshire

Re: raspberrypi-bootloader (1.20190925-1) upgrade fails: /boot too small

Sun Oct 13, 2019 8:30 am

HawaiianPi wrote:
Wed Oct 09, 2019 7:31 am
ShiftPlusOne wrote:
Thu Oct 03, 2019 4:16 pm
... but the solution to it is getting more and more convoluted the more I work on it. When it's ready, I'll push it out.
It seems to me the solution is for people to follow recommendations and not upgrade from an older OS. As far as I know, that was never a supported procedure (Debian/Raspbian stable is not a rolling release), so I'm not sure why effort is being devoted to supporting it now?

Especially when it will likely just lead to further trouble (limiting what gets installed in the smaller /boot partition will cause problems when someone tries to swap the card to another model). So you're just trading one problem for another.

Although it is very nice of you to try. Image
But it is a nice solution as the updating to Buster is possible and many people do of course do it, generally as it works ok.

While it is swapping one problem for another, one solution stops the Pi dead after a reboot and cannot be used on any Pi after an everyday OS update.

The other still allows the person to happily get on with using the Pi without noticing anything, up until they try it in an older Pi ( or Pi4). At which point the card is still usable and the data can be had on the older Pi (or Pi4) still.
They can then come looking for answers and be told.

I know which solution I would prefer.
Perhaps if there is space a text file might be made in /boot with a descriptive filename that can give hints when the problem is found during the update.
E.g. give it the file name
'Updated from Stretch to Buster read this'
And a description of what they now cannot do.

If anyone reads or sees it is another thing ;-)

nclmrc
Posts: 7
Joined: Thu Nov 15, 2012 12:55 am

Re: raspberrypi-bootloader (1.20190925-1) upgrade fails: /boot too small

Sun Oct 13, 2019 11:17 am

Milliways wrote:
Sat Oct 12, 2019 11:45 pm
If you make a backup using the code in https://raspberrypi.stackexchange.com/a/103991/8697 then restore the new Image will have a 256MB boot partition. (This also fixes the problem with Buster images which actually have 256MB + 1 sector boot partition and a 4MB gap before the root partition).

NOTE Upgrading is still risky.
many thanks it work perfectly

fru1tl00p
Posts: 3
Joined: Tue Oct 15, 2019 4:09 am
Location: Sydney, Australia

Re: raspberrypi-bootloader (1.20190925-1) upgrade fails: /boot too small

Tue Oct 15, 2019 4:16 am

Yeah so I also bricked my /boot partition even though I had already updated to buster from stretch successfully earlier.

I managed to fix it though without losing anything from my linux partition.

So during the upgrade apt-get does all these diversions like this:

Code: Select all

Adding 'diversion of /boot/start.elf to /usr/share/rpikernelhack/start.elf by rpikernelhack'
So luckily had a VM of Debian on a laptop and just copied all those diverted files back to the boot partition minus any *4 files, and kernel8.img.

The exact error message I got from apt-get before my rpi being bricked was this:

Code: Select all

Unpacking raspberrypi-kernel-headers (1.20190925+1-1) over (1.20190925-2) ...
Setting up raspberrypi-kernel (1.20190925+1-1) ...
You do not have enough space in /boot to install this package.
Skipping Pi 4 support
Removing 'diversion of /boot/kernel.img to /usr/share/rpikernelhack/kernel.img by rpikernelhack'
Then it just hung for ages, I opened another ssh session and rebooted and it was bricked.

I have so spent so much time setting up my rpi to do a lot of extra functions, like many homebridge manually configured plugins, afp time machine, and many more. It would have been a nightmare to have to start from scratch.

Is there anyway of non-destructively resizing the boot partition?

ShiftPlusOne
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6084
Joined: Fri Jul 29, 2011 5:36 pm
Location: The unfashionable end of the western spiral arm of the Galaxy

Re: raspberrypi-bootloader (1.20190925-1) upgrade fails: /boot too small

Tue Oct 15, 2019 1:19 pm

fru1tl00p wrote: So during the upgrade apt-get does all these diversions like this:
That's fine. That the part of the install that makes sure that files don't get installed directly to /boot. Files only actually get moved to /boot when the divert is removed.
fru1tl00p wrote: The exact error message I got from apt-get before my rpi being bricked was this:
Good, that looks like it's working as expected. If there was a problem the divert would fail to get removed.
fru1tl00p wrote: Then it just hung for ages, I opened another ssh session and rebooted and it was bricked.
Then it's an unrelated issue. If your ssh session drops during an install like that for whatever reason, it won't end well. tmux or gnu screen are a good idea when doing things like this.

fru1tl00p
Posts: 3
Joined: Tue Oct 15, 2019 4:09 am
Location: Sydney, Australia

Re: raspberrypi-bootloader (1.20190925-1) upgrade fails: /boot too small

Wed Oct 16, 2019 2:21 am

ShiftPlusOne wrote:Then it's an unrelated issue. If your ssh session drops during an install like that for whatever reason, it won't end well. tmux or gnu screen are a good idea when doing things like this.
No the ssh session was fine, I could still do carriage returns etc... but the install just wouldn't complete, I waited long enough.

Also I should mention when I did get it back up and running apt-get told me to run a dpkg command to finish the install and delete the diversions, can't remember the exact command though.

One other thing is, I had a usb drive connected to my 3B+ that I removed thinking it might be causing problems which lead to another problem of getting the following error message on reboot about emergency mode:

Code: Select all

Cannot open access to console. The root account is locked see sulogin(8) man page for more details.
After some searching I figured out it was because I had an fstab entry for that usb drive and after reinserting it, it booted fine. Just mentioning this in case anyone else comes across a similar problem.

EDIT: Btw, noob question maybe, but which kernel.img files am I supposed to have on a 3B+? I currently have kernel.img and kernel7.img, there wasn't enough room for kernel7l.img as well...
Last edited by fru1tl00p on Wed Oct 16, 2019 2:46 am, edited 2 times in total.

Milliways
Posts: 476
Joined: Fri Apr 25, 2014 12:18 am
Location: Sydney, Australia

Re: raspberrypi-bootloader (1.20190925-1) upgrade fails: /boot too small

Wed Oct 16, 2019 2:30 am

fru1tl00p wrote:
Tue Oct 15, 2019 4:16 am
Is there anyway of non-destructively resizing the boot partition?
No - at least not on a running system - you can't move an active root filesystem.

It is possible to resize/move partitions on a mounted filesystem. This can be done with gparted (or manually).
The easiest is to make a modified image. The answer I posted above shows a tool to do this. It can also be done manually, but is rather tedious (and error-prone)

fru1tl00p
Posts: 3
Joined: Tue Oct 15, 2019 4:09 am
Location: Sydney, Australia

Re: raspberrypi-bootloader (1.20190925-1) upgrade fails: /boot too small

Wed Oct 16, 2019 2:43 am

Milliways wrote:
Wed Oct 16, 2019 2:30 am
fru1tl00p wrote:
Tue Oct 15, 2019 4:16 am
Is there anyway of non-destructively resizing the boot partition?
No - at least not on a running system - you can't move an active root filesystem.

It is possible to resize/move partitions on a mounted filesystem. This can be done with gparted (or manually).
The easiest is to make a modified image. The answer I posted above shows a tool to do this. It can also be done manually, but is rather tedious (and error-prone)
What about if I "mount" the disk in Debian on another machine?

Milliways
Posts: 476
Joined: Fri Apr 25, 2014 12:18 am
Location: Sydney, Australia

Re: raspberrypi-bootloader (1.20190925-1) upgrade fails: /boot too small

Wed Oct 16, 2019 2:51 am

You can do it on any Linux system.

Return to “Raspbian”