Skip to contentSkip to conversation

Does overlay driver work if built in to the kernel?

DISCUSSION Keyon Jie 3 participants 6 messages Sep 21, 2022 – Sep 22, 2022

lore
Share & tools
lore

Keyon Jie

author
#0 lore raw

Hi all,

I am new to the overlayfs, I am hitting issues to make kernel modules work in a container environment where the Kubernetes feature really need the overlayfs support.

I figured out to make overlay driver built-in to the VM kernel (and then shared to the container), but looks like the Kubernetes always fail when trying to create overlayfs mounts, with errors like 'permission denied'.

I am seeing that overlay driver is released with modular (CONFIG_OVERLAY_FS=m) in most (not sure if it is all) Linux distributions, so I am wondering if the overlay driver work when built in to the kernel?

Thanks,

~Keyon

author
#1 lore raw

Hi all,

Sorry for annoys in case the mail is sent twice, it looks to me it was moderated that the previous one was sent before subscribing the mailing list.

I am new to the overlayfs, I am hitting issues to make kernel modules work in a container environment where the Kubernetes feature really need the overlayfs support.

I figured out to make overlay driver built-in to the VM kernel (and then shared to the container), but looks like the Kubernetes always fail when trying to create overlayfs mounts, with errors like 'permission denied'.

I am seeing that overlay driver is released with modular (CONFIG_OVERLAY_FS=m) in most (not sure if it is all) Linux distributions, so I am wondering if the overlay driver work when built in to the kernel?

Thanks,

~Keyon

#2 lore raw
In reply to Keyon Jie
Quoted 11 lines · Keyon Jie

Hi all,

I am new to the overlayfs, I am hitting issues to make kernel modules work in a container environment where the Kubernetes feature really need the overlayfs support.

I figured out to make overlay driver built-in to the VM kernel (and then shared to the container), but looks like the Kubernetes always fail when trying to create overlayfs mounts, with errors like 'permission denied'.

Usually, you want to look at the kernel log to see the reason for failure. That is likely because the container is "unprivileged"
meaning not using the same uid 0 as the host.

Don't know which kernel you are running, but overlayfs can be mounted inside unprivileged container since kernel v5.11:

https://lore.kernel.org/linux-fsdevel/[email protected]/

Quoted 6 lines

I am seeing that overlay driver is released with modular (CONFIG_OVERLAY_FS=m) in most (not sure if it is all) Linux distributions, so I am wondering if the overlay driver work when built in to the kernel?

It can be built in or module.
That seems unrelated to your problem.

Thanks,
Amir.

#3 lore raw
Quoted 28 lines

-----Original Message-----
From: Amir Goldstein <[email protected]>
Sent: Tuesday, September 20, 2022 11:50 PM
To: Keyon Jie <[email protected]>
Cc: Miklos Szeredi <[email protected]>; overlayfs <linux- [email protected]>; Jie, Keyon <[email protected]>
Subject: Re: Does overlay driver work if built in to the kernel?

Quoted 5 lines · Keyon Jie

Hi all,

I am new to the overlayfs, I am hitting issues to make kernel modules work in a container environment where the Kubernetes feature really

need

Quoted 6 lines

the overlayfs support.

I figured out to make overlay driver built-in to the VM kernel (and then shared to the container), but looks like the Kubernetes always fail when trying to create overlayfs mounts, with errors like 'permission denied'.

Usually, you want to look at the kernel log to see the reason for failure. That is likely because the container is "unprivileged"
meaning not using the same uid 0 as the host.

Quoted 5 lines

Don't know which kernel you are running, but overlayfs can be mounted inside unprivileged container since kernel v5.11:

https://lore.kernel.org/linux-
fsdevel/[email protected]/

Thank you Amir.
I am using v5.10 kernel, so looks I can try to backport some of the patches and try it again. I assume take the 10-commits series from Miklos should be enough?
vfs: move cap_convert_nscap() call into vfs_setxattr()
vfs: verify source area in vfs_dedupe_file_range_one()
ovl: check privs before decoding file handle
ovl: make ioctl() safe
ovl: simplify file splice
ovl: user xattr
ovl: do not fail when setting origin xattr
ovl: do not fail because of O_NOATIME
ovl: do not get metacopy for userxattr
ovl: unprivieged mounts
https://lore.kernel.org/linux-fsdevel/[email protected]/T/

Thanks,
~Keyon

Quoted 13 lines
Quoted 7 lines

I am seeing that overlay driver is released with modular (CONFIG_OVERLAY_FS=m) in most (not sure if it is all) Linux distributions, so I am wondering if the overlay driver work when built in to the kernel?

It can be built in or module.
That seems unrelated to your problem.

Thanks,
Amir.

#4 lore raw
Quoted 35 lines · Keyon
Quoted 29 lines

