Connecting with ssh to virtualbox (headless)?
It may very well be that the server is having trouble starting up, or some other random error may be occurring.
Fortunately, when you launch a headless server using VirtualBox without specifying the --vrde
flag, it will automatically enable RDP (Remote Desktop Protocol) on the VM. Try connecting to your server using RDP--because VirtualBox guarantees it to be running, and doesn't depend on the guest OS, you can rule out rather its an issue with the IP, the VM, or your connection to the server itself.
The official VirtualBox documentation has more info on what kind of RDP clients are available for your system (I recommend rdesktop
), and how to work with your headless system.
Best of luck, and although this isn't technically an answer, it will allow you to do some real debugging! :)
Knargle
Updated on September 17, 2022Comments
-
Knargle over 1 year
I'm trying to work through the "Start Another Activity" tutorial but, having worked through the whole thing (twice), the app still refuses to return the text entered in the textbox - it always returns "Hello World".
I've tried to figure it out, and suspect it might be something to do with the
fragment_display_message.xml
, in which there is anEditText
calling the Hello World string. But really I have no idea.Any help would be appreciated. Here's the code:
MainActivity.java
package com.knargle.streetiteatit; import android.content.Intent; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v7.app.ActionBarActivity; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.EditText; public class MainActivity extends ActionBarActivity { public final static String EXTRA_MESSAGE = "com.knargle.streetiteatit.MESSAGE"; /** Called when the user clicks the Send button */ public void sendMessage(View view) { // Do something in response to button Intent intent = new Intent(this, DisplayMessageActivity.class); EditText editText = (EditText) findViewById(R.id.edit_message); String message = editText.getText().toString(); intent.putExtra(EXTRA_MESSAGE, message); startActivity(intent); } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction() .add(R.id.container, new PlaceholderFragment()).commit(); } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } /** * A placeholder fragment containing a simple view. */ public static class PlaceholderFragment extends Fragment { public PlaceholderFragment() { } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_main, container, false); return rootView; } } }
fragment_main.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context="com.knargle.streetiteatit.MainActivity$PlaceholderFragment" > <EditText android:id="@+id/edit_message" android:layout_weight="1" android:layout_width="0dp" android:layout_height="wrap_content" android:hint="@string/edit_message" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/button_send" android:onClick="sendMessage" /> </LinearLayout>
DisplayMessageActivity.java
package com.knargle.streetiteatit; import android.content.Intent; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v7.app.ActionBarActivity; import android.view.LayoutInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; public class DisplayMessageActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Get the message from the intent Intent intent = getIntent(); String message = intent.getStringExtra(MainActivity.EXTRA_MESSAGE); // Create the text view TextView textView = new TextView(this); textView.setTextSize(40); textView.setText(message); // Set the text view as the activity layout setContentView(textView); setContentView(R.layout.activity_display_message); if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction() .add(R.id.container, new PlaceholderFragment()).commit(); } } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } /** * A placeholder fragment containing a simple view. */ public static class PlaceholderFragment extends Fragment { public PlaceholderFragment() { } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_display_message, container, false); return rootView; } } }
fragment_display_message.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context="com.knargle.streetiteatit.DisplayMessageActivity$PlaceholderFragment" > <EditText android:id="@+id/edit_message" android:layout_width="wrap_content" android:layout_height="wrap_content" android:hint="@string/hello_world" /> </RelativeLayout>
-
user9517 about 13 yearsWas ssh working to it before you started it headless ?
-
user9517 about 13 yearsand what is your host operating system ?
-
CamTheArtist about 13 years@Iain: Host OP is Ubuntu 10.10 desktop, SSH works like a charm when running the normal way
-
CamTheArtist about 13 yearsUPDATE: Running
nohup VBoxHeadless -s "Ubuntu server"&
from a terminal works well, but not in my bash script...
-
-
CamTheArtist about 13 yearsThanks for great tips @redmumba. I did some research and found out that my syntax didn't work for some reason. Calling
nohup VBoxManage startvm "Ubuntu server" --type headless&
from the bash file made my Vbox start and run perfectly!