Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 562284 - sys-block/targetcli-9999 fails to backup old configuration - errno 13 (permission denied)
Summary: sys-block/targetcli-9999 fails to backup old configuration - errno 13 (permis...
Status: RESOLVED DUPLICATE of bug 565824
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: AMD64 Linux
: Normal major (vote)
Assignee: Alexey Shvetsov
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-10-05 09:03 UTC by toon
Modified: 2016-04-06 09:00 UTC (History)
6 users (show)

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


Attachments
emerge --info (emerge-info.txt,5.86 KB, text/plain)
2015-10-05 09:11 UTC, toon
Details

Note You need to log in before you can comment on or make changes to this bug.
Description toon 2015-10-05 09:03:56 UTC
When saving a modified iscsi configuration to disk, targetcli usually saves the old version to /etc/target/backup.  This used to work, but today it failed with errno 13 (permission denied).  It creates the backup files but fails to write them (files are empty).

The new configuration was saved successfully.

In the past, targetcli used to write the backup files successfully, so this is a regression.

Reproducible: Didn't try

Steps to Reproduce:
1.Run targetcli
2.Using targetcli, make changes to the iscsi configuration
3.Still inside targetcli, call saveconfig
Actual Results:  
The new configuration is saved.
The old configuration is NOT saved to the backup files.
The backup files are created, but not written.  Targetcli reports errno 13 (permission denied), appearently on an executable.

Expected Results:  
The backup files should have been written successfully.

I emerged targetcli on may 9th:
8< - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# genlop -l|grep targetcli
     Sat May  9 22:57:50 2015 >>> sys-block/targetcli-9999
8< - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

There is a problem with this package.  I get errors when requesting the version.
I tried to remerge the packages configshell, rtslib and targetcli.
This did not bring any change/improvement:
8< - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# targetcli
targetcli GIT_VERSION (rtslib GIT_VERSION)
Copyright (c) 2011-2013 by Datera, Inc.
All rights reserved.
/> version
Cannot find configshell version. The configshell package has probably not been built properly from either the git repository or a public tarball.
Cannot find rtslib version. The rtslib package has probably not been built properly from either the git repository or a public tarball.
Cannot find targetcli version. The targetcli package has probably not been built properly from either the git repository or a public tarball.
8< - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

See below my current python configuration.
Please note that I did run python-updater after the last python update.
8< - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# eselect python list
Available Python interpreters:
  [1]   python2.7 *
  [2]   python3.4
8< - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Output of the saveconfig command:
8< - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/> saveconfig 
WARNING: Saving werkstation current configuration to disk will overwrite your boot settings.
The current target configuration will become the default boot config.
Are you sure? Type 'yes': yes
Making backup of srpt/ConfigFS with timestamp: 2015-10-05_00:13:16.189814
Traceback (most recent call last):
  File "/usr/sbin/tcm_fabric", line 141, in <module>
    os.execv(target_executable_path, sys.argv)
OSError: [Errno 13] Permission denied
Successfully updated default config /etc/target/srpt_start.sh
Making backup of loopback/ConfigFS with timestamp: 2015-10-05_00:13:16.189814
Traceback (most recent call last):
  File "/usr/sbin/tcm_fabric", line 141, in <module>
    os.execv(target_executable_path, sys.argv)
OSError: [Errno 13] Permission denied
Successfully updated default config /etc/target/loopback_start.sh
Making backup of LIO-Target/ConfigFS with timestamp: 2015-10-05_00:13:16.189814
Traceback (most recent call last):
  File "/usr/sbin/lio_dump", line 141, in <module>
    os.execv(target_executable_path, sys.argv)
OSError: [Errno 13] Permission denied
Generated LIO-Target config: /etc/target/backup/lio_backup-2015-10-05_00:13:16.189814.sh
Making backup of Target_Core_Mod/ConfigFS with timestamp: 2015-10-05_00:13:16.189814
Traceback (most recent call last):
  File "/usr/sbin/tcm_dump", line 141, in <module>
    os.execv(target_executable_path, sys.argv)
OSError: [Errno 13] Permission denied
Generated Target_Core_Mod config: /etc/target/backup/tcm_backup-2015-10-05_00:13:16.189814.sh
Successfully updated default config /etc/target/lio_start.sh
Successfully updated default config /etc/target/tcm_start.sh
8< - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Listing of the backup directory:
8< - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# ls -l /etc/target/backup/
total 140
-rw-r--r-- 1 root root 5718 10 mei 22:49 lio_backup-2015-05-10_22:49:14.229418.sh
-rw-r--r-- 1 root root 5716 11 mei 15:32 lio_backup-2015-05-11_15:32:12.770930.sh
-rw-r--r-- 1 root root 5093 11 mei 22:48 lio_backup-2015-05-11_22:48:28.591592.sh
-rw-r--r-- 1 root root 5716 11 mei 22:52 lio_backup-2015-05-11_22:52:31.744488.sh
-rw-r--r-- 1 root root 5716 11 mei 23:36 lio_backup-2015-05-11_23:36:19.196406.sh
-rw-r--r-- 1 root root 8335 11 mei 23:59 lio_backup-2015-05-11_23:59:58.710752.sh
-rw-r--r-- 1 root root 8703 12 mei 00:28 lio_backup-2015-05-12_00:28:08.932482.sh
-rw-r--r-- 1 root root    0  5 okt 00:13 lio_backup-2015-10-05_00:13:16.189814.sh
-rw-r--r-- 1 root root   59 10 mei 22:49 loopback_backup-2015-05-10_22:49:14.229418.sh
-rw-r--r-- 1 root root   59 11 mei 15:32 loopback_backup-2015-05-11_15:32:12.770930.sh
-rw-r--r-- 1 root root   59 11 mei 22:48 loopback_backup-2015-05-11_22:48:28.591592.sh
-rw-r--r-- 1 root root   59 11 mei 22:52 loopback_backup-2015-05-11_22:52:31.744488.sh
-rw-r--r-- 1 root root   59 11 mei 23:36 loopback_backup-2015-05-11_23:36:19.196406.sh
-rw-r--r-- 1 root root   59 11 mei 23:59 loopback_backup-2015-05-11_23:59:58.710752.sh
-rw-r--r-- 1 root root   59 12 mei 00:28 loopback_backup-2015-05-12_00:28:08.932482.sh
-rw-r--r-- 1 root root    0  5 okt 00:13 loopback_backup-2015-10-05_00:13:16.189814.sh
-rw-r--r-- 1 root root   54 11 mei 22:48 srpt_backup-2015-05-11_22:48:28.591592.sh
-rw-r--r-- 1 root root   54 11 mei 22:52 srpt_backup-2015-05-11_22:52:31.744488.sh
-rw-r--r-- 1 root root   54 11 mei 23:36 srpt_backup-2015-05-11_23:36:19.196406.sh
-rw-r--r-- 1 root root   54 11 mei 23:59 srpt_backup-2015-05-11_23:59:58.710752.sh
-rw-r--r-- 1 root root   54 12 mei 00:28 srpt_backup-2015-05-12_00:28:08.932482.sh
-rw-r--r-- 1 root root    0  5 okt 00:13 srpt_backup-2015-10-05_00:13:16.189814.sh
-rw-r--r-- 1 root root 3067 10 mei 22:49 tcm_backup-2015-05-10_22:49:14.229418.sh
-rw-r--r-- 1 root root 2995 11 mei 15:32 tcm_backup-2015-05-11_15:32:12.770930.sh
-rw-r--r-- 1 root root 2995 11 mei 22:48 tcm_backup-2015-05-11_22:48:28.591592.sh
-rw-r--r-- 1 root root 2995 11 mei 22:52 tcm_backup-2015-05-11_22:52:31.744488.sh
-rw-r--r-- 1 root root 2995 11 mei 23:36 tcm_backup-2015-05-11_23:36:19.196406.sh
-rw-r--r-- 1 root root 2995 11 mei 23:59 tcm_backup-2015-05-11_23:59:58.710752.sh
-rw-r--r-- 1 root root 2995 12 mei 00:28 tcm_backup-2015-05-12_00:28:08.932482.sh
-rw-r--r-- 1 root root    0  5 okt 00:13 tcm_backup-2015-10-05_00:13:16.189814.sh
8< - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


Based on the error messages I am worried that something fundamental is wrong.
It would be a disaster if my iscsi target stopped working because of this.
It would be nice if targetcli would be stabelized in portage.
It is an essential base package, not some nice-to-have thingy...
Comment 1 toon 2015-10-05 09:11:57 UTC
Created attachment 413772 [details]
emerge --info
Comment 2 toon 2015-10-11 20:43:35 UTC
Guys, it is worse than I already reported.
Today I rebooted the system after an emerge update.
After the reboot the target config was totally gone.
I entered the config again using targetcli and did a saveconfig.
The output was reassuring( for the config files that is...
But a closer look revealed that the new config files were created but not written:

/iscsi/iqn.20...station/tpgt1> cd /
/> ls
o- / ............................................................................... [...]
  o- backstores .................................................................... [...]
  | o- fileio ......................................................... [0 Storage Object]
  | o- iblock ......................................................... [1 Storage Object]
  | | o- iqn.2015-10.nl.vanvergehaald:ocdata1 ........ [/dev/mapper/vg1-ocdata1 activated]
  | o- pscsi .......................................................... [0 Storage Object]
  | o- rd_dr .......................................................... [0 Storage Object]
  | o- rd_mcp ......................................................... [0 Storage Object]
  o- ib_srpt ................................................................. [0 Targets]
  o- iscsi .................................................................... [1 Target]
  | o- iqn.2015-10.nl.vanvergehaald:werkstation .................................. [1 TPG]
  |   o- tpgt1 ................................................................. [enabled]
  |     o- acls .................................................................. [1 ACL]
  |     | o- iqn.2015-11.nl.vanvergehaald:owncloud ........................ [1 Mapped LUN]
  |     |   o- mapped_lun0 ................................................... [lun0 (rw)]
  |     o- luns .................................................................. [1 LUN]
  |     | o- lun0  [iblock/iqn.2015-10.nl.vanvergehaald:ocdata1 (/dev/mapper/vg1-ocdata1)]
  |     o- portals ............................................................ [1 Portal]
  |       o- 192.168.3.6:3260 ........................................ [OK, iser disabled]
  o- loopback ................................................................ [0 Targets]/> saveconfig
WARNING: Saving werkstation current configuration to disk will overwrite your boot settings.
The current target configuration will become the default boot config.
Are you sure? Type 'yes': yes
Making backup of loopback/ConfigFS with timestamp: 2015-10-11_18:53:09.861411
Traceback (most recent call last):
  File "/usr/sbin/tcm_fabric", line 141, in <module>
    os.execv(target_executable_path, sys.argv)
OSError: [Errno 13] Permission denied
Successfully updated default config /etc/target/loopback_start.sh
Making backup of srpt/ConfigFS with timestamp: 2015-10-11_18:53:09.861411
Traceback (most recent call last):
  File "/usr/sbin/tcm_fabric", line 141, in <module>
    os.execv(target_executable_path, sys.argv)
OSError: [Errno 13] Permission denied
Successfully updated default config /etc/target/srpt_start.sh
Making backup of LIO-Target/ConfigFS with timestamp: 2015-10-11_18:53:09.861411
Traceback (most recent call last):
  File "/usr/sbin/lio_dump", line 141, in <module>
    os.execv(target_executable_path, sys.argv)
OSError: [Errno 13] Permission denied
Generated LIO-Target config: /etc/target/backup/lio_backup-2015-10-11_18:53:09.861411.sh
Making backup of Target_Core_Mod/ConfigFS with timestamp: 2015-10-11_18:53:09.861411
Traceback (most recent call last):
  File "/usr/sbin/tcm_dump", line 141, in <module>
    os.execv(target_executable_path, sys.argv)
OSError: [Errno 13] Permission denied
Generated Target_Core_Mod config: /etc/target/backup/tcm_backup-2015-10-11_18:53:09.861411.sh
Successfully updated default config /etc/target/lio_start.sh
Successfully updated default config /etc/target/tcm_start.sh

# ls -l /etc/target/
total 4
drwxr-xr-x 2 root root 4096 11 okt 18:53 backup
-rwxr-xr-x 1 root root    0 11 okt 18:53 lio_start.sh
-rw-r--r-- 1 root root    0 11 okt 18:53 loopback_start.sh
-rw-r--r-- 1 root root    0 11 okt 18:53 srpt_start.sh
-rwxr-xr-x 1 root root    0 11 okt 18:53 tcm_start.sh

This is not good.
There seems to be something very wrong with the build of this package.
Comment 3 Karl Hakimian 2015-11-04 16:09:33 UTC
I ran into this today as well. The best I can tell it is a change to python-2.7 and how it executes some of its scripts.

Try the following

cd /usr/lib64/python2.7/site-packages

Look at the tcm and lio python files. If they are like mine, they have permissions set to 644. Try

chmod 755 tcm_* lio_*

Reboot and see if things are working better. I'm still not sure all is well, but my targets showed up again.
Comment 4 Ondrej Famera 2015-12-12 23:23:55 UTC
Hi Karl,

I can confirm that changing permissions makes it work on my system.
When I reinstall sys-block/lio-utils, the files /usr/lib64/python2.7/site-packages/{tcm,lio}_* 
have 644 permission and issuing 'saveconfig' inside targetcli results
in configuration and backups of configuration to be created without content (zero-sized files). 

Changing permission for following two files makes the 'saveconfig' work as expected 
(generating configuration that gets loaded after boot).

-rwxr-xr-x. 1 root root  9209 Dec 13 00:10 /usr/lib64/python2.7/site-packages/lio_dump.py
-rwxr-xr-x. 1 root root 10950 Dec 13 00:10 /usr/lib64/python2.7/site-packages/tcm_dump.py
Comment 5 Ondrej Famera 2015-12-12 23:36:12 UTC
Bug 565824 - "sys-block/lio-utils - improper mode on required utility scripts"
   looks like the same issue/solution.
Comment 6 Andrew Savchenko gentoo-dev 2016-04-06 09:00:58 UTC

*** This bug has been marked as a duplicate of bug 565824 ***