dpkg error: “trying to overwrite file, which is also in…”











up vote
84
down vote

favorite
23












For example:



$ sudo apt-get install curl
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
bsh : Depends: libjline-java but it is not going to be installed
groovy : Depends: libjline-java but it is not going to be installed
rhino : Depends: libjline-java but it is not going to be installed
E: Unmet dependencies.

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


I get the same or similar errors when I attempt to install clojure1.3, leiningen, and several other packages.



When I try the suggestion made in the error message, this is what happens:



$ sudo apt-get -f install 
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
diffstat linux-headers-3.2.0-26-generic linux-headers-3.2.0-26 dh-apparmor dkms html2text libmail-sendmail-perl libsys-hostname-long-perl
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
libjline-java
Suggested packages:
libjline-java-doc
The following NEW packages will be installed:
libjline-java
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
23 not fully installed or removed.
Need to get 0 B/72.0 kB of archives.
After this operation, 129 kB of additional disk space will be used.
Do you want to continue [Y/n]? Y
(Reading database ... 226243 files and directories currently installed.)
Unpacking libjline-java (from .../libjline-java_1.0-1_all.deb) ...
dpkg: error processing /var/cache/apt/archives/libjline-java_1.0-1_all.deb (--unpack):
trying to overwrite '/usr/share/java/jline.jar', which is also in package scala 2.9.2-400
Errors were encountered while processing:
/var/cache/apt/archives/libjline-java_1.0-1_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

$ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these.
The following packages have unmet dependencies:
bsh : Depends: libjline-java but it is not installed
groovy : Depends: libjline-java but it is not installed
rhino : Depends: libjline-java but it is not installed
E: Unmet dependencies. Try using -f.









share|improve this question
























  • Also looks live you need to install java, search for it in software center
    – Mark Kirby
    Aug 15 '12 at 12:46






  • 1




    Probably a duplicate of this Q&A or at least the solution should help
    – danjjl
    Aug 15 '12 at 12:51












  • @markkirby, I have run sudo apt-get update if that is what you are asking.
    – missingfaktor
    Aug 15 '12 at 16:59










  • @markkirby, JDK is already installed.
    – missingfaktor
    Aug 15 '12 at 16:59








  • 2




    IMHO Avinash Raj's answer is much safer and more widely applicable than the top two answers here. I recommend trying this first.
    – Zanna
    Aug 27 '17 at 10:03















up vote
84
down vote

favorite
23












For example:



$ sudo apt-get install curl
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
bsh : Depends: libjline-java but it is not going to be installed
groovy : Depends: libjline-java but it is not going to be installed
rhino : Depends: libjline-java but it is not going to be installed
E: Unmet dependencies.

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


I get the same or similar errors when I attempt to install clojure1.3, leiningen, and several other packages.



When I try the suggestion made in the error message, this is what happens:



$ sudo apt-get -f install 
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
diffstat linux-headers-3.2.0-26-generic linux-headers-3.2.0-26 dh-apparmor dkms html2text libmail-sendmail-perl libsys-hostname-long-perl
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
libjline-java
Suggested packages:
libjline-java-doc
The following NEW packages will be installed:
libjline-java
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
23 not fully installed or removed.
Need to get 0 B/72.0 kB of archives.
After this operation, 129 kB of additional disk space will be used.
Do you want to continue [Y/n]? Y
(Reading database ... 226243 files and directories currently installed.)
Unpacking libjline-java (from .../libjline-java_1.0-1_all.deb) ...
dpkg: error processing /var/cache/apt/archives/libjline-java_1.0-1_all.deb (--unpack):
trying to overwrite '/usr/share/java/jline.jar', which is also in package scala 2.9.2-400
Errors were encountered while processing:
/var/cache/apt/archives/libjline-java_1.0-1_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

$ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these.
The following packages have unmet dependencies:
bsh : Depends: libjline-java but it is not installed
groovy : Depends: libjline-java but it is not installed
rhino : Depends: libjline-java but it is not installed
E: Unmet dependencies. Try using -f.









share|improve this question
























  • Also looks live you need to install java, search for it in software center
    – Mark Kirby
    Aug 15 '12 at 12:46






  • 1




    Probably a duplicate of this Q&A or at least the solution should help
    – danjjl
    Aug 15 '12 at 12:51












  • @markkirby, I have run sudo apt-get update if that is what you are asking.
    – missingfaktor
    Aug 15 '12 at 16:59










  • @markkirby, JDK is already installed.
    – missingfaktor
    Aug 15 '12 at 16:59








  • 2




    IMHO Avinash Raj's answer is much safer and more widely applicable than the top two answers here. I recommend trying this first.
    – Zanna
    Aug 27 '17 at 10:03













up vote
84
down vote

favorite
23









up vote
84
down vote

favorite
23






23





For example:



$ sudo apt-get install curl
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
bsh : Depends: libjline-java but it is not going to be installed
groovy : Depends: libjline-java but it is not going to be installed
rhino : Depends: libjline-java but it is not going to be installed
E: Unmet dependencies.

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


