Author Archives: peter

Raspberry Pi | apt not working – segmentation fault

If you are experiencing segmentation fault on an apt update like this

peter@rasp1:~ $ sudo apt update
Get:1 http://archive.raspberrypi.org jessie InRelease [22.9 kB]
Get:2 http://mirrordirector.raspbian.org jessie InRelease [14.9 kB]
Get:3 http://mirrordirector.raspbian.org jessie/main armhf Packages [9,536 kB]
Get:4 http://archive.raspberrypi.org jessie/main armhf Packages [171 kB]
E: Method gzip has died unexpectedly!
E: Sub-process gzip received a segmentation fault.
E: Method /usr/lib/apt/methods/gzip did not start correctly

Then it can be resolved by sudo apt-get install –reinstall apt

peter@rasp1:~ $ sudo apt-get install --reinstall apt
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 0 not upgraded.
Need to get 0 B/1,067 kB of archives.
After this operation, 0 B of additional disk space will be used.
(Reading database ... 38419 files and directories currently installed.)
Preparing to unpack .../apt_1.0.9.8.4_armhf.deb ...
Unpacking apt (1.0.9.8.4) over (1.0.9.8.4) ...
Processing triggers for man-db (2.7.5-1~bpo8+1) ...
Setting up apt (1.0.9.8.4) ...
Processing triggers for libc-bin (2.19-18+deb8u10) ...

After update and reinstall you will be able to do an sudo apt-update end a sudo apt-upgrade

peter@rasp1:~ $ sudo apt update
Hit http://archive.raspberrypi.org jessie InRelease
Hit http://mirrordirector.raspbian.org jessie InRelease
Get:1 http://mirrordirector.raspbian.org jessie/main armhf Packages [9,536 kB]
Get:2 http://archive.raspberrypi.org jessie/main armhf Packages [171 kB]
Hit http://archive.raspberrypi.org jessie/ui armhf Packages
Ign http://archive.raspberrypi.org jessie/main Translation-en_GB
Ign http://archive.raspberrypi.org jessie/main Translation-en
Ign http://archive.raspberrypi.org jessie/ui Translation-en_GB
Get:3 http://mirrordirector.raspbian.org jessie/contrib armhf Packages [43.3 kB]
Ign http://archive.raspberrypi.org jessie/ui Translation-en
Get:4 http://mirrordirector.raspbian.org jessie/non-free armhf Packages [84.2 kB]
Get:5 http://mirrordirector.raspbian.org jessie/rpi armhf Packages [1,356 B]
Ign http://mirrordirector.raspbian.org jessie/contrib Translation-en_GB
Ign http://mirrordirector.raspbian.org jessie/contrib Translation-en
Ign http://mirrordirector.raspbian.org jessie/main Translation-en_GB
Ign http://mirrordirector.raspbian.org jessie/main Translation-en
Ign http://mirrordirector.raspbian.org jessie/non-free Translation-en_GB
Ign http://mirrordirector.raspbian.org jessie/non-free Translation-en
Ign http://mirrordirector.raspbian.org jessie/rpi Translation-en_GB
Ign http://mirrordirector.raspbian.org jessie/rpi Translation-en
Fetched 8,692 kB in 20s (417 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
49 packages can be upgraded. Run 'apt list --upgradable' to see them.

SSH – warning setlocale: LCC_ALL

If you are getting an error like this when you try to login trough ssh

bash: warning: setlocale: LC_ALL: cannot change locale (en_DK.UTF-8)
-bash: warning: setlocale: LC_ALL: cannot change locale (en_DK.UTF-8)
-bash: warning: setlocale: LC_ALL: cannot change locale (en_DK.UTF-8)

Then it can be the fixed by enable the locale on the remote system.

1. edit the file locale.gen and uncommend the line with the locale you are getting in your error message, in my example it is en_DK.UTF-8

sudo nano /etc/locale.gen

2. generate the new extra locale

sudo locale-gen