FileNotFound while reading /sys/class/block/<dev>/* dir

Bug #1774042 reported by Ryan Harper
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
curtin
Triaged
Low
Unassigned

Bug Description

During clear-holders wiping devices, a rescan of the partition table can cause sysfs partition files to be removed asynchronously from reading the directory structure.

We need to accept FileNotFound errors (log them) but not allow them to be fatal as the partition was being removed.

Disk tree looks like:

Current device storage tree:
vda
|-- vda2
`-- vda1
Shutdown Plan:
{'device': '/sys/class/block/vda/vda1', 'dev_type': 'partition', 'level': 1}
{'device': '/sys/class/block/vda/vda2', 'dev_type': 'partition', 'level': 1}
{'device': '/sys/class/block/vda', 'dev_type': 'disk', 'level': 0}

After removing vda2, then vda1, and finally a wipe of vda we see this stack trace:

Traceback (most recent call last):
  File "/curtin/curtin/commands/main.py", line 201, in main
    ret = args.func(args)
  File "/curtin/curtin/commands/block_meta.py", line 58, in block_meta
    meta_custom(args)
  File "/curtin/curtin/commands/block_meta.py", line 1473, in meta_custom
    clear_holders.assert_clear(disk_paths)
  File "/curtin/curtin/block/clear_holders.py", line 544, in assert_clear
    for holders_tree in [gen_holders_tree(p) for p in base_paths]:
  File "/curtin/curtin/block/clear_holders.py", line 544, in <listcomp>
    for holders_tree in [gen_holders_tree(p) for p in base_paths]:
  File "/curtin/curtin/block/clear_holders.py", line 443, in gen_holders_tree
    'holders': [gen_holders_tree(h) for h in holder_paths],
  File "/curtin/curtin/block/clear_holders.py", line 443, in <listcomp>
    'holders': [gen_holders_tree(h) for h in holder_paths],
  File "/curtin/curtin/block/clear_holders.py", line 427, in gen_holders_tree
    holder_paths = ([block.sys_block_path(h) for h in get_holders(device)] +
  File "/curtin/curtin/block/clear_holders.py", line 412, in get_holders
    holders = os.listdir(os.path.join(sysfs_path, 'holders'))
FileNotFoundError: [Errno 2] No such file or directory: '/sys/class/block/vda/vda2/holders'
[Errno 2] No such file or directory: '/sys/class/block/vda/vda2/holders'
builtin command failed
finish: cmd-install/stage-partitioning/builtin: FAIL: running 'curtin block-meta simple'
builtin took 1.982 seconds
stage_partitioning took 1.983 seconds

Ryan Harper (raharper)
Changed in curtin:
importance: Undecided → Low
status: New → Triaged
Revision history for this message
Scott Hussey (sh8121) wrote :

I see this is considered low and is over a year old. Any idea if/when this will be fixed?

Revision history for this message
Ryan Harper (raharper) wrote :

I've not seen this stack track in a long time, so no ETA on a fix at this time.

Revision history for this message
Ryan Harper (raharper) wrote :

Are you currently seeing this fail? If so do you have more details?

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.