Newbie here. Can't log into Linux after careless use of "chown" commnand

Questions about Grub, UEFI,the liveCD and the installer
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
jomama
Level 1
Level 1
Posts: 48
Joined: Thu May 24, 2018 10:16 pm

Newbie here. Can't log into Linux after careless use of "chown" commnand

Post by jomama »

Hi, I am very new to Linux. I'm a lifelong Windows user, but a few weeks ago I decided a to give Linux a try. I installed Linux Mint 18.3 in a dual-boot setup next to my Windows 10 system. The installation went flawlessly, and since then I am absolutely loving the Linux experience. I almost never go to Windows anymore. Then tonight I did something really stupid.

I was creating a folder in root that I was going to use as a mount point for an external drive. I went to check the newly-created folder permissions with chown -R user:user /filename but I forget the filename. I heard a lot of disk activity. Then, instead of staying in Linux and making sure that I hadn't messed anything up, I made an even worse mistake: I rebooted. Yup!

Now I can't get back into Linux. When I reboot the machine, I get into Linux, I see the Linux Mint logo but the password screen never comes. Instead, I have a blinking cursor at the top-left corner of the screen. I tried to boot into recovery but I don't know enough to navigate through the recovery boot menu. Please, some help would be truly appreciated. Thank you.
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
WharfRat

Re: Newbie here. Can't log into Linux after careless use of "chown" commnand

Post by WharfRat »

Hello jomama

Welcome to Linux Mint and the Linux Mint forum :)

If you did what I think you did, you made the ultimate neophyte mistake.

In the recovery mode console enter ls -lh /

If your user name shows instead of root as the owner and group then a re-installation would be the easiest and quickest fix.

Also you should setup a chown alias using --preserve-root so that would not happen again.
jomama
Level 1
Level 1
Posts: 48
Joined: Thu May 24, 2018 10:16 pm

Re: Newbie here. Can't log into Linux after careless use of "chown" commnand

Post by jomama »

Hi WharfRat:

Thank you for the warm welcome. Wish it were under better circumstances.

I went into the recovery console, executed the ls command. There were a number of entries and I didn't know which particular entry to look at for the info that you'd be interested in so I took a picture of the screen. Unfortunately, even a greatly reduced size that is still legible is "too large" for the forum. How to proceed?
User avatar
Moem
Level 22
Level 22
Posts: 16230
Joined: Tue Nov 17, 2015 9:14 am
Location: The Netherlands
Contact:

Re: Newbie here. Can't log into Linux after careless use of "chown" commnand

Post by Moem »

Put it on the net somewhere (there's tons of free image hosters) and post the direct link to the image here, enclosed in rimg tags.
Image

If your issue is solved, kindly indicate that by editing the first post in the topic, and adding [SOLVED] to the title. Thanks!
jomama
Level 1
Level 1
Posts: 48
Joined: Thu May 24, 2018 10:16 pm

Re: Newbie here. Can't log into Linux after careless use of "chown" commnand

Post by jomama »

Here you go. Hope it works...
Image
User avatar
Moem
Level 22
Level 22
Posts: 16230
Joined: Tue Nov 17, 2015 9:14 am
Location: The Netherlands
Contact:

Re: Newbie here. Can't log into Linux after careless use of "chown" commnand

Post by Moem »

That was the link to the page with the image, not to the image, but I've fixed that for you. Good luck!
Image

If your issue is solved, kindly indicate that by editing the first post in the topic, and adding [SOLVED] to the title. Thanks!
jomama
Level 1
Level 1
Posts: 48
Joined: Thu May 24, 2018 10:16 pm

Re: Newbie here. Can't log into Linux after careless use of "chown" commnand

Post by jomama »

Thank you, Moem. But "Good luck!"? Does that mean what I think it means? :(
User avatar
Moem
Level 22
Level 22
Posts: 16230
Joined: Tue Nov 17, 2015 9:14 am
Location: The Netherlands
Contact:

Re: Newbie here. Can't log into Linux after careless use of "chown" commnand

Post by Moem »

I don't know what you think it means, it means I'm hoping you'll have a good solution, is all.
But how bad can it be? I mean, a backup-and-reinstall is not a disaster... especially if you can copy your home directory. And I don't see any reason why you couldn't.

Indicentally, this is a reason why some of us prefer to have a separate /home partition. It's so easy to reinstall the OS and leave that partition intact (after making a backup just to be sure). It's like swapping out the table cloth while leaving all the plates and cutlery in place.

Don't worry, WharfRat is great at stuff like this, you're in good hands.
Image

If your issue is solved, kindly indicate that by editing the first post in the topic, and adding [SOLVED] to the title. Thanks!
jomama
Level 1
Level 1
Posts: 48
Joined: Thu May 24, 2018 10:16 pm

Re: Newbie here. Can't log into Linux after careless use of "chown" commnand

Post by jomama »

Thanks for the encouragement and you're right--it really won't be a big deal if I have to reinstall the OS. It's only been a few weeks that I've been on Linux and that wasn't enough time for me to create a wasteland of content, just a few files I'd like to preserve. Besides, I do believe I created a separate partition for home when I installed the OS. So yes, not bad at all. Anyway, it's 2 AM here and I need my beauty sleep, so good night. Catch you guys on the flip side.
WharfRat

Re: Newbie here. Can't log into Linux after careless use of "chown" commnand

Post by WharfRat »

jomama,

Yep, you did exactly what I thought you did and changed every files owner:group to you :?

Consider this a learning experience and just reinstall - it's the quickest solution and much less painful than reinstalling Windows.

When setting up a mount point for your external media use the /media folder for it, e.g., sudo mkdir /media/external

If you check man hier
/media This directory contains mount points for removable media such as CD and DVD disks or USB sticks.
There's no need to chown anything after creating a mount point as the permissions are maintained in the filesystem :wink:

Good luck :wink:
jomama
Level 1
Level 1
Posts: 48
Joined: Thu May 24, 2018 10:16 pm

Re: Newbie here. Can't log into Linux after careless use of "chown" commnand

Post by jomama »

Ouch! That's a hard lesson to learn but hopefully it'll serve me well in the future. :oops:

I was creating a mount point outside of /media specifically because I needed Plex to be able to access it. You're right though, I didn't need to execute chown after creating the folder.

I'm going to go ahead and reinstall the OS, as you suggested. I was contemplating doing that at some point in the near future anyway, and give Mint more space on the SSD than I had originally assigned.

But I have a few of preparatory questions:

1) Can I keep the /home partition intact during the reinstall and thus preserve the documents I created, or perhaps move them somewhere? ( I have docs in the Documents and Downloads folders, but also on the Desktop that I'd like to preserve.)

2) I have an opportunity to enlarge the partitions now. What sizes for /root /swap and /home would you recommend for long-term use?

3) Anything else I should know before delving into this?

Thank you for your help, WharfRat.
WharfRat

Re: Newbie here. Can't log into Linux after careless use of "chown" commnand

Post by WharfRat »

Are you sure about the home partition :?:

The standard installation does not provision a separate home partition.

Even if you have one it's still recommended that you copy anything you couldn't do without to an external media as a safety precaution.

The easiest way to recover your files is to boot the live installation media, mount your linux or home partition and copy them to your external media.

If you paste back the results of sudo blkid from the live session here we can have a look at your disk's layout.

As far as size goes it depends on the number of additional apps you intend to install. Usually 24GIG always worked for me for the root partition.

Swap is still debated since memory is more abundant than in the past, but 1X physical memory works for me.

But be advised that I don't suspend or hibernate and I believe that 2X memory is required for that.
User avatar
Spearmint2
Level 16
Level 16
Posts: 6900
Joined: Sat May 04, 2013 1:41 pm
Location: Maryland, USA

Re: Newbie here. Can't log into Linux after careless use of "chown" commnand

Post by Spearmint2 »

I would boot LIVE DVD and copy that /home folder only to a FAT32 partition on flashdrive, then reinstall the system the way I wanted it. The reason I say to a FAT32 partition is because FAT strips off all file ownership and later you can copy them direct to your new home folder and they will automatically shift ownership to your new home. It also avoids using CHOWN again.
All things go better with Mint. Mint julep, mint jelly, mint gum, candy mints, pillow mints, peppermint, chocolate mints, spearmint,....
jomama
Level 1
Level 1
Posts: 48
Joined: Thu May 24, 2018 10:16 pm

Re: Newbie here. Can't log into Linux after careless use of "chown" commnand

Post by jomama »

Am I sure that that I created a separate partition for /home?

I'm pretty sure. When I installed Linux Mint, I took the "Something else" option for the Installation Type and created the three partitions manually, similar to the way guide lays out a dual-boot installation:
https://www.tecmint.com/install-linux-m ... uefi-mode/.

So I think I could preserve the existing root partition. But I rather prefer your suggestion of moving the files I want to keep somewhere and of starting off with a completely fresh install.

Now, the question is: Do you have a guide, a link perhaps, where I can find the various steps I need to follow? Or I could do some googling, write down the few steps/commands I think I'll need and share them with you here before proceeding?
WharfRat

Re: Newbie here. Can't log into Linux after careless use of "chown" commnand

Post by WharfRat »

jomama wrote: Fri May 25, 2018 12:59 pm Am I sure that that I created a separate partition for /home?

I'm pretty sure. When I installed Linux Mint, I took the "Something else" option for the Installation Type and created the three partitions manually, similar to the way guide lays out a dual-boot installation:
https://www.tecmint.com/install-linux-m ... uefi-mode/.

So I think I could preserve the existing root partition. But I rather prefer your suggestion of moving the files I want to keep somewhere and of starting off with a completely fresh install.

Now, the question is: Do you have a guide, a link perhaps, where I can find the various steps I need to follow? Or I could do some googling, write down the few steps/commands I think I'll need and share them with you here before proceeding?
If you followed that link's instructions then you do have a home partition.
You can resize/move partitions using the live session's gparted application.

Do you need assistance with copying your files or reinstalling :?: I'm not quite clear on that :?
jomama
Level 1
Level 1
Posts: 48
Joined: Thu May 24, 2018 10:16 pm

Re: Newbie here. Can't log into Linux after careless use of "chown" commnand

Post by jomama »

The former. Having done it once, I am pretty comfortable with the installation steps. I'm just not sure how you move files/folders from an existing partition to a some other location for safekeeping. I imagine it'll be with shell commands. Sorry, I know my newbie is showing.
User avatar
Spearmint2
Level 16
Level 16
Posts: 6900
Joined: Sat May 04, 2013 1:41 pm
Location: Maryland, USA

Re: Newbie here. Can't log into Linux after careless use of "chown" commnand

Post by Spearmint2 »

what's wrong with using the file manager included in the distro?
All things go better with Mint. Mint julep, mint jelly, mint gum, candy mints, pillow mints, peppermint, chocolate mints, spearmint,....
jomama
Level 1
Level 1
Posts: 48
Joined: Thu May 24, 2018 10:16 pm

Re: Newbie here. Can't log into Linux after careless use of "chown" commnand

Post by jomama »

Spearmint2 wrote: Fri May 25, 2018 2:44 pm what's wrong with using the file manager included in the distro?
Sorry I didn't see your previous reply till just now, Spearmint2, but I really appreciate it. I'll use a flash drive. I think the ones I have are all FAT32.

I didn't realize I had access to a file manager in the distro. LOL. That'll work for me. I'm gonna give it a go now and report back.

Thank you!
jomama
Level 1
Level 1
Posts: 48
Joined: Thu May 24, 2018 10:16 pm

Re: Newbie here. Can't log into Linux after careless use of "chown" commnand

Post by jomama »

WharfRat wrote: Fri May 25, 2018 1:09 pm ...
If you followed that link's instructions then you do have a home partition.
You can resize/move partitions using the live session's gparted application.

Do you need assistance with copying your files or reinstalling :?: I'm not quite clear on that :?
Gentlemen, I just wanted to report back and tell you that I 'm back up and running. Now the process of customizing, updating, installing applications begin, but that's the fun part. Thank you for your patience and help. Things are never so bleak as when you have good people holding you up. I'll be more careful going forward. :D
Locked

Return to “Installation & Boot”