LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how to fix fstab of one Ubuntu from older Ubuntu in multi-boot system (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-fix-fstab-of-one-ubuntu-from-older-ubuntu-in-multi-boot-system-4175609437/)

abo sal 07-08-2017 05:59 AM

how to fix fstab of one Ubuntu from older Ubuntu in multi-boot system
 
I have 6 os installed (MBR HDD) on my PC (2 windows and 4 Linux disros), but let me make the long story short. I will say that I have 4 Os's (2 windows, Ubuntu 14.04 and Ubuntu 16.04 installed). After I copied the Ubuntu 16.04 /home data to external HDD, I manipulated the HDD (repartitions) using disk management and MiniTool Partition Wizard in MS windows. I intentionally deleted the /home and /swap partitions of one Ubuntu 16.04; using those windows tools. I ended up booting to one windows only from the 4 OS's, so I used boot-repair USP flash to to fix the grub. all 4 OS's are in the grub I can log to one Ubuntu but not the other it try to log and comes back to login screen(because I deleted /home). Using Ubuntu 14.04 ( instead of live CD) I created new home and swap partitions for Ubuntu 16.04 and edited its fstab using the method recommended by , Steve Stites in: http://www.linuxquestions.org/questi...estion-631370/ . I still can't log to Ubuntu 16.04. please help to fix this, Abo sal

yancek 07-08-2017 07:17 AM

Since you already have the boot repair software, the best thing to do would be to run it again and select the option to Create BootInfo Summary. This will give a link at the end to post here so that members can review drive/partition and boot file info. You modified partitions and thus changed UUID's.

AwesomeMachine 07-08-2017 12:10 PM

From the Ubuntu you can log into, plug in the external drive, and do:
Code:

$ ls -al /dev/disk/by-UUID
and grab the UUID of the external /home partition of the system you can't log into.

Open /etc/fstab of that system and replace the UUID for /home with the new UUID you grabbed from the command above.

colorpurple21859 07-08-2017 05:57 PM

did you create a new user, or create new directory for the user you already have in /home?

BW-userx 07-08-2017 06:07 PM

or back door that one as root re-create a user or same one - give passwd to said same user then try to get in that way?

jailbait 07-08-2017 07:12 PM

Check to see if the UUIDs in your 2 /etc/fstab files are the same as the UUIDs on the corresponding partitions.

----------------------
Steve Stites

abo sal 07-09-2017 12:16 PM

Thank you all for your help
 
Thank you all for your help
Steve Stites – The 2 /etc/fstab files are the same _after some modification_as the UUIDs on the
corresponding partitions, if you meant by the 2 /etc/fstab - ( fstab's Ubuntu 16.04 + fstab's Ubuntu
14.04.) - I think each distro has its own fstab (independent). Of course Ubuntu 14.04 fstab matches
its home UUID after boot repair. For Ubuntu 16.04 I recreated new home and swap and added the
new UUID to fstab of 16.04 using installed Ubuntu 14.04 not live CD; like you explained before in
your post(..gedit /sparrow/etc/fstab..). Of course I commented the old UUID, because they don't
exist any more. I think I used your method once but using live CD and I think it worked. Now I
don't have have live CD but I have another Ubuntu that I can create new /home and new swap using
geparted and edit fstab of the other Ubuntu.
Colorpurple21859 I see the 3 users (created before) in the login screen when trying to log (no new
user). I can log as gust. Does new directory means new home ?? regards

jailbait 07-09-2017 01:08 PM

Quote:

Originally Posted by abo sal (Post 5732819)
Colorpurple21859 [/U][/B]I see the 3 users (created before) in the login screen when trying to log (no new
user). I can log as gust. Does new directory means new home ?? regards

Linux keeps a table of usernames with a corresponding number for each username. In the various directories and files the owner is represented by a number not a name. If you have different users in your two Ubuntu systems or if you created the users in different orders on the two systems then the user numbers for some or all users will be different on the two Ubuntu systems. In that case copying the /home directory from one Ubuntu to another would create an unusable system.

-----------------------
Steve Stites

BW-userx 07-09-2017 01:35 PM

yeah what jailbate said but in short hand all of your users have to have same username = same UID and group = same GID in every and all distos if you are sharing the /home especially or it will have conflicts.

find it
Code:

id -u username
id -g username
id -G username
id username

change it
Code:

# find / -group 2000 -exec chgrp -h foo {} \;
# find / -user 1005 -exec chown -h foo {} \;


colorpurple21859 07-09-2017 02:15 PM

Quote:

because I deleted /home). Using Ubuntu 14.04 ( instead of live CD) I created new home and swap partitions for Ubuntu 16.04 and edited its fstab using the method recommended b
when you created the new home was it /home or /home/<username>? and even then, when you create the new /home/<username>/ you will still have to change ownership of the new /home/<username> to the user that owned the /home/<username> that you had deleted.

abo sal 07-10-2017 03:23 AM

To avoid confusion let me ask a simpler question I have Ubuntu 16.04 installed on mbr HDD. The partitions on the hdd are:
/root /dev/sda1
/home /dev/sda2
/swap /dev/sda3
NTFS /dev/sda3
The users are: A and B.
if I used live CD and deleted the home and swap partitions,kept /root intact.I repartitioned the HDD. How can I add new home + swap and edit fstab. thnakx

abo sal 07-10-2017 07:39 AM

Colorpurple21859 when I created the new home it was /home not /home/<username>? I don't know how to create /home/<username>

BW-userx 07-10-2017 07:40 AM

why are you deleting the partitions? if you are needing more space in you home and swap is where you are taking it from then just resize. to delete two partitions and just re-establish them seems redundant.

too bad you cannot just log in root with your system being split that just removes the need to use a DVD or USB Stick - logging in root keeps you on the / (sda1) side then you can do what ever you want to sda2 thru N

but now can this be?
Code:

/swap /dev/sda3
NTFS /dev/sda3

NTFS and swap partition on same partition?

but to just answer your question.

Boot DVD
when you are in a login off DVD open a terminal blkid to get the proper address for safety, then cfdisk /dev/sda2 delete /dev/sda3 delete - then take that new space and split it up again then when you have everything the way you want it, then have cfdisk 'write' that to the disk. I believe that formatting will then be need if using cfdisk.

Now the need for home/user lifts its head, so then you're back to adding that home/user with proper permissions UID and GID on the directory, and their is plenty of how to do that in this thread.

you can delete the partitions with Gparted too if the DVD os has gparted. and do that same thing with Gparted. GParted can easily do the formatting for you after you've re done your partitions.

Not forgetting New swap, New Home Partitions --

you can use old school /dev/sda3 /home - until you get into your original OS and change it to UUID's -- that will work - or
sudo blkid to get UUIDs - I usually open two terminals one for notes
UUID and such notes and the other terminal for the work to be done.

still DVD OS just terminal -> mount /sda1 to DVD /tmp
Code:


sudo nano /tmp/ect/fstab

do your thing
save
reboot when ready.

abo sal 07-10-2017 07:46 AM

[QUOTE= would create an unusable system.

-----------------------
Steve Stites[/QUOTE]
jailbait I don't know what u meant by "would create an unusable system".grub lists all operating systems, I can use 3 of them (2 windows and one Ubuntu). I meant copying data I downloaded or created in desktop or downloaded to NfTS partition. Every distro has its own home directory. Eventually all of my data ends up to NTFS partition, because they can be accessed by windows and Linux.

abo sal 07-10-2017 07:54 AM

BW-userx
windows is in (sda1). but I can log to the root using recovery or alt+ ctr l F1.


All times are GMT -5. The time now is 06:37 AM.