Issue with GRUB and existing /home partition in installing Trisquel mini

10 respuestas [Último envío]
JimG
Desconectado/a
se unió: 01/13/2019

I just installed Trisquel Mini on a laptop with sda1 as "/", sda6 as "/home", and sda5 as swap. I intended to leave /home as is.

I actually did this twice; the first time I installed I didn't partition "/". When booting, I got the Mageia grub page as before the install. So I installed again, this time formatting "/". After this, I get a grub error:

file '/boot/grub2/i386-pc/normal.mod' not found. Entering rescue mode

After searching I found how to boot:

set prefix=(hd0,1)/boot/grub
set root=(hd0,1)
insmod normal
normal

and then the laptop boots to the log-in screen.

Now, however, it will not accept the password I gave for user "jim" when I installed, perhaps because the directory "/home/jim" in sda6 hasn't been assigned to this user yet. Okay, I'll log in as root and fix things...but wait, this is an Ubuntu-based system, there is no root user. Or is there a way to log in as root?

So it seems I have two issues:
1. How to fix grub?
2. How to assign /home/jim to user jim and get login to work?

Can this system be salvaged?

Thank you!

Jim G

loldier
Desconectado/a
se unió: 02/17/2016
Magic Banana

I am a member!

I am a translator!

Desconectado/a
se unió: 07/24/2010

You can get a root terminal using 'chroot' from another (installed or live) system. Here is (too) comprehensive information on how to do so and then reinstall GRUB: https://help.ubuntu.com/community/Grub2/Installing#via_ChRoot

Instructions 7, 10, 11, 12 and 13 are certainly enough. In fact there may not even be a need to reinstall GRUB (instruction 12): 'update-grub' (instruction 13) may be enough.

Still from that terminal, you need to set (e.g., with 'chown') the uid and gid of the files to match those of the created users/groups: they can be respectively read in the third and fourth column of /etc/passwd. Or you delete those users (but not their home folders) and recreate them (e.g., with 'adduser --uid ID --gid ID') with the ids matching those of the files. You can read those ids with 'stat /home/*' (well, assuming your /dev/sda6 was mounted in /home). In fact, if your goal is to have /home shared among several GNU/Linux systems, you must follow the second path (the uid and gid must be the same on all systems) to not mess around with the other systems.

As far as I remember and if that has not changed (a decade ago, I was using BLAG Linux And GNU, a 100% free distribution that was based on Fedora), users' ids start at 500 on Fedora. On Trisquel, they start at 1000, as written in /etc/login.defs. That is certainly the source of your problem.

EDIT: according to https://fedoraproject.org/wiki/Features/1000SystemAccounts a clean installation of Fedora 16 (released in November 2011) or above should have its user ids starting at 1000... and you actually use Mageia (I do not know why I thought you were using Fedora)... but, according to https://wiki.mageia.org/en/From_Mageia_5_to_6 the same happen when Mageia 6 was released, in July 2017. So if the install that created the user directories is that of Mageia 5 (or before), here is your problem.

JimG
Desconectado/a
se unió: 01/13/2019

Thank you! This is a lot of great information. I'll be giving all this a try tomorrow.

JimG
Desconectado/a
se unió: 01/13/2019

Okay, all of your posts are very helpful and I now have GRUB installed and can boot up. Now I need to fix the user ID issue so I can use the home partition and log in. Which I think I can do once I have a shell with root privileges.

When booting normally, I can't log into my (new) "jim" account, and the guest account forbids root privilege. Is there another way, such as booting into troubleshooting some sort of troubleshooting mode?

If I boot from the flash drive, I now know how to use chroot and drive mounting to "become" root for my installed system. However, can I also mount /home and have it be placed correctly? Do I need this? I was able to delete the user "jim" but haven't been able to create the user "jim" without having /home mounted. I know the user ID and group ID for user "jim" from the old OS (10000 and 500, respectively).

I tried the command

adduser --uid 10000 --gid 500 --home /home/jim --no-create-home jim

Also, the group ID 500 apparently doesn't exist in the new system. So I need to create group "jim" with group ID 500 also?

Getting there...but need a little more info.

Thanks again!

Magic Banana

I am a member!

I am a translator!

Desconectado/a
se unió: 07/24/2010

Instructions 7 and 11 of https://help.ubuntu.com/community/Grub2/Installing#via_ChRoot give you a shell with root privileges and, indeed, you then need to 'mount /dev/sda6 /home'.

That said, you can also get a root terminal from GRUB's menu, using the "e" key to edit the entry you will boot and adding the "single" option to Linux (as far as I remember). /home will be mounted with that technique.

Realizing how easy it is to get a root terminal for anybody with a physical access, you may then want to add recovery entries to GRUB's "Advanced options for Trisquel" (or whatever it is called). Here is how:

  1. Open /etc/default/grub in your favorite text editor (here 'nano') and using administrative privileges:
    $ sudo nano /etc/default/grub
  2. Add the character "#" at the beginning of the following line of /etc/default/grub:
    GRUB_DISABLE_RECOVERY="true"
  3. Save and quit;
  4. Update GRUB:
    $ sudo update-grub

Recovery entries boot in root terminals.

Your command is fine but, after reading some of 'man adduser', I am pretty sure it can simply be:
# adduser --uid 10000 --gid 500 jim
Also, that command should create the group as well.

JimG
Desconectado/a
se unió: 01/13/2019

Success! Thank you, thank you, thank you!

Just a few additional details for the benefit of anyone else who might be following this path.

Ultimately I couldn't add the user with the specified group ID, so I created the user without specifying the gid, and then changed the group ID.

Also, I had to add the user to the sudoers file with adduser jim sudo

Now I have a good deal of cleanup yet to do, and things to install, but I have a working laptop and account!

Magic Banana

I am a member!

I am a translator!

Desconectado/a
se unió: 07/24/2010

I should have told you to set the value of GID_MIN to 500 in /etc/login.defs before adding the user. That value being 1000 (by default) is the reason for adduser's error, I believe. When you write that you "changed the group ID", do you mean editing /etc/group to have 500 next to your login (if so, edit /etc/login.defs too) or changing the group owner of all your personal files ('chgrp -R jim ~jim' or equivalent)?

JimG
Desconectado/a
se unió: 01/13/2019

I came across GID_MIN in documentation and thought that might be relevant but decided to go ahead and try anyway.

I changed the group ID by "groupmod -g 500 jim", I think. No manual file editing.

Magic Banana

I am a member!

I am a translator!

Desconectado/a
se unió: 07/24/2010

Good. I would still set the value of GID_MIN to 500 in /etc/login.defs. With the default GID_MIN, "jim" is not a normal group but a system group. I honestly do not know what difference it makes (well, except for the commands 'useradd', 'groupadd' and 'newusers' that create the groups).

JimG
Desconectado/a
se unió: 01/13/2019

Done, thanks.