VeraCrypt icon indicating copy to clipboard operation
VeraCrypt copied to clipboard

switch from libfuse2 to libfuse3

Open david-geiger opened this issue 5 years ago • 11 comments

Hi,

I'm a mageia linux packager, and I tried to compile veracrypt against libfuse3 but unsuccessfully. Could this project be ported to libfuse3 (3.7.0)? for now it is still needed libfuse2

Regards, David

david-geiger avatar Oct 28 '19 04:10 david-geiger

@david-geiger, it would probably help if you could expand on why such a switch would be beneficial for the project. Do you know of any v3 advantages over v2 that would be relevant for VC? And the opposite of this - why can't Mageia have libfuse v2 (e.g. Fedora does)?

alt3r-3go avatar Nov 13 '19 20:11 alt3r-3go

@alt3r-3go I'm not very familiar with the backbone of Veracrypt or libfuse, but the last update of libfuse2 are from 2016-06-20. Since this date, it gives a lot of updates, especially a security update of libfuse 3.2.5 from 2018-07-24. So I think, it should be updated or give it a good reason why not? Changelog of libfuse: https://github.com/libfuse/libfuse/blob/master/ChangeLog.rst

Schweineschwarte avatar Jan 18 '20 13:01 Schweineschwarte

That's not entirely the case - there was a release in Jan 2019: https://github.com/libfuse/libfuse/releases/tag/fuse-2.9.9, but indeed looks like they're encouraging people to move over. Sounds like a valid request then, maybe I could even take a look at it at some point...

alt3r-3go avatar Feb 04 '20 20:02 alt3r-3go

Yeah exactly, I think that fuse2 will be probably definitely disappear one day in favor of fuse3 like python2 VS python3.

david-geiger avatar Feb 04 '20 21:02 david-geiger

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Dec 30 '20 07:12 stale[bot]

This issue has been automatically closed because it has not had recent activity. This probably means that it is not reproducible or it has been fixed in a newer version. If it’s an enhancement and hasn’t been taken on for so long, then it seems no one has the time to implement this. Please reopen if you still encounter this issue with the latest stable version. You can also contribute directly by providing a pull request. Thank you!

stale[bot] avatar Jan 06 '21 07:01 stale[bot]

@idrassi, this is still a valid feature request I think, I missed it in the flurry of stalebot notifications.

alt3r-3go avatar Jan 06 '21 10:01 alt3r-3go

A quick and dirty way to do this is:

Description: Move from Fuse2 to Fuse3.

Index: veracrypt-1.25~git20210920.5e547b1/src/Main/Main.make
===================================================================
--- veracrypt-1.25~git20210920.5e547b1.orig/src/Main/Main.make
+++ veracrypt-1.25~git20210920.5e547b1/src/Main/Main.make
@@ -102,7 +102,7 @@ endif
 
 #------ FUSE configuration ------
 
-FUSE_LIBS = $(shell pkg-config fuse --libs)
+FUSE_LIBS = $(shell pkg-config fuse3 --libs)
 
 #------ Executable ------
 
Index: veracrypt-1.25~git20210920.5e547b1/src/Driver/Fuse/Driver.make
===================================================================
--- veracrypt-1.25~git20210920.5e547b1.orig/src/Driver/Fuse/Driver.make
+++ veracrypt-1.25~git20210920.5e547b1/src/Driver/Fuse/Driver.make
@@ -15,6 +15,6 @@ NAME := Driver
 OBJS :=
 OBJS += FuseService.o
 
-CXXFLAGS += $(shell pkg-config fuse --cflags)
+CXXFLAGS += $(shell pkg-config fuse3 --cflags)
 
 include $(BUILD_INC)/Makefile.inc
Index: veracrypt-1.25~git20210920.5e547b1/src/Driver/Fuse/FuseService.cpp
===================================================================
--- veracrypt-1.25~git20210920.5e547b1.orig/src/Driver/Fuse/FuseService.cpp
+++ veracrypt-1.25~git20210920.5e547b1/src/Driver/Fuse/FuseService.cpp
@@ -13,7 +13,7 @@
 #ifdef TC_OPENBSD
 #define FUSE_USE_VERSION  26
 #else
-#define FUSE_USE_VERSION  25
+#define FUSE_USE_VERSION  30
 #endif
 
 #include <errno.h>
@@ -56,11 +56,7 @@ namespace VeraCrypt
 		return 0;
 	}
 
-#ifdef TC_OPENBSD
-	static void *fuse_service_init (struct fuse_conn_info *)
-#else
-	static void *fuse_service_init ()
-#endif
+	static void *fuse_service_init (struct fuse_conn_info *, struct fuse_config *config)
 	{
 		try
 		{
@@ -104,7 +100,7 @@ namespace VeraCrypt
 		}
 	}
 
-	static int fuse_service_getattr (const char *path, struct stat *statData)
+	static int fuse_service_getattr (const char *path, struct stat *statData, struct fuse_file_info *fi)
 	{
 		try
 		{
@@ -261,7 +257,7 @@ namespace VeraCrypt
 		return -ENOENT;
 	}
 
-	static int fuse_service_readdir (const char *path, void *buf, fuse_fill_dir_t filler, off_t offset, struct fuse_file_info *fi)
+	static int fuse_service_readdir (const char *path, void *buf, fuse_fill_dir_t filler, off_t offset, struct fuse_file_info *fi, enum fuse_readdir_flags fl)
 	{
 		try
 		{
@@ -271,10 +267,10 @@ namespace VeraCrypt
 			if (strcmp (path, "/") != 0)
 				return -ENOENT;
 
-			filler (buf, ".", NULL, 0);
-			filler (buf, "..", NULL, 0);
-			filler (buf, FuseService::GetVolumeImagePath() + 1, NULL, 0);
-			filler (buf, FuseService::GetControlPath() + 1, NULL, 0);
+			filler (buf, ".", NULL, 0, (enum fuse_fill_dir_flags)0);
+			filler (buf, "..", NULL, 0, (enum fuse_fill_dir_flags)0);
+			filler (buf, FuseService::GetVolumeImagePath() + 1, NULL, 0, (enum fuse_fill_dir_flags)0);
+			filler (buf, FuseService::GetControlPath() + 1, NULL, 0, (enum fuse_fill_dir_flags)0);
 		}
 		catch (...)
 		{
@@ -446,7 +446,7 @@ namespace VeraCrypt
 		}
 
 		ExecFunctor execFunctor (openVolume, slotNumber);
-		Process::Execute ("fuse", args, -1, &execFunctor);
+		Process::Execute ("fusermount3", args, -1, &execFunctor);
 
 		for (int t = 0; true; t++)
 		{
@@ -592,11 +588,7 @@ namespace VeraCrypt
 
 		SignalHandlerPipe->GetWriteFD();
 
-#ifdef TC_OPENBSD
 		_exit (fuse_main (argc, argv, &fuse_service_oper, NULL));
-#else
-		_exit (fuse_main (argc, argv, &fuse_service_oper));
-#endif
 	}
 
 	VolumeInfo FuseService::OpenVolumeInfo;

Unit193 avatar Oct 07 '21 04:10 Unit193

This issue should be reopened @idrassi

cypherbits avatar Oct 07 '21 07:10 cypherbits

As of Ubuntu 22.04 LTS, libfuse2 is no longer available. Uninstalling libfuse3 and installing libfuse2 breaks the desktop. Are there any plans to make VeraCrypt work with libfuse3?

shawndcorn avatar Jul 17 '23 21:07 shawndcorn

As of Ubuntu 22.04 LTS, libfuse2 is no longer available. Uninstalling libfuse3 and installing libfuse2 breaks the desktop. Are there any plans to make VeraCrypt work with libfuse3?

libfuse2 does not conflict with libfuse3-3 and is available in the universe repo. Try:

sudo add-apt-repository universe
sudo apt update
sudo apt-get -y install libfuse2

To the topic, upgrading the codebase from libfuse2 to libfuse3 would most likely limit the program's backwards compatibility and supported distros. I believe currently the binaries are built against old versions such as CentOS 6 to increase compatibility, and I believe that old versions such as that don't have the required libraries (like libc6) to build and run fuse3.

Jertzukka avatar Jul 18 '23 12:07 Jertzukka