Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Copy Gentoo Linux installation from Virtualbox to actual mac
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
vysakhp
n00b
n00b


Joined: 13 Apr 2020
Posts: 6

PostPosted: Mon Apr 13, 2020 7:28 am    Post subject: Copy Gentoo Linux installation from Virtualbox to actual mac Reply with quote

Hi

I have an MSI GL63 laptop (Core i7 8750h, 16 GB RAM, Samsung 970 Evo 250 GB SSD, 1 TB HDD and Nvidia GTX 1060 mobile).

Currently I have started installing Gentoo Linux on Virtualbox. My cflags are "-march=native -O2 -pipe". I don't have broadband connection and I am relying on mobile data ( maximum speed which I got is 18 Mbps :cry: ).

Currently I have Windows 10, Ubuntu 18.04 and Clear Linux installed on my SSD.

I want to know if it is possible to copy the Gentoo Linux installation from Virtualbox to my actual machine? I believe that I have to make changes to fstab and may be compile Nvidia drivers to kernel ( please correct me if I am wrong) and make changes to existing GRUB2 configuration. I am planning to shrink the Clear Linux partition (maybe install Gentoo Linux by removing Clear Linux).

I really want to do this since my internet connection is much slow.

Thanks is advance
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54300
Location: 56N 3W

PostPosted: Mon Apr 13, 2020 10:45 am    Post subject: Reply with quote

vysakhp,

Virtualbox will emulate some hardware for your Gentoo guest install.
This will be nothing like your real Mac hardware.

In addition to the things you listed, you will need to rebuild the kernel to support both the emulated hardware and your real hardware.
Then it will work in both places.

A few things before you get started.

Do you want to keep Windows?

Windows can support guest networking in Virtualbox.
It will be much easier to fix your network issue that to migrate your install to the real hardware.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
vysakhp
n00b
n00b


Joined: 13 Apr 2020
Posts: 6

PostPosted: Mon Apr 13, 2020 11:19 am    Post subject: Reply with quote

Thank you NeddySeagoon.

I want to keep Windows 10. But I am ready to remove Clear Linux. I am okay with rebuilding kernel. Only thing is that I don't want to download everything from the beginning and compiling from sources.

Once again thank you very much for your reply.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54300
Location: 56N 3W

PostPosted: Mon Apr 13, 2020 12:05 pm    Post subject: Reply with quote

vysakhp,

All the downloads you need to rebuild your install are in your distfiles directory unless you remove them.
They are never auto cleaned. If you didn't know that you will have every distfile that gentoo has ever downloaded still.
You can save the distfiles in case of accidents.

Code:
eclean distfiles
will remove all the distfiles that were fetched for ebuilds no longer in your repo, so you can,t need them anyway.
Code:
eclean -d distfiles
will remove all the distfiles that you have but are not required to rebuild your existing install.

-- edit --

To copy your install, you need to make a tarball of it first. This process is called making a stage4.
Google will tell you how to do it but there in a twist for you.
You cannot make a stage4 from your Gentoo while its running.

Exactly how you get started on creating a stage4 depends on where your Gentoo filesystem is.
It can be in a partition on the host drive, in a logical volume on the host drive or in a file on the host filesystem.

-- edit 2 --

I don't understand how moving from Virtualbox to a bare metal install will make your network faster.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
vysakhp
n00b
n00b


Joined: 13 Apr 2020
Posts: 6

PostPosted: Mon Apr 13, 2020 1:42 pm    Post subject: Reply with quote

Hi NeddySeagoon

I just don't want to redo all the downloading and compiling again because it is going to take a lot of time. Also kindly note that I don't expect the network to get faster on bare metal. Anyway if recompiling kernel is unavoidable then I will do it but recompiling each and every package is a really time consuming process and I don't want to do it. :D

Also kindly tell me if it is possible to shutdown the laptop during the installation. I was able to pause the virtual machine during the installation.

Thank you for your time.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54300
Location: 56N 3W

PostPosted: Mon Apr 13, 2020 2:05 pm    Post subject: Reply with quote

vysakhp,

Yes, its possible to shutdown during installation. You shouldn't need to if you do the stage4 though.

