无法使用set-AzureRmVMOSDisk使用Linux时,登录到新创建的虚拟机ARM和附加 [英] Unable to log in to the newly created ARM VM when using Set-AzureRmVMOSDisk with linux and attach

查看:418
本文介绍了无法使用set-AzureRmVMOSDisk使用Linux时,登录到新创建的虚拟机ARM和附加的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想开发我的正常工作ARM VM运行Ubuntu的克隆工作流程。
这是虚拟机在市场Bitnami LAMP的形象创造。

我试图使用-CreateOption的连接的选项,而不是的 fromImage 的,据我所知,这应该工作...我知道,有一个其他选择: deprovision->捕获 - > - CreateOption fromImage,但也有问题,请参见从拍摄的图像创建新的ARM VM:URL中的BLOB名称必须结束根据许多描述与'的.vhd扩展错误工作流程我也跟着,我不明白这一点登录问题,希望我错过了一个简单的步骤...

我和的不同的的源虚拟机ARM尝试这个工作流程两次,得到了同样的结果:新机似乎完全运行,但我无法与已知用户名密码为新的计算机登录(通过SSH)。

诊断:


  • 即使Web服务器和MySQL在新机正常工作,因为新机器启动后,我可以查看其服务的网站。

  • 从下面的脚本我省略的入站规则的配置,但我成功地允许HTTP(见上文)和SSH。该SSH连接要求密码,并评估其为错误的。

这里是我干了什么:


  • 停止了功能齐全的ARM VM(无waagent -deprovision是跑)

  • 复制的操作系统VHD到一个新的.vhd BLOB(成功,复制脚本是出题目)

  • 然后跑下面的脚本的具有完全的成功

 登录-AzureRmAccount
选择-AzureRmSubscription -SubscriptionName的Visual Studio premium与MSDN#从现有的图像创建VM$位置=westeurope
$ vmSize =Standard_DS2#Existing资源名称参数:
$ rgName =RG-WP
$ vnetName =VN-WP
$ stName =mystorage
#这个VHD是一个完全的工作ARM操作系统VHD的副本:
$ vhdUri =htt​​ps://mystorage.blob.core.windows.net/vhds/disk-wp-01.vhd#Newly可创建资源名称和其他参数
$ VMNAME =VM-WP-02
$ NICNAME =NI-WP-02
$ pipName =PIP-WP-02
$ nsgName =NSG-WP-02
$ vhdName =磁盘WP-02$ VNET = GET-AzureRmVirtualNetwork -Name $ vnetName -ResourceGroupName $ rgName
$ storageAccount = GET-AzureRmStorageAccount -AccountName $ stName -ResourceGroupName $ rgName$点子=新AzureRmPublicIpAddress -Name $ pipName -ResourceGroupName $ rgName -Location $位置-AllocationMethod静态-DomainNameLabel $ pipName
$ NSG =新AzureRmNetworkSecurityGroup -Name $ nsgName -ResourceGroupName $ rgName -Location $位置
$网卡=新AzureRmNetworkInterface -Name $ NICNAME -ResourceGroupName $ rgName -Location $位置-SubnetId $ vnet.Subnets [0] .ID -PublicIpAddressId $ pip.Id -NetworkSecurityGroupId $ nsg.Id#配置虚拟机:
$ VM =新AzureRmVMConfig -vmName $ VMNAME -vmSize $ vmSize
$ VM =添加-AzureRmVMNetworkInterface -VM $ VM -Id $ nic.Id
$ VM =设置AzureRmVMOSDisk -VM $ VM -Name $ vhdName -VhdUri $ vhdUri -Linux -CreateOption附加新AzureRmVM -ResourceGroupName $ rgName -Location $位置-VM $ VM


解决方案

我不得不通过这个一看,这似乎是bitnami内的东西是$ P $从登录pventing它。

我没有把大量的时间放在试图找出如何一切连接,但肯定是有code那里时,一个新的虚拟机已经从图像中部署了检查,因为它总是会重新生成的sshd当它这样做的键。

所有预期的文件是相同的(我进行了一个普通的Ubuntu的框和bitnami箱之间的差异)

它产生的误差

  3月8日20时09分19秒灯的sshd [2511]:而pam_unix(sshd的:AUTH):认证失败; LOGNAME = uid = 0的EUID = 0 = TTY SSH R用户= = rhost的用户13.69.83.238的ubuntu =
3月8日20时09分21秒灯的sshd [2511]:从13.69.83.238端口32991 SSH2的Ubuntu失败的密码

然而,/ etc / shadow中有我使用的密码正确盐/哈希值。有人用更多的Linux / bitnami经验也许能找出错误是什么。但在第一电刷,它应该是工作...

这不正是上班纯Ubuntu的图像不如预期,所以它可能是简单从头建立一个新的机器。

否则,你可能会在bitnami论坛更好的答案张贴。 (它很可能只是一个配置设置)

I am trying to develop a clone workflow for my properly working ARM VM running Ubuntu. This VM was created from Bitnami LAMP image in Marketplace.

I am trying to use the -CreateOption attach option instead of fromImage, according my knowledge it should work... I am aware that there is an other option: deprovision->capture->-CreateOption fromImage, but that also have problems see Creating new ARM VM from captured image: Blob name in URL must end with '.vhd' extension error The workflow I followed is according to many description and I do not understand this login issue, hopefully I miss a simple step...

I've tried this workflow twice with different source ARM VMs and got the very same results: The new machine seems fully operational, but I can not log in with the known username password to the new machine (via SSH).

Diagnostics:

  • Even the web server and mysql works in the new machine properly, because after the new machine is started I can view the web sites served by it.
  • From the script below I've omitted the configuration of inbound rules, but I successfully allowed HTTP (see above) and SSH. The SSH connects asking the password and evaluates it as wrong.

Here is what I've done:

  • Stopped the fully functional ARM VM (No waagent -deprovision was ran)
  • Copied the OS vhd to a new .vhd blob (Success, the copy script is out of topic)
  • Then ran the following script with full success:

.

Login-AzureRmAccount
Select-AzureRmSubscription -SubscriptionName "Visual Studio Premium with MSDN"

# Create VM from an existing image

$location = "westeurope"
$vmSize = "Standard_DS2"

#Existing resource name parameters:
$rgName = "rg-wp"
$vnetName= "vn-wp" 
$stName = "mystorage"
#This vhd is a copy of a completely working ARM OS vhd: 
$vhdUri = "https://mystorage.blob.core.windows.net/vhds/disk-wp-01.vhd"

#Newly creatable resource names and other parameters
$vmName = "vm-wp-02"
$nicName="ni-wp-02"
$pipName="pip-wp-02"
$nsgName="nsg-wp-02"
$vhdName = "disk-wp-02"

$vnet = Get-AzureRmVirtualNetwork -Name $vnetName -ResourceGroupName $rgName
$storageAccount = Get-AzureRmStorageAccount -AccountName $stName -ResourceGroupName $rgName 

$pip = New-AzureRmPublicIpAddress -Name $pipName -ResourceGroupName $rgName -Location $location -AllocationMethod Static -DomainNameLabel $pipName 
$nsg = New-AzureRmNetworkSecurityGroup -Name $nsgName -ResourceGroupName $rgName -Location $location
$nic = New-AzureRmNetworkInterface -Name $nicName -ResourceGroupName $rgName -Location $location -SubnetId $vnet.Subnets[0].Id -PublicIpAddressId $pip.Id -NetworkSecurityGroupId $nsg.Id

# Configure VM: 
$vm = New-AzureRmVMConfig -vmName $vmName -vmSize $vmSize
$vm = Add-AzureRmVMNetworkInterface -VM $vm -Id $nic.Id
$vm = Set-AzureRmVMOSDisk -VM $vm -Name $vhdName -VhdUri $vhdUri -Linux -CreateOption attach

New-AzureRmVM -ResourceGroupName $rgName -Location $location -VM $vm

解决方案

I had a look through this, and it seems to be something within bitnami that is preventing it from logging in.

I didn't put a lot of time into trying to work out how everything connects, but there is definitely code there that checks when a new VM has been deployed from the image, as it will always regenerate the sshd keys when it does so.

All of the expected files are identical (I performed a diff between a plain ubuntu box and the bitnami box)

the error it produces is

Mar  8 20:09:19 lamp sshd[2511]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=13.69.83.238  user=ubuntu
Mar  8 20:09:21 lamp sshd[2511]: Failed password for ubuntu from 13.69.83.238 port 32991 ssh2

Yet /etc/shadow has the right salt / hash for the password I'm using. Someone with more Linux / bitnami experience might be able to pinpoint what the error is in that. But at first brush, it should be working...

This does work exactly as expected on a plain ubuntu image, so it might be simpler to build a new machine from scratch.

Otherwise you might get a better answer posting on the bitnami forums. (its very likely just a config setting)

这篇关于无法使用set-AzureRmVMOSDisk使用Linux时,登录到新创建的虚拟机ARM和附加的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