5

I have installed Ubuntu 16.04 onto my hard disk.

After tingling with the nvidia drivers and installing xserver-xorg-core or something (I was trying to get bumblebee and optirun to work), I found a post saying xserver-xorg-input-all was not installed - which left me with a system that I can boot into, but not interact with.

I tried recovery mode, but my laptop only has wifi (or LAN via USB-Stick, which I think would probably be as complicated to get to work) and I cannot manage to get network up and working in recovery mode.

So I started a live cd / live-USB-Stick with Ubuntu 16.04 (that I used to install Ubuntu) and it mounted my hard drive with Ubuntu on it as well.

Is there a way to somehow install that package into the installation of Ubuntu on my hard drive while running live Ubuntu?

Igor
  • 203
  • 1
  • 2
  • 9
  • Short answer: NO. –  Nov 16 '17 at 04:50
  • might this possible with chroot? – virullius Nov 16 '17 at 04:51
  • @mjb2kmn I had a brief look into chroot and it seems as if it might be just the tool to do what I want (I found a tutorial explaining how to use chroot with /mnt in order to reset the root password using passwd). If you could elaborate a bit on chroot and perhaps offer an example on what to do to install a package to an installation (after having fired up a terminal from within a booted recovery-CD/-flashdrive), I woulld greatly appreciate it and mark the answer as correct if it works. Meanwhile I solved the problem by connecting via USB-LAN in recovery mode. – Igor Nov 19 '17 at 19:49

1 Answers1

11

It's difficult to speak to the exact situation with xserver-xorg-input-all, however, I can show how to install packages on an installation booted from a live image.

I tested this with a Xubuntu 17.04 VM.

Summary of steps

  • Boot from a compatible live image, preferably the one you installed from.
  • Mount the root volume of the installation.
  • Bind mount /dev, /proc, and /sys inside the root volume mount.
  • Bind mount /run if /etc/resolv.conf is a symlink to /run/resolvconf/resolv.conf. This is required on Ubuntu 17.04, but I'm not sure if it is on 16.04. This is required for DNS name resolution.
  • chroot into the mounted file system.
  • Install, uninstall, or configure as needed.
  • Reboot into installation.

Actual commands

The device you're mounting in the first command will need to be adjusted to match your installation's root volume.

mount /dev/xubuntu-vg/root /mnt
mount --bind /dev /mnt/dev
mount --bind /sys /mnt/sys
mount --bind /proc /mnt/proc
mount --bind /run /mnt/run # if needed, as noted above
chroot /mnt
apt install gnucash # or whatever you need

Wrap up

I was able to install gnucash, an application I did not previously have installed and which has many dependencies. After a reboot, GnuCash was installed and functional.

Note that I did not update the cache with apt-get update before installing, this was intentional because I knew my cache on the installation was up-to date enough. Depending on your situation, updating the cache may be necessary.

virullius
  • 641
  • Thank you! I just tried it on my laptop (where I installed Ubuntu 16.04) and it seemed to work just the way I wanted. – Igor Nov 26 '17 at 07:32
  • 1
    Correction: Under "Wrap up" in answer 1 above, it refers to apt-cache update, but I believe this should read apt-get update. Apologies if I'm wrong. – dave Jun 24 '19 at 17:33
  • You are correct. Thanks for the note, I've fixed the answer. – virullius Jun 25 '19 at 14:59
  • 1
    Also: if the application I want to install is in a different repository (ppa), I have to add that repository and - at least it seemed so - use apt-get update in order to be able to install that application. – Igor Sep 09 '19 at 16:36