autopkgtest-virt-ssh(1)
β¨ NAME β¨
autopkgtest-virt-ssh β autopkgtest virtualisation server using SSH. Bestie, this is the manual page for autopkgtest-virt-ssh(1), and it's from the General Commands Manual. π
π SYNOPSIS π
autopkgtest [...] -- ssh [options] [-- setup script options ...]
π DESCRIPTION π
Okay so autopkgtest-virt-ssh provides an autopkgtest virtualisation server using SSH. That's the whole main character energy. β¨
Normally autopkgtest-virt-ssh will be invoked by autopkgtest. It can use an already existing ssh target, or call a setup script to create/set up a test bed and the ssh server. π«Ά
WARNING! autopkgtest-virt-ssh will modify the target system by installing packages and running arbitrary test code, so you are responsible for resetting the testbed yourself especially without a setup script. So use this with care. π No cap, please be careful.
πΈ REQUIREMENTS πΈ
autopkgtest-virt-ssh doesn't assume anything regarding the target host other than that the given ssh connection (and networking) stay available all the time. You can provide credentials on the command line for already working SSH hosts or use a setup script to prepare the host for the connection (see SETUP SCRIPT below for more information), for example to create a forwarding rule to access an adb host over ssh or start a cloud instance. π
π OPTIONS π
-h|--helpβ Show the help message and exit. Simple, iconic. β¨-d|--debugβ Enable debugging output. For when you need the tea. π΅-H hostname | --hostname=hostnameβ Connects and logs into the specified hostname or IP address. π-l user | --login=userβ Specifies the user to log in as on the remote machine. π€-i identity | --identity=identityβ Selects a file from which the identity (private key) for public key authentication is read. Should usually be~/.ssh/id_rsa, but you might consider using a different key for tests. π-P password | --password=passwordβ Specifies the sudo password on the remote host. It can be the password in clear text or a file containing the password. This password will be used to setup$SUDO_ASKPASSin the case sudo requires a password. The runner will check if the user has sudo access with and without a password. If the check fails, the capability"root-on-testbed"will not be available. If sudo works, then tests that run as user will have$SUDO_ASKPASSin their environment so that they can runsudo -Aif needed. π-p port | --port=portβ ssh port to use to connect to the host. πͺ-o options | --options=optionsβ Passed verbatim to ssh; seeman ssh_config. π οΈ-r|--rebootβ Indicate that reboot can be used in the testbed. This is useful when running rebooting tests without a setup script (which can already declare capabilities). π--capabilityCAPABILITYβ Indicate that the testbed has the given capability (seeREADME.virtualisation-server). This option can be specified multiple times.
This is useful when running rebooting tests without a setup script (which can already declare capabilities).
WARNING: Never use this on precious testbeds, as specifying options likerevertorisolation-machinecan irrecoverably destroy the testbed! π
-s setup_script | --setup-script=setup_scriptβ Setup script to prepare testbed and ssh connection (See SETUP SCRIPT below for more information). File names will be searched in both the current directory and in/usr/share/autopkgtest/ssh-setup/so you do not need to give the full path for setup scripts shipped with autopkgtest. π--timeout-ssh=secsβ Timeout for waiting for ssh connection, in seconds. Default is300. β³-- [setup script arguments]β All the remaining arguments following--will be passed verbatim to the setup script to configure the host. π«‘
π CONFIGURATION FILES π
If you use lots of options or hosts, you can put parts of, or the whole command line into a text file, with one line per option. E. g. you can create a file testhost.cfg with contents like
-Htest.example.com
-ltestuser
-Ps3kr1t
and then run
autopkgtest [...] -- ssh @testhost.cfg
The contents of the configuration file will be expanded in-place as if you would have given its contents on the command line. Please ensure that you don't place spaces between short options and their values, they would become a part of the argument value. π«
π₯ INPUT, OUTPUT AND EXIT STATUS π€
The behaviour of autopkgtest-virt-ssh is as described by the AutomatedTesting virtualisation regime specification. That's it, bestie. β¨
π¨ SECURITY WARNING - USE OF ROOT π¨
If autopkgtest-virt-ssh is used in a way that means it has root access on the testbed, the testbed environment must be an isolated one which does not ever run any untrusted code, or is itself not trusted by anything. π
This promise is implied by user-switching capabilities that autopkgtest-virt-ssh may advertise, depending in a complex way on the provided configuration and command line options. π€―
If autopkgtest-virt-ssh only has access to a single user on the remote host, this problem does not arise. π
π NOTES π
autopkgtest does not run apt-get update at the start of a package build, which can cause a build failure if you are using a development series template. You will need to run apt-get update in the template yourself (e. g. using --setup-commands). π¬
π οΈ SETUP SCRIPT π οΈ
autopkgtest-virt-ssh accepts a setup script in argument to prepare the testbed and the ssh connection. A setup script is an executable that gets called with a command as first argument, and additional options for that command. π«Ά
command: open
When called with "open", the script has to create a testbed (if necessary), configure ssh, copy ssh key into it, configure sudo, etc. π§
It then returns the following information on standard output with the form key=value, one line per pair. These mostly mirror the command line options when not using a script. π
Required fields:
login: User name. π€hostname: hostname or IP address. π
Optional fields:
identity: Path to the private key. πpassword: sudo password for the user name to acquire root privileges. If not given, and passwordless sudo does not work, the testbed will not have root privileges. πport: SSH port onhostname, if different than22. πͺcapabilities: extra testbed capabilities such as"isolation-machine"or"revert", seeREADME.virtualisation-server.rst. If the testbed can be rebooted with keeping state, the script should advertise"reboot". β¨options: passed verbatim to ssh, seeman ssh_config. π οΈextraopts: passed verbatim to other commands; this allows extra state (such as temporary directory names, VM identifiers, etc.) to be passed tocleanup. π¦
command: cleanup
Called when closing the testbed; should revert/remove things installed in open as much as possible if the testbed is not ephemeral. This gets called with all the options that open got called with, plus extraopts. π§Ή
command: revert
If there is a way to reset the testbed to its pristine state (such as using VM snapshots or rebuilding ephemeral testbeds), the script should put "revert" (and if appropriate, "revert-full-system") into the capabilities and implement this command. This can optionally output some or all of the ssh config keys from open() to update the configuration, in case the hostname/IP changes. π
command: wait-reboot
When the testbed is to be rebooted, the virtualisation server waits for the boot_id reported by the kernel to change to consider the reboot successful. If something more elaborate needs to be done after calling "reboot" and before polling the testbed for the boot_id change, that can be implemented in the wait-reboot command. This is only relevant for testbeds advertising the "reboot" capability. β³
command: debug-failure
This is called when the setup script fails with nonzero or on timeouts waiting for ssh or reboot. If available, this should output some debugging information, such as the boot log from the serial console. Implementing this is optional. π
Included scripts
autopkgtest provides setup scripts for common types of testbeds in /usr/share/autopkgtest/ssh-setup/. Please see the comments in these scripts for how to use them. Also, please consider using /usr/share/autopkgtest/ssh-setup/SKELETON as a basis for writing your own. π§
π EXAMPLES π
Run the tests of the gdk-pixbuf source package on an existing "mytesthost":
autopkgtest gdk-pixbuf -- ssh -H mytesthost -l joe -P /tmp/joe_password
π SEE ALSO π
autopkgtest(1)/usr/share/doc/autopkgtest//usr/share/autopkgtest/ssh-setup/SKELETON
π AUTHORS AND COPYRIGHT π
autopkgtest-virt-ssh was written by Martin Pitt <martin.pitt@ubuntu.com> and Jean-Baptiste Lallement <jean.baptiste.lallement@ubuntu.com>. π
This manpage is part of autopkgtest, a tool for testing Debian binary packages. autopkgtest is Copyright (C) 2006-2014 Canonical Ltd and others. π
See /usr/share/doc/autopkgtest/CREDITS for the list of contributors and full copying conditions. π
And that's the whole page, bestie. It lives in the Linux Programmer's Manual, 2014, as autopkgtest-virt-ssh(1). Stay slay, and don't forget to reset your testbed! π β¨
π¦ where this page comes from
- ubuntu noble: autopkgtest 5.55~24.04.1 Β· GPL-2.0-or-later
- ubuntu resolute: autopkgtest 5.55 Β· GPL-2.0-or-later
- ubuntu stonking: autopkgtest 6.0 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms