0

Say I'm running an experimental/unstable linux distro day-to-day, but want a stable fallback in case things break (e.g. Arch on one partition, Debian on a second, data on a third).

Is there a way to ensure that the stable distro is updated while booted into the unstable one? So that when I boot into the stable distro after months away it doesn't have a huge number of updates to run at once.

Samizdis
  • 249
  • 2
  • 9
  • That's an interesting idea! Have you tried anything yet? Has googling yielded anything useful? – gronostaj Feb 08 '17 at 18:11
  • 2
    That for sure should be possible. This is more or less the way the installation of any linux distro works. You boot from the cd (=your experimental system), copy over the files for the other linux to the according drive, then you "chroot" into the new distro, and can run all commands. Only the kernel used in while being in the chroot-environment is your current one of the experimental build. From chroot you can then run apt-update or whatever command your distro uses. – TJJ Feb 08 '17 at 18:21

1 Answers1

1

So TJJ's comment gives the key: use chroot, then run apt-get or whatever. There are a few devilish details though:

1) PATH needs to be set correctly. export PATH=$PATH:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin gets Ubuntu's apt-get to work correctly.

2) Ubuntu has a fancy resolv.conf alternative, which breaks. Prompted by this askubuntu answer: backup /etc/resolv.conf using cp -av /etc/resolv.conf{,.bak} (since it's a symlink), replace it with a one-line resolv.conf (rm /etc/resolv.conf ; echo 'nameserver 91.239.100.100 #blog.uncensoreddns.org' > /etc/resolv.conf), and restore it afterwards (cp -av /etc/resolv.conf{.bak,})

3) apt-get warns that /dev/pts is broken, but this doesn't seem to cause a problem.

I haven't come across any of the kernel issues that TJJ mentions, but YMMV I guess.

Samizdis
  • 249
  • 2
  • 9
  • 1
    see an (oldy but goody) [chroot guide](http://superuser.com/questions/111152/whats-the-proper-way-to-prepare-chroot-to-recover-a-broken-linux-installation) -- note the `mount` commands before the actual `chroot` command; those are to put the proc/sys/dev trees in place. you may need to tweak those commands for your distribution (as mentioned, it's an old guide). – quixotic Feb 10 '17 at 02:30