It is possible to emulate a running system via chroot on a live booted system. The steps primarily include booting a LiveCD and mount file systems AND MOST IMPORTANTLY mount the /etc/resolv.conf into the temporary chroot which resolves DNS (translates human-friendly domain names into the numeric IP addresses that are required for access to resources on the local area network or the Internet or something like that).

Boot into a live system and then drop into a terminal root shell:

List the disk partitions like below:

root@localhost: ~ # /sbin/fdisk -l
Disk /dev/sda: 465.8 GiB, 500107862016 bytes, 976773168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: FCF6DF37-A156-41E9-A9CF-D031C3FE956F

Device         Start       End   Sectors   Size Type
/dev/sda1       2048 586133503 586131456 279.5G Linux filesystem
/dev/sda2  586133504 587110399    976896   477M EFI System

you can see, here /dev/sda1 is the root partition (where Debian is installed into) and /dev/sda2 is the EFI boot partition. You might have some other partitions too like an extra home partition etc. So now you need to mount those partitions to the running Live session. It can be done by the following way (very similar):

root@localhost: ~ # mount /dev/sda1 /mnt  (Mounted the rootfs)
root@localhost: ~ # mount /dev/sda2 /mnt/boot/efi/  (Mounted the EFI boot partition)
root@localhost: ~ # mount /dev/sdaX /mnt/home (Only if you have separate partitions for /HOME)

just assume /mnt as new / for now and everything will be fall under /mnt/var, /mnt/tmp, /mnt/home like that. You also need to bind mounts of /dev (device nodes), /proc (process information pseudo-file system), and /sys (kernel objects file system). For that, just issue the following loop:

root@localhost: ~ # for name in proc sys dev ; do mount --bind /$name /mnt/$name; done

also for getting your network work inside chroot environment, just mount /etc/resolve.conf into chroot by following way:

root@localhost: ~ # mount --bind /etc/resolv.conf /mnt/etc/resolv.conf

now you are almost done and you can access/operate your locally installed system from live cd and make changes to it. For that, just type:

root@localhost: ~ # chroot /mnt/ /bin/bash

from here, do whatever you want, reinstall packages, DE or somewhat else. After you are done, just upgrade the grub and regenerate initramfs if necessary (most probably you don't have to).

root@chroot: ~ # apt install network-manager-gnome
root@chroot: ~ # update-initramfs -uv; update-grub
root@chroot: ~ # exit


CategorySystemRescue