During the course of your Gentoo install, you partitioned the drive, made filesystems on the partitions, downloaded a stage3 and eventually did
Code:
chroot /mnt/gentoo /bin/bash
so that you could perform the install in the embryonic Gentoo install.
Hold that thought about chroot.

Once in the chroot, everything you do is preserved on the HDD. To get back into the chroot, skip partitioning, making filesystems and downloading. Those steps are destructive.
Mount your partitions at /mnt/gentoo
You will need to copy /etc/resolv.conf into the chroot or you network may not work inside the chroot, then
Code:
chroot /mnt/gentoo /bin/bash
to get back to your Gentoo install in progress.
It will be as you left it.

That's not quite as easy as pausing a virtual machine.

If you follow the stage4 instructions, you will unpack your entire existing install to /mnt/gentoo, then chroot into it to fix the things we have already discussed.
You will only need to get back into the chroot if your install does not boot and you need to fix it.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
vysakhp
n00b
n00b


Joined: 13 Apr 2020
Posts: 6

PostPosted: Tue Apr 14, 2020 3:45 am    Post subject: Reply with quote

Hi NeddySeagoon

I will inform you after finishing the installation in Virtualbox.

Thank you for your reply.
Back to top
View user's profile Send private message
vysakhp
n00b
n00b


Joined: 13 Apr 2020
Posts: 6

PostPosted: Wed Apr 15, 2020 4:43 pm    Post subject: Reply with quote

Hi NeddySeagoon

I managed to install Gentoo Linux on my laptop without GUI. I have also logged in but now I can't access internet. By the way, I had accessed the internet from my android phone via usb tethering only. I remember adding network and usb support to kernel (version 5.4). I have also added drivers for Intel wifi as a backup option.

While using the installation medium, the name of usb interface was something like "enps20f0u1" (don't remember the exact name) and I have the same interface name to /etc/conf.d/net with dhcp enabled.

Since there is no internet access for the installation, should I recompile a new kernel with usb tethering support using installation medium as mentioned in https://wiki.gentoo.org/wiki/Android_USB_Tethering?

Also I would like to know how to disable Nvidia GPU (mine is an Optimus enabled laptop)while using Gentoo Linux.

Thanks in advance
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54300
Location: 56N 3W

PostPosted: Wed Apr 15, 2020 6:34 pm    Post subject: Reply with quote

vysakhp,

You should not need USB tethering for internet access.
Virtualbox will allow you to share the hosts network connection.

With the guest shut down, in the Virualbox configuration for the guest, there is a list of networking options.
I think it says None, Host only, Bridge and NAT. My Virtualbox is broken right now,
Anyway, None or Host only are not what you want. Try the other two.

You don't say how you configured your kernel but unless you made changes yourself, tethering will not be supported.

The network name enps20f0u1 varies with the USB port you connect to.
That's one of the downsides of 'persistent device naming'. Its broken for a single device not always connected to the same USB port.
The name will be in
Code:
ifconfig -a
if the kernel knows about the interface.

To use the nvidia GPU in an optimus system, you must set it up.
That's not something you will do by accident.
If you are concerned about battery life, disable it in the BIOS.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
vysakhp
n00b
n00b


Joined: 13 Apr 2020
Posts: 6

PostPosted: Thu Apr 16, 2020 5:48 am    Post subject: Reply with quote

Hi NeddySeagoon

As mentioned in my previous post I have installed Gentoo Linux on bare metal itself. USB tethering was working fine while using the installation.

I have followed the Gentoo Handbook and configured the kernel via 'make menuconfig' command. I have added network drivers and usb drivers from the menu. As mentioned in my previous post, I have added the usb tethering interface (it is not eth0) to "/etc/conf.d/net". I ran "ifconfig -a" command and it showed only loopback interface.

Should I recompile kernel or install genkernel using installation media to get internet access?

Thank you for your time.
Back to top
View user's profile Send private message
Vulgar
n00b
n00b


Joined: 15 Sep 2004
Posts: 63

PostPosted: Thu Apr 23, 2020 10:36 pm    Post subject: Reply with quote

If you have Gentoo installed, and is the only OS running, you will need to enable the capability in the kernel as outlined in the wiki page you posted earlier

https://wiki.gentoo.org/wiki/Android_USB_Tethering

Running Genkernel will most probably build what is needed. But since you already have a working kernel manually configured. Simply adding what is needed for tethering would the fastest.

I recently had to add tethering due to an outage. Following the tethering page worked for me.
Back to top
View user's profile Send private message
figueroa
Advocate
Advocate


Joined: 14 Aug 2005
Posts: 2965
Location: Edge of marsh USA

PostPosted: Fri Jul 10, 2020 9:27 pm    Post subject: Reply with quote

Although this is an old thread, yes, you can make a tarball of your running VirtualBox Gentoo installation and unpack it into a free unused partition. You will, in particular need to edit /etc/fstab to match the disk layout of the actual machine. Other changes depend on how you customized your VirtualBox-Gentoo to match the VirtualBox hardware. If you don't have a very generic kernel, you'll need to rebuild the kernel customized for your actual box's hardware. You can build the kernel so it would support both the virtual and actual hardware.

You can be very sophisticated in making the tarball so that it does not contain files you don't need it to contain, i.e. /proc/*, /sys/*, /tmp/* your portage distfiles (in the script below my distfiles are at the new default /var/cache/distfiles so you would exclude /var/cache/distfiles/*). Use exclude files to list what you don't want to include in the tarball.

I actually do this to make system backups of a running system, making a collection of mini tarballs with a script as follows, which would have to be tailored to match your actual layout.

You'll note that I have a personal script directory in /scratch/bin (/scratch is where most of my actual personal files are located, symlinked to /home/username/dir
Code:

#!/bin/sh
#gentoo2bak.scr
mount /mnt/backup0
cd /
tar cpzf /mnt/backup0/sysbak/bin.tgz --xattrs --numeric-owner bin/
tar cpzf /mnt/backup0/sysbak/boot.tgz --xattrs --numeric-owner boot/
tar cpzf /mnt/backup0/sysbak/dev.tgz --xattrs --numeric-owner dev/
tar cpzf /mnt/backup0/sysbak/etc.tgz --xattrs --numeric-owner etc/
tar cpf /mnt/backup0/sysbak/home.tar --xattrs --numeric-owner --no-recursion -X /scratch/bin/exclude.home2 home/*
tar cpzf /mnt/backup0/sysbak/lib.tgz --xattrs --numeric-owner lib/
tar cpzf /mnt/backup0/sysbak/lib64.tgz --xattrs --numeric-owner lib64/
tar cpf /mnt/backup0/sysbak/media.tar --xattrs --numeric-owner --no-recursion media/*
tar cpf /mnt/backup0/sysbak/mnt.tar --xattrs --numeric-owner --no-recursion mnt/*
tar cpzf /mnt/backup0/sysbak/opt.tgz --xattrs --numeric-owner opt/
tar cpf /mnt/backup0/sysbak/proc.tar --xattrs --numeric-owner --no-recursion proc/
tar cpzf /mnt/backup0/sysbak/root.tgz --xattrs --numeric-owner root/
tar cpf /mnt/backup0/sysbak/run.tar --xattrs --numeric-owner --no-recursion run/
tar cpzf /mnt/backup0/sysbak/sbin.tgz --xattrs --numeric-owner sbin/
tar cpf /mnt/backup0/sysbak/sys.tar --xattrs --numeric-owner  --no-recursion sys/
tar cpf /mnt/backup0/sysbak/tmp.tar --xattrs --numeric-owner --no-recursion tmp/
tar cpzf /mnt/backup0/sysbak/var.tgz --xattrs --numeric-owner -X scratch/bin/exclude.var var/
cd
umount /mnt/backup0


My well populated system backup comes to 4 GB. Your mileage may vary. Some of my other systems backup to more like 2 GB.
_________________
Andy Figueroa
hp pavilion hpe h8-1260t/2AB5; spinning rust x3
i7-2600 @ 3.40GHz; 16 gb; Radeon HD 7570
amd64/23.0/split-usr/desktop (stable), OpenRC, -systemd -pulseaudio -uefi
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum