https://wiki.archlinux.org/api.php?action=feedcontributions&user=Txmoose&feedformat=atomArchWiki - User contributions [en]2024-03-19T10:26:42ZUser contributionsMediaWiki 1.41.0https://wiki.archlinux.org/index.php?title=Arch_Linux_on_a_VPS&diff=257018Arch Linux on a VPS2013-05-14T00:43:22Z<p>Txmoose: /* Providers that offer Arch Linux */</p>
<hr />
<div>[[Category:Getting and installing Arch]]<br />
[[Category:Virtualization]]<br />
{{Article summary start}}<br />
{{Article summary text|This article discusses the use of Arch Linux on Virtual Private Servers, and includes some fixes and installation instructions specific to VPSes.}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|Comprehensive Server Guide}}<br />
{{Article summary end}}<br />
From [[Wikipedia:Virtual private server]]:<br />
<br />
:''Virtual private server (VPS) is a term used by Internet hosting services to refer to a virtual machine. The term is used for emphasizing that the virtual machine, although running in software on the same physical computer as other customers' virtual machines, is in many respects functionally equivalent to a separate physical computer, is dedicated to the individual customer's needs, has the privacy of a separate physical computer, and can be configured to run server software.''<br />
<br />
==Providers that offer Arch Linux==<br />
<br />
{{Warning|We cannot vouch for the honesty or quality of any provider. Please conduct due diligence before ordering.}}<br />
{{Note|This list is for providers with a convenient Arch Linux image. Using Arch on other providers is probably possible, but would require loading custom ISOs or disk images or [[Installation Chroot|installing under chroot]].}}<br />
<br />
{| border="1"<br />
! Provider !! Arch Release !! Virtualization !! Locations !! Notes<br />
|-<br />
| [http://123systems.net 123 Systems] || 2010.05 i686/x86_64 || OpenVZ || Dallas, TX || Arch available as a selection upon reinstall. Very old (2.6.18-308) kernel - See [[Virtual_Private_Server#OpenVZ:_kernel_too_old_for_glibc|OpenVZ troubleshooting]].<br />
|-<br />
| [http://afterburst.com/ Afterburst] || 2012.12.01 i686/x86_64 || OpenVZ || Miami (USA), Falkenstein (Germany) || Formerly FanaticalVPS, kernel version depends on what node your VPS is on, the ones in Miami are fine (2.6.32-042stab072.10) but some of the ones in Germany require a [[Virtual_Private_Server#OpenVZ:_kernel_too_old_for_glibc|custom glibc]].<br />
|-<br />
| [http://alienvps.com/ AlienVPS] || 2010.05 || Xen, KVM || Los Angeles, New York ||<br />
|-<br />
| [https://www.clodo.ru/ Clodo.ru] || 2011.?? || Xen || Moscow || Can pay per hour. Lists an invalid release version of the installer.<br />
|-<br />
| [http://en.edis.at/ Edis] || 2011.08 i686/x86_64 || vServer, KVM || Austria, Chile, Germany, France, Hong Kong, Italy, Iceland, Poland, Sweden, Switzerland, Spain, UK, USA ||<br />
|-<br />
| [http://eoreality.net/ EOReality] || (?) i686/x86_64 || OpenVZ || Chicago || Need to use special glibc-vps repo for this provider . See [[Virtual_Private_Server#OpenVZ:_kernel_too_old_for_glibc|OpenVZ troubleshooting]] for instructions. You will also need to remove heimdal.<br />
|-<br />
| [https://www.directvps.nl/ DirectVPS] || 2012.09 x86_64 || Xen || Amsterdam, Rotterdam || <br />
|-<br />
| [http://generation-host.com Generation-Host] || 2012.07 || Xen || Chicago IL, Clifton NJ and Toronto ON Canada ||<br />
|-<br />
| [https://www.gigatux.com/virtual.php GigaTux] || 2011.08 x86_64 || Xen || Chicago, Frankfurt, Israel, London, San Jose ||<br />
|-<br />
| [http://www.vr.org/ Host Virtual] || 2011.08 || Xen || Amsterdam, Chennai (Madras), Chicago, Dallas, Hong Kong, London, Los Angeles, New York, Paris, Reston, San Jose ||<br />
|-<br />
| [https://hostigation.com/ Hostigation] || 2010.05 i686 || OpenVZ, KVM || Charlotte, Los Angeles || You can [[Migrating Between Architectures Without Reinstalling|migrate to x86_64]].<br />
|-<br />
| [http://www.intovps.com IntoVPS] || 2012.05 i686/x86_64 || OpenVZ || Amsterdam, Bucharest, Dallas, Fremont, London ||<br />
|-<br />
| [https://www.linode.com Linode.com] || 2012.07 || Xen || Atlanta, Dallas, Fremont, London, Newark, Tokyo || Uses a custom kernel; do not install the {{pkg|linux}} package.<br />
|-<br />
| [http://lylix.net/home Lylix] || 2007.08 || ? || ? ||<br />
|-<br />
| [http://www.nodedeploy.com Node Deploy] || ? || OpenVZ, KVM || LA, Germany || unmanaged, solusvm server manager<br />
|-<br />
| [http://netcup.de Netcup] || 2011.10 x86_64/2012.11 x86_64 || vServer, KVM || Germany || <br />
|-<br />
| [http://onepoundwebhosting.co.uk OnePoundWebHosting] || 2012.09 x86_64 || Xen || UK ||<br />
|-<br />
| [http://openvz.ca/ OpenVZ.ca] || 2010.05 i686/x86_64 || OpenVZ || Canada ||<br />
|-<br />
| [https://www.proplay.biz/ proPlay.de] || 2011.10 i686/x86_64 || OpenVZ, KVM || Germany ||<br />
|-<br />
| [http://www.rackspace.com/cloud/cloud_hosting_products/servers/ Rackspace Cloud] || 2013.2 || Xen || Chicago, Dallas, London || Billed per hour.<br />
|-<br />
| [http://www.ramhost.us RamHost.us] || 2012.12 || OpenVZ, KVM || Atlanta, England, Germany, Los Angeles || You can request a newer iso on IRC. ||<br />
|-<br />
| [http://www.tilaa.nl/ Tilaa] || 2012.12 i686/x86_64 || KVM || Amsterdam ||<br />
|-<br />
| [https://www.transip.nl/ TransIP] || 2013.01.04 || KVM || Amsterdam ||<br />
|-<br />
| [http://www.xenvz.co.uk/ XenVZ] || 2009.12 x86_64 || OpenVZ, Xen || UK? ||<br />
|-<br />
| [http://www.virpus.com/ Virpus] || 2010.05 x86_64 || OpenVZ, Xen || Kansas City ||<br />
|-<br />
| [http://www.vmline.pl/ Vmline] || 2012.08.04-dual.iso || Xen-HVM || Poland - Kraków || [http://www.s-net.pl/en/ S-Net] reseller. It's probably imposible to install i686 due to lack of xen_netfront and xen_blkfront modules ||<br />
|-<br />
| [https://vps6.net/ VPS6.NET] || 2010.05 i686/x86_64 OpenVZ, 2012.01 x86_64 Xen || OpenVZ, Xen || Germany, Romania, Turkey, USA ||<br />
|-<br />
| [http://www.uk2.net/ UK2.net] || 2010.05 i686/x86_64 || Xen || United Kingdom || Appears to use a custom kernel; do not install the {{pkg|linux}} package.<br />
|}<br />
<br />
==Installation==<br />
<br />
===KVM===<br />
{{Expansion|Are there instructions specific to VPSes?}}<br />
See [[KVM#Preparing an (Arch) Linux guest]].<br />
<br />
===OpenVZ===<br />
<br />
====Getting a 2010.05 Image Up To Date====<br />
<br />
These instructions you have a 2010.05 image from your VPS provider and you'd like to get it up to scratch. The biggest work involves preparing /lib for the symlink upgrade (glibc 2.16, and later filesystem 2013.01).<br />
<br />
{{Warning|If you are on a older kernel than 2.6.32, please refer [[Virtual_Private_Server#OpenVZ:_kernel_too_old_for_glibc|further down the page]] to get the glibc-vps repo working (just add the repo and you can follow these steps).}}<br />
<br />
To start, grab the latest busybox from http://busybox.net/downloads/binaries/latest/. This allows you to force glibc (losing /lib temporarily) without losing your OS (busybox comes with its own GNU tools which are statically linked).<br />
<br />
{{bc|wget http://busybox.net/downloads/binaries/latest/busybox-i686<br />
chmod +x busybox-i686}}<br />
<br />
First off you can get a list of packages that own files in /lib with the following command:<br />
{{bc|<nowiki><br />
pacman -Qo /lib/* | cut -d' ' -f 5 | egrep -v 'glibc' | uniq | xargs<br />
</nowiki>}}<br />
<br />
For the current 2010.05 that comes straight off of ibiru's page, these are the packages that were required to be removed for me:<br />
<br />
{{bc|pacman -S acl attr util-linux-ng bzip2 libcap e2fsprogs libgcrypt libgpg-error udev readline ncurses pam pcre popt procps readline shadow e2fsprogs sysfsutils udev util-linux-ng sysvinit coreutils}}<br />
<br />
You may have to remove /lib/udev/devices/loop0 (a simple rm works).<br />
<br />
After the upgrade finishes, you must remove any extra empty directories in /lib (/lib/modules is the common offender):<br />
{{bc|rm -rf /lib/modules}}<br />
<br />
Install tzdata to fix some dependencies and remove /etc/profile.d/locale.sh:<br />
{{bc|pacman -S tzdata<br />
rm /etc/profile.d/locale.sh}}<br />
<br />
Remove /var/run (you should have nothing running that matters):<br />
{{bc|rm -rf /var/run}}<br />
<br />
Force glibc (this will pull in the latest filesystem, but BREAK everything (other than busybox)):<br />
{{bc|pacman -S --force glibc}}<br />
<br />
Now you will have a broken system, so first thing symlink /usr/lib to /lib with busybox's ln:<br />
{{bc|./busybox-i686 ln -s /usr/lib /lib}}<br />
<br />
And you should have a fully functional system where you can now update pacman.<br />
<br />
{{bc|pacman -S pacman; pacman-key --init; pacman-key --populate archlinux; pacman-db-upgrade; pacman -Syy}}<br />
<br />
Now, update initscripts to get iproute2:<br />
<br />
{{bc|pacman -S iniscripts}}<br />
<br />
Install makedev:<br />
{{bc|pacman -S makedev}}<br />
<br />
Add the following to your /etc/rc.local:<br />
{{bc|/usr/sbin/MAKEDEV tty<br />
/usr/sbin/MAKEDEV pty}}<br />
<br />
Comment the following lines in /etc/inittab:<br />
{{bc|#c1:2345:respawn:/sbin/agetty -8 -s 38400 tty1 linux<br />
#c2:2345:respawn:/sbin/agetty -8 -s 38400 tty2 linux<br />
#c3:2345:respawn:/sbin/agetty -8 -s 38400 tty3 linux<br />
#c4:2345:respawn:/sbin/agetty -8 -s 38400 tty4 linux<br />
#c5:2345:respawn:/sbin/agetty -8 -s 38400 tty5 linux<br />
#c6:2345:respawn:/sbin/agetty -8 -s 38400 tty6 linux}}<br />
<br />
Finally, you should be able to upgrade the whole system:<br />
<br />
{{bc|pacman -Su}}<br />
<br />
You may run into some issues with krb5 and heimdal, as krb5 no longer provides+conflicts+replaces heimdal (https://projects.archlinux.org/svntogit/packages.git/commit/trunk/PKGBUILD?h=packages/krb5&id=f5e6d77fd14ced15ebf5b6a78a7c76e0db0625f7). The old openssh depends on heimdal (and the new openssh depends on krb5), so force install krb5, then upgrade openssh, then remove heimdal and reinstall krb5.<br />
<br />
{{bc|pacman -S --force krb5<br />
pacman -S openssh openssl<br />
pacman -R heimdal<br />
pacman -S krb5}}<br />
<br />
Fix syslog-ng (set the src to unix-dgram("/dev/log") and add --no-caps to both check and run args in /etc/conf.d/syslog-ng).<br />
<br />
Make sure your rc.conf isn't messed up with broken network definitions, or else be sure serial access works on your VPS before you reboot.<br />
<br />
<br />
====Moving your VPS from network configuration in rc.conf to netcfg (tested with OpenVZ)====<br />
<br />
1) Install netcfg<br />
<br />
{{bc|pacman -S netcfg}}<br />
<br />
2) Create a netcfg configuration file {{ic|/etc/network.d/venet}}<br />
<br />
{{bc|1=CONNECTION='ethernet'<br />
DESCRIPTION='VPS venet connection'<br />
INTERFACE='venet0'<br />
IP='static'<br />
IPCFG=(<br />
#IPv4 address<br />
'addr add xxx.xxx.xxx.xxx/32 broadcast 0.0.0.0 dev venet0'<br />
#IPv4 route<br />
'route add default dev venet0'<br />
#IPv6 address<br />
'addr add xxxx:xx:xx::x/128 dev venet0'<br />
#IPv6 route<br />
'-6 route add default dev venet0'<br />
)<br />
DNS=('xxx.xxx.xxx.xxx' 'xxx.xxx.xxx.xxx')}}<br />
<br />
3) Edit your netcfg main conf file {{ic|/etc/conf.d/netcfg}}<br />
<br />
{{bc|1=NETWORKS=(venet)<br />
WIRED_INTERFACE="venet0"}}<br />
<br />
4) Try your new setup<br />
<br />
{{bc|rc.d stop network && ip addr flush venet0 && netcfg venet}}<br />
<br />
Your VPS should still be connected and have its IP addresses set correctly. (Check with {{ic|ip a}})<br />
<br />
DO NOT proceed to next step if this isn't the case.<br />
<br />
5) Make your new setup survive reboots<br />
<br />
In the {{ic|DAEMONS}} array in {{ic|/etc/rc.conf}}, replace {{ic|network}} with {{ic|net-profiles}}.<br />
<br />
Remove all networking information that is in {{ic|/etc/rc.conf}}.<br />
{{bc|reboot}}<br />
<br />
====Moving your VPS from initscripts to systemd====<br />
<br />
{{Warning|This has been known to work with OpenVZ on the 2.6.32 kernel, but systemd may not work on older kernels.}}<br />
<br />
This is very similar to a regular arch system, except you probably don't have access to your kernel line.<br />
<br />
1) Move from network in rc.conf to netcfg (see above).<br />
<br />
2) Install systemd<br />
<br />
{{bc|pacman -S systemd}}<br />
<br />
2 bonus for OpenVZ) Remove kernel core dump pattern since this is blocked by OpenVZ and causes errors<br />
<br />
Edit {{ic|/usr/lib/sysctl.d/coredump.conf}}, comment out the following line:<br />
{{bc|#kernel.core_pattern&#61;&#124;/usr/lib/systemd/systemd-coredump %p %u %g %s %t %e}}<br />
<br />
3) Move all configuration from {{ic|/etc/rc.conf}} (except the {{ic|DAEMONS}} array) to its appropriate location.<br />
<br />
See [https://wiki.archlinux.org/index.php/Systemd#Native_configuration Native configuration] and [https://wiki.archlinux.org/index.php/Rc.conf rc.conf] for details.<br />
<br />
Now your {{ic|/etc/rc.conf}} should only contain the {{ic|DAEMONS}} array.<br />
<br />
4) Install systemd-sysvcompat<br />
<br />
{{bc|pacman -S systemd-sysvcompat}}<br />
<br />
It will ask to replace sysvinit, say yes.<br />
<br />
{{bc|reboot}}<br />
<br />
5) Move daemons from the {{ic|DAEMONS}} array in {{ic|/etc/rc.conf}} to {{ic|systemd}}<br />
<br />
See the [https://wiki.archlinux.org/index.php/Systemd#Moving_away_from_the_DAEMONS_array guide] and the [https://wiki.archlinux.org/index.php/Daemons_List daemons list].<br />
<br />
If your {{ic|DAEMONS}} array is now empty, skip next step.<br />
<br />
6) Moving rc.d daemons with no systemd support, example: {{ic|vzquota}}<br />
<br />
Create a custom systemd service file for vzquota: {{ic|/etc/systemd/system/newvzquota.service}}:<br />
{{bc|1=[Unit]<br />
Description=Setup vzquota on VPS<br />
ConditionFileIsExecutable=/etc/rc.d/vzquota<br />
<br />
[Service]<br />
Type=oneshot<br />
ExecStart=/etc/rc.d/vzquota start<br />
ExecStop=/etc/rc.d/vzquota stop<br />
TimeoutSec=0<br />
StandardInput=tty<br />
RemainAfterExit=yes<br />
<br />
[Install]<br />
WantedBy=multi-user.target}}<br />
<br />
{{Note|It is recommended to choose a .service file name that is different from the name of the daemon, because systemd might try to call the LEGACY scripts with the old name.}}<br />
<br />
Enable this service:<br />
{{bc|systemctl enable newvzquota.service}}<br />
<br />
Remove {{ic|vzquota}} from the {{ic|DAEMONS}} array in {{ic|/etc/rc.conf}}<br />
<br />
Repeat this step to remove all daemons from {{ic|/etc/rc.conf}}.<br />
<br />
7) Removing {{ic|/etc/rc.local}} and {{ic|/etc/rc.local.shutdown}}<br />
<br />
Write [https://wiki.archlinux.org/index.php/Systemd#Writing_custom_.service_files custom .service files] to replace functionality in {{ic|/etc/rc.local}} and {{ic|/etc/rc.local.shutdown}}. You can take a look at {{ic|/usr/lib/systemd/system/rc-local.service}} and {{ic|/usr/lib/systemd/system/rc-local-shutdown.service}} for inspiration.<br />
<br />
8) Removing {{ic|initscripts}}<br />
<br />
Your {{ic|/etc/rc.conf}} file must look like this:<br />
{{bc|1=DAEMONS=()}}<br />
and {{ic|/etc/rc.local}} and {{ic|/etc/rc.local.shutdown}} must now be empty.<br />
<br />
Uninstall {{ic|initscripts}}<br />
{{bc|pacman -R initscripts}}<br />
<br />
{{bc|reboot}}<br />
<br />
===Xen===<br />
{{Expansion|Are there instructions specific to VPSes?}}<br />
See [[Xen#Arch as Xen guest (PVHVM mode)]] and/or [[Xen#Arch as Xen guest (PV mode)]].<br />
<br />
==Troubleshooting==<br />
===OpenVZ: kernel too old for glibc===<br />
Are you on a virtual private server (VPS) with an old kernel & broke your system? Are you using OpenVZ?<br />
<br />
Check your kernel version with:<br />
<br />
{{bc|uname -r}}<br />
<br />
If your kernel is older than 2.6.32, you will need a custom version of glibc ([https://www.archlinux.org/news/minimum-kernel-requirement-2632/ because of dependencies in glibc]).<br />
<br />
Arch Template Used: https://dev.archlinux.org/~ibiru/openvz/2010.05/arch-2010.05-i686-minimal.tar.gz<br />
<br />
{{Note|for installs that have not been updated to glibc-2.16, it will save you lots of time and prevent major breakage to do:<br />
pacman -U https://dev.archlinux.org/~ibiru/openvz/glibc-vps/i686/glibc-2.16.0-101-i686.pkg.tar.xz<br />
or<br />
pacman -U https://dev.archlinux.org/~ibiru/openvz/glibc-vps/x86_64/glibc-2.16.0-101-x86_64.pkg.tar.xz<br />
Add a single "-d" if needed. ''The instructions below assume that this has been done.''<br />
}}<br />
<br />
<br />
Following similar instructions from [[DeveloperWiki:usrlib]].<br />
<br />
Try doing the following to fix it:<br />
<br />
1) Edit {{ic|/etc/pacman.conf}} and add the following repository '''ABOVE [core]''':<br />
<br />
for 32-bit:<br />
<br />
{{bc|<nowiki>[glibc-vps]<br />
Server = https://dev.archlinux.org/~ibiru/openvz/glibc-vps/i686</nowiki>}}<br />
<br />
for 64-bit:<br />
<br />
{{bc|<nowiki>[glibc-vps]<br />
Server = https://dev.archlinux.org/~ibiru/openvz/glibc-vps/x86_64</nowiki>}}<br />
<br />
2) Then run {{ic|pacman -Syy}} followed by {{ic|pacman -Syu}}. You will be notified to upgrade pacman first.<br />
<br />
3) Upgrade the [[pacman]] database by running {{ic|pacman-db-upgrade}} as root.<br />
<br />
4) Edit {{ic|/etc/pacman.conf.pacnew}} (new pacman config file) and add the following repository '''ABOVE [core]''':<br />
<br />
{{bc|<nowiki>[glibc-vps]<br />
Server = https://dev.archlinux.org/~ibiru/openvz/glibc-vps/$arch</nowiki>}}<br />
<br />
5) Replace {{ic|/etc/pacman.conf}} with {{ic|/etc/pacman.conf.pacnew}} (run as root):<br />
<br />
{{bc|mv /etc/pacman.conf.pacnew /etc/pacman.conf}}<br />
<br />
6) Upgrade your whole system with new packages again {{ic|pacman -Syu}}<br />
<br />
If you get the following or similar error:<br />
{{bc|initscripts: /etc/profile.d/locale.sh exists in filesystem}}<br />
<br />
Simply delete that file (e.g., {{ic|rm -f /etc/profile.d/locale.sh}}), then run {{ic|pacman -Syu}} again.<br />
<br />
<br />
If you get the following or similar error:<br />
{{bc|filesystem: /etc/mtab exists in filesystem}}<br />
<br />
Run {{ic|pacman -S filesystem --force}}<br />
<br />
<br />
If you get the following or similar error:<br />
{{bc|libusb-compat: /usr/bin/libusb-config exists in filesystem}}<br />
<br />
Run {{ic|pacman -S libusb}} and then {{ic|pacman -S libusb-compat}}<br />
<br />
7) Before rebooting, you need to [[pacman|install]] the {{Pkg|makedev}} package by running {{ic|pacman -S makedev}}.<br />
<br />
8) Add MAKEDEV to {{ic|/etc/rc.local}}:<br />
<br />
{{bc|/usr/sbin/MAKEDEV tty<br />
/usr/sbin/MAKEDEV pty}}<br />
<br />
9) Edit {{ic|/etc/inittab}}, comment out the following lines (otherwise you will see errors in {{ic|/var/log/errors.log}}):<br />
<br />
{{bc|#c1:2345:respawn:/sbin/agetty -8 -s 38400 tty1 linux<br />
#c2:2345:respawn:/sbin/agetty -8 -s 38400 tty2 linux<br />
#c3:2345:respawn:/sbin/agetty -8 -s 38400 tty3 linux<br />
#c4:2345:respawn:/sbin/agetty -8 -s 38400 tty4 linux<br />
#c5:2345:respawn:/sbin/agetty -8 -s 38400 tty5 linux<br />
#c6:2345:respawn:/sbin/agetty -8 -s 38400 tty6 linux}}<br />
<br />
10) To enable the use of the {{ic|hostname}} command, [[pacman|install]] the package {{Pkg|inetutils}} from the [[Official Repositories|official repositories]]. <br />
<br />
11) Remove disabling of SysRq key and setup of core dump pattern since this is blocked by OpenVZ and causes errors<br />
<br />
Edit {{ic|/etc/sysctl.conf}}, comment out the following line:<br />
{{bc|1=#kernel.sysrq = 0}}<br />
<br />
Edit {{ic|/usr/lib/sysctl.d/coredump.conf}}, comment out the following line:<br />
{{bc|1=#kernel.core_pattern=&#124;/usr/lib/systemd/systemd-coredump %p %u %g %s %t %e}}<br />
<br />
12) Save and reboot.<br />
<br />
Enjoy & thank ioni if you happen to be in #archlinux<br />
<br />
===SSH fails: PTY allocation request failed on channel 0===<br />
<br />
Some VPSes have an outdated {{ic|rc.sysinit}}. You may be able to login via serial console or with<br />
<br />
{{bc|> ssh root@broken.server '/bin/bash -i'}}<br />
<br />
Then run the following:<br />
<br />
{{bc|# mv /etc/rc.sysinit.pacnew /etc/rc.sysinit<br />
# reboot}}<br />
<br />
Once it’s working, you should be able to comment out the {{ic|udevd_modprobe}} line in {{ic|rc.sysinit}} to save a bit of RAM the next time you reboot.<br />
<br />
If the above doesn’t work, take a look at<br />
http://fsk141.com/fix-pty-allocation-request-failed-on-channel-0.</div>Txmoosehttps://wiki.archlinux.org/index.php?title=Arch_Linux_on_a_VPS&diff=257017Arch Linux on a VPS2013-05-14T00:42:37Z<p>Txmoose: /* Providers that offer Arch Linux */</p>
<hr />
<div>[[Category:Getting and installing Arch]]<br />
[[Category:Virtualization]]<br />
{{Article summary start}}<br />
{{Article summary text|This article discusses the use of Arch Linux on Virtual Private Servers, and includes some fixes and installation instructions specific to VPSes.}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|Comprehensive Server Guide}}<br />
{{Article summary end}}<br />
From [[Wikipedia:Virtual private server]]:<br />
<br />
:''Virtual private server (VPS) is a term used by Internet hosting services to refer to a virtual machine. The term is used for emphasizing that the virtual machine, although running in software on the same physical computer as other customers' virtual machines, is in many respects functionally equivalent to a separate physical computer, is dedicated to the individual customer's needs, has the privacy of a separate physical computer, and can be configured to run server software.''<br />
<br />
==Providers that offer Arch Linux==<br />
<br />
{{Warning|We cannot vouch for the honesty or quality of any provider. Please conduct due diligence before ordering.}}<br />
{{Note|This list is for providers with a convenient Arch Linux image. Using Arch on other providers is probably possible, but would require loading custom ISOs or disk images or [[Installation Chroot|installing under chroot]].}}<br />
<br />
{| border="1"<br />
! Provider !! Arch Release !! Virtualization !! Locations !! Notes<br />
|-<br />
| [http://123systems.net 123 Systems] || 2010.05 i686/x86_64 || OpenVZ || Dallas, TX || Arch available as a selection upon reinstall. Very old (2.6.18-308) kernel - See [[Virtual_Private_Server#OpenVZ:_kernel_too_old_for_glibc|OpenVZ troubleshooting]].<br />
|-<br />
| [http://afterburst.com/ Afterburst] || 2012.12.01 i686/x86_64 || OpenVZ || Miami (USA), Falkenstein (Germany) || Formerly FanaticalVPS, kernel version depends on what node your VPS is on, the ones in Miami are fine (2.6.32-042stab072.10) but some of the ones in Germany require a [[Virtual_Private_Server#OpenVZ:_kernel_too_old_for_glibc|custom glibc]].<br />
|-<br />
| [http://alienvps.com/ AlienVPS] || 2010.05 || Xen, KVM || Los Angeles, New York ||<br />
|-<br />
| [https://www.clodo.ru/ Clodo.ru] || 2011.?? || Xen || Moscow || Can pay per hour. Lists an invalid release version of the installer.<br />
|-<br />
| [http://en.edis.at/ Edis] || 2011.08 i686/x86_64 || vServer, KVM || Austria, Chile, Germany, France, Hong Kong, Italy, Iceland, Poland, Sweden, Switzerland, Spain, UK, USA ||<br />
|-<br />
| [http://eoreality.net/ EOReality] || (?) i686/x86_64 || OpenVZ || Chicago || Need to use special glibc-vps repo for this provider . See [[Virtual_Private_Server#OpenVZ:_kernel_too_old_for_glibc|OpenVZ troubleshooting]] for instructions. You will also need to remove heimdal.<br />
|-<br />
| [https://www.directvps.nl/ DirectVPS] || 2012.09 x86_64 || Xen || Amsterdam, Rotterdam || <br />
|-<br />
| [http://generation-host.com Generation-Host] || 2012.07 || Xen || Chicago IL, Clifton NJ and Toronto ON Canada ||<br />
|-<br />
| [https://www.gigatux.com/virtual.php GigaTux] || 2011.08 x86_64 || Xen || Chicago, Frankfurt, Israel, London, San Jose ||<br />
|-<br />
| [http://www.vr.org/ Host Virtual] || 2011.08 || Xen || Amsterdam, Chennai (Madras), Chicago, Dallas, Hong Kong, London, Los Angeles, New York, Paris, Reston, San Jose ||<br />
|-<br />
| [https://hostigation.com/ Hostigation] || 2010.05 i686 || OpenVZ, KVM || Charlotte, Los Angeles || You can [[Migrating Between Architectures Without Reinstalling|migrate to x86_64]].<br />
|-<br />
| [http://www.intovps.com IntoVPS] || 2012.05 i686/x86_64 || OpenVZ || Amsterdam, Bucharest, Dallas, Fremont, London ||<br />
|-<br />
| [https://www.linode.com Linode.com] || 2012.07 || Xen || Atlanta, Dallas, Fremont, London, Newark, Tokyo || Uses a custom kernel; do not install the {{pkg|linux}} package.<br />
|-<br />
| [http://lylix.net/home Lylix] || 2007.08 || ? || ? ||<br />
|-<br />
| [http://www.nodedeploy.com Node Deploy] || ? || OpenVZ, KVM || LA, Germany || unmanaged, solusvm server manager<br />
|-<br />
| [http://netcup.de Netcup] || 2011.10 x86_64/2012.11 x86_64 || vServer, KVM || Germany || <br />
|-<br />
| [http://onepoundwebhosting.co.uk OnePoundWebHosting] || 2012.09 x86_64 || Xen || UK ||<br />
|-<br />
| [http://openvz.ca/ OpenVZ.ca] || 2010.05 i686/x86_64 || OpenVZ || Canada ||<br />
|-<br />
| [https://www.proplay.biz/ proPlay.de] || 2011.10 i686/x86_64 || OpenVZ, KVM || Germany ||<br />
|-<br />
| [http://www.rackspace.com/cloud/cloud_hosting_products/servers/ Rackspace Cloud] || 2013.2 || XenServer || Chicago, Dallas, London || Billed per hour.<br />
|-<br />
| [http://www.ramhost.us RamHost.us] || 2012.12 || OpenVZ, KVM || Atlanta, England, Germany, Los Angeles || You can request a newer iso on IRC. ||<br />
|-<br />
| [http://www.tilaa.nl/ Tilaa] || 2012.12 i686/x86_64 || KVM || Amsterdam ||<br />
|-<br />
| [https://www.transip.nl/ TransIP] || 2013.01.04 || KVM || Amsterdam ||<br />
|-<br />
| [http://www.xenvz.co.uk/ XenVZ] || 2009.12 x86_64 || OpenVZ, Xen || UK? ||<br />
|-<br />
| [http://www.virpus.com/ Virpus] || 2010.05 x86_64 || OpenVZ, Xen || Kansas City ||<br />
|-<br />
| [http://www.vmline.pl/ Vmline] || 2012.08.04-dual.iso || Xen-HVM || Poland - Kraków || [http://www.s-net.pl/en/ S-Net] reseller. It's probably imposible to install i686 due to lack of xen_netfront and xen_blkfront modules ||<br />
|-<br />
| [https://vps6.net/ VPS6.NET] || 2010.05 i686/x86_64 OpenVZ, 2012.01 x86_64 Xen || OpenVZ, Xen || Germany, Romania, Turkey, USA ||<br />
|-<br />
| [http://www.uk2.net/ UK2.net] || 2010.05 i686/x86_64 || Xen || United Kingdom || Appears to use a custom kernel; do not install the {{pkg|linux}} package.<br />
|}<br />
<br />
==Installation==<br />
<br />
===KVM===<br />
{{Expansion|Are there instructions specific to VPSes?}}<br />
See [[KVM#Preparing an (Arch) Linux guest]].<br />
<br />
===OpenVZ===<br />
<br />
====Getting a 2010.05 Image Up To Date====<br />
<br />
These instructions you have a 2010.05 image from your VPS provider and you'd like to get it up to scratch. The biggest work involves preparing /lib for the symlink upgrade (glibc 2.16, and later filesystem 2013.01).<br />
<br />
{{Warning|If you are on a older kernel than 2.6.32, please refer [[Virtual_Private_Server#OpenVZ:_kernel_too_old_for_glibc|further down the page]] to get the glibc-vps repo working (just add the repo and you can follow these steps).}}<br />
<br />
To start, grab the latest busybox from http://busybox.net/downloads/binaries/latest/. This allows you to force glibc (losing /lib temporarily) without losing your OS (busybox comes with its own GNU tools which are statically linked).<br />
<br />
{{bc|wget http://busybox.net/downloads/binaries/latest/busybox-i686<br />
chmod +x busybox-i686}}<br />
<br />
First off you can get a list of packages that own files in /lib with the following command:<br />
{{bc|<nowiki><br />
pacman -Qo /lib/* | cut -d' ' -f 5 | egrep -v 'glibc' | uniq | xargs<br />
</nowiki>}}<br />
<br />
For the current 2010.05 that comes straight off of ibiru's page, these are the packages that were required to be removed for me:<br />
<br />
{{bc|pacman -S acl attr util-linux-ng bzip2 libcap e2fsprogs libgcrypt libgpg-error udev readline ncurses pam pcre popt procps readline shadow e2fsprogs sysfsutils udev util-linux-ng sysvinit coreutils}}<br />
<br />
You may have to remove /lib/udev/devices/loop0 (a simple rm works).<br />
<br />
After the upgrade finishes, you must remove any extra empty directories in /lib (/lib/modules is the common offender):<br />
{{bc|rm -rf /lib/modules}}<br />
<br />
Install tzdata to fix some dependencies and remove /etc/profile.d/locale.sh:<br />
{{bc|pacman -S tzdata<br />
rm /etc/profile.d/locale.sh}}<br />
<br />
Remove /var/run (you should have nothing running that matters):<br />
{{bc|rm -rf /var/run}}<br />
<br />
Force glibc (this will pull in the latest filesystem, but BREAK everything (other than busybox)):<br />
{{bc|pacman -S --force glibc}}<br />
<br />
Now you will have a broken system, so first thing symlink /usr/lib to /lib with busybox's ln:<br />
{{bc|./busybox-i686 ln -s /usr/lib /lib}}<br />
<br />
And you should have a fully functional system where you can now update pacman.<br />
<br />
{{bc|pacman -S pacman; pacman-key --init; pacman-key --populate archlinux; pacman-db-upgrade; pacman -Syy}}<br />
<br />
Now, update initscripts to get iproute2:<br />
<br />
{{bc|pacman -S iniscripts}}<br />
<br />
Install makedev:<br />
{{bc|pacman -S makedev}}<br />
<br />
Add the following to your /etc/rc.local:<br />
{{bc|/usr/sbin/MAKEDEV tty<br />
/usr/sbin/MAKEDEV pty}}<br />
<br />
Comment the following lines in /etc/inittab:<br />
{{bc|#c1:2345:respawn:/sbin/agetty -8 -s 38400 tty1 linux<br />
#c2:2345:respawn:/sbin/agetty -8 -s 38400 tty2 linux<br />
#c3:2345:respawn:/sbin/agetty -8 -s 38400 tty3 linux<br />
#c4:2345:respawn:/sbin/agetty -8 -s 38400 tty4 linux<br />
#c5:2345:respawn:/sbin/agetty -8 -s 38400 tty5 linux<br />
#c6:2345:respawn:/sbin/agetty -8 -s 38400 tty6 linux}}<br />
<br />
Finally, you should be able to upgrade the whole system:<br />
<br />
{{bc|pacman -Su}}<br />
<br />
You may run into some issues with krb5 and heimdal, as krb5 no longer provides+conflicts+replaces heimdal (https://projects.archlinux.org/svntogit/packages.git/commit/trunk/PKGBUILD?h=packages/krb5&id=f5e6d77fd14ced15ebf5b6a78a7c76e0db0625f7). The old openssh depends on heimdal (and the new openssh depends on krb5), so force install krb5, then upgrade openssh, then remove heimdal and reinstall krb5.<br />
<br />
{{bc|pacman -S --force krb5<br />
pacman -S openssh openssl<br />
pacman -R heimdal<br />
pacman -S krb5}}<br />
<br />
Fix syslog-ng (set the src to unix-dgram("/dev/log") and add --no-caps to both check and run args in /etc/conf.d/syslog-ng).<br />
<br />
Make sure your rc.conf isn't messed up with broken network definitions, or else be sure serial access works on your VPS before you reboot.<br />
<br />
<br />
====Moving your VPS from network configuration in rc.conf to netcfg (tested with OpenVZ)====<br />
<br />
1) Install netcfg<br />
<br />
{{bc|pacman -S netcfg}}<br />
<br />
2) Create a netcfg configuration file {{ic|/etc/network.d/venet}}<br />
<br />
{{bc|1=CONNECTION='ethernet'<br />
DESCRIPTION='VPS venet connection'<br />
INTERFACE='venet0'<br />
IP='static'<br />
IPCFG=(<br />
#IPv4 address<br />
'addr add xxx.xxx.xxx.xxx/32 broadcast 0.0.0.0 dev venet0'<br />
#IPv4 route<br />
'route add default dev venet0'<br />
#IPv6 address<br />
'addr add xxxx:xx:xx::x/128 dev venet0'<br />
#IPv6 route<br />
'-6 route add default dev venet0'<br />
)<br />
DNS=('xxx.xxx.xxx.xxx' 'xxx.xxx.xxx.xxx')}}<br />
<br />
3) Edit your netcfg main conf file {{ic|/etc/conf.d/netcfg}}<br />
<br />
{{bc|1=NETWORKS=(venet)<br />
WIRED_INTERFACE="venet0"}}<br />
<br />
4) Try your new setup<br />
<br />
{{bc|rc.d stop network && ip addr flush venet0 && netcfg venet}}<br />
<br />
Your VPS should still be connected and have its IP addresses set correctly. (Check with {{ic|ip a}})<br />
<br />
DO NOT proceed to next step if this isn't the case.<br />
<br />
5) Make your new setup survive reboots<br />
<br />
In the {{ic|DAEMONS}} array in {{ic|/etc/rc.conf}}, replace {{ic|network}} with {{ic|net-profiles}}.<br />
<br />
Remove all networking information that is in {{ic|/etc/rc.conf}}.<br />
{{bc|reboot}}<br />
<br />
====Moving your VPS from initscripts to systemd====<br />
<br />
{{Warning|This has been known to work with OpenVZ on the 2.6.32 kernel, but systemd may not work on older kernels.}}<br />
<br />
This is very similar to a regular arch system, except you probably don't have access to your kernel line.<br />
<br />
1) Move from network in rc.conf to netcfg (see above).<br />
<br />
2) Install systemd<br />
<br />
{{bc|pacman -S systemd}}<br />
<br />
2 bonus for OpenVZ) Remove kernel core dump pattern since this is blocked by OpenVZ and causes errors<br />
<br />
Edit {{ic|/usr/lib/sysctl.d/coredump.conf}}, comment out the following line:<br />
{{bc|#kernel.core_pattern&#61;&#124;/usr/lib/systemd/systemd-coredump %p %u %g %s %t %e}}<br />
<br />
3) Move all configuration from {{ic|/etc/rc.conf}} (except the {{ic|DAEMONS}} array) to its appropriate location.<br />
<br />
See [https://wiki.archlinux.org/index.php/Systemd#Native_configuration Native configuration] and [https://wiki.archlinux.org/index.php/Rc.conf rc.conf] for details.<br />
<br />
Now your {{ic|/etc/rc.conf}} should only contain the {{ic|DAEMONS}} array.<br />
<br />
4) Install systemd-sysvcompat<br />
<br />
{{bc|pacman -S systemd-sysvcompat}}<br />
<br />
It will ask to replace sysvinit, say yes.<br />
<br />
{{bc|reboot}}<br />
<br />
5) Move daemons from the {{ic|DAEMONS}} array in {{ic|/etc/rc.conf}} to {{ic|systemd}}<br />
<br />
See the [https://wiki.archlinux.org/index.php/Systemd#Moving_away_from_the_DAEMONS_array guide] and the [https://wiki.archlinux.org/index.php/Daemons_List daemons list].<br />
<br />
If your {{ic|DAEMONS}} array is now empty, skip next step.<br />
<br />
6) Moving rc.d daemons with no systemd support, example: {{ic|vzquota}}<br />
<br />
Create a custom systemd service file for vzquota: {{ic|/etc/systemd/system/newvzquota.service}}:<br />
{{bc|1=[Unit]<br />
Description=Setup vzquota on VPS<br />
ConditionFileIsExecutable=/etc/rc.d/vzquota<br />
<br />
[Service]<br />
Type=oneshot<br />
ExecStart=/etc/rc.d/vzquota start<br />
ExecStop=/etc/rc.d/vzquota stop<br />
TimeoutSec=0<br />
StandardInput=tty<br />
RemainAfterExit=yes<br />
<br />
[Install]<br />
WantedBy=multi-user.target}}<br />
<br />
{{Note|It is recommended to choose a .service file name that is different from the name of the daemon, because systemd might try to call the LEGACY scripts with the old name.}}<br />
<br />
Enable this service:<br />
{{bc|systemctl enable newvzquota.service}}<br />
<br />
Remove {{ic|vzquota}} from the {{ic|DAEMONS}} array in {{ic|/etc/rc.conf}}<br />
<br />
Repeat this step to remove all daemons from {{ic|/etc/rc.conf}}.<br />
<br />
7) Removing {{ic|/etc/rc.local}} and {{ic|/etc/rc.local.shutdown}}<br />
<br />
Write [https://wiki.archlinux.org/index.php/Systemd#Writing_custom_.service_files custom .service files] to replace functionality in {{ic|/etc/rc.local}} and {{ic|/etc/rc.local.shutdown}}. You can take a look at {{ic|/usr/lib/systemd/system/rc-local.service}} and {{ic|/usr/lib/systemd/system/rc-local-shutdown.service}} for inspiration.<br />
<br />
8) Removing {{ic|initscripts}}<br />
<br />
Your {{ic|/etc/rc.conf}} file must look like this:<br />
{{bc|1=DAEMONS=()}}<br />
and {{ic|/etc/rc.local}} and {{ic|/etc/rc.local.shutdown}} must now be empty.<br />
<br />
Uninstall {{ic|initscripts}}<br />
{{bc|pacman -R initscripts}}<br />
<br />
{{bc|reboot}}<br />
<br />
===Xen===<br />
{{Expansion|Are there instructions specific to VPSes?}}<br />
See [[Xen#Arch as Xen guest (PVHVM mode)]] and/or [[Xen#Arch as Xen guest (PV mode)]].<br />
<br />
==Troubleshooting==<br />
===OpenVZ: kernel too old for glibc===<br />
Are you on a virtual private server (VPS) with an old kernel & broke your system? Are you using OpenVZ?<br />
<br />
Check your kernel version with:<br />
<br />
{{bc|uname -r}}<br />
<br />
If your kernel is older than 2.6.32, you will need a custom version of glibc ([https://www.archlinux.org/news/minimum-kernel-requirement-2632/ because of dependencies in glibc]).<br />
<br />
Arch Template Used: https://dev.archlinux.org/~ibiru/openvz/2010.05/arch-2010.05-i686-minimal.tar.gz<br />
<br />
{{Note|for installs that have not been updated to glibc-2.16, it will save you lots of time and prevent major breakage to do:<br />
pacman -U https://dev.archlinux.org/~ibiru/openvz/glibc-vps/i686/glibc-2.16.0-101-i686.pkg.tar.xz<br />
or<br />
pacman -U https://dev.archlinux.org/~ibiru/openvz/glibc-vps/x86_64/glibc-2.16.0-101-x86_64.pkg.tar.xz<br />
Add a single "-d" if needed. ''The instructions below assume that this has been done.''<br />
}}<br />
<br />
<br />
Following similar instructions from [[DeveloperWiki:usrlib]].<br />
<br />
Try doing the following to fix it:<br />
<br />
1) Edit {{ic|/etc/pacman.conf}} and add the following repository '''ABOVE [core]''':<br />
<br />
for 32-bit:<br />
<br />
{{bc|<nowiki>[glibc-vps]<br />
Server = https://dev.archlinux.org/~ibiru/openvz/glibc-vps/i686</nowiki>}}<br />
<br />
for 64-bit:<br />
<br />
{{bc|<nowiki>[glibc-vps]<br />
Server = https://dev.archlinux.org/~ibiru/openvz/glibc-vps/x86_64</nowiki>}}<br />
<br />
2) Then run {{ic|pacman -Syy}} followed by {{ic|pacman -Syu}}. You will be notified to upgrade pacman first.<br />
<br />
3) Upgrade the [[pacman]] database by running {{ic|pacman-db-upgrade}} as root.<br />
<br />
4) Edit {{ic|/etc/pacman.conf.pacnew}} (new pacman config file) and add the following repository '''ABOVE [core]''':<br />
<br />
{{bc|<nowiki>[glibc-vps]<br />
Server = https://dev.archlinux.org/~ibiru/openvz/glibc-vps/$arch</nowiki>}}<br />
<br />
5) Replace {{ic|/etc/pacman.conf}} with {{ic|/etc/pacman.conf.pacnew}} (run as root):<br />
<br />
{{bc|mv /etc/pacman.conf.pacnew /etc/pacman.conf}}<br />
<br />
6) Upgrade your whole system with new packages again {{ic|pacman -Syu}}<br />
<br />
If you get the following or similar error:<br />
{{bc|initscripts: /etc/profile.d/locale.sh exists in filesystem}}<br />
<br />
Simply delete that file (e.g., {{ic|rm -f /etc/profile.d/locale.sh}}), then run {{ic|pacman -Syu}} again.<br />
<br />
<br />
If you get the following or similar error:<br />
{{bc|filesystem: /etc/mtab exists in filesystem}}<br />
<br />
Run {{ic|pacman -S filesystem --force}}<br />
<br />
<br />
If you get the following or similar error:<br />
{{bc|libusb-compat: /usr/bin/libusb-config exists in filesystem}}<br />
<br />
Run {{ic|pacman -S libusb}} and then {{ic|pacman -S libusb-compat}}<br />
<br />
7) Before rebooting, you need to [[pacman|install]] the {{Pkg|makedev}} package by running {{ic|pacman -S makedev}}.<br />
<br />
8) Add MAKEDEV to {{ic|/etc/rc.local}}:<br />
<br />
{{bc|/usr/sbin/MAKEDEV tty<br />
/usr/sbin/MAKEDEV pty}}<br />
<br />
9) Edit {{ic|/etc/inittab}}, comment out the following lines (otherwise you will see errors in {{ic|/var/log/errors.log}}):<br />
<br />
{{bc|#c1:2345:respawn:/sbin/agetty -8 -s 38400 tty1 linux<br />
#c2:2345:respawn:/sbin/agetty -8 -s 38400 tty2 linux<br />
#c3:2345:respawn:/sbin/agetty -8 -s 38400 tty3 linux<br />
#c4:2345:respawn:/sbin/agetty -8 -s 38400 tty4 linux<br />
#c5:2345:respawn:/sbin/agetty -8 -s 38400 tty5 linux<br />
#c6:2345:respawn:/sbin/agetty -8 -s 38400 tty6 linux}}<br />
<br />
10) To enable the use of the {{ic|hostname}} command, [[pacman|install]] the package {{Pkg|inetutils}} from the [[Official Repositories|official repositories]]. <br />
<br />
11) Remove disabling of SysRq key and setup of core dump pattern since this is blocked by OpenVZ and causes errors<br />
<br />
Edit {{ic|/etc/sysctl.conf}}, comment out the following line:<br />
{{bc|1=#kernel.sysrq = 0}}<br />
<br />
Edit {{ic|/usr/lib/sysctl.d/coredump.conf}}, comment out the following line:<br />
{{bc|1=#kernel.core_pattern=&#124;/usr/lib/systemd/systemd-coredump %p %u %g %s %t %e}}<br />
<br />
12) Save and reboot.<br />
<br />
Enjoy & thank ioni if you happen to be in #archlinux<br />
<br />
===SSH fails: PTY allocation request failed on channel 0===<br />
<br />
Some VPSes have an outdated {{ic|rc.sysinit}}. You may be able to login via serial console or with<br />
<br />
{{bc|> ssh root@broken.server '/bin/bash -i'}}<br />
<br />
Then run the following:<br />
<br />
{{bc|# mv /etc/rc.sysinit.pacnew /etc/rc.sysinit<br />
# reboot}}<br />
<br />
Once it’s working, you should be able to comment out the {{ic|udevd_modprobe}} line in {{ic|rc.sysinit}} to save a bit of RAM the next time you reboot.<br />
<br />
If the above doesn’t work, take a look at<br />
http://fsk141.com/fix-pty-allocation-request-failed-on-channel-0.</div>Txmoose