4

I was using Xubuntu in my laptop. I, accidentally removed the sources.list file, when trying to find a solution for apt-get error in my system. I shut it down and the next time, I boot my system, it started to run memory tests and it went on in a loop, did not stop. Finally, I found Linux is missing from the grub menu. There were only, memory test and memory testx86.

I am not able to find a solution for this, so I planned to reinstall Xubuntu again. I have Xubuntu bootable pen drive now. But I have to do it, without losing the data from the /home folder. Can someone please help me with this?

Thanks in advance.

2 Answers 2

2

Try this:

Boot the Xubuntu Live-Usb.

Open a terminal,

Press Ctrl+Alt+T

Run it:

exec sudo -i
fdisk -l

Suppose fdisk reports, /dev/sda1 = / and /dev/sda5 = /home, continue runing:

umount /dev/sda1
fsck -a /dev/sda1
umount /dev/sda5
fsck /dev/sda5
mount /dev/sda1 /mnt
mount --bind /dev /mnt/dev
mount --bind /dev/pts /mnt/dev/pts
mount --bind /proc /mnt/proc
mount --bind /sys /mnt/sys
cp /etc/apt/sources.list /mnt/etc/apt/sources.list
chroot /mnt
nano /etc/resolv.conf

In the open file paste the following lines:

nameserver 208.67.222.222
nameserver 208.67.220.220

Ctrl+O

Save file.

Ctrl+X

Close nano.

Continue running:

apt update
apt dist-upgrade
grub-install --root-directory=/mnt/ubuntu /dev/sda
grub-install --recheck /dev/sda
update-grub
umount /mnt/dev
umount /mnt/dev/pts
umount /mnt/proc
umount /mnt/sys
umount /mnt
reboot
2
  • It returns the following after executing 'fdisk -l', /dev/sda1 * in the boot column
    – User
    Commented Jul 31, 2016 at 17:11
  • Disk /dev/sda: 74,5 GiB, 80032038912 bytes, 156312576 sectors /dev/sda1 * 2048 2527231 2525184 1,2G 83 Linux = / (root)
    – kyodake
    Commented Jul 31, 2016 at 17:59
2

I would recommend you to reinstall the system, as it is the easiest way to go.

if you don't have the /home into a separate partition, you should backup your data into another drive. After that, you should be able to install Xubuntu without troubles, and you won't need to follow the next steps I'm giving you.

If the /home folder is in a separate partition, just start the Xubuntu installer.

When you are asked if you want to delete the disk, select the last option (I don't know how is it labeled in English, maybe More options, Something more or Advanced options) and click on Next.

Select the partition where your actual system is installed and click on Change.

Select ext4 (or what you want) as the filesystem, / as the mount point and check the Format partition request. Click Accept

Select the /home partition (use fdisk -l or mount to know what partition is the home. It's usually the largest one in your disk) and click on Change. Select filesystem (you have to choose the actual filesystem of the partition. Again, use fdisk -l or mount to know it) and mount point (/home), but DON'T CHECK the Format drive option. Click on Accept and you are done.

Click on Install, confirm your changes, continue the system configuration, wait for it to be installed, etc.

When your system is fully ready-to-use, backup the sources.list file, so you won't need to reformat the PC if you face this issue again in the future.

Hope this helps!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .