Skip to content

Add sysfs mount for pmon container#24017

Merged
qiluo-msft merged 1 commit intosonic-net:masterfrom
qiluo-msft:qiluo/fixi2c
Sep 17, 2025
Merged

Add sysfs mount for pmon container#24017
qiluo-msft merged 1 commit intosonic-net:masterfrom
qiluo-msft:qiluo/fixi2c

Conversation

@qiluo-msft
Copy link
Copy Markdown
Collaborator

@qiluo-msft qiluo-msft commented Sep 16, 2025

Why I did it

For platform using sysfs, the current pmon is broken.

admin@sonic:~$ docker exec -it pmon bash
root@sonic:/# python3
Python 3.11.2 (main, Apr 28 2025, 14:11:48) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> open('/sys/class/i2c-adapter/i2c-71/71-0050/eeprom', mode='r+b', buffering=0)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OSError: [Errno 30] Read-only file system: '/sys/class/i2c-adapter/i2c-71/71-0050/eeprom'

After this fix

admin@sonic:~$ docker exec -it pmon bash
root@sonic:/# python3
Python 3.11.2 (main, Apr 28 2025, 14:11:48) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> open('/sys/class/i2c-adapter/i2c-71/71-0050/eeprom', mode='r+b', buffering=0)
<_io.FileIO name='/sys/class/i2c-adapter/i2c-71/71-0050/eeprom' mode='rb+' closefd=True>

This regression was introduced by #23457

Work item tracking
  • Microsoft ADO (number only):

How I did it

How to verify it

Which release branch to backport (provide reason below if selected)

  • 202205
  • 202211
  • 202305
  • 202311
  • 202405
  • 202411
  • 202505

Tested branch (Please provide the tested image version)

Description for the changelog

Link to config_db schema for YANG module changes

A picture of a cute animal (not mandatory but encouraged)

@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@qiluo-msft qiluo-msft marked this pull request as ready for review September 17, 2025 00:56
@r12f
Copy link
Copy Markdown
Contributor

r12f commented Oct 5, 2025

hi @qiluo-msft , I wonder if you could help pick this change to 202505?

@qiluo-msft
Copy link
Copy Markdown
Collaborator Author

hi @qiluo-msft , I wonder if you could help pick this change to 202505?

It is not necessary for 202505, since the regression introducing PR #23457 is not on 202505.

FengPan-Frank pushed a commit to FengPan-Frank/sonic-buildimage that referenced this pull request Dec 4, 2025
Why I did it
For platform using sysfs, the current pmon is broken.

admin@sonic:~$ docker exec -it pmon bash
root@sonic:/# python3
Python 3.11.2 (main, Apr 28 2025, 14:11:48) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> open('/sys/class/i2c-adapter/i2c-71/71-0050/eeprom', mode='r+b', buffering=0)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OSError: [Errno 30] Read-only file system: '/sys/class/i2c-adapter/i2c-71/71-0050/eeprom'
After this fix

admin@sonic:~$ docker exec -it pmon bash
root@sonic:/# python3
Python 3.11.2 (main, Apr 28 2025, 14:11:48) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> open('/sys/class/i2c-adapter/i2c-71/71-0050/eeprom', mode='r+b', buffering=0)
<_io.FileIO name='/sys/class/i2c-adapter/i2c-71/71-0050/eeprom' mode='rb+' closefd=True>

This regression was introduced by sonic-net#23457

Signed-off-by: Feng Pan <fenpan@microsoft.com>
peterbailey-arista added a commit to peterbailey-arista/sonic-buildimage-msft that referenced this pull request Jan 14, 2026
arlakshm pushed a commit to Azure/sonic-buildimage-msft that referenced this pull request Jan 21, 2026
Backport sonic-net/sonic-buildimage#24017 to
MSFT-202503 to access sysfs from within PMON

<!--
Please make sure you've read and understood our contributing guidelines:
     https://github.com/Azure/SONiC/blob/gh-pages/CONTRIBUTING.md

** Make sure all your commits include a signature generated with `git
commit -s` **

If this is a bug fix, make sure your description includes "fixes #xxxx",
or
     "closes #xxxx" or "resolves #xxxx"

     Please provide the following information:
-->

#### Why I did it

##### Work item tracking
- Microsoft ADO **(number only)**:

#### How I did it

#### How to verify it

<!--
If PR needs to be backported, then the PR must be tested against the
base branch and the earliest backport release branch and provide tested
image version on these two branches. For example, if the PR is requested
for master, 202211 and 202012, then the requester needs to provide test
results on master and 202012.
-->

#### Which release branch to backport (provide reason below if selected)

<!--
- Note we only backport fixes to a release branch, *not* features!
- Please also provide a reason for the backporting below.
- e.g.
- [x] 202006
-->

- [ ] 201811
- [ ] 201911
- [ ] 202006
- [ ] 202012
- [ ] 202106
- [ ] 202111
- [ ] 202205
- [ ] 202211

#### Tested branch (Please provide the tested image version)

<!--
- Please provide tested image version
- e.g.
- [x] 20201231.100
-->

- [ ] <!-- image version 1 -->
- [ ] <!-- image version 2 -->

#### Description for the changelog
<!--
Write a short (one line) summary that describes the changes in this
pull request for inclusion in the changelog:
-->

<!--
Ensure to add label/tag for the feature raised. example - PR#2174 under
sonic-utilities repo. where, Generic Config and Update feature has been
labelled as GCU.
-->

#### Link to config_db schema for YANG module changes
<!--
Provide a link to config_db schema for the table for which YANG model
is defined
Link should point to correct section on
https://github.com/Azure/sonic-buildimage/blob/master/src/sonic-yang-models/doc/Configuration.md
-->

#### A picture of a cute animal (not mandatory but encouraged)
byu343 pushed a commit to byu343/sonic-buildimage that referenced this pull request Mar 24, 2026
Why I did it
For platform using sysfs, the current pmon is broken.

admin@sonic:~$ docker exec -it pmon bash
root@sonic:/# python3
Python 3.11.2 (main, Apr 28 2025, 14:11:48) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> open('/sys/class/i2c-adapter/i2c-71/71-0050/eeprom', mode='r+b', buffering=0)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OSError: [Errno 30] Read-only file system: '/sys/class/i2c-adapter/i2c-71/71-0050/eeprom'
After this fix

admin@sonic:~$ docker exec -it pmon bash
root@sonic:/# python3
Python 3.11.2 (main, Apr 28 2025, 14:11:48) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> open('/sys/class/i2c-adapter/i2c-71/71-0050/eeprom', mode='r+b', buffering=0)
<_io.FileIO name='/sys/class/i2c-adapter/i2c-71/71-0050/eeprom' mode='rb+' closefd=True>

This regression was introduced by sonic-net#23457
byu343 pushed a commit to byu343/sonic-buildimage that referenced this pull request Mar 24, 2026
Why I did it
For platform using sysfs, the current pmon is broken.

admin@sonic:~$ docker exec -it pmon bash
root@sonic:/# python3
Python 3.11.2 (main, Apr 28 2025, 14:11:48) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> open('/sys/class/i2c-adapter/i2c-71/71-0050/eeprom', mode='r+b', buffering=0)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OSError: [Errno 30] Read-only file system: '/sys/class/i2c-adapter/i2c-71/71-0050/eeprom'
After this fix

admin@sonic:~$ docker exec -it pmon bash
root@sonic:/# python3
Python 3.11.2 (main, Apr 28 2025, 14:11:48) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> open('/sys/class/i2c-adapter/i2c-71/71-0050/eeprom', mode='r+b', buffering=0)
<_io.FileIO name='/sys/class/i2c-adapter/i2c-71/71-0050/eeprom' mode='rb+' closefd=True>

This regression was introduced by sonic-net#23457

Signed-off-by: Boyang Yu <byu@arista.com>
@byu343
Copy link
Copy Markdown
Contributor

byu343 commented Mar 24, 2026

The cherry-pick to 202505 has a conflict. I manually opened the PR #26346

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants