Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 947111 - devpts is not mounted in LXC container (after changes introduced in 761918)
Summary: devpts is not mounted in LXC container (after changes introduced in 761918)
Status: UNCONFIRMED
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: OpenRC (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: OpenRC Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-12-28 11:17 UTC by kiwi93872
Modified: 2025-01-09 15:25 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description kiwi93872 2024-12-28 11:17:38 UTC
I have recently upgraded my LXC-containerised Gentoo installation and ran into issues related to the changes introduced in the bugreport #761918.

Ths symtomps are the following:
When I connect with SSH to the container, I get the message: 
"PTY allocation request failed on channel 0"
To workaround it, I run ssh with "/bin/bash -if" options and manually run "mount -t devpts none /dev/pts".



Reproducible: Always




https://bugs.gentoo.org/761918#c6

Additional info:
1) I am running app/emulation-1.0.11 (outside the container) and sys-apps/openrc-0.53 (inside the container)
2) The container's config files do not have lines to mount devpts during container startup. I tried to add them, but there was no result.
3) The /etc/fstab file inside the container has the line to mount devpts, but possibly has no effect since /etc/init.d/localmount has "-lxc" in the keyword list. Eventually, I commented that line in /etc/fstab with no effect.
4) I can solve the issue by masking lxc (appending "-lxc") in the depend() function of the /etc/init.d/devfs initscript. Thus, partially reverting changes introduced in the bugreport #761918.
5) Commenting out "mountinfo -q $2 && continue" line in the seed_dev() function also solves my issue.
Comment 1 Anna 2024-12-30 01:51:36 UTC
does it work if you unmask lxc in /etc/init.d/localmount?

related pull request upstream: https://github.com/OpenRC/openrc/pull/766, and possibly related bug: https://bugs.gentoo.org/898904
Comment 2 kiwi93872 2025-01-02 00:18:40 UTC
(In reply to Anna from comment #1)
> does it work if you unmask lxc in /etc/init.d/localmount?
> 
> related pull request upstream: https://github.com/OpenRC/openrc/pull/766,
> and possibly related bug: https://bugs.gentoo.org/898904

It depends on the content of /etc/fstab (inside the container). If there is a line for devpts filesystem, then it works.

However, this is not expected solution, since just disguises original problem introduced in 761918.

The devfs init script inside the container interferes with the LXC container launcher, which itself mounts devpts (if 'lxc.pts' or 'lxc.mount.entry' exist in container's conf file). The corresponding option for dev is lxc.autodev.

I believe that using of lxc.* options for mounting local and other special FS inside the container is (historically) the preferable and main usage case. And that is the reason of inclusion "-lxc" in the devfs, localmount, networkmount scripts inside the container.

In my case, the launching devfs init script (after the devpts has been already mounted by the container launcher) effectively hides /dev/pts: the mount_dev() subroutine mounts devtmpfs and the seed() subroutine does not mount devpts since it is already mounted.

In my opinion, such modifications of the default behavior of an init scripts is unsafe and makes trouble during upgrade.
Comment 3 Anna 2025-01-02 02:33:47 UTC
> However, this is not expected solution, since just disguises original
> problem introduced in 761918.

> I believe that using of lxc.* options for mounting local and other special
> FS inside the container is (historically) the preferable and main usage
> case. And that is the reason of inclusion "-lxc" in the devfs, localmount,
> networkmount scripts inside the container.

i'm unsure about the expected solution/preferable usage since upstream called it an alpine bug[1], and they patch localmount to be ran in their alpine ci image[2]

1: https://github.com/canonical/lxd/issues/5967#issuecomment-511829050
2: https://github.com/lxc/lxc-ci/blob/main/images/alpine.yaml#L362

> In my case, the launching devfs init script (after the devpts has been
> already mounted by the container launcher) effectively hides /dev/pts: the
> mount_dev() subroutine mounts devtmpfs and the seed() subroutine does not
> mount devpts since it is already mounted.

it feels like skip_dev_mount in conf.d/devfs should be set when using the container launcher to setup dev, and at the same time lxc-ci doesn't seem to use it to do so in alpine, using devfs and localmount
Comment 4 kiwi93872 2025-01-09 15:25:53 UTC
> 
> it feels like skip_dev_mount in conf.d/devfs should be set when using the
> container launcher to setup dev, and at the same time lxc-ci doesn't seem to
> use it to do so in alpine, using devfs and localmount

In the present circumstances, I believe the "skip_mount_dev" option is an acceptable solution/workaround.

The reason I have filed the bug report is to document the issue other Gentoo users may come across upon upgrading (and perhaps to get some feedback from the patch author)

So, at the moment, I have no objection to marking the bug report as resolved.
Should I do it by myself?