1

I need to repair a network related package (Samba) that is preventing my system from booting. (mint 17).

I have a bootable USB stick with the same OS. How would I fix the broken package on my hard disk through the USB operating system?

  • Give me a few minutes, and I'll have an answer for you.... This takes awhile as I have to create a chroot – eyoung100 Dec 10 '14 at 16:50
0

Download the package(s) that you need and use dkpg with the --instdir option:

dpkg --instdir=/path/to/mounted/HDD --install yourpackage.deb

you might want to use --purge (also with the appropriate --instdir!!) first if dpkg doesn't want to overwrite a half installed package.

0

Fix

The easiest way to do this is to create a chroot, and then perform the repair operations inside the chroot. You do this by:

  1. Verify the network works outside the chroot. Issue a sudo ifconfig.
  2. Create a mountpoint for your installation that needs fixing. Issue a sudo mkdir -pv /mnt/mymint
  3. Now mount your installation. Issue sudo mount -v -t ext4 /dev/sdX where X is the letter for your root partition. You may need to change the -t option depending on your filesystem.
  4. Verify your swap partition. Issue sudo swapon /dev/sdY where Y is your swap partition.
  5. Issue the following commands to sync up the LiveDisk with your install:
    mount -t proc proc /mnt/mymint/proc
    mount --rbind /sys /mnt/mymint/sys
    mount --rbind /dev /mnt/mymint/dev
  6. Enter Your Change Root. Issue:
    chroot /mnt/mymint /bin/bash
    source /etc/profile
    export PS1="(chroot) $PS1"
  7. Now we don't have to use any extra options with any Targets as in Anthon's Answer. We can use apt-get(Do this for all Broken packages):
    sudo apt-get remove --purge brokenpackagename && sudo apt-get-install packagename
  8. Reboot. Issue:
    exit
    umount -l /mnt/mymint/dev{/shm,/pts,}
    umount /mnt/mymint{/boot,/sys,/proc,}
    reboot

Reasoning

My personal opinion is that using a changeroot is the safest approach because, in this way nothing from the LiveCD/USB interferes with your system. I'll admit this approach probably scares off some newer users, but I can assure you that this work as it is the method that the Gentoo Distribution uses for new installs. If interested, see Chapter 6 of the Gentoo Install Handbook.

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.