Talk:Convert a running Linux installation to Debian

From Organic Design wiki
Your virtual dedicated server has been configured according to your preferences and is now ready for your use.

====================================================
Your virtual dedicated hosting account information:

Account Name: wikiexpert
Server IP Address*: 68.178.204.110
Allotted Monthly Bandwidth: 500 GB
Disk Space: 10 GB

*Note: By default, we have assigned one dedicated IP address to your server.
To add two more IP addresses, please open the Virtual Dedicated Hosting Manager and click on the "Request Additional IP" link.
go ahead and get addition'l IP's if you want, the old wx had 3. --Phalseid 01:56, 17 Oct 2006 (NZDT)

Regarding Debian flavour of linux. Its definately the way to go, apt-get installs are far better than rpms in redshat. There is a gui interface apparently available from the pull down menu for gnome/kde which allows you to see all the dependency packages quickly (the command line version can probably give this also), which would help in the construction of Debian Post Install --Sven 10:39, 6 Apr 2006 (NZST)

Yeah that last install sold me on it once and for all :-) Rob and me were talking last night about how we could eventually get the peer to handle install using its new interactive-shell abilities. We could build trees of commands and matching rules for shell-interaction instead of just website-interaction. It could then do installs either on the local machine, or on remote machines over SSH. --Nad 10:49, 6 Apr 2006 (NZST)
The redshat cracked me up! So anyway I have gotten hold of some script from the Geexbox distro, that does a nice automated install to hardisc from scratch kind of thing. It's still a bit too interactive for my liking, but does a good job of detecting and configuring wifi/ethernet, existing partions/creating/detecting and a range of sound, video and hardware detection. It's in sh, but as far as shell scripts go this is pretty nice. They obviously know what they are doing. Here is the script: geexbox installator. --Rob 11:10, 6 Apr 2006 (NZST)
I wonder if we could make a peer/debian combo that you can save as a file onto a system over SCP, then run it an it installs a boot loader etc to install at least enough of our setup to be able to SSH back again. We could run it on the fucked redhat box :-) --Nad 11:44, 6 Apr 2006 (NZST)
Installing Debian on an existing Linux system, they set up a chroot-debian and configure that first, then install a boot-loader (which I think you can apt-get from your chroot :) --Nad
Looks like it could be a go-er. I think the index.php problem on wikiexpert is a minor issue though that should be able to be solved, Ive just not had time to look again --Sven 12:39, 6 Apr 2006 (NZST)
If it was a go-er getting it Debianised, we should check it out because that would be powerful shit to be able to get peers to do zero-down-time conversion of the entire OS with no more than SSH access! --Nad 12:48, 6 Apr 2006 (NZST)
NOTE: When a process is running and has an open file descriptor, that file can be rm'ed and the process will continue to function until the file is closed, at which point the file descriptor is closed and the file becomes really deleted. Because of this it should be possible to re-write the whole linux filesystem from a script, have it reboot, and on restart become another distro. --Rob 13:31, 6 Apr 2006 (NZST)
That would be nice --Sven 13:54, 6 Apr 2006 (NZST)

First attempt

I'm attempting a Debian chroot install on the wikiexpert server now in /debian. I coudln't use the normal instructions which use debootstrap because they all required partitions to be made, but we have only a /dev/vzfs device which can't be read or adjusted by fdisk etc.

  • http://twiki.iwethey.org/twiki/bin/view/Main/DebianChrootInstall - the instructions I'm working from
  • I had to use -o APT::Cache-Limit=16777216 in my apt-get update etc
  • FAILED: apt-get's are broken and won't load, don't know how to fix it...
  • I'm now testing what happens if we copy an existing working Debian file structure into the foreign environment and chroot into that instead of trying to build one from scratch...
  • /dev/vzfs means Virtuozzo VPS, instrunctions for installing Debian onto virtuozzo here (in German) (English translation)
  • http://wiki.openvz.org/Replace_distro - another doc specific to virtuozzo
  • I'm setting up a fully working debian in my closet/chroot
    • I had to apt-get remove --purge mysql-server-4.1, apache, php4-mysql and put them back again
    • MySQL still failed, but after running with --safe-mode I found that it was a missing /tmp with mode 777
  • The site is running under the Debian-chroot, but is not the primary OS (its on http://www.wikiexpert.com since that domain didn't move to closet)
    • The site is unable to update the database, but only from PHP it works normally logging in to mysql with the same access details

Second attempt

We couldn't use the methods given because there is no rescue system to boot into, and the kernel has been "hard-wired" with /sbin/init being the first point of access in the VPS environment after reboot. Our only option was to download a tar of a working Debian, chroot into it and get its networking and sshd working, then overwrite that structure directly over the redhat root while running.

The current system broke and won't boot. It was probably because of a partial kernel update remaining in apt-get, because we had successfully rebooted the server into the new Debian root structure before it broke.

Is this definately the case, or had it just become Debian after the copy, but hadn't been able to reboot?

Third attempt
  • Server successfully reprovisioned
  • Minimal debian-template created: template.tgz (20665 files occupying 295MB gzipped to 117MB)
  • System broke when /lib was moved to /redhat/lib

Forth attempt
  • Server successfully reprovisioned
  • Currently transferring template.tgz to reprovisioned wikiexpert server...
  • Copy all full root directories (non-mount-points) into /redhat except for /lib
  • Copy all the /debian directories into root except for /debian/lib
  • Use perl to swap the libs in a single command as follows:
perl -e "rename '/lib','/redhat/lib'; rename '/debian/lib','/lib';"
  • The first reboot is safest from the web admin console (using /sbin/shutdown crashes it, but /redhat/sbin/shutdown may have worked)
  • Debian Post Install has worked perfectly with no errors
  • MediaWiki editing works
  • Backup transferred and unpacked
  • Testing XmlWiki environment... ok
  • Setup and test peer operations... ok