Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot install virtualmin pro under Ubuntu 22.04 (running in an Azure VM) #914

Open
danboid opened this issue Oct 1, 2024 · 19 comments
Open

Comments

@danboid
Copy link

danboid commented Oct 1, 2024

We've had to start over with our virtualmin server but I've not been able to get it the latest vmin pro install.sh script to install any packages under Ubuntu 22.04 running in an Azure VM.

As per the vmin download page instructions, I'm trying to install it using the install.sh I downloaded from https://www.virtualmin.com/account/ when signed in.

Apparently ./install -s should fix the repos but that gives me errors.

# sh ./install.sh -s
[INFO] Log will be written to: /home/danielm/virtualmin-install.log
[INFO] Started Virtualmin 7 Professional software repositories setup
▣ Phase 1 of 1: Setup
Downloading Virtualmin 7 key                                                 ✔ 
Installing Virtualmin 7 key                                                  ✔ 
Downloading repository metadata                                             [ERROR] Failed with error: 100
 ✘ 

[ERROR] Something went wrong. Exiting.
[ERROR] The last few log entries were:
Err:6 https://software.virtualmin.com/vm/7/pro/apt virtualmin InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 3E570892B9A0B8B7
Hit:12 https://esm.ubuntu.com/infra/ubuntu jammy-infra-updates InRelease
Get:13 https://download.webmin.com/download/newkey/repository stable Release [18.3 kB]
Get:14 https://download.webmin.com/download/newkey/repository stable Release.gpg [819 B]
Ign:14 https://download.webmin.com/download/newkey/repository stable Release.gpg
Reading package lists...
W: https://packages.microsoft.com/ubuntu/22.04/prod/dists/jammy/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for d
etails.
W: GPG error: https://software.virtualmin.com/vm/7/pro/apt virtualmin InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 3E570892B9A0
B8B7
E: The repository 'https://software.virtualmin.com/vm/7/pro/apt virtualmin InRelease' is not signed.
W: GPG error: https://download.webmin.com/download/newkey/repository stable Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 2D223B91
8916F2A2
E: The repository 'https://download.webmin.com/download/newkey/repository stable Release' is not signed.
Downloading repository metadata: [2024-10-01 15:38:39 BST] [ERROR] Failed with error: 100
[2024-10-01 15:38:39 BST] [ERROR] Something went wrong. Exiting.
[2024-10-01 15:38:39 BST] [ERROR] The last few log entries were:
# cat virtualmin-install.log 
Checking for HTTP client .. found /usr/bin/wget -nv
2024-10-01 15:38:33 URL:https://software.virtualmin.com/lib/slib.sh [24222/24222] -> "slib.sh" [1]
[2024-10-01 15:38:33 BST] [INFO] Log will be written to: /home/danielm/virtualmin-install.log
[2024-10-01 15:38:33 BST] [DEBUG] LOG_ERRORS_FATAL=1
[2024-10-01 15:38:33 BST] [DEBUG] LOG_LEVEL_STDOUT=INFO
[2024-10-01 15:38:33 BST] [DEBUG] LOG_LEVEL_LOG=DEBUG
Checking for Perl .... found Perl at /usr/bin/perl
Checking for HTTP client .. found /usr/bin/wget -nv
Checking for GPG .. found GPG command
[2024-10-01 15:38:33 BST] [INFO] Started Virtualmin 7 Professional software repositories setup
[2024-10-01 15:38:33 BST] [DEBUG] Install mode: setup
[2024-10-01 15:38:33 BST] [DEBUG] Product: Virtualmin Professional
[2024-10-01 15:38:33 BST] [DEBUG] virtualmin-install.sh version: 7.4.0
[2024-10-01 15:38:33 BST] [DEBUG] Installing serial number and license key into /etc/virtualmin-license
[2024-10-01 15:38:33 BST] [DEBUG] Operating system name:    Ubuntu
[2024-10-01 15:38:33 BST] [DEBUG] Operating system version: 22.04
[2024-10-01 15:38:33 BST] [DEBUG] Operating system type:    ubuntu
[2024-10-01 15:38:33 BST] [DEBUG] Operating system major:   22
[2024-10-01 15:38:33 BST] [DEBUG] Configuring package manager for Ubuntu 22.04 ..
[2024-10-01 15:38:33 BST] [DEBUG] apt-get repos: virtualmin
[2024-10-01 15:38:33 BST] [DEBUG] Installing Webmin and Virtualmin package signing keys ..
Spin pid is: 226324
2024-10-01 15:38:33 URL:https://software.virtualmin.com/lib/RPM-GPG-KEY-virtualmin-7 [3212/3212] -> "RPM-GPG-KEY-virtualmin-7" [1]
Downloading Virtualmin 7 key: Success.
Spin pid is: 226349
gpg: key 3E570892B9A0B8B7: "Virtualmin, Inc. (Package signing key for Virtualmin 7) <[email protected]>" not changed
gpg: Total number processed: 1
gpg:              unchanged: 1
Installing Virtualmin 7 key: Success.
Spin pid is: 226379
Hit:1 https://packages.microsoft.com/ubuntu/22.04/prod jammy InRelease
Hit:2 http://azure.archive.ubuntu.com/ubuntu jammy InRelease
Hit:3 http://azure.archive.ubuntu.com/ubuntu jammy-updates InRelease
Hit:4 http://azure.archive.ubuntu.com/ubuntu jammy-backports InRelease
Hit:5 http://azure.archive.ubuntu.com/ubuntu jammy-security InRelease
Get:6 https://software.virtualmin.com/vm/7/pro/apt virtualmin InRelease [10.7 kB]
Hit:7 https://esm.ubuntu.com/cis/ubuntu jammy InRelease
Hit:8 https://esm.ubuntu.com/apps/ubuntu jammy-apps-security InRelease
Hit:9 https://esm.ubuntu.com/apps/ubuntu jammy-apps-updates InRelease
Hit:10 https://esm.ubuntu.com/infra/ubuntu jammy-infra-security InRelease
Ign:11 https://download.webmin.com/download/newkey/repository stable InRelease
Err:6 https://software.virtualmin.com/vm/7/pro/apt virtualmin InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 3E570892B9A0B8B7
Hit:12 https://esm.ubuntu.com/infra/ubuntu jammy-infra-updates InRelease
Get:13 https://download.webmin.com/download/newkey/repository stable Release [18.3 kB]
Get:14 https://download.webmin.com/download/newkey/repository stable Release.gpg [819 B]
Ign:14 https://download.webmin.com/download/newkey/repository stable Release.gpg
Reading package lists...
W: https://packages.microsoft.com/ubuntu/22.04/prod/dists/jammy/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for d
etails.
W: GPG error: https://software.virtualmin.com/vm/7/pro/apt virtualmin InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 3E570892B9A0
B8B7
E: The repository 'https://software.virtualmin.com/vm/7/pro/apt virtualmin InRelease' is not signed.
W: GPG error: https://download.webmin.com/download/newkey/repository stable Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 2D223B91
8916F2A2
E: The repository 'https://download.webmin.com/download/newkey/repository stable Release' is not signed.
Downloading repository metadata: [2024-10-01 15:38:39 BST] [ERROR] Failed with error: 100
[2024-10-01 15:38:39 BST] [ERROR] Something went wrong. Exiting.
[2024-10-01 15:38:39 BST] [ERROR] The last few log entries were:

I can provide any other logs you require.

Hopefully we won't have to install Ubuntu 20.04 and then upgrade from there, it is out of support in a few months so thats only a temp workaround.

I have tried running

sudo apt clean
sudo apt update

After running the install.sh -s but that doesn't help.

Is the vmin apt repo signed in a way that is friendly with Ubuntu 22.04 and later? It seems they changed the way apt deals with gpg keys in Ubuntu 22.04, apt-key is deprecated. I have read a number of reports of people who can install vmin under Ubuntu 20.04 and then update it to Ubuntu 22 or Ubuntu 24 but cannot get it to install under 22.04 and I can't help but think its this:

https://sites.google.com/site/installationubuntu/home/ubuntu-22-04/apt-key-is-deprecated

@danboid
Copy link
Author

danboid commented Oct 1, 2024

A tool I'd never come across before today when searching for a fix to these errors is Y PPA manager

https://askubuntu.com/questions/1877/what-is-the-easiest-way-to-resolve-apt-get-badsig-gpg-errors/145933#145933

That's a GUI tool though. Is there a terminal friendly equivalent I wonder?

I also tried:

gpg --refresh-keys

Didn't work for me.

@danboid danboid changed the title Cannot install virtualmin pro under Ubuntu 22.04 (running in a Azure VM) Cannot install virtualmin pro under Ubuntu 22.04 (running in an Azure VM) Oct 1, 2024
@danboid
Copy link
Author

danboid commented Oct 1, 2024

The end of my install.sh run looks like:

Virtualmin may already be installed. This can happen if an installation failed,
  and can be ignored in that case.

  However, if Virtualmin has already been successfully installed you must not
  run this script again! It will cause breakage to your existing configuration.

  Virtualmin repositories can be fixed using install.sh -s command.

  License details can be changed using virtualmin change-license command.
  Changing the license never requires re-installation.

  Updates and upgrades must be performed from within either Virtualmin or using
  system package manager on the command line.

 Continue? (y/n) y
[INFO] Started installation log in /home/danielm/virtualmin-install.log
▣◻◻◻ Phase 1 of 4: Check
Checking system time                                                         ✔ 
Checking Perl installation                                                   ✔ 
Checking CA certificates package                                             ✔ 
Checking HTTP client                                                         ✔ 
Checking GPG package                                                         ✔ 

▣▣◻◻ Phase 2 of 4: Setup
Downloading Virtualmin 7 key                                                 ✔ 
Installing Virtualmin 7 key                                                  ✔ 
Downloading repository metadata                                             [ERROR] Failed with error: 100
 ✘ 

[ERROR] Something went wrong. Exiting.
[ERROR] The last few log entries were:
Ign:12 https://download.webmin.com/download/newkey/repository stable InRelease
Err:11 https://software.virtualmin.com/vm/7/pro/apt virtualmin InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 3E570892B9A0B8B7
Get:13 https://download.webmin.com/download/newkey/repository stable Release [18.3 kB]
Get:14 https://download.webmin.com/download/newkey/repository stable Release.gpg [819 B]
Ign:14 https://download.webmin.com/download/newkey/repository stable Release.gpg
Reading package lists...
W: https://packages.microsoft.com/ubuntu/22.04/prod/dists/jammy/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for d
etails.
W: GPG error: https://software.virtualmin.com/vm/7/pro/apt virtualmin InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 3E570892B9A0
B8B7
E: The repository 'https://software.virtualmin.com/vm/7/pro/apt virtualmin InRelease' is not signed.
W: GPG error: https://download.webmin.com/download/newkey/repository stable Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 2D223B91
8916F2A2
E: The repository 'https://download.webmin.com/download/newkey/repository stable Release' is not signed.
Downloading repository metadata: [2024-10-01 16:17:46 BST] [ERROR] Failed with error: 100
[2024-10-01 16:17:46 BST] [ERROR] Something went wrong. Exiting.
[2024-10-01 16:17:46 BST] [ERROR] The last few log entries were:

@danboid
Copy link
Author

danboid commented Oct 2, 2024

I've finally got past that error. The fix for me was:

