How to: Fix “Could not get lock…” “Unable to lock directory…” in OpenMediaVault (OMV)

The Error

Sometimes when we want to install some tools/program with “sudo apt install program” in OMV via terminal/SSH we encounter following error which blocks us from installing the program

E: Could not get lock /var/cache/archives/lock – open (11: resource temporarily unavailable)
E: Unable to lock directory /var/cache/apt/archives

The Fix

Usually, that means we have new updates waiting to be installed

1 Navigate to OMV web UI via http/https://your-OMV-hostname-or-IP-address

2 Navigate to “System” click on “Update Management”

OMV - Update Management
OMV – Update Management

3 Check all available updates then click on “Install” button

4 Wait till all updates are done

5 Now get back to terminal/SSH and try to install program again, this time there should be no errors

Bonus

Here are some useful apps/programs/utilities can be installed via “sudo apt install” and can be used easily for managing/monitoring OMV from terminal/SSH

htop – Similar to top, with more info

htop
htop

nethogs – Real-time network/traffic usage

nethogs
nethogs

iftop – Another traffic monitoring program

iftop
iftop

glances – Comprehensive monitoring

glances
glances

How To: Create Apple Time Machine in Open Media Vault 5 (OMV 5) with Shared Folder (SMB Share/Windows Share/Shared Folder/CIFS)

In How To: Create Apple Time Machine in Open Media Vault (OMV) we have walked-through how to create Apple Time Machine in OMV 4 with openmediavault-netatalk plugin. It’s compatible with many older and newer macOS, but it’s not possible to see or share files using that space with Microsoft Windows Operating Systems like Windows 10 etc.

From macOS Mojave 10.14 and onwards (Including macOS Catalina 10.15), Time Machine is compatible with Windows Share/Shared Folder/SMB/CIFS. (Suggested minimum SMB version V3)

This guide will not only walk you through how to create apple time machine in open media vault 5 (OMV 5) with Shared Folder/SMB Share/Windows Share/CIFS, you will also learn how to create Windows shared folder for use between Windows PC<-> Windows PC, Windows PC <-> macOS, macOS <-> macOS in OMV 5.

(For OpenMediaVault 4/OMV 4, please follow this one: How To: Create SMB/CIFs/Windows Share in Open Media Vault (OMV))

1 Make sure OMV 5 Installed

1.1 Login to OMV webui

1.2 Go to “Diagnostics” -> “System Information”

OMV -> Diagnostics -> System Information
OMV -> Diagnostics -> System Information

1.3 Make sure you have OMV 5 installed

OMV - Version - 5.2.1-1 (Usul)
OMV – Version – 5.2.1-1 (Usul)

2 Create File system

2.1 Make sure you have attached the physical disk to the device

2.2 Login to open media vault webui

2.3 Go to “Storage” -> “Disks”

OMV -> Storage -> Disks
OMV -> Storage -> Disks

2.4 Scan for disks if it’s not there

OMV -> Storage -> Disks -> Scan
OMV -> Storage -> Disks -> Scan

2.5 Go to “Storage” -> “File Systems”

OMV -> Storage -> File Systems
OMV -> Storage -> File Systems

2.6 Click on “Create” button to create and initialise the disk for use

OMV-> Storage -> File Systems
OMV-> Storage -> File Systems

2.7 Create file system, make sure you have selected correct “Device”, you can leave the “Label” empty, select default “EXT4” as “File system” if you have no idea what is this or which one to go with.

OMV-> Storage -> File Systems -> Create file system
OMV-> Storage -> File Systems -> Create file system

2.8 Now the new File system is created, we need to Mount it (Attach it for use). Select the File system we have just created, then click on Mount button

OMV-> Storage -> File Systems -> Mount
OMV-> Storage -> File Systems -> Mount

2.9 Click on “Apply” to commit the change

The configuration has been changed. You must apply the changes in order for them to take effect.
The configuration has been changed. You must apply the changes in order for them to take effect.

3 Create Windows Share (SMB Share/Shared Folder/CIFS) For Time Machine (and Windows) to use/share

3.1 Go to “Services” -> “SMB/CIFS”

OMV -> Services -> SMB/CIFS
OMV -> Services -> SMB/CIFS

3.2 Click on “Shares” then click on “Add”

OMV - Services -> SMB/CIFS -> Shares -> Add
OMV – Services -> SMB/CIFS -> Shares -> Add

3.3 Click on “+” button from “Shared folder” row

OMV -> Services -> SMB/CIFS -> Shares -> Add -> Add Share
OMV -> Services -> SMB/CIFS -> Shares -> Add -> Add Share

3.4 Give it a name, select correct device, create a path leave the permission as default, Click on “Save” button to save the settings

OMV -> Services -> SMB/CIFS ->Shares -> Add -> Add Share ->Add shared folder
OMV -> Services -> SMB/CIFS ->Shares -> Add -> Add Share ->Add shared folder

3.5 Make sure “Shared folder” row has right settings, Make sure “Time Machine support” is enabled, Click on “Save” button to save the settings

OMV -> Services -> SMB/CIFS -> Shares -> Add -> Add Share
OMV -> Services -> SMB/CIFS -> Shares -> Add -> Add Share
OMV -> Services -> SMB/CIFS -> Shares -> Add -> Add Share
OMV -> Services -> SMB/CIFS -> Shares -> Add -> Add Share

3.6 Click on Settings, enable SMB/CIFS service

OMV -> Services -> SMB/CIFS -> Settings -> Enable
OMV -> Services -> SMB/CIFS -> Settings -> Enable

3.7 Now you will be able to find the Time Machine folder from your “macOS” -> Top Left corner “Apple Icon” -> “System Preferences” -> “Time Machine” -> “Select Backup Disk…” (Warning: It’s a good idea to continue with Section 4 to create and use a dedicate account for accessing shared folder rather than using OMV’s administrator account for security reasons though it’s not essential for making shared folder and Time Machine working)

macOS -> Apple Icon -> System Preferences...
macOS -> Apple Icon -> System Preferences…
macOS -> Apple Icon -> System Preferences... -> Time Machine
macOS -> Apple Icon -> System Preferences… -> Time Machine
macOS -> Apple Icon -> System Preferences... -> Time Machine -》 Select Backup Disk...
macOS -> Apple Icon -> System Preferences… -> Time Machine -》 Select Backup Disk…

4 Create and configure Users if necessary

4.1 Go to “Access Rights Management” -> “User”

OMV -> Access Rights Management -> User
OMV -> Access Rights Management -> User

4.2 Click on “Add” -> “Add”

OMV -> Access Rights Management -> User -> Add -> Add
OMV -> Access Rights Management -> User -> Add -> Add

4.3 Enter Name, Password for the new user under “General” tab, make sure the user is in “users” group under “Group” tab

OMV -> Access Rights Management -> User -> Add -> Add -> Add user - General
OMV -> Access Rights Management -> User -> Add -> Add -> Add user – General
OMV -> Access Rights Management -> User -> Add -> Add -> Add user - Group
OMV -> Access Rights Management -> User -> Add -> Add -> Add user – Group

4.3 Now you should be able to see the new user in the list

OMV -> Access Rights Management -> User
OMV -> Access Rights Management -> User

5 Configure user permission for shared folder

5.1 Go to “Access Rights Management” -> “Shared Folders”

OMV -> Access Rights Management -> Shared Folders
OMV -> Access Rights Management -> Shared Folders

5.2 Click on the shared folder which we have configured in Section 3, then click on “Privileges” button, make sure give “Read/Write” access to the user we have created

OMV -> Access Rights Management -> Shared Folders
OMV -> Access Rights Management -> Shared Folders

6 Configure Time Machine on macOS

6.1 On macOS, go to Top Left corner “Apple Icon” -> “System Preferences” -> “Time Machine” -> “Select Backup Disk…”

macOS -> Apple Icon -> System Preferences...
macOS -> Apple Icon -> System Preferences…
macOS -> Apple Icon -> System Preferences... -> Time Machine
macOS -> Apple Icon -> System Preferences… -> Time Machine
macOS -> Apple Icon -> System Preferences... -> Time Machine -》 Select Backup Disk...
macOS -> Apple Icon -> System Preferences… -> Time Machine -》 Select Backup Disk…

6.2 Select the one we have just created under “Available Disks”, click on “Use Disk” button, it will start to backup automatically. If you want secure the backup, make sure check the “Encrypt backups” before click on “Use Disk”

macOS Catalina -> Time Machine - Available Disks
macOS Catalina -> Time Machine – Available Disks

6.3 If you do not like automatic backup, just uncheck “Back Up Automatically” (Check “Show Time Machine in menu bar”, it will make your manual backup easier, the time machine icon will appear at the top of the screen (Menu bar) and access able for you to manually backup)

macOS Catalina -> Time Machine
macOS Catalina -> Time Machine

Extra: 7 Configure disk quota (Limit Time Machine size in shared folder)

7.1 In OMV, go to “Storage” -> “File Systems”, click on the Filesystem which we have just created, click on “Quota”, set an appropriate size limit for the user we have just created for Time Machine purpose and click on “Save” button

OMV - Configure quota for user
OMV – Configure quota for user

Note: This will not only limit Time Machine backup size, it actually limits the usable size for the user/account on this filesystem which means, including time machine and windows share as well. If you only want to limit time machine size, use that account only for time machine purpose, then create another account for windows share or other purpose of file sharing.

Extra: 8 Microsoft Windows access the shared folder

8.1 Open File Explorer/This PC from Windows and enter the IP address of OMV or host name of it e.g. o-test.mynetwork then Press Enter key

Microsoft Windows 10 - This PC/File Explorer
Microsoft Windows 10 – This PC/File Explorer

8.2 Enter your credential details then click on “OK” button

Microsoft Windows 10 - Login Window
Microsoft Windows 10 – Login Window

8.3 Now you will see the shared folder which we have created

Shared folder - tm
Shared folder – tm

8.4 Double click to open the shared folder, If you have already initialized Time Machine backup, you will be able to see a folder named “YourMacName.backupbundle”

Shared folder - tm - Time Machine backup
Shared folder – tm – Time Machine backup

(You won’t be able to see normal file structures e.g. your photo or document on your macOS’ desktop (Since it’s just for demo purpose I did not opt-in for encrypt backup option and that’s what you will see if the time machine backup is not encrypted ))

Shared folder - tm - Time Machine backup Folder
Shared folder – tm – Time Machine backup Folder
Shared folder - tm - Time Machine backup Folder - bands folder
Shared folder – tm – Time Machine backup Folder – bands folder
Shared folder - tm - Time Machine backup Folder - mapped folder
Shared folder – tm – Time Machine backup Folder – mapped folder
Shared folder - tm - Time Machine backup Folder Peoperties
Shared folder – tm – Time Machine backup Folder Peoperties

8.5 You can also create and modify folders and files in the shared folder from Windows PC

Creating a New folder from Windows 10 PC in shared folder
Creating a New folder from Windows 10 PC in shared folder
Creating a New test document from Windows 10 PC in shared folder
Creating a New test document from Windows 10 PC in shared folder

(Note: I strongly suggest to use this shared folder only for time machine, to protect the backup files from mistakes like accidental deletion/rename etc. You can follow Section 3 and Section 4 again to create an dedicate shared folder for macOS and Windows PC to share files rather than for Time Machine to backup files and the system, the only difference will be leave the “Time Machine support” option disabled at Step 3.5)

Other resources:

OpenMediaVault official website: https://www.openmediavault.org

OpenMediaVault official Download page: https://www.openmediavault.org/download.html

OpenMediaVault official SourceForge download repository: https://sourceforge.net/projects/openmediavault/files

How to: Install omv-extras for Open Media Vault (OMV)

1 Bring up the open media vault terminal from the device or SSH into OMV

OMV - Terminal
OMV – Terminal

2 Run following command as root

~# wget -O - https://github.com/OpenMediaVault-Plugin-Developers/packages/raw/master/install | bash

(This script just simply check the version of OMV then download and install right omv-extras version, the content is attached below)

#!/bin/bash
declare -i version
url="https://github.com/OpenMediaVault-Plugin-Developers/packages/raw/master/"
version=$(dpkg -l openmediavault | awk '$2 == "openmediavault" { print substr($3,1,1) }')
echo ${version}
if [ ${version} -eq 5 ]; then
  echo "Downloading omv-extras.org plugin for openmediavault 5.x ..."
  file="openmediavault-omvextrasorg_latest_all5.deb"
elif [ ${version} -eq 4 ]; then
  echo "Downloading omv-extras.org plugin for openmediavault 4.x ..."
  file="openmediavault-omvextrasorg_latest_all4.deb"
