Read Write Permissions Lost To Media Drives

Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Post Reply
Finnaaah
Level 1
Level 1
Posts: 3
Joined: Thu Feb 15, 2024 9:36 am

Read Write Permissions Lost To Media Drives

Post by Finnaaah »

Hi all,
I'm still relatively new to using Linux so I apologise if this is dumb. In order to use some Windows only software without having to boot into Windows, I set up a VM using Virtualbox, which worked great for a while until I needed USB passthrough. I had to update Virtualbox in order to use the latest extension package, but after updating it requested I add my user to the vboxusers group, which I did with:

Code: Select all

 sudo usermod -a -G vboxusers $USER 
After this I logged out and back in, then I got an error related to read write permissions when launching the VM. I found that when I went to the drive which the VM is stored in (a separate partition from my root and home), I could not create or edit any files, which is concerning since almost all of my work is on this drive. I'm not sure if I've missed something that I did which could cause this, but trying to change the permissions to allow read and write access to this drive didn't fix the issue. When I try access the drive as root I still have the same issue.
Just to clarify, I was able to read and write out of this drive without any issues for months up until this point. The only other command I ran before realising I lost permissions was:

Code: Select all

/sbin/vboxconfig
Which Virtualbox had prompted me to run.

I'm not sure if this is of any use, but running "ls -l /dev/nvme0n1p2" (/dev/nvme0n1p2 being the drive in question) returns:

Code: Select all

brwxrw---- 1 root disk 259, 2 Feb 16 00:10 /dev/nvme0n1p2
Any help is greatly appreciated, thanks!!
User avatar
AndyMH
Level 21
Level 21
Posts: 13759
Joined: Fri Mar 04, 2016 5:23 pm
Location: Wiltshire

Re: Read Write Permissions Lost To Media Drives

Post by AndyMH »

That ls output is normal, you need to check ownership of home, ls -l /home/$USER. You should own everything, specifically the VirtualBox VMs folder (assuming you have not changed the default).
Thinkcentre M720Q - LM21.3 cinnamon, 4 x T430 - LM21.3 cinnamon, Homebrew desktop i5-8400+GTX1080 Cinnamon 19.0
Finnaaah
Level 1
Level 1
Posts: 3
Joined: Thu Feb 15, 2024 9:36 am

Re: Read Write Permissions Lost To Media Drives

Post by Finnaaah »

AndyMH wrote: Thu Feb 15, 2024 2:16 pm That ls output is normal, you need to check ownership of home, ls -l /home/$USER. You should own everything, specifically the VirtualBox VMs folder (assuming you have not changed the default).
Hi, thanks for the help. It looks like my user owns everything there, ls -l /home/$USER returns:

Code: Select all

total 42844
drwxrwxr-x  9 finn finn     4096 Nov 21 12:01  Arduino
drwxr-xr-x  9 finn finn     4096 Nov  7 16:31  arduino-1.8.19
drwxrwxr-x  2 finn finn     4096 Dec 20 10:22 'Bambu Studio'
drwxrwxr-x  6 finn finn     4096 Nov 12 19:24 'Design Projects'
drwxr-xr-x  2 finn finn     4096 Feb  8 13:50  Desktop
drwxr-xr-x  3 finn finn     4096 Nov 27 22:03  Documents
drwxr-xr-x 11 finn finn    12288 Feb 15 23:20  Downloads
-rw-rw-r--  1 finn finn      501 Feb  3 22:21  JBC-Controller.code-workspace
-rw-rw-r--  1 finn finn       98 Jan 22 11:07  JBC-Tests.code-workspace
-rw-rw-r--  1 finn finn 43771659 Jan 23 17:18 'Keysight 34450A manual.pdf'
-rw-rw-r--  1 finn finn      140 Jan 22 17:33  minicom.log
drwxr-xr-x  2 finn finn     4096 Nov  7 16:09  Music
drwxrwxr-x 14 finn finn     4096 Nov  7 19:15  openocd
drwxr-xr-x  3 finn finn     4096 Feb  6 21:05  Pictures
drwxr-xr-x  2 finn finn     4096 Nov  7 16:09  Public
-rw-rw-r--  1 finn finn     5047 Dec  5 18:19  pw60.json
drwxrwxr-x  3 finn finn     4096 Nov 27 21:54  python
drwxrwxr-x 19 finn finn     4096 Jan 15 13:41  qmk_firmware
drwxrwxr-x  2 finn finn     4096 Jan 18 13:57  Shortcut
drwxr-xr-x  2 finn finn     4096 Nov  7 16:09  Templates
drwxr-xr-x  2 finn finn     4096 Jan 18 14:01  Videos
drwxrwxr-x  3 finn finn     4096 Feb 15 23:52 'VirtualBox VMs'
But I still cannot write to my drive. To be more specific, I have two SSDs which are both partitioned, and I can't write or edit any partitions other than home and root.
Finnaaah
Level 1
Level 1
Posts: 3
Joined: Thu Feb 15, 2024 9:36 am

Re: Read Write Permissions Lost To Media Drives

Post by Finnaaah »

I figured it out!! After hours of messing around I managed to get read write permissions and thought it was fixed. I ran my VM and was working away for a few hours before needing to restart for a NI-VISA driver. When I restarted the VM, nothing had saved at all. I then realised that it had been booting in read only due to a Windows cleanup issue, and even though I had gotten past that, nothing could actually be written to the drive.
This was what tipped me off;
I had edited my fstab file to mount the partitions as read and write, then unmounted both drives and ran sudo mount -a which returned:

Code: Select all

The disk contains an unclean file system (0, 0).
Metadata kept in Windows cache, refused to mount.
Falling back to read-only mount because the NTFS partition is in an
unsafe state. Please resume and shutdown Windows fully (no hibernation
or fast restarting.)
Could not mount read-write, trying read-only
The disk contains an unclean file system (0, 0).
Metadata kept in Windows cache, refused to mount.
Falling back to read-only mount because the NTFS partition is in an
unsafe state. Please resume and shutdown Windows fully (no hibernation
or fast restarting.)
Could not mount read-write, trying read-only
I then remembered that I had force shutdown my Windows boot, since it was asking to update and I hadn't used it in months, so didn't want to deal with said updates. That hadn't cleaned up the cache. All I needed to do was boot into Windows, sit through 45 minutes of updates, shut down properly, and then happy days. Hopefully someone finds this useful, I lost hours of work in my VM :oops:
Post Reply

Return to “Storage”