1

I thought the Linux beta came with Pixelbook was Ubuntu so made some error input in the terminal I can no longer traceback. And now I face dependency error when I try to install R.

sudo apt install r-base

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:
 r-base : Depends: r-base-core (>= 3.5.3-1xenial) but it is not going to be installed
          Depends: r-recommended (= 3.5.3-1xenial) but it is not going to be installed
          Recommends: r-base-html but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

This is the output for

apt policy r-recommended

-recommended:
  Installed: (none)
  Candidate: 3.5.3-1xenial
  Version table:
     3.5.3-1xenial 500
        500 https://cloud.r-project.org/bin/linux/ubuntu xenial-cran35/ Packages
     3.5.3-1~stretchcran.0 500
        500 https://cloud.r-project.org/bin/linux/debian stretch-cran35/ Packages
     3.5.2-1xenial 500
        500 https://cloud.r-project.org/bin/linux/ubuntu xenial-cran35/ Packages
     3.5.2-1~stretchcran.0 500
        500 https://cloud.r-project.org/bin/linux/debian stretch-cran35/ Packages
     3.5.1-2xenial 500
        500 https://cloud.r-project.org/bin/linux/ubuntu xenial-cran35/ Packages
     3.5.1-1xenial 500
        500 https://cloud.r-project.org/bin/linux/ubuntu xenial-cran35/ Packages
     3.5.0-1xenial 500
        500 https://cloud.r-project.org/bin/linux/ubuntu xenial-cran35/ Packages
     3.3.3-1 500
        500 https://deb.debian.org/debian stretch/main amd64 Packages

Based on what my research, I think this is due to trying to install multiple versions of R using different methods, but I don't know how to fix it giving that I don't have a Linux interface on my pixelbook, just the terminal.I've tried to removing all r-base, r-core dependencies but no avail. Can somebody help?

1 Answer 1

1

These are some fast and easy ways to fix the you have held broken packages error.

  • Open your sources.list file in /etc/apt/sources.list and check that there aren't any software sources for a different release than the release that you are currently using. If you find any incorrect release lines in sources.list, open the sources.list file with sudoedit /etc/apt/sources.list, comment out the incorrect lines in sources.list by preceding them with a # character, save the sources.list file, and run sudo apt update to update the list of available software packages.

  • Select the Fix Broken Packages option in Synaptic package manager. Run the following commands to install Synaptic.

    sudo apt update  
    sudo apt upgrade   
    sudo apt install synaptic  
    

    Open Synaptic and in Synaptic select Edit -> Fix Broken Packages and then repeat Edit -> Fix Broken Packages a second time.

    In Synaptic in the left pane click the Custom Filters button which is marked by the mouse cursor in the below screenshot. From the list in the top left corner select Broken. In the center pane will be listed any broken packages that still need to be repaired.

    show broken packages in Synaptic

    Select the broken packages one at a time. Select a broken package, and then open the terminal and run apt policy <package-name>. The results of this command will tell you if that broken package was installed from the default software repositories or from some other source. If the broken package was installed from some other source, maybe that package can be removed along with its software source and replaced by a different version of the same package from the default repositories. Usually this means fixing a broken package by downgrading that package to an older version.

  • Another method of troubleshooting may be to use aptitude ( sudo apt install aptitude ) rather than apt to try to install your package:

    sudo aptitude install <packagename>

    Unlike apt, aptitude will attempt to find solutions that may involve modifying other installed packages, and it gives more information about your options for fixing the problem.

  • If you get this error message:

    Try 'apt-get -f install' with no packages (or specify a solution)  
    

    Run the following commands:

    sudo apt update  
    sudo apt upgrade   
    sudo apt-get -f install   
    
  • Manually remove a broken package.

    1. Find your package in /var/lib/dpkg/info

      ls -l /var/lib/dpkg/info | grep <package>
      
    2. Move the package folder to another location.

      cd /tmp && sudo mkdir new-package-location  
      sudo mv /var/lib/dpkg/info/<package>.* /tmp/new-package-location/    
      
    3. Run the following command:

      sudo dpkg --remove --force-remove-reinstreq <package>
      

If all of these methods don't work it is possible that the broken packages are caused by something that is embedded so deeply in the operating system that none of these methods have any effect on it. The first obvious place to look for this deeply embedded "something" is in the software sources in /etc/apt/sources.list. Check the sources.list file to see if it contains any non-standard lines that may be causing a broken packages error. A standard Ubuntu sources.list file looks like the sources.list files in this answer.

The correct way to remove a suspicious line from sources.list is to comment it out by preceding it with a # character. Then run sudo apt update to refresh the list of available software.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .