LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-08-2017, 05:59 AM   #1
abo sal
LQ Newbie
 
Registered: May 2017
Location: KSA
Distribution: ubuntu 14.4
Posts: 9

Rep: Reputation: Disabled
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
 
Old 07-08-2017, 07:17 AM   #2
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,502

Rep: Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489
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.
 
Old 07-08-2017, 12:10 PM   #3
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524

Rep: Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015
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.
 
Old 07-08-2017, 05:57 PM   #4
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,346

Rep: Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589
did you create a new user, or create new directory for the user you already have in /home?
 
Old 07-08-2017, 06:07 PM   #5
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
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?

Last edited by BW-userx; 07-08-2017 at 06:23 PM.
 
Old 07-08-2017, 07:12 PM   #6
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Virginia, USA
Distribution: Debian 12
Posts: 8,337

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

----------------------
Steve Stites
 
Old 07-09-2017, 12:16 PM   #7
abo sal
LQ Newbie
 
Registered: May 2017
Location: KSA
Distribution: ubuntu 14.4
Posts: 9

Original Poster
Rep: Reputation: Disabled
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
 
Old 07-09-2017, 01:08 PM   #8
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Virginia, USA
Distribution: Debian 12
Posts: 8,337

Rep: Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548
Quote:
Originally Posted by abo sal View Post
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
 
Old 07-09-2017, 01:35 PM   #9
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
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 {} \;

Last edited by BW-userx; 07-09-2017 at 01:37 PM.
 
Old 07-09-2017, 02:15 PM   #10
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,346

Rep: Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589
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.

Last edited by colorpurple21859; 07-09-2017 at 03:20 PM.
 
Old 07-10-2017, 03:23 AM   #11
abo sal
LQ Newbie
 
Registered: May 2017
Location: KSA
Distribution: ubuntu 14.4
Posts: 9

Original Poster
Rep: Reputation: Disabled
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
 
Old 07-10-2017, 07:39 AM   #12
abo sal
LQ Newbie
 
Registered: May 2017
Location: KSA
Distribution: ubuntu 14.4
Posts: 9

Original Poster
Rep: Reputation: Disabled
Colorpurple21859 when I created the new home it was /home not /home/<username>? I don't know how to create /home/<username>
 
Old 07-10-2017, 07:40 AM   #13
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
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.

Last edited by BW-userx; 07-10-2017 at 07:51 AM.
 
Old 07-10-2017, 07:46 AM   #14
abo sal
LQ Newbie
 
Registered: May 2017
Location: KSA
Distribution: ubuntu 14.4
Posts: 9

Original Poster
Rep: Reputation: Disabled
[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.
 
Old 07-10-2017, 07:54 AM   #15
abo sal
LQ Newbie
 
Registered: May 2017
Location: KSA
Distribution: ubuntu 14.4
Posts: 9

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


Reply

Tags
fstab, home, uuid



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
restoring ubuntu in boot option in multi-boot set up. avee137 Linux - Newbie 4 05-07-2010 01:42 AM
Multi-boot Ubuntu-64/Vista-64/WinXP only boots Ubuntu and Vista rben Linux - Newbie 4 02-24-2009 04:52 AM
Ubuntu Partition does not work on Multi System PC countrydance Linux - Desktop 2 10-15-2008 02:03 PM
LXer: Installing Ubuntu/Kubuntu Dapper Drake on a Single/Multi-Boot RAID System LXer Syndicated Linux News 0 02-08-2007 03:21 PM
Mounting a new ext3 on LVM system by a co-existing older system's ext2 /etc/fstab JZL240I-U Linux - Software 2 11-28-2005 07:44 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:41 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration