Create a VM with CLI

S L 1 Reputation point
2020-08-04T21:20:00.233+00:00

I am trying to follow a module on using the CLI to create a VM with Bash. But when I enter az group create --name myRGCLI --location EastUS, the CLI gives me a bunch of errors such as The command failed with an unexpected error. Here is the traceback:
[Errno 30] Read-only file system: 15631-capture.jpg

not sure why this is not letting me through this little exercise. Help?

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,201 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Ronen Ariely 15,096 Reputation points
    2020-08-09T22:44:57.17+00:00

    Good day @S L

    I am trying to follow a module on using the CLI to create a VM with Bash.

    The issue is not with your command to create the VM but before it. Check your image. You can clearly see that you got an error before you even execute your first command:

    bash: history: /home/seeven/.bash_history: cannot create Read-only file system

    It probably make no sense to keep working before you fix this issue.

    It seems like the issue related to the .bash_history file. This file is created for you automatically. In fact, this is not related to the Azure only, and each Linux user has his personal command line history stored within the home directory as ~/.bash_history.

    You can execute the following command in order to see it:

    ls -a  
    

    16577-image.png

    ----------

    I cannot advice you directly what to do in production environment and anything you do is on your own responsibility, but I assume that one of these options might solve your issue (can't be sure without testing your specific case).

    (1) By default, the session history is appended to the history file each time you end the session. If there is an issue with the file then it will probably continue next time you connect. You can change this behavior using the command "shopt -u histappend". Once you execute this, instead of appending the new session commands replace the existing content which might solve your issue the next time you open the Azure Portal shell.

    You can use the command "shopt histappend" in order to find the setting of the history content (ON = appending, OFF = overwrite the history file)

    Note! You can use the command "history" in order to read the content of the file. It will show you all your history commands.

    (2) You can use the command "history -c" following the command "history -w" in order to clear the current session history. close all windows after this ans wait about 20 minutes before try to connect again

    (3) You can use the command "vi .bash_history" from the shell (click "i" to get insert mode -> clear the content of the file -> use ":w" to save the file -> ":q" ti go out the vi app). This option worked for me by the way in the past.

    (4) As I mentioned each Linux user has his personal command line history stored within the home directory as ~/.bash_history or better use the full path : /home/<user name>/.bash_history

    In your case the user name is "steven" and the path to the file is /home/steven/.bash_history

    You can use a different user which will use a different file which will probably work well

    (5) You can delete the resource group which is related to the Azure shell. The name of the resource group can be something like "cloud-shell-storage-northeurope" for example. This should clean everything and next time that you will use the Azure Shell in the portal the you will get a message like bellow:

    16578-image.png

    Click on "create storage" and it will be re-created for you. You are now use a clean service.

    (6) If non helped then you will need someone with permission to check your specific case, which mean you need to open a support ticket from your account

    0 comments No comments