DarkElvenAngel
Posts: 103
Joined: Tue Mar 20, 2018 9:53 pm

[TESTING] Upgrade fails, boot partition left full

Thu Dec 06, 2018 1:09 am

Hello all,

I've been attempting to solve this one for a while now. Straight to it,
I've been investigating this issue for months it's hard to pin down because it doesn't happen with each upgrade. I've noticed it happens predictability with a kernel upgrade, however this last time there was no kernel upgrade and I'm at a loss as to how find the script that runs during the update.

I managed to collect what I hope is a vital clue to this mystery. During the latest apt upgrade the packages initramfs-tools reported iF installed ok halF configured this package wasn't included in the upgrade.

I've rewritten the initramfs hooks for kernel upgrades and deleted the old ones. I can verify 100% these didn't run.

My setup uses an initramfs to display a boot splash and set some system values. From what I can tell the initramfs is being updated for some reason and during that process a backup or something is created but it's much larger than original. I can also verify that the boot partition is large enough to hold two initramfs files as I have complied one for a pi0 and pi3 on the same SD card with space to spare.

Now I'm stumped not sure where to go from here.

Any insights?
Last edited by DarkElvenAngel on Thu Dec 13, 2018 10:57 pm, edited 1 time in total.

DarkElvenAngel
Posts: 103
Joined: Tue Mar 20, 2018 9:53 pm

Re: Upgrade fails, boot partition left full

Mon Dec 10, 2018 1:21 am

UPDATE

I've modified the /etc/initramfs-tools/update-initramfs.conf

Code: Select all

#
# Configuration file for update-initramfs(8)
#

#
# update_initramfs [ yes | all | no ]
#
# Default is yes
# If set to all update-initramfs will update all initramfs
# If set to no disables any update to initramfs beside kernel upgrade

# CHANGED SETTING #
update_initramfs=no

#
# backup_initramfs [ yes | no ]
#
# Default is no
# If set to no leaves no .bak backup files.

backup_initramfs=no
I've set the update_initramfs value to no the only problem with doing this is that if the initramfs needs to be updated I don't get a notice or warning and this could cause the system not to boot!

So now I'm trying to work out how to add a trigger to the upgrade process that I can write a script to delete and rebuild the initramfs or modify the package initramfs-tools v130 configuration script to delete and rebuild and not just update the initramfs.

Any idea's how to do this?

DarkElvenAngel
Posts: 103
Joined: Tue Mar 20, 2018 9:53 pm

Re: Upgrade fails, boot partition left full

Mon Dec 10, 2018 10:51 pm

So I have found the configuration script but when I change it to delete first it didn't work

I downloaded and unpacked the initramfs-tools_0.130_all.deb package and edited this portion of the /DEBIAN/postinst file

Code: Select all

# Regenerate initramfs whenever we go to dpkg state `installed'
if [ "x$1" != xtriggered ]; then
        # this activates the trigger, if triggers are working
        update-initramfs -dk all
        update-initramfs -ck $(uname -r)
else
        # force it to actually happen
        update-initramfs -dk all
        DPKG_MAINTSCRIPT_PACKAGE='' update-initramfs -ck $(uname -r)
fi
I also changed the version number to 0.130.0 so it would update.

however when I installed it I go this output

Code: Select all

# dpkg-deb -b initramfs-tools initramfs-tools.deb
dpkg-deb: building package 'initramfs-tools' in 'initramfs-tools.deb'.
# apt install ./initramfs-tools.deb 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'initramfs-tools' instead of './initramfs-tools.deb'
The following packages will be upgraded:
  initramfs-tools
1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/66.0 kB of archives.
After this operation, 108 kB disk space will be freed.
Get:1 /media/initramfs-tools.deb initramfs-tools all 0.130.0 [66.0 kB]
Reading changelogs... Done           
(Reading database ... 131154 files and directories currently installed.)
Preparing to unpack .../initramfs-tools.deb ...
Unpacking initramfs-tools (0.130.0) over (0.130) ...
Setting up initramfs-tools (0.130.0) ...
Delete mode requires a version argument

Usage: /usr/sbin/update-initramfs [OPTION]...

Options:
 -k version	Specify kernel version or 'all'
 -c		Create a new initramfs
 -u		Update an existing initramfs
 -d		Remove an existing initramfs
 -t		Take over a custom initramfs with this one
 -b directory	Set alternate boot directory
 -v		Be verbose
 -h		This message

dpkg: error processing package initramfs-tools (--configure):
 subprocess installed post-installation script returned error exit status 1
Processing triggers for man-db (2.7.6.1-2) ...
Errors were encountered while processing:
 initramfs-tools
N: Download is performed unsandboxed as root as file '/media/initramfs-tools.deb' couldn't be accessed by user '_apt'. - pkgAcquire::Run (13: Permission denied)
E: Sub-process /usr/bin/dpkg returned an error code (1)
#
When I use the same command on the terminal it works fine, clearly I have done something wrong. Is there a way to have it look for an external script and run that?

I'm so close to the solution

DarkElvenAngel
Posts: 103
Joined: Tue Mar 20, 2018 9:53 pm

Re: Upgrade fails, boot partition left full

Thu Dec 13, 2018 10:55 pm

I've successfully created a deb package to replace the initramfs-tools 130 it executes an external script the deletes and rebuilds the initramfs image in the boot folder.

Code: Select all

 apt install ./initramfs-tools.deb 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'initramfs-tools' instead of './initramfs-tools.deb'
The following packages will be upgraded:
  initramfs-tools
1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/66.0 kB of archives.
After this operation, 108 kB disk space will be freed.
Get:1 /initramfs-tools.deb initramfs-tools all 0.130.0 [66.0 kB]
Reading changelogs... Done           
(Reading database ... 131154 files and directories currently installed.)
Preparing to unpack .../initramfs-tools.deb ...
Unpacking initramfs-tools (0.130.0) over (0.130) ...
Setting up initramfs-tools (0.130.0) ...
TRIGGERED [START]
update-initramfs: Deleting /boot/initrd.img-4.14.79-v7+
update-initramfs: Generating /boot/initrd.img-4.14.79-v7+
/etc/initramfs-tools/scripts/init-top/splash: 3: /etc/initramfs-tools/scripts/init-top/splash: lzopcat: not found
TRIGGERED [FINISHED]
Processing triggers for man-db (2.7.6.1-2) ...
N: Download is performed unsandboxed as root as file '/initramfs-tools.deb' couldn't be accessed by user '_apt'. - pkgAcquire::Run (13: Permission denied)
I still get the Notice about unsandboxed I'm going to try to set up a local repository to solve this issue

The TRIGGERED is my external script running I'm going to place it into the package , the error about lzopcat is normal it's part of my very early boot splash. Something I can now refocus on if this is fixed.

Once I get an update that requires the initramfs to update without a kernel update I will mark this as solved and post my changed files and instructions on how to get this working.

This should be good news for anyone with unsupported file systems that require the initramfs image to load correctly for each boot, using the very early bootsplash, or whatever else you need a working initrams for.

Return to “Troubleshooting”