Convert from Ubuntu to Debian LIVE
The following will walk you through setting up a chroot on your live system, updating it to include the software you need to replace your live system, overwriting your live system, and rebooting into your new Debian based system.
The debian base debian system will be set up via debootstrap.
export $CHROOT=/path_to_chrootapt-get install debootstrap
You are ready to run debootstrap This command will take a while as it is downloading and installing a base system. Sit back and relax.
Installing the chroot with debootstrap
sudo debootstrap --arch amd64 sid $CHROOT http://http.debian.net/debian/
You will need to determine what your systems architecture is, you can do this by executing uname -p
Entering the chroot
In this section mount points will be set up to refer to similar places on your current live system. These are mainly pseudo filesystems like proc, sysfs, etc. Instead of mounting them manually inside of the chroot a mount bind is used for persistence.
Perform the following as root.
sudo mount --bind /proc $CHROOT/proc
sudo mount --bind /sys $CHROOT/sys
sudo mount --bind /dev $CHROOT/dev
sudo mount --bind /dev/pts $CHROOT/dev/pts
sudo mkdir $CHROOT/old_root
sudo mount --bind / $CHROOT/old_root
# Copy files over to the chroot
sudo cp /etc/resolv.conf $CHROOT/etc/resolv.conf
sudo cp /etc/fstab $CHROOT/etc/
Get the packages from your old system and install them on your "new" install
sudo dpkg --get-selections | sudo tee $CHROOT/packages
Enter the chroot
sudo chroot $CHROOT
Installing and setting up the new system
This section walks you through updating your system to look as similar as possible to the previous system you had set up. This can be skipped if you arrived here looking for a way to overwrite your live system using any sort of chroot (stage3 gentoo, fedora chroot etc), you may skip this section.
*At this stage you should be inside the CHROOT.
Install dselect and initialize its database
apt-get install dselect
dselect update
Now, take a moment to look at the packages file we created in the root of your sysroot /packages. Packages that no longer are necessary or undesired can be removed from this file.
Ubuntu uses a different init system, upstart, than Debian, sysvinit. To ensure that upstart does not remove sysvinit find the line in packages that says:
upstart install
Remove it.
After saving any modifications to packages, it is time to use the package file to set packages to install.
Still in the CHROOT
dpkg --set-selections < packages 2> dead_packages
dead_packages are packages that did not match up with any of the available packages in debian.
They are identified by lines like:
dpkg: warning: package not in database at line 653: libppl-c2
These are packages worth noting for later so they can be installed by hand.
Run the dselect upgrade command and wait for all the packages to be installed:
apt-get dselect-upgrade
Daemons not starting
After the dselect-upgrade has completed a number of daemons will most likely not be able to start. You have two options, remove the daemons for now or iteratively disable the daemons on the currently live system so the ports are available for the newly installed ones to start.
To iterate over the items that need repair use apt-get -f install. The process is more or less.
- Find daemon with a problem (mysql)
- Stop daemon on live system (/etc/init.d/mysqld stop)
- Continue apt upgrade process in chroot (apt-get -f install)
Example of what this may look like:
Errors were encountered while processing:
mysql-server-5.5
mpd
mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
Configuring your Chroot
In order to be able to use the newly created live system a few things will need to be set up properly.
- A kernel and bootloader need to be present
- Networking needs to be set up
- User account/root password
Install a kernel and a bootloader
If you used the dselect upgrade method above a bootloader is most likely already installed, however, chances are low that a kernel is installed.
apt-get install linux-image-amd64 grub
Notice the amd64, again pay attention to the architecture you want to install.
Setup a root password/Addusers
Users need to be set up so that the new debian system is accessible once booted. It is not necessary to add users now but at the very least a root password needs to be set.
In the chroot the default user is ‘root’ run passwd to set up a password
To add users use adduser <username>
Setting up networking
debootstrap by default will not setup networking and a server without networking is of little help when the machine is remote.
Add the following to /etc/network/interfaces
auto eth0 allow-hotplug eth0
iface eth0 inet dhcp
If the default ethernet device is not eth0 replace it with the proper device. If you are unsure run ifconfig or ip link show on the current system and look for your current IP Address.
***Make sure openssh-server is installed on the system.
Taking over the live system
The majority of distros are not exactly binary compatible so it is not possible to simply move part of the sysroot out of the way. All of this has to be done at the same time via the chroot.
Remember the old system is mounted in the chroot under $CHROOT/old_system, this was performed above in the Entering the Chroot section.
Once these steps are started it is difficult to turn back.
mkdir old_root/old && cd old_root && mv * old
The above mv command will not complete without a few failures or warnings like
mv: cannot move 'sys' to 'old/sys': Device or resource busy, this is OK. The directories are used by the new system and it is due to a FS or PseudoFS being mounted on that location.
Now copy the new system over, this is still within the chroot!
cd / ; rsync -a bin boot debian dead_packages etc initrd.img lib lib32 libx32 lib64 media mnt opt packages root sbin var vmlinuz run usr var vmlinuz old_root/
*Note: You may see errors about rsync not being able to link_stat some files. This can safely be ignored.
Finalizing
Make sure your fstab points at the proper system.
install grub on your device
/usr/bin/grub-install /dev/sda
Regenerate grub’s config
/usr/sbin/update-grub
That’s it, reboot your system and hope for the best. If you get stuck somewhere post a comment and I’ll help where I can.
Potential problems
Q. When entering the chroot the old_root was not available?If this happens you can mount the root device within the chroot as if it is a normal block device
mount /dev/sda1 /old_root
Where /dev/sda1 is the root device from your currently booted system.
Casino-Barcelona - Mapyro
ReplyDeleteCasinos 강원도 출장안마 and lounges. Casinos. The 파주 출장샵 Casino-Barcelona 용인 출장안마 Forum at Casino-Barcelona. 4 Comments. 0 Comments. See more Info. 공주 출장샵 Online 안성 출장마사지 Casino:.
yozgat
ReplyDeletesivas
bayburt
van
uşak
İ71GPB
uşak evden eve nakliyat
ReplyDeletebalıkesir evden eve nakliyat
tokat evden eve nakliyat
kayseri evden eve nakliyat
denizli evden eve nakliyat
6D8TE
D3238
ReplyDeleteÇerkezköy Marangoz
Adıyaman Parça Eşya Taşıma
Isparta Parça Eşya Taşıma
Antalya Evden Eve Nakliyat
Edirne Evden Eve Nakliyat
Ordu Şehir İçi Nakliyat
Elazığ Şehir İçi Nakliyat
Tunceli Şehirler Arası Nakliyat
Sinop Parça Eşya Taşıma
3D565
ReplyDeleteAdana Lojistik
Batıkent Parke Ustası
Yenimahalle Parke Ustası
Rize Parça Eşya Taşıma
Yalova Parça Eşya Taşıma
Samsun Şehirler Arası Nakliyat
Edirne Şehir İçi Nakliyat
Mersin Şehirler Arası Nakliyat
Ardahan Şehirler Arası Nakliyat
4CBE3
ReplyDeletenevşehir görüntülü sohbet kızlarla
mobil sohbet et
bingöl sesli sohbet siteler
çanakkale tamamen ücretsiz sohbet siteleri
muğla mobil sesli sohbet
maraş kadınlarla sohbet
amasya sesli sohbet siteleri
çanakkale canlı görüntülü sohbet siteleri
afyon rastgele görüntülü sohbet
73910
ReplyDeletekadınlarla görüntülü sohbet
antep telefonda rastgele sohbet
telefonda sohbet
kırklareli canlı sohbet odaları
kocaeli kadınlarla ücretsiz sohbet
canli sohbet bedava
adana bedava görüntülü sohbet
bilecik bedava sohbet siteleri
artvin görüntülü sohbet yabancı
5CCE6
ReplyDeleteCoin Çıkarma
Bitcoin Üretme Siteleri
Caw Coin Hangi Borsada
Instagram Beğeni Hilesi
Coin Nasıl Üretilir
Facebook Takipçi Hilesi
Bitcoin Kazanma
Tiktok İzlenme Satın Al
Facebook Sayfa Beğeni Hilesi
04E6B
ReplyDeleteTumblr Takipçi Hilesi
Big Wolf Coin Hangi Borsada
Binance Referans Kodu
Soundcloud Reposts Satın Al
Görüntülü Sohbet
Kripto Para Üretme
Bitcoin Para Kazanma
Facebook Sayfa Beğeni Satın Al
Coin Kazma Siteleri
D9AB7
ReplyDeleteTorbalı
Alaplı
Yakutiye
Baykan
Kızılören
İzmir
Sur
Eyyübiye
Maltepe
E0BE453263
ReplyDeletedüşmeyen takipçi
F161747AF7
ReplyDeletetakipci satin alma instagram
14E6582678
ReplyDeletedusmeyen takipçi satın al
tiktok takipci satin al
Uygulamalar Optimize Ediliyor Ne Demek
Kripto Para Nasıl Alınır
En Güvenilir Vpn Uygulaması
Bora Bora Adaları Nerede
instagram takipci satin al
Binance Referans Kimliği
Google İşletme Yorum Satın Al