3

I got my first ever Raspberry Pi in the mail yesterday and today I thought it might need some updates as it's brand new. I used:

sudo apt-get update && sudo apt-get dist-upgrade

And all was fine, until the terminal showed a prompt asking what should be done with a preferences or config file. I don't know what it was, but the desktop background and system font were stored in the file. I opted to check out the differences between the current and the replacement file, but I couldn't find my way back in the terminal.

That terminal is now closed but I'm not sure if the upgrade process is finished. I've tried running the upgrade process again, plus just about everything I could find on google. Does anyone have some experience with this?

PS - It says:

Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)'

Edit: So I decided to reboot it. Everything seems to be fine, the login screen is there. The problem is now that my keyboard, mouse, and touch screen don't work anymore. Shutting down and starting up again didn't help either.

Is there anything I can do other than downloading NOOBS again?

2
  • download NOOBS again, If it comes to the same point asking what to do as before then ask for help in the Raspberry Pi forums. Be specific when asking for help - i.e. don't paraphrase messages or be vague (e.g. 'a preferences or config file' which one?). It's part of the learning process to make mistakes, and researching the issues and solving the problems is part of the process.
    – Charemer
    Commented Sep 27, 2017 at 12:28
  • dist-upgrade = update to latest OS Release (full system upgrade). upgrade = update all packages to the newest version for the currently installed release (package update).
    – crasic
    Commented Sep 28, 2017 at 0:28

4 Answers 4

2

Your current system is broken. As it is a new image, it is not worth trying to recover.

Install a new image.

I strongly recommend you download a new up-to-date image - what you have been supplied with is probably old, requiring extensive updates.

If you do upgrade DO NOT use dist-upgrade just use upgrade, at least initially.

If you are prompted to overwrite files just answer Yes. There will be nothing in there because you have not customised it.

0

Could not get lock /var/lib/dpkg/lock ..... is an indication that apt is running already and you can't start it twice.

And before a 'sudo apt-get dist-upgradeit is recommended to do a backup.

If you can edit the SD card in another computer and edit /boot/config.txt to startx=0.

Ref.: https://www.raspberrypi.org/documentation/configuration/config-txt/boot.md

and thereafter run apt update and follow the instructions.

0

tl;dr: kill the previous apt upgrade process if necessary, and then run:

sudo dpkg --configure -a

to resume.

Longer answer

I think my recent experience is a great example of helpful error messages guiding the user to a successful outcome, so if you'll indulge me...

I faced this issue today, where I'd left the sudo apt dist-upgrade running unattended, and the ssh session timed out while awaiting my response to a file conflict:

....
Setting up libhtml-parser-perl (3.75-1+b1) ...
Setting up dphys-swapfile (20100506-7) ...
Setting up procps (2:3.3.17-5) ...

Configuration file '/etc/sysctl.conf'
 ==> Modified (by you or by a script) since installation.
 ==> Package distributor has shipped an updated version.
   What would you like to do about it ?  Your options are:
    Y or I  : install the package maintainer's version
    N or O  : keep your currently-installed version
      D     : show the differences between the versions
      Z     : start a shell to examine the situation
 The default action is to keep your current version.
*** sysctl.conf (Y/I/N/O/D/Z) [default=N] ? client_loop: send disconnect: Broken pipe

First, thanks to the accepted answer here, I knew I had to run upgrade rather than dist-upgrade. This wasn't on a vanilla install, so I really wanted to fix without having to format and start again.

When ran that, I got an error telling me the previous upgrade was still running, waiting for my response...

pi@homebridge:~ $ sudo apt upgrade
Exiting for cache lock: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 14748 (apt)... 5s

So I ran sudo kill 14748 and tried again, but this time...

pi@homebridge:~ $ sudo apt upgrade
E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.

... so I ran that, and the (dist) upgrade picked up where it left off, and completed successfully.

-1

When you use the apt/ directory at multiple places, this error occurs.

Watch where you use apt-get multiple times.

If problem exists still, try running

dpkg configure -a
1
  • 1
    What error, the keyboard not responding?
    – RalfFriedl
    Commented Jun 16, 2019 at 8:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.