1

I'm using raspberry pi3 B and am new to the linux system (raspbian). I was trying to build VS Code into raspberry pi3 according to: https://www.hanselman.com/blog/BuildingVisualStudioCodeOnARaspberryPi3.aspx

But when I run the command in the command terminal pi@raspberrypi:

sudo apt-get install libx11-dev

I got the following results:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
libx11-dev : Depends: libx11-6 (= 2:1.6.2-3+deb8u1) but 2:1.6.4-3 is to be installed
          Depends: libxdmcp-dev (>= 1:1.0.0-1) but it is not going to be installed
          Depends: libxcb1-dev but it is not going to be installed
          Recommends: libx11-doc but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

I have tried searching for solutions which includes:

 sudo apt-get install --reinstall raspberrypi-bootloader
 sudo apt-get install -f
 sudo apt-get update

I have even tried installing the required dependencies individually as shown, but the same issue happes:

 sudo apt-get install libx11-6
 sudo apt-get install libxdmcp-dev
 sudo apt-get install libxcb1-dev
 sudo apt-get install libx11-doc

but when I try

sudo apt-get install libx11-dev 

again, the same issue occurs :(

Running on:

pi@raspberrypi:~ $ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)"
NAME="Raspbian GNU/Linux" 
VERSION_ID="9" VERSION="9 (stretch)"

and:

pi@raspberrypi:~ $ cat /etc/apt/sources.list 
#deb http://mirrordirector.raspbian.org/raspbian/ stretch main contrib non-free rpi 
# Uncomment line below then 'apt-get update' to enable 'apt-get source' 
#deb-src http://archive.raspbian.org/raspbian/ stretch main contrib non-free rpi 
deb http://archive.raspbian.org/raspbian jessie main contrib non-free 
deb-src http://archive.raspbian.org/raspbian jessie main contrib non-free

What should I do to repair/reinstall the broken packages, please helppp thank you!

  • Does anything change if you do an update (sudo apt-get update) and repeat your command? Perhaps your package lists are out of date. – Aurora0001 Jan 13 '18 at 15:21
  • @Aurora0001 I have done that too, and the update runs smoothly. But, the same issue occur when I tried sudo apt-get install libx11-dev again. – GoodCodes Jan 13 '18 at 15:32
  • Which version of Raspbian is this? Could you also include /etc/apt/sources.list? From the version of libx11-6 being installed, it looks like it's trying to install Stretch's version of libx11-6 when it wants Jessie's version. A wild guess: did you try upgrading a Jessie system to Stretch possibly? – Aurora0001 Jan 13 '18 at 16:35
  • Could you put that in an edit, and indent all the config files by selecting Ctrl+K with them? That'll give you code formatting so it's easier to read the files. The line breaks get deleted in comments, unfortunately. Thanks. – Aurora0001 Jan 13 '18 at 17:07
  • @Aurora0001 I have done so in the post. Seem to be stretch version... Could you kindly tell me what I should do please; thanks so much! – GoodCodes Jan 13 '18 at 17:22
0

It seems odd to me that your system reports being Stretch, and yet your sources.list is set up to use the Jessie repositories. I suspect that's causing the inconsistencies when installing.

Replace your sources.list with the following:

deb http://mirrordirector.raspbian.org/raspbian/ stretch main contrib non-free rpi 
# Uncomment line below then 'apt-get update' to enable 'apt-get source' 
deb-src http://archive.raspbian.org/raspbian/ stretch main contrib non-free rpi 
#deb http://archive.raspbian.org/raspbian jessie main contrib non-free 
#deb-src http://archive.raspbian.org/raspbian jessie main contrib non-free

(uncomment lines 1 and 3, and comment out lines 4 and 5)

Then, run:

apt-get update

And run your install command again. This should resolve the package conflicts.

  • Thank you so much! It works so far for now after half a day!!!! You're my life saviour! By the way, would Stretch be able to satisfy for any future usage (aka I can leave line 4 and 5 commented for good)? Thank you very much once again!!! – GoodCodes Jan 13 '18 at 17:49
  • I'm really pleased to hear this solved it, @GoodCodes. Yes, you definitely should leave the last lines commented out... I'm not sure how your sources.list ended up like it did, but you definitely want the Stretch repos for all future usage, not the old Jessie repos which are incompatible with your system. You shouldn't have any more problems with it as long as you leave it as it is now. – Aurora0001 Jan 13 '18 at 17:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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