-----Original Message-----
From: Amir Goldstein <[email protected]>
Sent: Tuesday, September 20, 2022 11:50 PM
To: Keyon Jie <[email protected]>
Cc: Miklos Szeredi <[email protected]>; overlayfs <linux- [email protected]>; Jie, Keyon <[email protected]>
Subject: Re: Does overlay driver work if built in to the kernel?

Quoted 5 lines · Keyon Jie

Hi all,

I am new to the overlayfs, I am hitting issues to make kernel modules work in a container environment where the Kubernetes feature really

need

Quoted 6 lines

the overlayfs support.

I figured out to make overlay driver built-in to the VM kernel (and then shared to the container), but looks like the Kubernetes always fail when trying to create overlayfs mounts, with errors like 'permission denied'.

Usually, you want to look at the kernel log to see the reason for failure. That is likely because the container is "unprivileged"
meaning not using the same uid 0 as the host.

Quoted 5 lines

Don't know which kernel you are running, but overlayfs can be mounted inside unprivileged container since kernel v5.11:

https://lore.kernel.org/linux-
fsdevel/[email protected]/

Quoted 15 lines

Thank you Amir.
I am using v5.10 kernel, so looks I can try to backport some of the patches and try it again. I assume take the 10-commits series from Miklos should be enough?
vfs: move cap_convert_nscap() call into vfs_setxattr()
vfs: verify source area in vfs_dedupe_file_range_one()
ovl: check privs before decoding file handle
ovl: make ioctl() safe
ovl: simplify file splice
ovl: user xattr
ovl: do not fail when setting origin xattr
ovl: do not fail because of O_NOATIME
ovl: do not get metacopy for userxattr
ovl: unprivieged mounts
https://lore.kernel.org/linux-fsdevel/[email protected]/T/

Not sure you can try.
There may be other bug fixes that need backporting.
It is not recommended to backport such a feature by yourself.
You would be much better off taking or build a newer LTS kernel (e.g. 5.15.y)

Thanks,
Amir.

#5 lore raw
Quoted 61 lines

-----Original Message-----
From: Amir Goldstein <[email protected]>
Sent: Wednesday, September 21, 2022 10:42 AM
To: Jie, Keyon <[email protected]>
Cc: Keyon Jie <[email protected]>; Miklos Szeredi <[email protected]>; overlayfs <[email protected]>
Subject: Re: Does overlay driver work if built in to the kernel?

Quoted 13 lines · Keyon
Quoted 13 lines

-----Original Message-----
From: Amir Goldstein <[email protected]>
Sent: Tuesday, September 20, 2022 11:50 PM
To: Keyon Jie <[email protected]>
Cc: Miklos Szeredi <[email protected]>; overlayfs <linux- [email protected]>; Jie, Keyon <[email protected]>
Subject: Re: Does overlay driver work if built in to the kernel?

Quoted 1 line · Keyon Jie
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines

Hi all,

I am new to the overlayfs, I am hitting issues to make kernel modules work in a container environment where the Kubernetes feature really

need

Quoted 3 lines

the overlayfs support.

I figured out to make overlay driver built-in to the VM kernel (and

then

Quoted 1 line
Quoted 1 line
Quoted 1 line

shared to the container), but looks like the Kubernetes always fail

when

Quoted 7 lines
Quoted 7 lines
Quoted 2 lines

trying to create overlayfs mounts, with errors like 'permission denied'.

Usually, you want to look at the kernel log to see the reason for failure. That is likely because the container is "unprivileged"
meaning not using the same uid 0 as the host.

Quoted 8 lines
Quoted 5 lines

Don't know which kernel you are running, but overlayfs can be mounted inside unprivileged container since kernel v5.11:

https://lore.kernel.org/linux-
fsdevel/[email protected]/

Thank you Amir.
I am using v5.10 kernel, so looks I can try to backport some of the patches

and try it again.

Quoted 4 lines

I assume take the 10-commits series from Miklos should be enough?
vfs: move cap_convert_nscap() call into vfs_setxattr()
vfs: verify source area in vfs_dedupe_file_range_one()
ovl: check privs before decoding file handle

Quoted 8 lines

ovl: make ioctl() safe
ovl: simplify file splice
ovl: user xattr
ovl: do not fail when setting origin xattr
ovl: do not fail because of O_NOATIME
ovl: do not get metacopy for userxattr
ovl: unprivieged mounts
https://lore.kernel.org/linux-fsdevel/1725e01a-4d4d-aecb-bad6-

Quoted 7 lines

[email protected]/T/

Quoted 1 line

Not sure you can try.
There may be other bug fixes that need backporting.
It is not recommended to backport such a feature by yourself.
You would be much better off taking or build a newer LTS kernel (e.g. 5.15.y)

Thank you so much Amir. Just tried and 5.15 works well for me!

Thanks,
~Keyon

Quoted 3 lines

Thanks,
Amir.