brittAnderson / Intro2Computing4Psychology

A guided introduction to computing tools useful for research in psychology - targeted to complete beginners
46 stars 159 forks source link

Can anyone help? Ubuntu VM stuck & not starting; can't run a manual fsck on the root filesystem #77

Closed K14R45H closed 2 years ago

K14R45H commented 2 years ago

Yesterday, while using my Ubuntu 20.04 VM, I got a little pop-up error saying the virtual machine's hard drive is running out of space (< 200 MB left). I went in the settings and checked that it was set to 13 GB by default.

I looked up some instructions online on how to extend it. Basically, I turned off the VM, went to the VM's settings in Hyper-V Manager and increased the allotted virtual hard drive space to 64 GB. Then, when I applied the changes and went to power on my VM, I got the following error code again and again.

image

I tried looking up instructions online, and tried to manually do a file system check (fsck) using fsck /dev/sda1 and similar variants, but I would get the same error, and when it would ask me to abort, the only option I could press was "yes" (see below).

image

Has anyone encountered a similar issue, or does anyone have any clue what I might have done wrong and how to fix it?

brittAnderson commented 2 years ago

This is a bad error, and may result in you needing to reinstall the virtual machine. But it does allow you to learn a little more about your computer. You have a hard disk (in your case virtuall). When you fill it up there is no more room to write data. It will try to swap things around for a while, deleting what it knows to be temporary, but eventually it fills up and can't perform proper housekeeping. So, you decided to increase the hard disk size, /but/ your computer needs to know the rules for what to do with the extra size. So, you have to also increase the file system. This is the second part of things: the map or rules about how addresses in software space are mapped to addresses in hardward space (and in a virtual machine there are even more layers of abstraction). If you mess with the size of partitions you have to also mess with the filesystem. I have made this mistake on physical drives using LLVM and it resulted in me having to reinstall.

You can try fsck /dev/sda -y

You can find out more about fsck here: fsck

If this works, and I have my doubts, you will still need to extend your fs. For that you will need to look into resizefs. As you can see you are deep in the weeds here, but it is a good learning experience, and we can always rework the assignment deadlines.

K14R45H commented 2 years ago

Hi Professor Anderson,

"Deep in the weeds" is a good way to put it. I think I may have messed up by not mounting/unmounting the file system(s), or perhaps by not increasing the file system correctly the 1st and only time it booted up (after I first inreased the virtual hard disk size).

I tried the fsck /dev/sda1 -y (since in my case the file system is called "dev/sda1") and a couple variants of it, but all of them leave me with the same error and only an option to abort the fsck.

I'll try looking into the link you provided about fsck, and I'll see if I can resizefs the file system and get my VM back up & running somehow. I hope it won't come to this, but if necessary, I'll shut down & reinstall the VM entirely. At least I've submitted some previous assignments, so it shouldn't be the end of the world.

Thank you as well for being very flexible with assignment deadlines in this course. It really helps reduce my anxiety about getting started on assignments, and also with seeing them through to completion.

j3rowlan commented 2 years ago

Hi! I have had some trouble opening my virtual machine due to not having enough memory. To fix this, I opened up hyper-V manager and clicked on the virtual machine that had trouble opening. Next, I scrolled down the action menu until I found settings and from there I was able to open 'Memory.' The top of the memory section should say RAM: 2400 MB. I decreased 2400 gradually until I got to 1500 MB and it was able to open. I am not sure if 1500 will work for you but you can give it a try! Finally, I clicked 'apply' and 'okay.' I am not sure if this will work for you since my error message was slightly different but it might help others using virtual machines. Good luck!

On a side note, if you have multiple virtual machines, it may be best to delete any that you are not using.

K14R45H commented 2 years ago

Hi all,

I tried the RAM decrease and the fsck solutions proposed by @j3rowlan and by Professor @brittAnderson respectively, but to no avail. Nothing got rid of the error, nor did any of the fixes I attempted change the status to a different error/issue. Nevertheless, thank you both for trying to help me.

I eventually gave up, deleted the VM and reinstalled Ubuntu 20.04 using VMware this time. I configured my browser, password manager, RStudio and Emacs, and all seems to be running well so far as of yesterday when I last booted it up.

Lesson learned: When looking to extend your virtual disk storage space on a VM, don't do so when you're sleepy/tired, and follow instructions you find on how to do so carefully. Most importantly, after you've increased the virtual disk space allocated to your VM, make sure you do a proper job increasing/adjusting the file system size in your VM afterward... otherwise, you may end up in a similarly unfortunate situation :).

brittAnderson commented 2 years ago

Might be nice to share a few points of comparison between virtual box and vmware. The latter is more devoted to corporate environments though it does have the free single VM personal version. What were the trade-offs you found for ease of use versus flexibility and potential for growth.