User avatar
gdw35
Posts: 29
Joined: Thu Nov 15, 2012 10:46 am
Location: Paris, France

How to repair raspian?

Sat Nov 30, 2013 1:47 pm

After about 4 months of no use I fired up my Pi today. The first thing that I did after booting was to run 'apt-get update' followed by 'apt-get upgrade'.

The upgrade took a really long time, almost an hour. I appeared that almost everything was being upgraded, including the kernel. During the upgrade there were some errors stating that the kernel upgrade could not occur. After the process was finished I rebooted OK and then after the reboot repeated the process which appeared to do the kernel upgrade without error. After this was done I rebooted again. Then the problems started.

The Pi would not reboot, just black screen. At first I thought the SD card was corrupted but when I looked at it on my Mac the boot partition was there, however there was only 4 files in it (config.txt, cmdline.txt, issue.txt and start_x.elf). In an attempt to fix this I copied all of the files from another SD card I had (also Raspian, created by NOOBS, but an earlier version). Since doing this I am now able to boot from my original SD card but there are lots of errors during the boot, suspect due to incompatibilities between upgraded components and the old kernel. My USB keyboard no longer works and the Wifi dongle also does not work. The only way I can get access is via ssh login through the ethernet port.

Is there anyway I can run a repair on the SD card to fix the Raspian install and make all the files consistent with the version? I spent a lot of time setting this card up with lots of really useful stuff and I don't want to lose it all and have to start again.
Any help would be appreciated.

Thanks.

User avatar
DougieLawson
Posts: 39165
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: How to repair raspian?

Sat Nov 30, 2013 1:58 pm

Try

Code: Select all

sudo apt-get install rpi-update
sudo rpi-update
That will pull the very latest kernel (and associated stuff) and update your /boot and /lib/modules directories with good copies of everything.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

User avatar
gdw35
Posts: 29
Joined: Thu Nov 15, 2012 10:46 am
Location: Paris, France

Re: How to repair raspian?

Sat Nov 30, 2013 2:13 pm

Dougie you're a champion!!!

All good now. :D

Now, I better start investigating how to backup my SD card with my Mac so I don't run into this problem again. :oops:

User avatar
DougieLawson
Posts: 39165
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: How to repair raspian?

Sat Nov 30, 2013 3:01 pm

gdw35 wrote:Now, I better start investigating how to backup my SD card with my Mac so I don't run into this problem again. :oops:
My Fuji USB SDCard Reader is the best thing I've got. Plug it in, put a blank SDCard (same size as my Raspbian one) in, open a command window and run

Code: Select all

sudo dd if=/dev/mmcblk0 of=/dev/sda bs=1M
Leave it over night. It's not a good idea to do it on a busy system with the file systems mounted a read/write but ... .

Or you can shutdown, pull the card and use Win32DiskImager to grab an *.img file of it.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

User avatar
Lob0426
Posts: 2198
Joined: Fri Aug 05, 2011 4:30 pm
Location: Susanville CA.
Contact: Website

Re: How to repair raspian?

Sat Nov 30, 2013 6:11 pm

I find Win32DiskImager to be the quickest method of backing up an SD card. DD works but takes a lot longer. If anything happens, like a power outage or brownout then you have to start again. So faster is better!

I also like to store a number of these backups so using my main hard drive instead of another SD is better for me. I also end up with these stored in the backup of my main system. I can go back almost to day one!

Make a backup before you update and before changing your installs and then you can go back and find out what went wrong. Every time I forget to backup I end up screwing my card up, never fails! :lol: :lol:
512MB version 2.0 as WordPress Server
Motorola Lapdock with Pi2B
Modded Rev 1.0 with pin headers at USB

http://rich1.dyndns.tv/
(RS)Allied ships old stock to reward its Customers for long wait!

Return to “Troubleshooting”