{"action":"created","issue":{"url":"https://api.github.com/repos/saltstack/salt/issues/38389","repository_url":"https://api.github.com/repos/saltstack/salt","labels_url":"https://api.github.com/repos/saltstack/salt/issues/38389/labels{/name}","comments_url":"https://api.github.com/repos/saltstack/salt/issues/38389/comments","events_url":"https://api.github.com/repos/saltstack/salt/issues/38389/events","html_url":"https://github.com/saltstack/salt/issues/38389","id":196884391,"number":38389,"title":"Centos 7 - sfdisk -d before qemu-nbd connect in seeding virt images","user":{"login":"rtmie","id":1281838,"avatar_url":"https://avatars.githubusercontent.com/u/1281838?v=3","gravatar_id":"","url":"https://api.github.com/users/rtmie","html_url":"https://github.com/rtmie","followers_url":"https://api.github.com/users/rtmie/followers","following_url":"https://api.github.com/users/rtmie/following{/other_user}","gists_url":"https://api.github.com/users/rtmie/gists{/gist_id}","starred_url":"https://api.github.com/users/rtmie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rtmie/subscriptions","organizations_url":"https://api.github.com/users/rtmie/orgs","repos_url":"https://api.github.com/users/rtmie/repos","events_url":"https://api.github.com/users/rtmie/events{/privacy}","received_events_url":"https://api.github.com/users/rtmie/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-12-21T09:28:26Z","updated_at":"2016-12-21T21:04:53Z","closed_at":null,"body":"### Description of Issue/Question\r\nIn version 2016.11.1 - When running seed.apply on a vm image  qemu-nbd I always get an error in seeding the vm image and the 'qemu-nbd -c' command is never executed.\r\n\r\nIt seems that behaviour of Centos7 sfdisk returns 0 even after command fails:\r\n```\r\n[root@smiley salt]# sfdisk -d /dev/nbd0\r\nread: Inappropriate ioctl for device\r\n\r\nsfdisk: read error on /dev/nbd0 - cannot read sector 0\r\n[root@smiley salt]# echo $?\r\n0\r\n[root@smiley salt]# \r\n```\r\nWhereas fdisk -l returns an error\r\n```\r\n[root@smiley salt]# fdisk -l /dev/nbd0\r\nfdisk: cannot open /dev/nbd0: Inappropriate ioctl for device\r\n[root@smiley salt]# echo $?\r\n1\r\n```\r\n\r\nThis means that the qemu_nbd module will not go into the connecting loop on Centos if it uses sfdisk -d.\r\n\r\n\r\nInterestingly on Fedora (25) the opposite is true:\r\n\r\n```\r\n [root@fedora] sfdisk -d /dev/nbd0\r\nsfdisk: cannot open /dev/nbd0: No such file or directory\r\n [root@fedora] echo $?\r\n1\r\n [root@fedora] fdisk -l /dev/nbd0\r\nfdisk: cannot open /dev/nbd0: No such file or directory\r\n [root@fedora] echo $?\r\n0\r\n```\r\n\r\n### Setup\r\n` sudo salt 'hypervisor' seed.apply  /srv/salt-images/knode23.localdomain/system.qcow2  knode23.localdomain`\r\n\r\n### Steps to Reproduce Issue\r\nRun above command:\r\nLog output is:\r\n```2016-12-21 08:48:36,800 [salt.loader.salt.int.module.seed][DEBUG   ][10219] Mounting file at /srv/salt-images/knode23.localdomain/system.qcow2\r\n2016-12-21 08:48:36,801 [salt.utils.lazy  ][DEBUG   ][10219] LazyLoaded guestfs.mount\r\n2016-12-21 08:48:36,802 [salt.utils.lazy  ][DEBUG   ][10219] LazyLoaded mount.mount\r\n2016-12-21 08:48:36,803 [salt.utils.lazy  ][DEBUG   ][10219] LazyLoaded qemu_nbd.init\r\n2016-12-21 08:48:36,804 [salt.loader.salt.int.module.cmdmod][INFO    ][10219] Executing command 'modprobe nbd max_part=63' in directory '/root'\r\n2016-12-21 08:48:36,823 [salt.loader.salt.int.module.cmdmod][DEBUG   ][10219] output:\r\n2016-12-21 08:48:36,825 [salt.loader.salt.int.module.cmdmod][INFO    ][10219] Executing command 'sfdisk -d /dev/nbd9' in directory '/root'\r\n2016-12-21 08:48:36,841 [salt.loader.salt.int.module.cmdmod][DEBUG   ][10219] output: read: Inappropriate ioctl for device\r\n\r\nsfdisk: read error on /dev/nbd9 - cannot read sector 0\r\n2016-12-21 08:48:36,842 [salt.loader.salt.int.module.cmdmod][INFO    ][10219] Executing command 'sfdisk -d /dev/nbd8' in directory '/root'\r\n2016-12-21 08:48:36,858 [salt.loader.salt.int.module.cmdmod][DEBUG   ][10219] output: read: Inappropriate ioctl for device\r\n\r\nsfdisk: read error on /dev/nbd8 - cannot read sector 0\r\n2016-12-21 08:48:36,859 [salt.loader.salt.int.module.cmdmod][INFO    ][10219] Executing command 'sfdisk -d /dev/nbd7' in directory '/root'\r\n2016-12-21 08:48:36,875 [salt.loader.salt.int.module.cmdmod][DEBUG   ][10219] output: read: Inappropriate ioctl for device\r\n\r\nsfdisk: read error on /dev/nbd7 - cannot read sector 0\r\n2016-12-21 08:48:36,875 [salt.loader.salt.int.module.cmdmod][INFO    ][10219] Executing command 'sfdisk -d /dev/nbd6' in directory '/root'\r\n2016-12-21 08:48:36,893 [salt.loader.salt.int.module.cmdmod][DEBUG   ][10219] output: read: Inappropriate ioctl for device\r\n\r\nsfdisk: read error on /dev/nbd6 - cannot read sector 0\r\n2016-12-21 08:48:36,894 [salt.loader.salt.int.module.cmdmod][INFO    ][10219] Executing command 'sfdisk -d /dev/nbd5' in directory '/root'\r\n2016-12-21 08:48:36,909 [salt.loader.salt.int.module.cmdmod][DEBUG   ][10219] output: read: Inappropriate ioctl for device\r\n\r\nsfdisk: read error on /dev/nbd5 - cannot read sector 0\r\n2016-12-21 08:48:36,910 [salt.loader.salt.int.module.cmdmod][INFO    ][10219] Executing command 'sfdisk -d /dev/nbd4' in directory '/root'\r\n2016-12-21 08:48:36,925 [salt.loader.salt.int.module.cmdmod][DEBUG   ][10219] output: read: Inappropriate ioctl for device\r\n\r\nsfdisk: read error on /dev/nbd4 - cannot read sector 0\r\n2016-12-21 08:48:36,926 [salt.loader.salt.int.module.cmdmod][INFO    ][10219] Executing command 'sfdisk -d /dev/nbd3' in directory '/root'\r\n2016-12-21 08:48:36,943 [salt.loader.salt.int.module.cmdmod][DEBUG   ][10219] output: read: Inappropriate ioctl for device\r\n\r\nsfdisk: read error on /dev/nbd3 - cannot read sector 0\r\n2016-12-21 08:48:36,944 [salt.loader.salt.int.module.cmdmod][INFO    ][10219] Executing command 'sfdisk -d /dev/nbd2' in directory '/root'\r\n2016-12-21 08:48:36,959 [salt.loader.salt.int.module.cmdmod][DEBUG   ][10219] output: read: Inappropriate ioctl for device\r\n\r\nsfdisk: read error on /dev/nbd2 - cannot read sector 0\r\n2016-12-21 08:48:36,960 [salt.loader.salt.int.module.cmdmod][INFO    ][10219] Executing command 'sfdisk -d /dev/nbd1' in directory '/root'\r\n2016-12-21 08:48:36,977 [salt.loader.salt.int.module.cmdmod][DEBUG   ][10219] output: read: Inappropriate ioctl for device\r\n\r\nsfdisk: read error on /dev/nbd1 - cannot read sector 0\r\n2016-12-21 08:48:36,978 [salt.loader.salt.int.module.cmdmod][INFO    ][10219] Executing command 'sfdisk -d /dev/nbd0' in directory '/root'\r\n2016-12-21 08:48:36,993 [salt.loader.salt.int.module.cmdmod][DEBUG   ][10219] output: read: Inappropriate ioctl for device\r\n\r\nsfdisk: read error on /dev/nbd0 - cannot read sector 0\r\n2016-12-21 08:48:36,994 [salt.loader.salt.int.module.qemu_nbd][WARNING ][10219] Could not connect image: /srv/salt-images/knode23.localdomain/system.qcow2``\r\n```\r\n### Versions Report\r\n\r\n```Salt Version:\r\n           Salt: 2016.11.1\r\n \r\nDependency Versions:\r\n           cffi: 1.7.0\r\n       cherrypy: 3.2.2\r\n       dateutil: 2.5.3\r\n          gitdb: 0.6.4\r\n      gitpython: 1.0.1\r\n          ioflo: Not Installed\r\n         Jinja2: 2.7.2\r\n        libgit2: Not Installed\r\n        libnacl: Not Installed\r\n       M2Crypto: 0.21.1\r\n           Mako: Not Installed\r\n   msgpack-pure: Not Installed\r\n msgpack-python: 0.4.8\r\n   mysql-python: 1.2.5\r\n      pycparser: 2.14\r\n       pycrypto: 2.6.1\r\n         pygit2: Not Installed\r\n         Python: 2.7.5 (default, Nov  6 2016, 00:28:07)\r\n   python-gnupg: Not Installed\r\n         PyYAML: 3.11\r\n          PyZMQ: 15.3.0\r\n           RAET: Not Installed\r\n          smmap: 0.9.0\r\n        timelib: Not Installed\r\n        Tornado: 4.2.1\r\n            ZMQ: 4.1.4\r\n \r\nSystem Versions:\r\n           dist: centos 7.3.1611 Core\r\n        machine: x86_64\r\n        release: 4.9.0-1.el7.elrepo.x86_64\r\n         system: Linux\r\n        version: CentOS Linux 7.3.1611 Core\r\n```"},"comment":{"url":"https://api.github.com/repos/saltstack/salt/issues/comments/268639297","html_url":"https://github.com/saltstack/salt/issues/38389#issuecomment-268639297","issue_url":"https://api.github.com/repos/saltstack/salt/issues/38389","id":268639297,"user":{"login":"Ch3LL","id":6886822,"avatar_url":"https://avatars.githubusercontent.com/u/6886822?v=3","gravatar_id":"","url":"https://api.github.com/users/Ch3LL","html_url":"https://github.com/Ch3LL","followers_url":"https://api.github.com/users/Ch3LL/followers","following_url":"https://api.github.com/users/Ch3LL/following{/other_user}","gists_url":"https://api.github.com/users/Ch3LL/gists{/gist_id}","starred_url":"https://api.github.com/users/Ch3LL/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ch3LL/subscriptions","organizations_url":"https://api.github.com/users/Ch3LL/orgs","repos_url":"https://api.github.com/users/Ch3LL/repos","events_url":"https://api.github.com/users/Ch3LL/events{/privacy}","received_events_url":"https://api.github.com/users/Ch3LL/received_events","type":"User","site_admin":false},"created_at":"2016-12-21T21:04:53Z","updated_at":"2016-12-21T21:04:53Z","body":"@rtmie if i am interpreting this correctly this seems to be an upstream bug with centos.\r\n\r\nbut to see if there might be a way we can work aroudn this ping @techhat do you have any ideas if we can work around this or the user would just need to work with filing an upstream issue?"}}
{"actor":{"display_login":"Ch3LL"}}