chmod 644 /usr/share/keyrings/*

@iliajie
Copy link
Collaborator

iliajie commented Oct 2, 2024

Very interesting! Do you know what it was set to before?

@danboid
Copy link
Author

danboid commented Oct 3, 2024

root@poseidon:/usr/share/keyrings# ls -l
total 76
-rw-r----- 1 root root  641 Sep 25 15:16 microsoft-prod.gpg
-rw-r--r-- 1 root root 7399 Sep 18  2018 ubuntu-archive-keyring.gpg
-rw-r--r-- 1 root root 6713 Oct 27  2016 ubuntu-archive-removed-keys.gpg
-rw-r--r-- 1 root root 3023 Mar 26  2021 ubuntu-cloudimage-keyring.gpg
-rw-r--r-- 1 root root    0 Jan 17  2018 ubuntu-cloudimage-removed-keys.gpg
-rw-r--r-- 1 root root 1227 May 27  2010 ubuntu-master-keyring.gpg
-rw-r--r-- 1 root root 1150 Aug  8 15:00 ubuntu-pro-anbox-cloud.gpg
-rw-r--r-- 1 root root 2247 Aug  8 15:00 ubuntu-pro-cc-eal.gpg
-rw-r--r-- 1 root root 2274 Aug  8 15:00 ubuntu-pro-cis.gpg
-rw-r--r-- 1 root root 2236 Aug  8 15:00 ubuntu-pro-esm-apps.gpg
-rw-r--r-- 1 root root 2264 Aug  8 15:00 ubuntu-pro-esm-infra.gpg
-rw-r--r-- 1 root root 2275 Aug  8 15:00 ubuntu-pro-fips-preview.gpg
-rw-r--r-- 1 root root 2275 Aug  8 15:00 ubuntu-pro-fips.gpg
-rw-r--r-- 1 root root 2250 Aug  8 15:00 ubuntu-pro-realtime-kernel.gpg
-rw-r--r-- 1 root root 2235 Aug  8 15:00 ubuntu-pro-ros.gpg
-rw-r----- 1 root root 2313 Oct  1 16:20 ubuntu-virtualmin-7.gpg
-rw-r----- 1 root root 2261 Oct  1 14:02 ubuntu-webmin-developers.gpg
-rw-r----- 1 root root  891 Oct  1 15:05 webmin.gpg
root@poseidon:/usr/share/keyrings# umask 
0027

@danboid
Copy link
Author

danboid commented Oct 3, 2024

We had login issues with our vmin Ubuntu 22.04 VM so we had to restore it to a backup from before I got vmin to install and it would seem that running that chmod command isn't the only thing that I had to do to fix running the vmin install.sh script under Ubuntu 22.04.

The problematic thing is that I had tried all sorts of stuff - editing the apt config files, creating and moving gpg keys etc, and non of it seemed to be working but I must've changed something else too apart from doing that chmod command to fix the installation.

I'm back to this error when I try running the vmin pro install.sh script:

[INFO] Started installation log in /home/danielm/virtualmin-install.log
▣◻◻◻ Phase 1 of 4: Check
Checking system time                                                         ✔ 
Checking Perl installation                                                   ✔ 
Checking CA certificates package                                             ✔ 
Checking HTTP client                                                         ✔ 
Checking GPG package                                                         ✔ 

▣▣◻◻ Phase 2 of 4: Setup
Downloading Virtualmin 7 key                                                 ✔ 
Installing Virtualmin 7 key                                                  ✔ 
Downloading repository metadata                                             [ERROR] Failed with error: 100
 ✘ 

[ERROR] Something went wrong. Exiting.
[ERROR] The last few log entries were:
Hit:8 https://esm.ubuntu.com/apps/ubuntu jammy-apps-updates InRelease
Hit:9 https://esm.ubuntu.com/infra/ubuntu jammy-infra-security InRelease
Hit:10 https://esm.ubuntu.com/infra/ubuntu jammy-infra-updates InRelease
Get:11 https://software.virtualmin.com/vm/7/pro/apt virtualmin InRelease [10.7 kB]
Ign:12 https://download.webmin.com/download/newkey/repository stable InRelease
Hit:13 https://download.webmin.com/download/newkey/repository stable Release
Err:11 https://software.virtualmin.com/vm/7/pro/apt virtualmin InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 3E570892B9A0B8B7
Reading package lists...
W: https://packages.microsoft.com/ubuntu/22.04/prod/dists/jammy/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), 
see the DEPRECATION section in apt-key(8) for details.
W: GPG error: https://software.virtualmin.com/vm/7/pro/apt virtualmin InRelease: The following signatures couldn't be verified because the publ
ic key is not available: NO_PUBKEY 3E570892B9A0B8B7
E: The repository 'https://software.virtualmin.com/vm/7/pro/apt virtualmin InRelease' is not signed.
Downloading repository metadata: [2024-10-03 09:49:19 BST] [ERROR] Failed with error: 100
[2024-10-03 09:49:19 BST] [ERROR] Something went wrong. Exiting.
[2024-10-03 09:49:19 BST] [ERROR] The last few log entries were:

@danboid
Copy link
Author

danboid commented Oct 3, 2024

There are two things I mostly recall doing that I think could've fixed this that the commands are absent in my terminal history file, maybe you guys can give me the exact commands I need?

There are a couple of apt-key or gpg commands to fetch keys for your repos. I think I might've adjusted them slightly for Ubuntu 22.04 somehow.

Another thing I sorta remember doing was running

setup-repos.sh -f

Which creates a gpg key in /tmp/developers-key.asc and I think I might've used a gpg dearmor command to copy that into the required dir and/or I might adjusted the key file paths to different keys in the apt config files.

Any suggestions are gratefully accepted. We're in big hurry to get this server installed.

@danboid
Copy link
Author

danboid commented Oct 3, 2024

I've got it installing again.

The magic sequence of commands was:

 sh ./install.sh -s
 chmod 644 /usr/share/keyrings/*
 apt update

Then re-run install.sh. vmin installed without any errors under Ubuntu 22.04 after doing that.

@shoulders
Copy link

this commit from @iliajie is related

Add support for Btrfs quotas

virtualmin/Virtualmin-Config@483771c

@iliajie
Copy link
Collaborator

iliajie commented Oct 5, 2024

I don’t think it’s related.

@shoulders
Copy link

Ok, i posted this here incase it was as it was posted in this guys thread.

I can delete it if you want😃

@danboid
Copy link
Author

danboid commented Oct 7, 2024

This is exactly how our btrfs fstab quotas issue panned out:

Our fstab BEFORE running install.sh:

root@-:~# cat /etc/fstab.orig 
# CLOUD_IMG: This file was created/modified by the Cloud Image build process
UUID=f7f4e95a-a27d-47f7-83dc-dd813914aa8d/ ext4discard,errors=remount-ro0 1
UUID=7E5E-85C1/boot/efivfatumask=00770 1
UUID=fbcbbc2d-1049-42d1-88ae-a9bdd7204df6    /home     btrfs     nodev,nosuid     0     2
tmpfs /dev/shm tmpfs defaults,nosuid,inode64,nodev,noexec 0 0
/dev/disk/cloud/azure_resource-part1/mntautodefaults,nofail,x-systemd.after=cloud-init.service,_netdev,comment=cloudconfig02

During the running of the install script, the installer warned us:

...
[12/21] Configuring Quotas                                                     
The filesystem /home could not be remounted with quotas enabled.
You may need to reboot your system, and/or enable quotas
manually in Webmin/System/Disk Quotas module.                                ⚠ 
[13/21] Configuring SASL                                                     ✔ 

Our fstab after running install.sh, which failed to boot so we replaced it with the original:

root@-:/etc# cat fstab.postinst 
# CLOUD_IMG: This file was created/modified by the Cloud Image build process
UUID=f7f4e95a-a27d-47f7-83dc-dd813914aa8d/ ext4discard,errors=remount-ro0 1
UUID=7E5E-85C1/boot/efivfatumask=00770 1
UUID=fbcbbc2d-1049-42d1-88ae-a9bdd7204df6/homebtrfsgrpquota,usrquota,subvolid=5,quota,space_cache=v2,rw,nosuid,subvol=/,nodev,relatime,discard=async02
tmpfs /dev/shm tmpfs defaults,nosuid,inode64,nodev,noexec 0 0
/dev/disk/cloud/azure_resource-part1/mntautodefaults,nofail,x-systemd.after=cloud-init.service,_netdev,comment=cloudconfig02

Apart from that we got no errors from install.sh.

@danboid
Copy link
Author

danboid commented Oct 7, 2024

Are you guys confident that virtualmin check-config checks for btrfs quotas correctly? I have set up btrfs quota support using these commands:

btrfs quota enable /home
btrfs subvolume list /home | cut -d' ' -f2 | xargs -I{} -n1 btrfs qgroup create 0/{} /home

Then, I can check quotas are enabled like this:

root@poseidon:/etc# btrfs qgroup show /home
qgroupid         rfer         excl 
--------         ----         ---- 
0/5          61.09MiB     61.09MiB

I got these commands from https://archive.kernel.org/oldwiki/btrfs.wiki.kernel.org/index.php/Quota_support.html which says its obsolete but all of those commands still seem to work fine, even if that page is obsolete.

I should note now that I've never tried to use btrfs quotas before so I've not tested they actually work yet. It doesn't say anything about enabling quotas via fstab which is what install.sh tries and fails to do currently.

@danboid
Copy link
Author

danboid commented Oct 7, 2024

I'm a ZFS guy but unfortunately we weren't able to use ZFS for this new vmin server because MS Defender doesn't support scanning ZFS pools. :(

@iliajie
Copy link
Collaborator

iliajie commented Oct 7, 2024

Our fstab after running install.sh, which failed to boot so we replaced it with the original:

I recently fixed enabling quotas on Btrfs with this patch virtualmin/Virtualmin-Config@483771c correctly in Virtualmin configuration.

However, Virtualmin itself doesn’t support it yet...

@danboid
Copy link
Author

danboid commented Oct 7, 2024

However, Virtualmin itself doesn’t support it yet...

I don't think that will be a big deal. I'll just set users quota as part of my user/domain creation script as I did when using vmin with ZFS but vmin integration would be nice for both.

@danboid
Copy link
Author

danboid commented Oct 9, 2024

Ignore my previous post about how to configure BTRFS quotas, which was too incomplete.

I am new to btrfs quotas but this is how I understand they work currently, please correct me if you can.

First I enabled quota support on my btrfs /home partition, which initially didn't have any subvolumes configured.

sudo btrfs quota enable /home

I created a "root" subvol for my /home called @home

sudo btrfs sub create /home/@home

After creating /home/@home, I copied everything from /home into /home/@home then updated the '''/home''' entry in /etc/fstab to something like:

<DISK-UUID> /home btrfs subvol=@home,... 0 2 

Then rebooted to mount my /home in a subvolume. I can then create new btrfs subvol home dirs by running a command like:

 sudo btrfs sub create /home/$user

Limits can be applied to subvolumes with a command like:

sudo btrfs qgroup limit 1024M /home/$user

The quota for a users subvol can be checked by running:

sudo btrfs qgroup show -r /home/$user

The subvol quota being listed as the last (bottom) value in the max_rfer column from the btrfs qgroup show -r command output.

Thus, putting those commands together allows us to write a Vmin btrfs subvolume creation and deletion script ( /usr/local/bin/vmin-btrfs-domain.sh maybe? )

#!/bin/sh 
if [ "$VIRTUALSERVER_ACTION" = "CREATE_DOMAIN" ]; then 
  /usr/bin/btrfs sub create /home/$VIRTUALSERVER_USER 
  /usr/bin/btrfs qgroup limit 1024M /home/$VIRTUALSERVER_USER 
fi 

if [ "$VIRTUALSERVER_ACTION" = "DELETE_DOMAIN" ]; then 
  /usr/bin/btrfs sub delete /home/$VIRTUALSERVER_USER 
fi 

After creating that script, you need to tell Virtualmin to run that script by going to System Settings -> Virtualmin Configuration -> Actions upon server and user creation and pasting the full path to the script in the field next to Command to run before making changes to a server before clicking Save.

https://forum.virtualmin.com/t/introduction-to-btrfs-subvolume-quotas/129708

@iliajie
Copy link
Collaborator

iliajie commented Oct 10, 2024

First I enabled quota support on my btrfs /home partition, which initially didn't have any subvolumes configured.

sudo btrfs quota enable /home

I created a "root" subvol for my /home called @home

sudo btrfs sub create /home/@home

After creating /home/@home, I copied everything from /home into /home/@home then updated the '''/home''' entry in /etc/fstab to something like:

<DISK-UUID> /home btrfs subvol=@home,... 0 2 

Then rebooted to mount my /home in a subvolume. I can then create new btrfs subvol home dirs by running a command like:

 sudo btrfs sub create /home/$user

Couldn’t you just run btrfs quota enable / to enable quota support for / and other mount points, avoiding the need for subvolumes or changes to /etc/fstab?

@danboid
Copy link
Author

danboid commented Oct 10, 2024

Couldn’t you just run btrfs quota enable / to enable quota support for / and other mount points, avoiding the need for subvolumes or changes to /etc/fstab?

We probably could if we were using btrfs for our root partition but we're not, we're using ext4 which is what Azure Ubuntu defaults to.

There is btrfs-convert that allows us to convert our ext4 root disk into btrfs but we're in a hurry to get this server re-installed and so we've had to put that conversion on the TODO list, it would be nice to be able to create btrfs snapshots of the root disk too. Its a lot more work to do stuff like that under Azure than it is under say virtual box or on real hardware where you can easily boot systemrescuecd or whatever off a USB disk or a virtual DVD drive to do stuff like this.

Its a good point that my instructions above are only for those with /home on a separate, btrfs drive or partition so aren't suitable for general use yet but I think its still useful info. There's a lot of overly confusing btrfs docs out there!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants