mse_68870
Posts: 7
Joined: Wed Sep 02, 2015 5:50 am
Location: France, Alsace, between Mulhouse and Basel

B+: Boots only after second power cycle

Mon Nov 14, 2016 1:47 pm

Hello,

I am puzzled by following systematic behavior :

HW : Raspberry 1 model B+ + 16GB Kingston uSD card

My system was running just fine, do I decided to make a complete SD Card backup, into file backup_full.img (~16GB)
Since I have to deploy that image on 20 devices, I shrank the image into a file backup_shrinked.img (~1.1GB)
To do this, I used the script from here : http://sirlagz.net/2013/03/10/script-au ... downsizer/

I then programmed that shrinked image into a new SD card, put it into the same Rpi, and powered the device.
To my surprise, the boot process stopped at "nonblocking pool initialized"

Even more surprising is that after power cycling the device, boot process completed properly.

I renewed the experiment with different RPis, different SD cards, and always got same result :

- if I burn backup_full.img, RPi boots properly
- if I burn backup_shrinked.img, RPI boots properly only after second power cycle.

So I wonder :
- what gets broken by shrinking operation ?
- How does the first boot is able to fix above issue ?

I compared boot partition before and after second powercycle and they appear to be identical.
cmdline.txt and config.txt are not modified by first boot.

Any idea on this interesting puzzle ?

Aydan
Posts: 676
Joined: Fri Apr 13, 2012 11:48 am
Location: Germany, near Lake Constance

Re: B+: Boots only after second power cycle

Mon Nov 14, 2016 2:11 pm

How much free space is there after shrinking?

mse_68870
Posts: 7
Joined: Wed Sep 02, 2015 5:50 am
Location: France, Alsace, between Mulhouse and Basel

Re: B+: Boots only after second power cycle

Mon Nov 14, 2016 2:17 pm

Thanks Aydan for looking at this.
Here is df output.
[email protected] / $ df
Filesystem 1K-blocks Used Available Use% Mounted on
rootfs 969112 778872 152220 84% /
/dev/root 969112 778872 152220 84% /
devtmpfs 242992 0 242992 0% /dev
tmpfs 49452 204 49248 1% /run
tmpfs 5120 0 5120 0% /run/lock
tmpfs 98900 0 98900 0% /run/shm
/dev/mmcblk0p1 57288 9928 47360 18% /boot
tmpfs 30720 0 30720 0% /var/www/db/ram

User avatar
FTrevorGowen
Forum Moderator
Forum Moderator
Posts: 4991
Joined: Mon Mar 04, 2013 6:12 pm
Location: Bristol, U.K.
Contact: Website

Re: B+: Boots only after second power cycle

Mon Nov 14, 2016 2:39 pm

mse_68870 wrote:Hello,
...
So I wonder :
- what gets broken by shrinking operation ?
- How does the first boot is able to fix above issue ?
...
For some time now, on "first boot" of a newly written card (from an *.img file), Raspbian Jessie automatically expands the file system to fill the space available on the uSDHC card**. Perhaps you "overshrunk" things and thus that expansion's the only thing that can happen on "first boot" of your card with said "shrunken image".
Trev.
**It used to be an operation required to be performed manually via raspi-config (or performed automatically by NOOBS when it installed the O.S.)
Still running Raspbian Jessie on some older Pi's (an A, B1, B2, B+, P2B, 3xP0, P0W) but Stretch on my 2xP3A+, P3B+, P3B, B+, A+ and a B2. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm

mse_68870
Posts: 7
Joined: Wed Sep 02, 2015 5:50 am
Location: France, Alsace, between Mulhouse and Basel

Re: B+: Boots only after second power cycle

Mon Nov 14, 2016 2:49 pm

Sorry, I should have mentioned I am still with Wheezy Raspbian.

Aydan
Posts: 676
Joined: Fri Apr 13, 2012 11:48 am
Location: Germany, near Lake Constance

Re: B+: Boots only after second power cycle

Mon Nov 14, 2016 6:35 pm

Please put one of those images on an SDcard and mount its root partition without booting and show it's "df".
Maybe there's some temp files still on the disk that get deleted at first boot.
Also, how long did you leave the Pi when it was stuck?
Maybe it was doing something longwinded.

Regards
Aydan

Aydan
Posts: 676
Joined: Fri Apr 13, 2012 11:48 am
Location: Germany, near Lake Constance

Re: B+: Boots only after second power cycle

Mon Nov 14, 2016 6:37 pm

FTrevorGowen wrote: For some time now, on "first boot" of a newly written card (from an *.img file), Raspbian Jessie automatically expands the file system to fill the space available on the uSDHC card**. Perhaps you "overshrunk" things and thus that expansion's the only thing that can happen on "first boot" of your card with said "shrunken image".
Trev.
**It used to be an operation required to be performed manually via raspi-config (or performed automatically by NOOBS when it installed the O.S.)
AFAIK that only works if it's the official Raspbian image, not an image later generated from a Raspbian card.

Regards
Aydan

User avatar
FTrevorGowen
Forum Moderator
Forum Moderator
Posts: 4991
Joined: Mon Mar 04, 2013 6:12 pm
Location: Bristol, U.K.
Contact: Website

