Giter Club home page Giter Club logo

vps2arch's Introduction

VPS2Arch

The fastest way to convert a VPS to Arch Linux!

Author

Timothy Redaelli

Description

This script is used to convert a VPS, running another linux distro, to Arch Linux.
It should be only used if your VPS provider doesn't provide you an Arch Linux image.

Disclaimer

I'm not responsible for any damage in your system and/or any violation of the agreement between you and your vps provider.
Use at your own risk!

How To

Download the script on your VPS and execute it with root privileges

WARNING The script will delete any data in your VPS!

wget https://felixc.at/vps2arch
chmod +x vps2arch
./vps2arch

Some Debian VPS images don't have the CA certificates installed, so wget will give you the following errors:

ERROR: The certificate of `gitlab.com' is not trusted.
ERROR: The certificate of `gitlab.com' hasn't got a known issuer.

To fix them just execute apt-get install ca-certificates and then re-execute the previous commands.

How does it work?

It's Black Magic. Just kiddin' 😏, the script itself is very simple.

In a nutshell, it will download the Arch Linux Bootstrap Image and (see the wiki), extract the image to / and configure the Bootstrap chroot.

Now, about the critical part:

How can you wipe the system without breaking everything?

It's simple: using ld.so from the Bootstrap chroot to launch the chroot tool.

Since it will erase all the system directories except from the Bootstrap chroot, /dev, /proc, /sys and the like, the only way to launch a command inside the Bootstrap chroot is to using ld.so from the Bootstrap chroot itself.

At this point Arch Linux has been installed, but not configured. The script will provide a SSH-able system automagically configuring grub (or syslinux), network and restoring the root password from the original system (or by using vps2arch as password if no root password was set).

Once done doing its job, the script will ask you to manually reboot your VPS and voilà, PROFIT!

Does it really work?

Yes, it does!

On the Tested VPS Providers wiki page you can find a list of Tested VPS Providers.

Theoretically it should also work on real computers (running linux), but I think it's not worth it, because you can install it in the canonical way.

Contributing

If you have any useful modification, please use Pull requests.
If you have successfully used this script on a different distro - VPS combination, please contact me so that I can update the above list.

If you are not a developer, but you still want to contribute, you can donate me an account on your VPS provider and I'll do my best to support it.
Or you can just donate me some bucks I'll spend to buy a VPS on your provider in order to support it.

Caveats

IPv6 currently is not supported. If you need to use it, please configure it manually.

vps2arch's People

Contributors

brucezhang1993 avatar drizzt avatar edgist avatar felixonmars avatar kunoisayami avatar makeding avatar megver83 avatar s1eke avatar wyn10 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

vps2arch's Issues

Not working on Openvz

I have just tried it on openvz(woiden.id),it just didnt work...The vps didnt boot...

Inherit ssh_host_*_key* from the original distribution

在一些不提供 arch 镜像/模板的 idc 有可能连 vnc 也不提供,这导致 vps2arch 后不能方便地确认新的 sshkey
我建议在安装 arch 时把原发行版上生成好的 sshkey 备份到一个地方,安装后启用 sshd 之前把 sshkey 放进 /etc/ssh 里

systemd errors

systemd-logind.service: Failed to connect stdout to the journal socket, ignoring: No such file or directory
Failed to mount /run/systemd/inaccessible/sock to /run/systemd/unit-root/dev/kmsg: No such file or directory
systemd-logind.service: Failed to set up mount namespacing: /run/systemd/unit-root/dev/kmsg: No such file or directory
systemd-logind.service: Failed to step NAMESPACE spawning /usr/lib/systemd/systemd-logind: No such file or directory

// Repeat the above output 4 more times
systemd-recolved.service: Failed to determine user credentials: No such process
systemd-recolved.service: Failed at step USER spawning /lib/systemd/systemd-resolved: No such process

There may be more errors, these are the two I can see.

Then if I execute a reboot:

System has not been booted with systemd as init system(PID 1). Can't operate.
Failed to connect to bus: Host is down
System has not been booted with systemd as init system(PID 1). Can't operate.
Failed to connect to bus: Host is down
Failed to talk to init daemon: Host is down

Reproduced on a Cloud VPS and a VBox virtual machine.

How to config IPv6 manually

In README it says 'IPv6 currently is not supported. If you need to use it, please configure it manually'. But it does not mention the way to config it manually.

about ipv6

May I ask how to use this script for vps in only ipv6 environment

Failure caused by Multiple Errors

我在VMware中安装了Debian并以Root身份执行了vps2arch2,但发生了以下的错误:
2021-06-21 00:31:07 (7.34 MB/s) - written to stdout [147406556/147406556]

archlinux-bootstrap-2021.06.01-x86_64.tar.gz: OK
tar: root.x86_64/sys: Cannot utime: Read-only file system
tar: root.x86_64/sys: Cannot change ownership to uid 0, gid 0: Read-only file system
tar: Ignoring unknown extended header keyword 'LIBARCHIVE.xattr.security.capability'
tar: Ignoring unknown extended header keyword 'LIBARCHIVE.xattr.security.capability'
tar: Exiting with failure status due to previous errors

WARNING: terminal is not fully functional

Great script and succeeded on both my local Virtualbox VM and cloud box. But my uxrvt terminal consistently receives warning when run some specific systemctl commands:

[root@archlinux ~]# systemctl list-timers              
WARNING: terminal is not fully functional
Press RETURN to continue 
NEXT                        LEFT        LAST                        PASSED UNIT                             ACTIVATES                         
Fri 2023-03-31 00:00:00 UTC 7h left     Thu 2023-03-30 07:05:46 UTC 9h ago shadow.timer                     shadow.service
Fri 2023-03-31 07:45:48 UTC 15h left    Thu 2023-03-30 07:45:48 UTC 8h ago systemd-tmpfiles-clean.timer     systemd-tmpfiles-clean.service
Tue 2023-04-04 10:29:08 UTC 4 days left Thu 2023-03-30 07:05:46 UTC 9h ago archlinux-keyring-wkd-sync.timer archlinux-keyring-wkd-sync.service

3 timers listed.
Pass --all to see loaded but inactive timers, too.
[root@archlinux ~]#
[root@archlinux ~]# systemctl list-units --type=service
WARNING: terminal is not fully functional
Press RETURN to continue 
  UNIT                               LOAD   ACTIVE SUB     DESCRIPTION                                                                  
  dbus.service                       loaded active running D-Bus System Message Bus
  [email protected]                 loaded active running Getty on tty1
  kmod-static-nodes.service          loaded active exited  Create List of Static Device Nodes
  lvm2-monitor.service               loaded active exited  Monitoring of LVM2 mirrors, snapshots etc. using dmeventd or progress polling
  sshd.service                       loaded active running OpenSSH Daemon
  systemd-journal-flush.service      loaded active exited  Flush Journal to Persistent Storage
  systemd-journald.service           loaded active running Journal Service
  systemd-logind.service             loaded active running User Login Management
  systemd-network-generator.service  loaded active exited  Generate network units from Kernel command line
  systemd-networkd.service           loaded active running Network Configuration
  systemd-random-seed.service        loaded active exited  Load/Save OS Random Seed
  systemd-remount-fs.service         loaded active exited  Remount Root and Kernel File Systems
  systemd-sysctl.service             loaded active exited  Apply Kernel Variables
  systemd-timesyncd.service          loaded active running Network Time Synchronization
  systemd-tmpfiles-setup-dev.service loaded active exited  Create Static Device Nodes in /dev
  systemd-tmpfiles-setup.service     loaded active exited  Create Volatile Files and Directories
  systemd-udev-trigger.service       loaded active exited  Coldplug All udev Devices
  systemd-udevd.service              loaded active running Rule-based Manager for Device Events and Files
  systemd-update-utmp.service        loaded active exited  Record System Boot/Shutdown in UTMP
  systemd-user-sessions.service      loaded active exited  Permit User Sessions
  [email protected]         loaded active exited  User Runtime Directory /run/user/0
  [email protected]                     loaded active running User Manager for UID 0

LOAD   = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB    = The low-level unit activation state, values depend on unit type.
22 loaded units listed. Pass --all to see loaded but inactive units, too.
To show all installed unit files use 'systemctl list-unit-files'.
[root@archlinux ~]# 

Add option to specify the country of the mirrors to run reflector

Running reflector for a list of mirrors around the world is slow. Better to have an option to specify a country code and only run reflector on the mirrors in that particular country. I know there is an "-m" option to specify a single mirror, but that is not as easy to use as to just type a country code.

PGP key is marginal trust

Total (135/135) 350.0 MiB 41.8 MiB/s 00:08 [##########################################################] 100%
(135/135) checking keys in keyring [##########################################################] 100%
downloading required keys...
:: Import PGP key 139B09DA5BF0D338, "David Runge [email protected]"? [Y/n]
(135/135) checking package integrity [##########################################################] 100%
error: libcap: signature from "David Runge [email protected]" is marginal trust
:: File /mnt/var/cache/pacman/pkg/libcap-2.65-1-x86_64.pkg.tar.zst is corrupted (invalid or corrupted package (PGP signature)).
Do you want to delete it? [Y/n]
error: failed to commit transaction (invalid or corrupted package)
Errors occurred, no packages were upgraded.
==> ERROR: Failed to install packages to new root

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.