elif [ ${version} -eq 3 ]; then
  echo "Downloading omv-extras.org plugin for openmediavault 3.x ..."
  file="openmediavault-omvextrasorg_latest_all3.deb"
elif [ ${version} -eq 2 ]; then
  echo "Downloading omv-extras.org plugin for openmediavault 2.x ..."
  file="openmediavault-omvextrasorg_latest_all.deb"
else
  echo "Unsupported version of openmediavault"
  exit 0
fi
if [ -f "${file}" ]; then
  rm ${file}
fi
wget ${url}/${file}
if [ -f "${file}" ]; then
  dpkg -i ${file}
  if [ $? -gt 0 ]; then
    echo "Installing other dependencies ..."
    apt-get -f install
  fi
  echo "Updating repos ..."
  apt-get update
else
  echo "There was a problem downloading the package."
fi
exit 0
OMV - Install omv-extras
OMV – Install omv-extras
omv-extras finished installation
omv-extras finished installation

3 Log back in to open media vault webui

4 Check if OMV-Extras appears under System

OMV - OMV-Extras
OMV – OMV-Extras

5 If it is there, that means it’s installed successfully

omv-extras: http://omv-extras.org

How to: Restore Mac OS from Time Machine over Ethernet easily (Works for Time Machine on Open Media Vault (OMV) as well)

Before starting, make sure you have a working backup of the current system!!!

1 Refer to this guide “Mac OS how to Enter Recovery Mode” to enter recovery mode and clean/reset the Mac OS to factory default

2 When finished, the migration assistant should appear if it doesn’t, we can create a user, login then start the migration assistant manually.

3 Within the migration assistant, we can select “From a Mac, Time Machine backup, or startup disk” option, then click on continue.

Mac OS, Migration Assistant
Older Mac OS, Migration Assistant
Newer macOS, (Catalina in this screenshot), Transfer Information to This Mac
Newer macOS, (Catalina in this screenshot), Transfer Information to This Mac
Time Machine from Open Media Vault (OMV) discovered and listed automatically
Time Machine from Open Media Vault (OMV) discovered and listed automatically

4 It will allow us to enter the address of the time machine volume and it will ask us for the password, in case we have used an encrypted backup.

5 Now we can choose what to recover. (Warning: If the user we have created after the installation has the same name as the one we have used in the backup, there will be a conflict). Then we need to choose, whether we want to keep or delete the user or keep the data.

How To: Create Apple Time Machine in Open Media Vault (OMV)

(If you are using OMV 5, please follow this guide: How To: Create Apple Time Machine in Open Media Vault 5 (OMV 5) with Shared Folder (SMB Share/Windows Share/Shared Folder/CIFS))

1 Create File System (Refer to this guide How To: Create SMB/CIFs/Windows Share in Open Media Vault (OMV))

2 Install OMV Extras from here http://omv-extras.org (For OMV V4, click on here, following the http://omv-extras.org/joomla/index.php/guides (Link doesn’t work anymore) and install the plugin http://omv-extras.org/joomla/index.php/omv-plugins-4/4-stable (Link doesn’t work anymore)

3 Back to OMV, click on Plugins and install openmediavault-netatalk

4 Create Shared folder for Apple Time Machine (Refer to this guide How To: Create SMB/CIFs/Windows Share in Open Media Vault (OMV)) The steps are very similar but instead of going to SMB/CIFS, we use Apple Filing Tab this time

Screenshot of Open Media Vault (OMV) Services Tab -> Apple Filing -> Shares
Screenshot of Open Media Vault (OMV) Services Tab -> Apple Filing -> Shares

5 Make sure in the Edit Share window Enable Time Machine support, so that Mac OS can recognize the Share folder as supported Time Machine

Screenshot of Open Media Vault (OMV) Services Tab -> Apple Filing -> Shares
Screenshot of Open Media Vault (OMV) Services Tab -> Apple Filing -> Shares

6 Save settings

7 Click on Settings Tab, enable service, save settings and Apply

Creating a User

Since Mac OS require Time Machine require a password, we will create a user

1 Go to Access Rights Manager Tab and click on User

Screenshot of Open Media Vault (OMV) Access Rights Manager Tab -> User
Screenshot of Open Media Vault (OMV) Access Rights Manager Tab -> User

2 Click on Add button and Create a user and Save

Screenshot of Open Media Vault (OMV) Access Rights Manager Tab -> User -> Add User
Screenshot of Open Media Vault (OMV) Access Rights Manager Tab -> User -> Add User

Configure permission for Time Machine folder

1 Click on Shared Folders

 Screenshot of Open Media Vault (OMV) Access Rights Manager Tab -> Shared Folders
Screenshot of Open Media Vault (OMV) Access Rights Manager Tab -> Shared Folders

2 Click on previously created shared Time Machine folder then click on Privileges button

Screenshot of Open Media Vault (OMV) Access Rights Manager Tab -> Shared Folders
Screenshot of Open Media Vault (OMV) Access Rights Manager Tab -> Shared Folders

3 Tick Read/Write permission for desired user for Time Machine

Screenshot of Open Media Vault (OMV) Access Rights Manager Tab -> Shared Folders -> Privileges
Screenshot of Open Media Vault (OMV) Access Rights Manager Tab -> Shared Folders -> Privileges

4 Now if we open our Mac, click on Top left corner (Apple icon) -> System preferences -> Time Machine, configure the settings to use the Time Machine we have just created

5 From now on, it will backup your everything from Mac OS, with hourly, weekly and monthly backup routine

How To: Create SMB/CIFs/Windows Share in Open Media Vault (OMV)

(For OpenMediaVault 5/OMV 5, please follow this one: How To: Create Apple Time Machine in Open Media Vault 5 (OMV 5) with Shared Folder (SMB Share/Windows Share/Shared Folder/CIFS))

Create File system

1 Make sure you have added disk

Screenshot of Open Media Vault (OMV) Storage Tab - Disks
Screenshot of Open Media Vault (OMV) Storage Tab – Disks

2 Click on File Systems

Screenshot of Open Media Vault (OMV) Storage Tab - File Systems
Screenshot of Open Media Vault (OMV) Storage Tab – File Systems

3 Format the disk/partition

Screenshot of Open Media Vault (OMV) Storage Tab -> File Systems -> Create Button
Screenshot of Open Media Vault (OMV) Storage Tab -> File Systems -> Create Button

4 Mount the file system

Screenshot of Open Media Vault (OMV) Storage Tab -> File Systems -> Mount Button
Screenshot of Open Media Vault (OMV) Storage Tab -> File Systems -> Mount Button

Create Windows Share

1 Click on SMB/CIFS from Services tab

Screenshot of Open Media Vault (OMV) Storage Tab -> File Systems -> Mount Button
Screenshot of Open Media Vault (OMV) Storage Tab -> File Systems -> Mount Button

2 Click on Shares then click on Add button

Screenshot of Open Media Vault (OMV) Services Tab -> SMB/CIFS -> Shares -> Add
Screenshot of Open Media Vault (OMV) Services Tab -> SMB/CIFS -> Shares -> Add

3 Click on + button for Shared folder

Screenshot of Open Media Vault (OMV) Services Tab -> SMB/CIFS -> Shares -> Add
Screenshot of Open Media Vault (OMV) Services Tab -> SMB/CIFS -> Shares -> Add

4 Follow the screenshot

Screenshot of Open Media Vault (OMV) Services Tab -> SMB/CIFS -> Shares -> Add -> Add Shared Folder
Screenshot of Open Media Vault (OMV) Services Tab -> SMB/CIFS -> Shares -> Add -> Add Shared Folder

5 Change Public to Only guests if you only need a public share without password (Means anyone on the same LAN can access and modify the shared folder)

Screenshot of Open Media Vault (OMV) Services Tab -> SMB/CIFS -> Shares -> Add
Screenshot of Open Media Vault (OMV) Services Tab -> SMB/CIFS -> Shares -> Add

6 Save the settings

7 Finally, Click on Services Tab, click on SMB/CIFS, then enable and Apply the new settings

Screenshot of Open Media Vault (OMV) Services Tab -> SMB/CIFS -> Settings
Screenshot of Open Media Vault (OMV) Services Tab -> SMB/CIFS -> Settings

8 Now if you point your file explorer to Open Media Vault’s name or IP address, you should be able to access the folder we have created and make changes to it