{"action":"created","issue":{"url":"https://api.github.com/repos/rancher/os/issues/135","labels_url":"https://api.github.com/repos/rancher/os/issues/135/labels{/name}","comments_url":"https://api.github.com/repos/rancher/os/issues/135/comments","events_url":"https://api.github.com/repos/rancher/os/issues/135/events","html_url":"https://github.com/rancher/os/issues/135","id":66940406,"number":135,"title":"rancheros-install -f does not partition or re-read table correctly","user":{"login":"huslage","id":413867,"avatar_url":"https://avatars.githubusercontent.com/u/413867?v=3","gravatar_id":"","url":"https://api.github.com/users/huslage","html_url":"https://github.com/huslage","followers_url":"https://api.github.com/users/huslage/followers","following_url":"https://api.github.com/users/huslage/following{/other_user}","gists_url":"https://api.github.com/users/huslage/gists{/gist_id}","starred_url":"https://api.github.com/users/huslage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/huslage/subscriptions","organizations_url":"https://api.github.com/users/huslage/orgs","repos_url":"https://api.github.com/users/huslage/repos","events_url":"https://api.github.com/users/huslage/events{/privacy}","received_events_url":"https://api.github.com/users/huslage/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":20,"created_at":"2015-04-07T17:12:22Z","updated_at":"2015-08-22T15:35:07Z","closed_at":"2015-04-30T21:26:23Z","body":"```\r\n[rancher@rancher ~]$ sudo rancheros-install -c cloud-init -f -v v0.2.1 -d /dev/sda -t generic   \r\nAll data will be wiped from this device\r\nPartition: true\r\nDEVICE: /dev/sda1\r\nAre you sure you want to continue? [yN]y+ DEVICE=/dev/sda1\r\n+ [[ -z /dev/sda1 ]]\r\n++ wc -l\r\n+++ cut -d / -f3\r\n+++ echo /dev/sda1\r\n++ grep sda1 /proc/partitions\r\n+ PARTITION_COUNT=1\r\n+ '[' 1 -gt 1 ']'\r\n+ fdisk /dev/sda1\r\n\r\nWelcome to fdisk (util-linux 2.25.2).\r\nChanges will remain in memory only, until you decide to write them.\r\nBe careful before using the write command.\r\n\r\n\r\nCommand (m for help): Partition type\r\n   p   primary (1 primary, 0 extended, 3 free)\r\n   e   extended (container for logical partitions)\r\nSelect (default p): Partition number (2-4, default 2): Value out of range.\r\nPartition number (2-4, default 2): \r\nNo free sectors available.\r\n\r\nCommand (m for help): \r\n\r\nCommand (m for help): \r\nThe partition table has been altered.\r\nCalling ioctl() to re-read partition table.\r\nRe-reading the partition table failed.: Invalid argument\r\n\r\nThe kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8).\r\n```\r\nThe script stops after this. Re-running `rancheros-install` with `/dev/sda1` gives us:\r\n\r\n```\r\n[root@rancher rancher]# rancheros-install -c cloud-init -v v0.2.1 -d /dev/sda1 -t generic\r\nAll data will be wiped from this device\r\nPartition: true\r\nDEVICE: /dev/sda1\r\nAre you sure you want to continue? [yN]y\r\n\r\n+ DEVICE=/dev/sda1\r\n+ [[ -z /dev/sda1 ]]\r\n++ wc -l\r\n+++ echo /dev/sda1\r\n+++ cut -d / -f3\r\n++ grep sda1 /proc/partitions\r\n+ PARTITION_COUNT=1\r\n+ '[' 1 -gt 1 ']'\r\n+ fdisk /dev/sda1\r\n\r\nWelcome to fdisk (util-linux 2.25.2).\r\nChanges will remain in memory only, until you decide to write them.\r\nBe careful before using the write command.\r\n\r\nCommand (m for help): Partition type\r\n   p   primary (1 primary, 0 extended, 3 free)\r\n   e   extended (container for logical partitions)\r\nSelect (default p): Partition number (2-4, default 2): Value out of range.\r\nPartition number (2-4, default 2): \r\nNo free sectors available.\r\n\r\nCommand (m for help): \r\n\r\nCommand (m for help): \r\nThe partition table has been altered.\r\nCalling ioctl() to re-read partition table.\r\nRe-reading the partition table failed.: Invalid argument\r\n\r\nThe kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8).\r\n```\r\n`fdisk` shows a partition:\r\n```\r\nDisk /dev/sda: 17.1 GB, 17179869184 bytes\r\n171 heads, 2 sectors/track, 98112 cylinders\r\nUnits = cylinders of 342 * 512 = 175104 bytes\r\n\r\n   Device Boot      Start         End      Blocks  Id System\r\n/dev/sda1               6       98113    16776192  83 Linux\r\n```\r\n\r\n`cloud-init` is simply my ssh keys."},"comment":{"url":"https://api.github.com/repos/rancher/os/issues/comments/133715751","html_url":"https://github.com/rancher/os/issues/135#issuecomment-133715751","issue_url":"https://api.github.com/repos/rancher/os/issues/135","id":133715751,"user":{"login":"daankets","id":2279985,"avatar_url":"https://avatars.githubusercontent.com/u/2279985?v=3","gravatar_id":"","url":"https://api.github.com/users/daankets","html_url":"https://github.com/daankets","followers_url":"https://api.github.com/users/daankets/followers","following_url":"https://api.github.com/users/daankets/following{/other_user}","gists_url":"https://api.github.com/users/daankets/gists{/gist_id}","starred_url":"https://api.github.com/users/daankets/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/daankets/subscriptions","organizations_url":"https://api.github.com/users/daankets/orgs","repos_url":"https://api.github.com/users/daankets/repos","events_url":"https://api.github.com/users/daankets/events{/privacy}","received_events_url":"https://api.github.com/users/daankets/received_events","type":"User","site_admin":false},"created_at":"2015-08-22T15:35:06Z","updated_at":"2015-08-22T15:35:06Z","body":"Still seeing this issue with 0.3.3. Using the rancher.iso on proxmox (KVM) with a virtio disk:\r\n*Cloud config:*\r\n```yaml\r\n#cloud-config\r\nhostname: dummy\r\nssh_authorized_keys:\r\n  - ssh-rsa AAAA... daankets@blackbit.be\r\nrancher:\r\n  network:\r\n    interfaces:\r\n      eth*:\r\n        dhcp: false\r\n      eth0:\r\n        address: 192.168.0.100/24\r\n        gateway: 192.168.0.1\r\n        mtu: 1500\r\n    dns:\r\n      nameservers:\r\n        - 8.8.8.8\r\n        - 8.8.4.4\r\n```\r\n*Command line:*\r\n```bash\r\nsudo rancheros-install -c cloudconfig.yml -d /dev/vda\r\n```\r\n*Output:*\r\n```bash\r\nNo install type specified...defaulting to generic\r\nDevice /dev/vda already partitioned!\r\nChecking to see if it is mounted\r\n+ DEVICE=/dev/vda\r\n+ [[ -z /dev/vda ]]\r\n++ wc -l\r\n+++ echo /dev/vda\r\n+++ cut -d / -f3\r\n++ grep vda /proc/partitions\r\n+ PARTITION_COUNT=2\r\n+ '[' 2 -gt 1 ']'\r\n+ echo 'Device /dev/vda already partitioned!'\r\n+ echo 'Checking to see if it is mounted'\r\n+ grep -q /dev/vda /proc/mounts\r\n++ system-docker ps -q\r\n+ for container in '$(system-docker ps -q)'\r\n+ system-docker exec ca40f1e71368 grep -q /dev/vda /proc/mounts\r\n+ for container in '$(system-docker ps -q)'\r\n+ system-docker exec eaa8d2dd6f0f grep -q /dev/vda /proc/mounts\r\n+ for container in '$(system-docker ps -q)'\r\n+ system-docker exec 16b33b477969 grep -q /dev/vda /proc/mounts\r\n+ for container in '$(system-docker ps -q)'\r\n+ system-docker exec e8bf3f735cb5 grep -q /dev/vda /proc/mounts\r\n+ for container in '$(system-docker ps -q)'\r\n+ system-docker exec 8700905d4492 grep -q /dev/vda /proc/mounts\r\n+ for container in '$(system-docker ps -q)'\r\n+ system-docker exec 0bb39604735f grep -q /dev/vda /proc/mounts\r\n+ for container in '$(system-docker ps -q)'\r\n+ system-docker exec 8f5a80a87136 grep -q /dev/vda /proc/mounts\r\n+ dd if=/dev/zero of=/dev/vda bs=512 count=1\r\n1+0 records in\r\n1+0 records out\r\n512 bytes (512 B) copied, 0.000809998 s, 632 kB/s\r\n+ partprobe /dev/vda\r\n+ fdisk /dev/vda\r\n/dev/vda: device contains a valid 'ext4' signature, it's strongly recommended to wipe the device by command wipefs(8) if this setup is unexpected to avoid possible collisions.\r\n\r\nWelcome to fdisk (util-linux 2.25.2).\r\nChanges will remain in memory only, until you decide to write them.\r\nBe careful before using the write command.\r\n\r\n\r\nDevice does not contain a recognized partition table.\r\nCreated a new DOS disklabel with disk identifier 0x6de42287.\r\n\r\nCommand (m for help): Partition type\r\n   p   primary (0 primary, 0 extended, 4 free)\r\n   e   extended (container for logical partitions)\r\nSelect (default p): Partition number (1-4, default 1): First sector (2048-33554431, default 2048): Last sector, +sectors or +size{K,M,G,T,P} (2048-33554431, default 33554431): \r\nCreated a new partition 1 of type 'Linux' and of size 16 GiB.\r\n\r\nCommand (m for help): The partition table has been altered.\r\nCalling ioctl() to re-read partition table.\r\nSyncing disks.\r\n\r\nudev\r\n+ getopts i:f:c:d:t:r:o:p: OPTION\r\n+ case $OPTION in\r\n+ DEVICE=/dev/vda\r\n+ getopts i:f:c:d:t:r:o:p: OPTION\r\n+ case $OPTION in\r\n+ ENV=generic\r\n+ getopts i:f:c:d:t:r:o:p: OPTION\r\n+ case $OPTION in\r\n+ CLOUD_CONFIG=/opt/user_config.yml\r\n+ getopts i:f:c:d:t:r:o:p: OPTION\r\n+ DIST=/dist\r\n+ BASE_DIR=/mnt/new_img\r\n+ PARTITION=/dev/vda1\r\n+ KERNEL_ARGS=\r\n+ '[' -n generic ']'\r\n+ case ${ENV} in\r\n+ format_and_mount\r\n+ format_device\r\n+ device_defined /dev/vda\r\n+ [[ -z /dev/vda ]]\r\n+ mkfs.ext4 -F -i 4096 -L RANCHER_STATE /dev/vda1\r\nmke2fs 1.42.12 (29-Aug-2014)\r\nCreating filesystem with 4194048 4k blocks and 4194304 inodes\r\nFilesystem UUID: 8b9d6bca-4b9b-4fe0-9191-68d4899720f0\r\nSuperblock backups stored on blocks: \r\n\t32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, \r\n\t4096000\r\n\r\nAllocating group tables: done                            \r\nWriting inode tables: done                            \r\nCreating journal (32768 blocks): done\r\nWriting superblocks and filesystem accounting information: done   \r\n\r\n+ mount_device\r\n+ local label=RANCHER_STATE\r\n+ local raw=false\r\n+ mkdir -p /mnt/new_img\r\n++ lsblk -o name\r\n++ grep RANCHER_BOOT\r\n++ wc -l\r\n+ '[' 0 -eq 1 ']'\r\n+ local 'mount_opts=-L RANCHER_STATE'\r\n+ '[' false == true ']'\r\n+ mount -L RANCHER_STATE /mnt/new_img\r\n+ trap 'umount /mnt/new_img' EXIT\r\n+ create_boot_dirs\r\n+ mkdir -p /mnt/new_img/boot/grub\r\n+ install_grub\r\n+ grub-install --boot-directory=/mnt/new_img/boot /dev/vda\r\nInstalling for i386-pc platform.\r\ngrub-install: warning: Attempting to install GRUB to a disk with multiple partition labels.  This is not supported yet..\r\ngrub-install: warning: Embedding is not possible.  GRUB can only be installed in this setup by using blocklists.  However, blocklists are UNRELIABLE and their use is discouraged..\r\ngrub-install: error: will not proceed with blocklists.\r\n+ umount /mnt/new_img\r\n```\r\n*Partition labels:*\r\n```bash\r\nls -l /dev/disk/by-label\r\ntotal 0\r\nlrwxrwxrwx    1 root     root            10 Aug 22 15:30 RANCHER_STATE -> ../../vda1\r\nlrwxrwxrwx    1 root     root             9 Aug 22 15:05 RancherOS -> ../../sr0\r\n```\r\n\r\n\r\n"}}