systemd: oper_save.c#947,filesystem_mount_partition():

Post here if you found a bug or something really not expected in the program
Post Reply
slickvguy
Posts: 5
Joined: Sun Oct 28, 2012 8:34 pm

systemd: oper_save.c#947,filesystem_mount_partition():

Post by slickvguy » Sun Oct 28, 2012 8:39 pm

craigdabbs reported this bug earlier. I confirm it.
craigdabbs wrote:Hi i have just recently been getting errors on my systems using fsarchiver.

It claims the filesystem is not supported

Code: Select all

[======DISK======] [=============NAME==============] [====SIZE====] [MAJ] [MIN]
[sda             ] [SAMSUNG HD204UI                ] [     1.82 TB] [  8] [  0]
[sdb             ] [ELSKY MSATA 16GB               ] [    14.91 GB] [  8] [ 16]

[=====DEVICE=====] [==FILESYS==] [======LABEL======] [====SIZE====] [MAJ] [MIN] 
[sda1            ] [LVM2_member] [<unknown>        ] [     1.82 TB] [  8] [  1] 
[sdb1            ] [ext4       ] [OS               ] [    14.91 GB] [  8] [ 17] 
[dm-0            ] [ext4       ] [hd1              ] [     1.82 TB] [254] [  0]

Code: Select all

fsarchiver savefs -v -A -j2 -o -z6 ~/backup.fsa /dev/sdb1
Im trying to backup /dev/sdb1 and it shows this error

Code: Select all

oper_save.c#947,filesystem_mount_partition(): filesystem of partition [/dev/sdb1] is not supported by fsarchiver
I am running arch linux, all up to date and have recently updated to systemd. Kernel is 3.5.6-1.

I would appreciate any insight into a solution. Thankyou

I updated my system yesterday, including installing systemd, and now I'm getting the same error from fsarchiver.
The error is while ti's trying to mount the source partition. filesystem_mount_partition().
I suspect it has something to do with systemd. I will try booting without it and see if that makes a difference.

UPDATE: Yes, when I booted without init=/bin/systemd, fsarchiver worked as usual.

slickvguy
Posts: 5
Joined: Sun Oct 28, 2012 8:34 pm

Re: systemd: oper_save.c#947,filesystem_mount_partition():

Post by slickvguy » Tue Oct 30, 2012 6:47 am

After a bit of tracing through the source code, here's the problem:

With systemd:

Code: Select all

filesys.c#171,generic_get_mntinfo(): device=[/dev/sda3] has major=[8] and minor=[3]
filesys.c#203,generic_get_mntinfo(): mountinfo entry: major=[0] minor=[3] filesys=[5] col_opt=[proc] col_mnt=[/proc]
filesys.c#203,generic_get_mntinfo(): mountinfo entry: major=[0] minor=[13] filesys=[6] col_opt=[sysfs] col_mnt=[/sys]
filesys.c#203,generic_get_mntinfo(): mountinfo entry: major=[0] minor=[5] filesys=[2] col_opt=[devtmpfs] col_mnt=[/dev]
filesys.c#203,generic_get_mntinfo(): mountinfo entry: major=[0] minor=[14] filesys=[10] col_opt=[tmpfs] col_mnt=[/run]
filesys.c#203,generic_get_mntinfo(): mountinfo entry: major=[8] minor=[3] filesys=[1] col_opt=[ext4] col_mnt=[/]
filesys.c#209,generic_get_mntinfo(): found mountinfo entry for device=[/dev/sda3]: mnt=[/] fs=[1] opt=[ext4]
oper_save.c#933,filesystem_mount_partition(): generic_get_mntinfo(/dev/sda3): mnt=[/], opt=[ext4], fs=[1], rw=[0]
oper_save.c#947,filesystem_mount_partition(): filesystem of partition [/dev/sda3] is not supported by fsarchiver: filesystem=[1]
oper_save.c#1211,oper_save(): archive_filesystem(/dev/sda3) failed
Without systemd:

Code: Select all

filesys.c#171,generic_get_mntinfo(): device=[/dev/sda3] has major=[8] and minor=[3]
filesys.c#203,generic_get_mntinfo(): mountinfo entry: major=[0] minor=[3] filesys=[proc] col_opt=[rw] col_mnt=[/proc]
filesys.c#203,generic_get_mntinfo(): mountinfo entry: major=[0] minor=[13] filesys=[sysfs] col_opt=[rw] col_mnt=[/sys]
filesys.c#203,generic_get_mntinfo(): mountinfo entry: major=[0] minor=[5] filesys=[devtmpfs] col_opt=[rw,size=931040k,nr_inodes=219791,mode=755] col_mnt=[/dev]
filesys.c#203,generic_get_mntinfo(): mountinfo entry: major=[0] minor=[14] filesys=[tmpfs] col_opt=[rw,mode=755] col_mnt=[/run]
filesys.c#203,generic_get_mntinfo(): mountinfo entry: major=[8] minor=[3] filesys=[ext4] col_opt=[rw,discard,data=ordered] col_mnt=[/]
filesys.c#209,generic_get_mntinfo(): found mountinfo entry for device=[/dev/sda3]: mnt=[/] fs=[ext4] opt=[rw,discard,data=ordered]
oper_save.c#933,filesystem_mount_partition(): generic_get_mntinfo(/dev/sda3): mnt=[/], opt=[rw,discard,data=ordered], fs=[ext4], rw=[1]
As you can see, when I boot with systemd, fsarchiver isn't parsing the /proc/mount/self/mountinfo properly. The fields are in the wrong places. Thus, filesystem=1 instead of ext4. lol.

Is the bug within systemd or fsarchiver? I don't know. This is beyond my paygrade. But at least we now know what the problem is.

slickvguy
Posts: 5
Joined: Sun Oct 28, 2012 8:34 pm

Re: systemd: oper_save.c#947,filesystem_mount_partition():

Post by slickvguy » Tue Oct 30, 2012 7:01 am

Upon further investigation....

/proc/self/mountinfo (systemd)
18 1 8:3 / / rw,noatime shared:1 - ext4 /dev/sda3 rw,discard,data=ordered

/proc/self/mountinfo (sysvinit)
18 1 8:3 / / rw,noatime - ext4 /dev/sda3 rw,discard,data=ordered

systemd uses the optional shared field ("shared:1") and this is what throws off the fsarchiver parsing.

Lazy_Kent
Posts: 53
Joined: Sun Nov 15, 2009 1:08 pm
Location: Moscow, Russia

Re: systemd: oper_save.c#947,filesystem_mount_partition():

Post by Lazy_Kent » Tue Oct 30, 2012 8:19 am

I don't see this in openSUSE (using systemd).

21 1 8:3 / / rw,noatime - ext4 /dev/sda3 rw,data=ordered

Just in case: systemd-44
Last edited by Lazy_Kent on Tue Oct 30, 2012 8:21 am, edited 1 time in total.
Reason: added version

slickvguy
Posts: 5
Joined: Sun Oct 28, 2012 8:34 pm

Re: systemd: oper_save.c#947,filesystem_mount_partition():

Post by slickvguy » Tue Oct 30, 2012 8:44 am

It might depend on which kernel and/or version of systemd you are using?

I'm using arch linux. kernel 3.6.3-1-ARCH. systemd is 195-2
Every entry in my /proc/self/mountinfo has the shared field.

I know that they changed systemd at some point so that the filesystem would automatically be shared.

Really, this is an oversight on the fsarchiver development. The routine should take into consideration that optional fields might appear in the /proc/self/mountinfo lines.

viking
Posts: 2
Joined: Fri Dec 07, 2012 11:39 am

Re: systemd: oper_save.c#947,filesystem_mount_partition():

Post by viking » Fri Dec 07, 2012 12:11 pm

I too suffer with this problem, but I am not sure that the analysis by slicvguy is correct. I will tell you why.

I have two machines both running the Arch based distro Manjaro. They both run the same version of fsarchiver 0.6.15.1. The older machine has systemd version 195.1 and the newer machine has version 196.2.

On the older machine fsarchiver runs normally. On the newer machine it does not run at all, telling me that the ext4 partition I wish to image has an unsupported file system - which of course it doesn't. I immediately assumed that this was because systemd version 196.2 had introduced a problem, so I downgraded it to version 195.1. Fsarchiver still failed to work. Furthermore, when I look at the old, functioning machine, the file /proc/self/mountinfo is almost identical to the newer non functioning machine. In other words all the entries contain the 'shared' field yet fsarchiver works normally.

However the two files are not completely identical. On the functioning machine /proc/self/mountinfo is a real file (or as real as they get in a virtual file system). However on the non-functioning machine /proc/self/mountinfo is a symlink to a numbered file. Now I don't know enough to say that this is why one machine works and the other doesn't, but it might be worth considering, which is why I raised it. Perhaps fsarchiver is not programmed to follow symlinks in the /proc directory?

oleg68
Posts: 2
Joined: Wed Feb 06, 2013 7:11 pm

Re: systemd: oper_save.c#947,filesystem_mount_partition():

Post by oleg68 » Wed Feb 06, 2013 7:25 pm

This patch makes fsarchiver compatible with recent systemd versions.
After applying it, fsarchiver works fine with both /proc/self/mountinfo formats: the old one and the new one.
I've tested it on fedora 18 with systemd-197 and on fedora 17 with systemd-44.

Code: Select all

diff -Naur fsarchiver-0.6.15.old/src/filesys.c fsarchiver-0.6.15.new/src/filesys.c
--- fsarchiver-0.6.15.old/src/filesys.c	2012-06-02 17:52:56.000000000 +0400
+++ fsarchiver-0.6.15.new/src/filesys.c	2013-02-06 22:49:31.980286674 +0400
@@ -147,7 +147,8 @@
     struct stat64 devstat;
     struct stat64 rootstat;
     long major, minor;
-    char delims[]=" \t\n:";
+    char delims[]=" \t\n";
+    char delims1[]=":";
     struct utsname suname;
     char col_dev[128];
     char col_mnt[128];
@@ -155,6 +156,7 @@
     char line[1024];
     char temp[2048];
     char *saveptr;
+    char *saveptr1;
     char *result;
     FILE *f;
     int i;
@@ -182,22 +184,25 @@
                     switch (i)
                     {
                         case 2:
-                            major = atol(result);
+                            major = strtok_r(result, delims1, &saveptr1);
+                            minor = strtok_r(NULL, delims1, &saveptr1);
                             break;
-                        case 3:
-                            minor = atol(result);
-                            break;
-                        case 5:
+                        case 4:
                             snprintf(col_mnt, sizeof(col_mnt), "%s", result);
                             break;
-                        case 8:
+                        case 7:
                             snprintf(col_fs, sizeof(col_fs), "%s", result);
                             break;
-                        case 10:
+                        case 9:
                             snprintf(col_opt, sizeof(col_opt), "%s", result);
                             break;
                     }
-                    result = strtok_r(NULL, delims, &saveptr);
+                    /* find the next word skipping all key:value pairs at the 6 col */
+                    do {
+                      result = strtok_r(NULL, delims, &saveptr);
+                    } while (
+                      result != NULL && i == 5 && strpbrk(result, delims1) != NULL
+                    );
                 }
 
                 msgprintf(MSG_DEBUG1, "mountinfo entry: major=[%ld] minor=[%ld] filesys=[%s] col_opt=[%s] col_mnt=[%s]\n", major, minor, col_fs, col_opt, col_mnt);

admin
Site Admin
Posts: 550
Joined: Sat Feb 21, 2004 12:12 pm

Re: systemd: oper_save.c#947,filesystem_mount_partition():

Post by admin » Thu Feb 07, 2013 6:41 am

I have modified the function to consider "-" as a separator as it seems to be how we are supposed to parse this file according to linux/Documentation/filesystems/proc.txt

Would you please be able to test the beta1 with both sysvint and systemd, so that I can release the final version soon ?

viking
Posts: 2
Joined: Fri Dec 07, 2012 11:39 am

Re: systemd: oper_save.c#947,filesystem_mount_partition():

Post by viking » Thu Feb 07, 2013 10:06 am

I confirm the beta version is working on both systemv and systemd now (backup at least, I haven't tried restore yet). Looks like a success - thanks very much.

Lazy_Kent
Posts: 53
Joined: Sun Nov 15, 2009 1:08 pm
Location: Moscow, Russia

Re: systemd: oper_save.c#947,filesystem_mount_partition():

Post by Lazy_Kent » Thu Feb 07, 2013 11:55 am

fsarchiver-0.6.16_beta001 works well with systemd-195 (tested backup only).

admin
Site Admin
Posts: 550
Joined: Sat Feb 21, 2004 12:12 pm

Re: systemd: oper_save.c#947,filesystem_mount_partition():

Post by admin » Thu Feb 07, 2013 7:04 pm

Thanks for having tested the beta version.
I have just released the sources of fsarchiver-0.6.16.

Post Reply