Skip to content

Podman container device points to wrong real device file #22

Description

@toffee

Probably this issue can be reproduced only if you have more USB devices on your system (I have 4).

To exemplify the behavior I will use the vcontrold USB device.

When the podman container vcontrold was created let's assume that symbolic link /dev/ttyVControlD points to /dev/ttyUSB3.

Using the podman container inspect I can see the command used to create the container:

 "CreateCommand": [
                    "podman",
                    "container",
                    "create",
                    "--name",
                    "vcontrold",
                    "--security-opt",
                    "label=disable",
                    "--cgroups=split",
                    "--log-driver",
                    "journald",
                    "--log-opt",
                    "tag=vcontrold",
                    "--hostname",
                    "vcontrold",
                    "--network",
                    "isolated",
                    "--ip",
                    "172.16.0.230",
                    "--expose",
                    "3002",
                    "--device",
                    "/dev/ttyVControlD:/dev/ttyVControlD:rwm",
                    "--env",
                    "TZ=Europe/Bucharest",
                    "--volume",
                    "/smartserver/etc/vcontrold/:/etc/vcontrold:ro",
                    "--volume",
                    "/smartserver/var/log/vcontrold/:/smartserver/var/log/vcontrold",
                    "custom_vcontrold:3.20.3-v0.98.12"
               ],

and also the devices used:

 "Devices": [
                    {
                         "PathOnHost": "/dev/ttyUSB3",
                         "PathInContainer": "/dev/ttyVControlD",
                         "CgroupPermissions": ""
                    }
               ],

As you can see, even if at creation time the symbolic link was used --device "/dev/ttyVControlD:/dev/ttyVControlD:rwm" seems that the container is using the real device file PathOnHost: /dev/ttyUSB3

The problem appear after a reboot when it's possible that real device file to be something else (like bellow - ttyUSB2):

ls -la /dev/ttyVControlD
lrwxrwxrwx 1 root root 7 Sep 26 21:13 /dev/ttyVControlD -> ttyUSB2

No error and container start, because ttyUSB3 exist in system but now it's totally other device.

With docker this behavior wasn't noticed, so I guess it has something to do with podman (and/or his configuration) .

Do you know this can be fixed (eg. container to use the symbolic link for PathOnHost)?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions