PiShrink: failure to run skript

Hello, sorry if this is a noob question but I can’t get it working. I’m running raspbian jessie and trying to resize an image from a windows network share. I made the image using Win32DiskImager 1.0. This is all what i get

 sudo ~/bin/pishrink.sh /mnt/network/1.img
Creating new /etc/rc.local
/dev/loop0: Inodes wurden gefunden, die Teil einer defekten verketteten Liste von
verwaisten Inodes waren.

/dev/loop0: UNERWARTETE INKONSISTENZ; fsck MANUELL AUSFÜHREN
        (d.h. ohne die Optionen -a oder -p)
resize2fs 1.43.3 (04-Sep-2016)
Bitte lassen Sie zuerst „e2fsck -f /dev/loop0“ laufen.

/home/pi/bin/pishrink.sh: Zeile 148: 7659520 - : Syntax Fehler: Operator erwartet. (Fehlerverursachendes Zeichen ist \"- \").
resize2fs 1.43.3 (04-Sep-2016)
Bitte lassen Sie zuerst „e2fsck -f /dev/loop0“ laufen.

ERROR: resize2fs failed...


About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 27 (8 by maintainers)

Most upvoted comments

Great you managed to fix the issue and share how you fixed it 👍 . Unfortunately you didn’t use option -d which creates some debug information and may help to debug the issue 😦. But nevertheless it’s interesting you fixed the issue with

losetup -P /dev/loop0 raspbian.img
e2fsck -f /dev/loop0

Looks like this is something everybody facing an issue with pishrink should try first.

I’ve had a similar issue. I’ve created a image file from a working Raspbian SDCard using Win32DiskImager. When I ran pishrink, the tool gave me the “orphaned inode list” error. So I followed the suggestion from Rocky Inde and executed fsck. It encountered and fixed some errors so I ran pishrink again and it worked! Thanks Rock Inde.

If you got this far and are still confused how to do it, I’ve created a script, partly based on pishrink, to fix these “orphaned inodes”. You can check the script source at

https://github.com/gmenezesg/fix_orphaned_inode_list

Hope it helps!

Thanks for the suggested fix, I finally got it working for me as well after I specified the correct partition for e2fsck to use:

sudo losetup -P /dev/loop0 raspbian.img
sudo e2fsck -f /dev/loop0p2
-------------------------^ # note the added 'p2' to reference the second partition

See: https://raspberrypi.stackexchange.com/a/78361

And finally detaching the image again via sudo losetup -d /dev/loop0 before running PiShrink. This fixed the issue for me.

@framps Thanks for your fork. It works!!