# Raspberry hangs on "pkg upgrade"



## aonishenko (Apr 13, 2017)

Hi!

I have RPi with freebsd installed on it version 11.
I made an image with crochet. 
I didn't install powerd. 
When I ran "pkg upgrade" and system become upgrading over 50 packages, RPi hangs and didn't respond on any commands untill I made hard reboot.
It happens, when large package being unzipped - raspberry userland. 
It seems, that it may be power issue. But, RPi never hangs, when my hostap adapter in AP mode with 30 dBm power, which is quite expensive for power. 
What should it be? Why it goes to totally unresponsable state during unzip? 
There is enough space and memory. I built custom kernel and got rid of unused software and modules.


----------



## SirDice (Apr 13, 2017)

I'm betting it doesn't hang, because it's a rather underpowered CPU extracting archives is a rather slow process and it will look like it's hanging. Does pressing <ctrl>-T produce output when it appears to hang?


----------



## aonishenko (Apr 13, 2017)

SirDice said:


> I'm betting it doesn't hang, because it's a rather underpowered CPU extracting archives is a rather slow process and it will look like it's hanging. Does pressing <ctrl>-T produce output when it appears to hang?


Even Ctrl+C doesn't make any sence. Also, it's impossible to connect over SSH to RPi box. Crontab entries, which should reboot RPi every night, didn't make reboot. Seems like totaly hanged.


----------



## SirDice (Apr 13, 2017)

Hmm... It might be swapping a lot when trying to extract large archives. That will make it incredibly slow, slow enough to fail to respond to network. Try running top(1) in one session while doing the upgrades in another. Keep an eye on memory, CPU and swap usage.


----------



## aonishenko (Apr 13, 2017)

SirDice said:


> Hmm... It might be swapping a lot when trying to extract large archives. That will make it incredibly slow, slow enough to fail to respond to network. Try running top(1) in one session while doing the upgrades in another. Keep an eye on memory, CPU and swap usage.


Thank you, gonna check. Yes, I made a swap file in fstab, may be it's useless.


----------



## SirDice (Apr 13, 2017)

Oh, also check if /tmp is a tmpfs(5) filesystem or not. I'm not sure if it gets used but since the Pi is fairly limited you may run out of space there.


----------



## Phishfry (Apr 13, 2017)

`powerd` does the CPU throttling so your only doing 600mhz without it.

I have seen some issues with growfs not working automatically so check that all your space is in use.


----------



## aonishenko (Apr 13, 2017)

SirDice said:


> Oh, also check if /tmp is a tmpfs(5) filesystem or not. I'm not sure if it gets used but since the Pi is fairly limited you may run out of space there.


On Crochet stage modified fstab entry. Made for /tmp 300 Mb space. Gonna check, may be it's not enough.


----------



## aonishenko (Apr 13, 2017)

Is it safe manually change fstab entry (for ex - size for tmpfs) and after saving reboot the mashine to apply changes?


----------



## SirDice (Apr 13, 2017)

As the Pi has limited memory you may want to consider putting /tmp/ on disk instead of using tmpfs(5). But yes, just change it in fstab and reboot.


----------



## aonishenko (Apr 23, 2017)

SirDice said:


> As the Pi has limited memory you may want to consider putting /tmp/ on disk instead of using tmpfs(5). But yes, just change it in fstab and reboot.


Hi!

Could you help me? How I can add partition on sd card (I have 2G free space) jn live system? 
Gpart show showing me, that I have 3g unallocated free space. Gpart add tells me, that there is no free space on device....
Is it necessary to add partition from another system, where I can work with this sd card?


----------



## Phishfry (Apr 23, 2017)

The program `growfs` will fill the free space.
https://www.freebsd.org/doc/handbook/disks-growing.html
https://www.freebsd.org/cgi/man.cgi?growfs(8)


----------



## SirDice (Apr 24, 2017)

aonishenko said:


> Is it necessary to add partition from another system, where I can work with this sd card?


There's no need for a separate partition if / is big enough. Just let it write to /tmp.


----------



## aonishenko (Apr 25, 2017)

Seems more stable after doing that.

Thank you all!!


----------

