I am facing the same error and some more. Your last comment (#4) made me
wonder. I had manually activated target.service because some tutorial I
was following at that time told me so. I remember that it had not been
automatically activated upon installation. So maybe the problem is
indeed caused by having two service files calling '/usr/bin/targetctl
restore' upon system start. That would make sense, not?

The following cases can be extracted from the syslog (ordered entries
after boot, timestamps stripped for easier readability):

1.) _Backstore already exists, Could not create Qla2xxxFabricModule, Directory 
not empty
Starting rtslib-fb-targetctl.service - Restore LIO kernel target 
configuration...
Starting target.service - Restore LIO kernel target configuration...
Could not create StorageObject S109-B: This _Backstore already exists in 
configFS, skipped
Could not create Target object: Could not create Qla2xxxFabricModule in 
configFS, skipped
Finished rtslib-fb-targetctl.service - Restore LIO kernel target configuration.
Could not create StorageObject S109-A: [Errno 39] Directory not empty: 
'/sys/kernel/config/target/core/iblock_0', skipped
Finished target.service - Restore LIO kernel target configuration.

2.) No saved config file, No such file or directory
Starting rtslib-fb-targetctl.service - Restore LIO kernel target 
configuration...
Starting target.service - Restore LIO kernel target configuration...
No saved config file at /etc/rtslib-fb-target/saveconfig.json, ok, exiting
Finished target.service - Restore LIO kernel target configuration.
Could not create StorageObject S109-A: [Errno 2] No such file or directory: 
'/sys/kernel/config/target/core/iblock_0/S109-A/alua', skipped
Could not find matching StorageObject for LUN 0, skipped
Could not find matching TPG LUN 0 for MappedLUN 0, skipped
Finished rtslib-fb-targetctl.service - Restore LIO kernel target configuration.

3.) UnboundLocalError: cannot access local variable 'lun_obj'
Starting rtslib-fb-targetctl.service - Restore LIO kernel target 
configuration...
Starting target.service - Restore LIO kernel target configuration...
Traceback (most recent call last):
  File "/usr/bin/targetctl", line 82, in <module>
    main()
  File "/usr/bin/targetctl", line 79, in main
    funcs[sys.argv[1]](savefile)
  File "/usr/bin/targetctl", line 47, in restore
    errors = RTSRoot().restore_from_file(restore_file=from_file)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/rtslib_fb/root.py", line 508, in 
restore_from_file
    return self.restore(config, target, storage_object,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/rtslib_fb/root.py", line 442, in restore
    Target.setup(fm_obj, t, err_func)
  File "/usr/lib/python3/dist-packages/rtslib_fb/target.py", line 133, in setup
    TPG.setup(t_obj, tpg, err_func)
  File "/usr/lib/python3/dist-packages/rtslib_fb/target.py", line 427, in setup
    LUN.setup(tpg_obj, lun, err_func)
  File "/usr/lib/python3/dist-packages/rtslib_fb/target.py", line 686, in setup
    lun_obj.alua_tg_pt_gp_name = lun['alua_tg_pt_gp_name']
    ^^^^^^^
UnboundLocalError: cannot access local variable 'lun_obj' where it is not 
associated with a value
rtslib-fb-targetctl.service: Main process exited, code=exited, status=1/FAILURE
rtslib-fb-targetctl.service: Failed with result 'exit-code'.
Failed to start rtslib-fb-targetctl.service - Restore LIO kernel target 
configuration.
rtslib-fb-targetctl.service: Consumed 1.168s CPU time.
Finished target.service - Restore LIO kernel target configuration.

4.) No errors
Starting rtslib-fb-targetctl.service - Restore LIO kernel target 
configuration...
Starting target.service - Restore LIO kernel target configuration...
No saved config file at /etc/rtslib-fb-target/saveconfig.json, ok, exiting
Finished target.service - Restore LIO kernel target configuration.
Finished rtslib-fb-targetctl.service - Restore LIO kernel target configuration.

I have not paid much attention to when what changes were done to the
configuration via targetclil so I cannot do more troubleshooting at the
moment. However, I have deactivated target.service and shall have a
close watch on the syslog for a while.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2085154

Title:
  rtslib-fb-targetctl.service crashes on startup

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/python-rtslib-fb/+bug/2085154/+subscriptions


-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to