I get the same or similar errors when I attempt to install clojure1.3, leiningen, and several other packages.



When I try the suggestion made in the error message, this is what happens:



$ sudo apt-get -f install 
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
diffstat linux-headers-3.2.0-26-generic linux-headers-3.2.0-26 dh-apparmor dkms html2text libmail-sendmail-perl libsys-hostname-long-perl
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
libjline-java
Suggested packages:
libjline-java-doc
The following NEW packages will be installed:
libjline-java
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
23 not fully installed or removed.
Need to get 0 B/72.0 kB of archives.
After this operation, 129 kB of additional disk space will be used.
Do you want to continue [Y/n]? Y
(Reading database ... 226243 files and directories currently installed.)
Unpacking libjline-java (from .../libjline-java_1.0-1_all.deb) ...
dpkg: error processing /var/cache/apt/archives/libjline-java_1.0-1_all.deb (--unpack):
trying to overwrite '/usr/share/java/jline.jar', which is also in package scala 2.9.2-400
Errors were encountered while processing:
/var/cache/apt/archives/libjline-java_1.0-1_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

$ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these.
The following packages have unmet dependencies:
bsh : Depends: libjline-java but it is not installed
groovy : Depends: libjline-java but it is not installed
rhino : Depends: libjline-java but it is not installed
E: Unmet dependencies. Try using -f.









share|improve this question















For example:



$ sudo apt-get install curl
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
bsh : Depends: libjline-java but it is not going to be installed
groovy : Depends: libjline-java but it is not going to be installed
rhino : Depends: libjline-java but it is not going to be installed
E: Unmet dependencies.

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


I get the same or similar errors when I attempt to install clojure1.3, leiningen, and several other packages.



When I try the suggestion made in the error message, this is what happens:



$ sudo apt-get -f install 
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
diffstat linux-headers-3.2.0-26-generic linux-headers-3.2.0-26 dh-apparmor dkms html2text libmail-sendmail-perl libsys-hostname-long-perl
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
libjline-java
Suggested packages:
libjline-java-doc
The following NEW packages will be installed:
libjline-java
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
23 not fully installed or removed.
Need to get 0 B/72.0 kB of archives.
After this operation, 129 kB of additional disk space will be used.
Do you want to continue [Y/n]? Y
(Reading database ... 226243 files and directories currently installed.)
Unpacking libjline-java (from .../libjline-java_1.0-1_all.deb) ...
dpkg: error processing /var/cache/apt/archives/libjline-java_1.0-1_all.deb (--unpack):
trying to overwrite '/usr/share/java/jline.jar', which is also in package scala 2.9.2-400
Errors were encountered while processing:
/var/cache/apt/archives/libjline-java_1.0-1_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

$ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these.
The following packages have unmet dependencies:
bsh : Depends: libjline-java but it is not installed
groovy : Depends: libjline-java but it is not installed
rhino : Depends: libjline-java but it is not installed
E: Unmet dependencies. Try using -f.






apt software-installation dpkg






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 20 '17 at 6:03









Anwar

55.4k20143252




55.4k20143252










asked Aug 15 '12 at 12:31









missingfaktor

73931021




73931021












  • Also looks live you need to install java, search for it in software center
    – Mark Kirby
    Aug 15 '12 at 12:46






  • 1




    Probably a duplicate of this Q&A or at least the solution should help
    – danjjl
    Aug 15 '12 at 12:51












  • @markkirby, I have run sudo apt-get update if that is what you are asking.
    – missingfaktor
    Aug 15 '12 at 16:59










  • @markkirby, JDK is already installed.
    – missingfaktor
    Aug 15 '12 at 16:59








  • 2




    IMHO Avinash Raj's answer is much safer and more widely applicable than the top two answers here. I recommend trying this first.
    – Zanna
    Aug 27 '17 at 10:03


















  • Also looks live you need to install java, search for it in software center
    – Mark Kirby
    Aug 15 '12 at 12:46






  • 1




    Probably a duplicate of this Q&A or at least the solution should help
    – danjjl
    Aug 15 '12 at 12:51












  • @markkirby, I have run sudo apt-get update if that is what you are asking.
    – missingfaktor
    Aug 15 '12 at 16:59










  • @markkirby, JDK is already installed.
    – missingfaktor
    Aug 15 '12 at 16:59








  • 2




    IMHO Avinash Raj's answer is much safer and more widely applicable than the top two answers here. I recommend trying this first.
    – Zanna
    Aug 27 '17 at 10:03
















Also looks live you need to install java, search for it in software center
– Mark Kirby
Aug 15 '12 at 12:46




Also looks live you need to install java, search for it in software center
– Mark Kirby
Aug 15 '12 at 12:46




1




1




Probably a duplicate of this Q&A or at least the solution should help
– danjjl
Aug 15 '12 at 12:51






Probably a duplicate of this Q&A or at least the solution should help
– danjjl
Aug 15 '12 at 12:51














@markkirby, I have run sudo apt-get update if that is what you are asking.
– missingfaktor
Aug 15 '12 at 16:59




@markkirby, I have run sudo apt-get update if that is what you are asking.
– missingfaktor
Aug 15 '12 at 16:59












@markkirby, JDK is already installed.
– missingfaktor
Aug 15 '12 at 16:59






@markkirby, JDK is already installed.
– missingfaktor
Aug 15 '12 at 16:59






2




2




IMHO Avinash Raj's answer is much safer and more widely applicable than the top two answers here. I recommend trying this first.
– Zanna
Aug 27 '17 at 10:03




IMHO Avinash Raj's answer is much safer and more widely applicable than the top two answers here. I recommend trying this first.
– Zanna
Aug 27 '17 at 10:03










4 Answers
4






active

oldest

votes

















up vote
53
down vote



accepted










Please don't go for the danjjl answer directly, if you face this kind of "trying to overwrite" error, is likely that you have conflicting packages that need to be solved first.



The immediate fix for the issue is to remove the conflicting package that is undesirable, in this case scala,



sudo dpkg -P scala


Next it would be recommended to submit a bug report with the respective package maintainers. This normally imply adding a Conflict: package line in the control file.



Also see this answer for more detailed explanation about this error.






share|improve this answer



















  • 3




    Not so sure about this advice. I think it depends on the situation. In the link to your earlier posting, there is a conflict from two versions of the same software. I agree there that one should remove the older software first. However, if there is a problem with how two different programs were packaged and the file that is being overwritten is identical or otherwise harmless, then I don't see a problem with the advice. No, not ideal...but it's probably a bit extreme to ask someone to not go for the a particular answer if the alternative is to wait until the problem is bug fixed...
    – Ray
    Dec 2 '15 at 13:11










  • @Ray in that case a bug report may be in order... but I doubt software from Ubuntu repositories has that problem, since they pull from Debian and Debian tests for these kind of problems exhaustively.
    – Braiam
    Jul 14 '16 at 1:35






  • 1




    @Braiam It's been a long time since I used Debian. Perhaps it's better now, but I saw similar problems with Debian. It isn't because of lack of exhaustive testing, but sometimes it is hard to test every possible scenario. No matter how much testing is performed, something can slip through. I'm not against writing a bug report, but "easier said that done". After all, it may be hard to summarize all of the conflicting packages. And, if bugs are not "hot" (i.e., they don't affect a lot of people), you'll just end up waiting.
    – Ray
    Jul 14 '16 at 1:48










  • Perhaps it would be better if the original answer was modified so that it said, "Please don't do because of (some reason)." So that someone can choose to ignore it once they know the pros and cons. As it stand, the answer above just says don't do it.
    – Ray
    Jul 14 '16 at 1:52










  • @Ray umm... when building a package dpkg stores a list of files (dpkg -L package) and simply looking for collisions should be enough for first measure. And by exhaustive testing I meant real world testing, unstable and testing are there precisely for this kind of stuff
    – Braiam
    Jul 14 '16 at 2:16


















up vote
85
down vote













To fix your problem run



sudo dpkg -i --force-overwrite /var/cache/apt/archives/libjline-java_1.0-1_all.deb


check everything is fixed by running : sudo apt-get -f install



If you still have problems rerun the first step with any dpkg: error processing (...) remaining



Solution found on webupd8






share|improve this answer



















  • 8




    This will effectively install the package but the problem remains when both package tries to use the same library/file/binary.
    – Braiam
    May 11 '14 at 23:11






  • 9




    Goodness, no, that's a recipe for a broken system...
    – fkraiem
    Jul 14 '16 at 1:41


















up vote
37
down vote













@danjjl's command works for .deb files. I found this command works with apt/apt-get:



sudo apt-get -o Dpkg::Options::="--force-overwrite" install <package-name>





share|improve this answer























  • only one that fixed an issue I had. thanks
    – dubnde
    Oct 26 '16 at 10:18






  • 4




    Great tipp. Be careful though: Overwriting things can cause serious trouble if the files are different. One of your conflicting packages will no longer function properly.
    – Cat
    Jan 24 '17 at 9:34










  • sudo apt-get -o Dpkg::Options::="--force-overwrite" install -f worked for me for a similar issue
    – user2205916
    Jul 23 at 1:28










  • @Cat: More like "great hack" then. ;-]
    – David Foerster
    Aug 17 at 12:41




















up vote
1
down vote













Not sure that is a global fix as I had the same issue, but with a libglx-mesa file in the cache conflicting with Nvidia-390. I removed the file and issued an apt install -f -y, let that finished and then proceeded with the apt update, upgrade and autoremove in that sequence.



I got the error while executing an apt dist-upgrade on Ubuntu 18.04 and continued the process again, no more issues and that seemed to be "my" fix.



Commands:



sudo su -
mv /var/cache/apt/archives/libglx-mesa0_18.0.0~rc5-1ubuntu1_amd64.deb ~
apt install -f -y
apt update -y
apt upgrade -y
apt autoremove -y
apt dist-upgrade


PS: Forcing an overwrite was a bad idea that I tried and I got lucky. But it's better to find the root cause, and fix it. I still have to investigate but the error lead me to move the file out the way.






share|improve this answer























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "89"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














     

    draft saved


    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f176121%2fdpkg-error-trying-to-overwrite-file-which-is-also-in%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    4 Answers
    4






    active

    oldest

    votes








    4 Answers
    4






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    53
    down vote



    accepted










    Please don't go for the danjjl answer directly, if you face this kind of "trying to overwrite" error, is likely that you have conflicting packages that need to be solved first.



    The immediate fix for the issue is to remove the conflicting package that is undesirable, in this case scala,



    sudo dpkg -P scala


    Next it would be recommended to submit a bug report with the respective package maintainers. This normally imply adding a Conflict: package line in the control file.



    Also see this answer for more detailed explanation about this error.






    share|improve this answer



















    • 3




      Not so sure about this advice. I think it depends on the situation. In the link to your earlier posting, there is a conflict from two versions of the same software. I agree there that one should remove the older software first. However, if there is a problem with how two different programs were packaged and the file that is being overwritten is identical or otherwise harmless, then I don't see a problem with the advice. No, not ideal...but it's probably a bit extreme to ask someone to not go for the a particular answer if the alternative is to wait until the problem is bug fixed...
      – Ray
      Dec 2 '15 at 13:11










    • @Ray in that case a bug report may be in order... but I doubt software from Ubuntu repositories has that problem, since they pull from Debian and Debian tests for these kind of problems exhaustively.
      – Braiam
      Jul 14 '16 at 1:35






    • 1




      @Braiam It's been a long time since I used Debian. Perhaps it's better now, but I saw similar problems with Debian. It isn't because of lack of exhaustive testing, but sometimes it is hard to test every possible scenario. No matter how much testing is performed, something can slip through. I'm not against writing a bug report, but "easier said that done". After all, it may be hard to summarize all of the conflicting packages. And, if bugs are not "hot" (i.e., they don't affect a lot of people), you'll just end up waiting.
      – Ray
      Jul 14 '16 at 1:48










    • Perhaps it would be better if the original answer was modified so that it said, "Please don't do because of (some reason)." So that someone can choose to ignore it once they know the pros and cons. As it stand, the answer above just says don't do it.
      – Ray
      Jul 14 '16 at 1:52










    • @Ray umm... when building a package dpkg stores a list of files (dpkg -L package) and simply looking for collisions should be enough for first measure. And by exhaustive testing I meant real world testing, unstable and testing are there precisely for this kind of stuff
      – Braiam
      Jul 14 '16 at 2:16















    up vote
    53
    down vote



    accepted










    Please don't go for the danjjl answer directly, if you face this kind of "trying to overwrite" error, is likely that you have conflicting packages that need to be solved first.



    The immediate fix for the issue is to remove the conflicting package that is undesirable, in this case scala,



    sudo dpkg -P scala


    Next it would be recommended to submit a bug report with the respective package maintainers. This normally imply adding a Conflict: package line in the control file.



    Also see this answer for more detailed explanation about this error.






    share|improve this answer



















    • 3




      Not so sure about this advice. I think it depends on the situation. In the link to your earlier posting, there is a conflict from two versions of the same software. I agree there that one should remove the older software first. However, if there is a problem with how two different programs were packaged and the file that is being overwritten is identical or otherwise harmless, then I don't see a problem with the advice. No, not ideal...but it's probably a bit extreme to ask someone to not go for the a particular answer if the alternative is to wait until the problem is bug fixed...
      – Ray
      Dec 2 '15 at 13:11










    • @Ray in that case a bug report may be in order... but I doubt software from Ubuntu repositories has that problem, since they pull from Debian and Debian tests for these kind of problems exhaustively.
      – Braiam
      Jul 14 '16 at 1:35






    • 1




      @Braiam It's been a long time since I used Debian. Perhaps it's better now, but I saw similar problems with Debian. It isn't because of lack of exhaustive testing, but sometimes it is hard to test every possible scenario. No matter how much testing is performed, something can slip through. I'm not against writing a bug report, but "easier said that done". After all, it may be hard to summarize all of the conflicting packages. And, if bugs are not "hot" (i.e., they don't affect a lot of people), you'll just end up waiting.
      – Ray
      Jul 14 '16 at 1:48










    • Perhaps it would be better if the original answer was modified so that it said, "Please don't do because of (some reason)." So that someone can choose to ignore it once they know the pros and cons. As it stand, the answer above just says don't do it.
      – Ray
      Jul 14 '16 at 1:52










    • @Ray umm... when building a package dpkg stores a list of files (dpkg -L package) and simply looking for collisions should be enough for first measure. And by exhaustive testing I meant real world testing, unstable and testing are there precisely for this kind of stuff
      – Braiam
      Jul 14 '16 at 2:16













    up vote
    53
    down vote



    accepted







    up vote
    53
    down vote



    accepted






    Please don't go for the danjjl answer directly, if you face this kind of "trying to overwrite" error, is likely that you have conflicting packages that need to be solved first.



    The immediate fix for the issue is to remove the conflicting package that is undesirable, in this case scala,



    sudo dpkg -P scala


    Next it would be recommended to submit a bug report with the respective package maintainers. This normally imply adding a Conflict: package line in the control file.



    Also see this answer for more detailed explanation about this error.






    share|improve this answer














    Please don't go for the danjjl answer directly, if you face this kind of "trying to overwrite" error, is likely that you have conflicting packages that need to be solved first.



    The immediate fix for the issue is to remove the conflicting package that is undesirable, in this case scala,



    sudo dpkg -P scala


    Next it would be recommended to submit a bug report with the respective package maintainers. This normally imply adding a Conflict: package line in the control file.



    Also see this answer for more detailed explanation about this error.







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Apr 13 '17 at 12:24









    Community

    1




    1










    answered Mar 13 '14 at 4:29









    Avinash Raj

    51k41165211




    51k41165211








    • 3




      Not so sure about this advice. I think it depends on the situation. In the link to your earlier posting, there is a conflict from two versions of the same software. I agree there that one should remove the older software first. However, if there is a problem with how two different programs were packaged and the file that is being overwritten is identical or otherwise harmless, then I don't see a problem with the advice. No, not ideal...but it's probably a bit extreme to ask someone to not go for the a particular answer if the alternative is to wait until the problem is bug fixed...
      – Ray
      Dec 2 '15 at 13:11










    • @Ray in that case a bug report may be in order... but I doubt software from Ubuntu repositories has that problem, since they pull from Debian and Debian tests for these kind of problems exhaustively.
      – Braiam
      Jul 14 '16 at 1:35






    • 1




      @Braiam It's been a long time since I used Debian. Perhaps it's better now, but I saw similar problems with Debian. It isn't because of lack of exhaustive testing, but sometimes it is hard to test every possible scenario. No matter how much testing is performed, something can slip through. I'm not against writing a bug report, but "easier said that done". After all, it may be hard to summarize all of the conflicting packages. And, if bugs are not "hot" (i.e., they don't affect a lot of people), you'll just end up waiting.
      – Ray
      Jul 14 '16 at 1:48










    • Perhaps it would be better if the original answer was modified so that it said, "Please don't do because of (some reason)." So that someone can choose to ignore it once they know the pros and cons. As it stand, the answer above just says don't do it.
      – Ray
      Jul 14 '16 at 1:52










    • @Ray umm... when building a package dpkg stores a list of files (dpkg -L package) and simply looking for collisions should be enough for first measure. And by exhaustive testing I meant real world testing, unstable and testing are there precisely for this kind of stuff
      – Braiam
      Jul 14 '16 at 2:16














    • 3




      Not so sure about this advice. I think it depends on the situation. In the link to your earlier posting, there is a conflict from two versions of the same software. I agree there that one should remove the older software first. However, if there is a problem with how two different programs were packaged and the file that is being overwritten is identical or otherwise harmless, then I don't see a problem with the advice. No, not ideal...but it's probably a bit extreme to ask someone to not go for the a particular answer if the alternative is to wait until the problem is bug fixed...
      – Ray
      Dec 2 '15 at 13:11










    • @Ray in that case a bug report may be in order... but I doubt software from Ubuntu repositories has that problem, since they pull from Debian and Debian tests for these kind of problems exhaustively.
      – Braiam
      Jul 14 '16 at 1:35






    • 1




      @Braiam It's been a long time since I used Debian. Perhaps it's better now, but I saw similar problems with Debian. It isn't because of lack of exhaustive testing, but sometimes it is hard to test every possible scenario. No matter how much testing is performed, something can slip through. I'm not against writing a bug report, but "easier said that done". After all, it may be hard to summarize all of the conflicting packages. And, if bugs are not "hot" (i.e., they don't affect a lot of people), you'll just end up waiting.
      – Ray
      Jul 14 '16 at 1:48










    • Perhaps it would be better if the original answer was modified so that it said, "Please don't do because of (some reason)." So that someone can choose to ignore it once they know the pros and cons. As it stand, the answer above just says don't do it.
      – Ray
      Jul 14 '16 at 1:52










    • @Ray umm... when building a package dpkg stores a list of files (dpkg -L package) and simply looking for collisions should be enough for first measure. And by exhaustive testing I meant real world testing, unstable and testing are there precisely for this kind of stuff
      – Braiam
      Jul 14 '16 at 2:16








    3




    3




    Not so sure about this advice. I think it depends on the situation. In the link to your earlier posting, there is a conflict from two versions of the same software. I agree there that one should remove the older software first. However, if there is a problem with how two different programs were packaged and the file that is being overwritten is identical or otherwise harmless, then I don't see a problem with the advice. No, not ideal...but it's probably a bit extreme to ask someone to not go for the a particular answer if the alternative is to wait until the problem is bug fixed...
    – Ray
    Dec 2 '15 at 13:11




    Not so sure about this advice. I think it depends on the situation. In the link to your earlier posting, there is a conflict from two versions of the same software. I agree there that one should remove the older software first. However, if there is a problem with how two different programs were packaged and the file that is being overwritten is identical or otherwise harmless, then I don't see a problem with the advice. No, not ideal...but it's probably a bit extreme to ask someone to not go for the a particular answer if the alternative is to wait until the problem is bug fixed...
    – Ray
    Dec 2 '15 at 13:11












    @Ray in that case a bug report may be in order... but I doubt software from Ubuntu repositories has that problem, since they pull from Debian and Debian tests for these kind of problems exhaustively.
    – Braiam
    Jul 14 '16 at 1:35




    @Ray in that case a bug report may be in order... but I doubt software from Ubuntu repositories has that problem, since they pull from Debian and Debian tests for these kind of problems exhaustively.
    – Braiam
    Jul 14 '16 at 1:35




    1




    1




    @Braiam It's been a long time since I used Debian. Perhaps it's better now, but I saw similar problems with Debian. It isn't because of lack of exhaustive testing, but sometimes it is hard to test every possible scenario. No matter how much testing is performed, something can slip through. I'm not against writing a bug report, but "easier said that done". After all, it may be hard to summarize all of the conflicting packages. And, if bugs are not "hot" (i.e., they don't affect a lot of people), you'll just end up waiting.
    – Ray
    Jul 14 '16 at 1:48




    @Braiam It's been a long time since I used Debian. Perhaps it's better now, but I saw similar problems with Debian. It isn't because of lack of exhaustive testing, but sometimes it is hard to test every possible scenario. No matter how much testing is performed, something can slip through. I'm not against writing a bug report, but "easier said that done". After all, it may be hard to summarize all of the conflicting packages. And, if bugs are not "hot" (i.e., they don't affect a lot of people), you'll just end up waiting.
    – Ray
    Jul 14 '16 at 1:48












    Perhaps it would be better if the original answer was modified so that it said, "Please don't do because of (some reason)." So that someone can choose to ignore it once they know the pros and cons. As it stand, the answer above just says don't do it.
    – Ray
    Jul 14 '16 at 1:52




    Perhaps it would be better if the original answer was modified so that it said, "Please don't do because of (some reason)." So that someone can choose to ignore it once they know the pros and cons. As it stand, the answer above just says don't do it.
    – Ray
    Jul 14 '16 at 1:52












    @Ray umm... when building a package dpkg stores a list of files (dpkg -L package) and simply looking for collisions should be enough for first measure. And by exhaustive testing I meant real world testing, unstable and testing are there precisely for this kind of stuff
    – Braiam
    Jul 14 '16 at 2:16




    @Ray umm... when building a package dpkg stores a list of files (dpkg -L package) and simply looking for collisions should be enough for first measure. And by exhaustive testing I meant real world testing, unstable and testing are there precisely for this kind of stuff
    – Braiam
    Jul 14 '16 at 2:16












    up vote
    85
    down vote













    To fix your problem run



    sudo dpkg -i --force-overwrite /var/cache/apt/archives/libjline-java_1.0-1_all.deb


    check everything is fixed by running : sudo apt-get -f install



    If you still have problems rerun the first step with any dpkg: error processing (...) remaining



    Solution found on webupd8






    share|improve this answer



















    • 8




      This will effectively install the package but the problem remains when both package tries to use the same library/file/binary.
      – Braiam
      May 11 '14 at 23:11






    • 9




      Goodness, no, that's a recipe for a broken system...
      – fkraiem
      Jul 14 '16 at 1:41















    up vote
    85
    down vote













    To fix your problem run



    sudo dpkg -i --force-overwrite /var/cache/apt/archives/libjline-java_1.0-1_all.deb


    check everything is fixed by running : sudo apt-get -f install



    If you still have problems rerun the first step with any dpkg: error processing (...) remaining



    Solution found on webupd8






    share|improve this answer



















    • 8




      This will effectively install the package but the problem remains when both package tries to use the same library/file/binary.
      – Braiam
      May 11 '14 at 23:11






    • 9




      Goodness, no, that's a recipe for a broken system...
      – fkraiem
      Jul 14 '16 at 1:41













    up vote
    85
    down vote










    up vote
    85
    down vote









    To fix your problem run



    sudo dpkg -i --force-overwrite /var/cache/apt/archives/libjline-java_1.0-1_all.deb


    check everything is fixed by running : sudo apt-get -f install



    If you still have problems rerun the first step with any dpkg: error processing (...) remaining



    Solution found on webupd8






    share|improve this answer














    To fix your problem run



    sudo dpkg -i --force-overwrite /var/cache/apt/archives/libjline-java_1.0-1_all.deb


    check everything is fixed by running : sudo apt-get -f install



    If you still have problems rerun the first step with any dpkg: error processing (...) remaining



    Solution found on webupd8







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Aug 19 '16 at 9:08









    Anwar

    55.4k20143252




    55.4k20143252










    answered Aug 15 '12 at 13:01









    danjjl

    4,53122343




    4,53122343








    • 8




      This will effectively install the package but the problem remains when both package tries to use the same library/file/binary.
      – Braiam
      May 11 '14 at 23:11






    • 9




      Goodness, no, that's a recipe for a broken system...
      – fkraiem
      Jul 14 '16 at 1:41














    • 8




      This will effectively install the package but the problem remains when both package tries to use the same library/file/binary.
      – Braiam
      May 11 '14 at 23:11






    • 9




      Goodness, no, that's a recipe for a broken system...
      – fkraiem
      Jul 14 '16 at 1:41








    8




    8




    This will effectively install the package but the problem remains when both package tries to use the same library/file/binary.
    – Braiam
    May 11 '14 at 23:11




    This will effectively install the package but the problem remains when both package tries to use the same library/file/binary.
    – Braiam
    May 11 '14 at 23:11




    9




    9




    Goodness, no, that's a recipe for a broken system...
    – fkraiem
    Jul 14 '16 at 1:41




    Goodness, no, that's a recipe for a broken system...
    – fkraiem
    Jul 14 '16 at 1:41










    up vote
    37
    down vote













    @danjjl's command works for .deb files. I found this command works with apt/apt-get:



    sudo apt-get -o Dpkg::Options::="--force-overwrite" install <package-name>





    share|improve this answer























    • only one that fixed an issue I had. thanks
      – dubnde
      Oct 26 '16 at 10:18






    • 4




      Great tipp. Be careful though: Overwriting things can cause serious trouble if the files are different. One of your conflicting packages will no longer function properly.
      – Cat
      Jan 24 '17 at 9:34










    • sudo apt-get -o Dpkg::Options::="--force-overwrite" install -f worked for me for a similar issue
      – user2205916
      Jul 23 at 1:28










    • @Cat: More like "great hack" then. ;-]
      – David Foerster
      Aug 17 at 12:41

















    up vote
    37
    down vote













    @danjjl's command works for .deb files. I found this command works with apt/apt-get:



    sudo apt-get -o Dpkg::Options::="--force-overwrite" install <package-name>





    share|improve this answer























    • only one that fixed an issue I had. thanks
      – dubnde
      Oct 26 '16 at 10:18






    • 4




      Great tipp. Be careful though: Overwriting things can cause serious trouble if the files are different. One of your conflicting packages will no longer function properly.
      – Cat
      Jan 24 '17 at 9:34










    • sudo apt-get -o Dpkg::Options::="--force-overwrite" install -f worked for me for a similar issue
      – user2205916
      Jul 23 at 1:28










    • @Cat: More like "great hack" then. ;-]
      – David Foerster
      Aug 17 at 12:41















    up vote
    37
    down vote










    up vote
    37
    down vote









    @danjjl's command works for .deb files. I found this command works with apt/apt-get:



    sudo apt-get -o Dpkg::Options::="--force-overwrite" install <package-name>





    share|improve this answer














    @danjjl's command works for .deb files. I found this command works with apt/apt-get:



    sudo apt-get -o Dpkg::Options::="--force-overwrite" install <package-name>






    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Aug 28 '16 at 17:24









    Byte Commander

    62.1k26167279




    62.1k26167279










    answered Jul 3 '14 at 3:48









    David Xia

    565159




    565159












    • only one that fixed an issue I had. thanks
      – dubnde
      Oct 26 '16 at 10:18






    • 4




      Great tipp. Be careful though: Overwriting things can cause serious trouble if the files are different. One of your conflicting packages will no longer function properly.
      – Cat
      Jan 24 '17 at 9:34










    • sudo apt-get -o Dpkg::Options::="--force-overwrite" install -f worked for me for a similar issue
      – user2205916
      Jul 23 at 1:28










    • @Cat: More like "great hack" then. ;-]
      – David Foerster
      Aug 17 at 12:41




















    • only one that fixed an issue I had. thanks
      – dubnde
      Oct 26 '16 at 10:18






    • 4




      Great tipp. Be careful though: Overwriting things can cause serious trouble if the files are different. One of your conflicting packages will no longer function properly.
      – Cat
      Jan 24 '17 at 9:34










    • sudo apt-get -o Dpkg::Options::="--force-overwrite" install -f worked for me for a similar issue
      – user2205916
      Jul 23 at 1:28










    • @Cat: More like "great hack" then. ;-]
      – David Foerster
      Aug 17 at 12:41


















    only one that fixed an issue I had. thanks
    – dubnde
    Oct 26 '16 at 10:18




    only one that fixed an issue I had. thanks
    – dubnde
    Oct 26 '16 at 10:18




    4




    4




    Great tipp. Be careful though: Overwriting things can cause serious trouble if the files are different. One of your conflicting packages will no longer function properly.
    – Cat
    Jan 24 '17 at 9:34




    Great tipp. Be careful though: Overwriting things can cause serious trouble if the files are different. One of your conflicting packages will no longer function properly.
    – Cat
    Jan 24 '17 at 9:34












    sudo apt-get -o Dpkg::Options::="--force-overwrite" install -f worked for me for a similar issue
    – user2205916
    Jul 23 at 1:28




    sudo apt-get -o Dpkg::Options::="--force-overwrite" install -f worked for me for a similar issue
    – user2205916
    Jul 23 at 1:28












    @Cat: More like "great hack" then. ;-]
    – David Foerster
    Aug 17 at 12:41






    @Cat: More like "great hack" then. ;-]
    – David Foerster
    Aug 17 at 12:41












    up vote
    1
    down vote













    Not sure that is a global fix as I had the same issue, but with a libglx-mesa file in the cache conflicting with Nvidia-390. I removed the file and issued an apt install -f -y, let that finished and then proceeded with the apt update, upgrade and autoremove in that sequence.



    I got the error while executing an apt dist-upgrade on Ubuntu 18.04 and continued the process again, no more issues and that seemed to be "my" fix.



    Commands:



    sudo su -
    mv /var/cache/apt/archives/libglx-mesa0_18.0.0~rc5-1ubuntu1_amd64.deb ~
    apt install -f -y
    apt update -y
    apt upgrade -y
    apt autoremove -y
    apt dist-upgrade


    PS: Forcing an overwrite was a bad idea that I tried and I got lucky. But it's better to find the root cause, and fix it. I still have to investigate but the error lead me to move the file out the way.






    share|improve this answer



























      up vote
      1
      down vote













      Not sure that is a global fix as I had the same issue, but with a libglx-mesa file in the cache conflicting with Nvidia-390. I removed the file and issued an apt install -f -y, let that finished and then proceeded with the apt update, upgrade and autoremove in that sequence.



      I got the error while executing an apt dist-upgrade on Ubuntu 18.04 and continued the process again, no more issues and that seemed to be "my" fix.



      Commands:



      sudo su -
      mv /var/cache/apt/archives/libglx-mesa0_18.0.0~rc5-1ubuntu1_amd64.deb ~
      apt install -f -y
      apt update -y
      apt upgrade -y
      apt autoremove -y
      apt dist-upgrade


      PS: Forcing an overwrite was a bad idea that I tried and I got lucky. But it's better to find the root cause, and fix it. I still have to investigate but the error lead me to move the file out the way.






      share|improve this answer

























        up vote
        1
        down vote










        up vote
        1
        down vote









        Not sure that is a global fix as I had the same issue, but with a libglx-mesa file in the cache conflicting with Nvidia-390. I removed the file and issued an apt install -f -y, let that finished and then proceeded with the apt update, upgrade and autoremove in that sequence.



        I got the error while executing an apt dist-upgrade on Ubuntu 18.04 and continued the process again, no more issues and that seemed to be "my" fix.



        Commands:



        sudo su -
        mv /var/cache/apt/archives/libglx-mesa0_18.0.0~rc5-1ubuntu1_amd64.deb ~
        apt install -f -y
        apt update -y
        apt upgrade -y
        apt autoremove -y
        apt dist-upgrade


        PS: Forcing an overwrite was a bad idea that I tried and I got lucky. But it's better to find the root cause, and fix it. I still have to investigate but the error lead me to move the file out the way.






        share|improve this answer














        Not sure that is a global fix as I had the same issue, but with a libglx-mesa file in the cache conflicting with Nvidia-390. I removed the file and issued an apt install -f -y, let that finished and then proceeded with the apt update, upgrade and autoremove in that sequence.



        I got the error while executing an apt dist-upgrade on Ubuntu 18.04 and continued the process again, no more issues and that seemed to be "my" fix.



        Commands:



        sudo su -
        mv /var/cache/apt/archives/libglx-mesa0_18.0.0~rc5-1ubuntu1_amd64.deb ~
        apt install -f -y
        apt update -y
        apt upgrade -y
        apt autoremove -y
        apt dist-upgrade


        PS: Forcing an overwrite was a bad idea that I tried and I got lucky. But it's better to find the root cause, and fix it. I still have to investigate but the error lead me to move the file out the way.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Jun 11 at 22:28









        Stephen Rauch

        1,1546716




        1,1546716










        answered Jun 11 at 19:34









        user3091464

        111




        111






























             

            draft saved


            draft discarded



















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f176121%2fdpkg-error-trying-to-overwrite-file-which-is-also-in%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            How to send String Array data to Server using php in android

            Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents

            Is anime1.com a legal site for watching anime?