Re: B+: Boots only after second power cycle

Mon Nov 14, 2016 8:14 pm

Aydan wrote:
FTrevorGowen wrote: For some time now, on "first boot" of a newly written card (from an *.img file), Raspbian Jessie automatically expands the file system to fill the space available on the uSDHC card**. Perhaps you "overshrunk" things and thus that expansion's the only thing that can happen on "first boot" of your card with said "shrunken image".
Trev.
**It used to be an operation required to be performed manually via raspi-config (or performed automatically by NOOBS when it installed the O.S.)
AFAIK that only works if it's the official Raspbian image, not an image later generated from a Raspbian card.
Regards
Aydan
You may be correct, but it may also depend upon how the image is created/written (I've only used Jessie's cloning tool) and the exact mechanism that determines whether expansion is needed (eg. actual size detection or just a simple "first-time" boot flag "file"). However, for the O.P. it's no longer relevant because Wheezy is still being used.
Trev.
Still running Raspbian Jessie on some older Pi's (an A, B1, B2, B+, P2B, 3xP0, P0W) but Stretch on my 2xP3A+, P3B+, P3B, B+, A+ and a B2. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm

mse_68870
Posts: 7
Joined: Wed Sep 02, 2015 5:50 am
Location: France, Alsace, between Mulhouse and Basel

Re: B+: Boots only after second power cycle

Tue Nov 15, 2016 8:56 am

Aydan wrote:Please put one of those images on an SDcard and mount its root partition without booting and show it's "df".
Maybe there's some temp files still on the disk that get deleted at first boot.
Also, how long did you leave the Pi when it was stuck?
Maybe it was doing something longwinded.

Regards
Aydan
Hello Aydan,

Not sure if this is what you meant :
- I burned an SD card with the shrunk image
- put it in a usb adapter
- insert it into a running Rpi
- ran few commands below

On the second point, I waited more than 30 minutes without success.

Regards,


[email protected] ~ $ sudo blkid
/dev/mmcblk0p1: SEC_TYPE="msdos" LABEL="boot" UUID="993B-8922" TYPE="vfat"
/dev/mmcblk0p2: UUID="fc254b57-8fff-4f96-9609-ea202d871acf" TYPE="ext4"
/dev/sda1: SEC_TYPE="msdos" LABEL="boot" UUID="993B-8922" TYPE="vfat"
/dev/sda2: UUID="fc254b57-8fff-4f96-9609-ea202d871acf" TYPE="ext4"

[email protected] ~ $ sudo mount /dev/sda1 /mnt
[email protected] ~ $
[email protected] ~ $
[email protected] ~ $ df
Filesystem 1K-blocks Used Available Use% Mounted on
rootfs 14842976 794652 13728984 6% /
/dev/root 14842976 794652 13728984 6% /
devtmpfs 242992 0 242992 0% /dev
tmpfs 49452 232 49220 1% /run
tmpfs 5120 0 5120 0% /run/lock
tmpfs 98900 0 98900 0% /run/shm
/dev/mmcblk0p1 57288 9928 47360 18% /boot
tmpfs 30720 3284 27436 11% /var/www/db/ram
/dev/sda1 57288 9928 47360 18% /mnt

Aydan
Posts: 676
Joined: Fri Apr 13, 2012 11:48 am
Location: Germany, near Lake Constance

Re: B+: Boots only after second power cycle

Tue Nov 15, 2016 12:13 pm

mse_68870 wrote: Hello Aydan,

Not sure if this is what you meant :
- I burned an SD card with the shrunk image
- put it in a usb adapter
- insert it into a running Rpi
- ran few commands below
Almost, you'll need to mount the 2nd partition of the sd-card. You mounted the first one, which only holds the boot files, not the root partition.
Did you see the act-light blinking while it was stuck? If not, then it seems to be something else.

Regards
Aydan

mse_68870
Posts: 7
Joined: Wed Sep 02, 2015 5:50 am
Location: France, Alsace, between Mulhouse and Basel

Re: B+: Boots only after second power cycle

Tue Nov 15, 2016 1:30 pm

Here is the df with the second partition mounted

[email protected] ~ $ df
Filesystem 1K-blocks Used Available Use% Mounted on
rootfs 14842976 797404 13726232 6% /
/dev/root 14842976 797404 13726232 6% /
devtmpfs 242992 0 242992 0% /dev
tmpfs 49452 232 49220 1% /run
tmpfs 5120 0 5120 0% /run/lock
tmpfs 98900 0 98900 0% /run/shm
/dev/mmcblk0p1 57288 9928 47360 18% /boot
tmpfs 30720 1368 29352 5% /var/www/db/ram
/dev/sda2 1069996 778772 251128 76% /mnt

The ACT LED is not blinking

Aydan
Posts: 676
Joined: Fri Apr 13, 2012 11:48 am
Location: Germany, near Lake Constance

Re: B+: Boots only after second power cycle

Tue Nov 15, 2016 2:04 pm

OK, the partition is not full.
Could you run an "fsck -f" on that partition and see if it then boots properly?
The partition needs to be unmounted first.

Regards
Aydan

Return to “Troubleshooting”