Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] Migrating from Ubuntu to Gentoo
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
freke
l33t
l33t


Joined: 23 Jan 2003
Posts: 978
Location: Somewhere in Denmark

PostPosted: Mon Jul 13, 2015 6:30 pm    Post subject: [SOLVED] Migrating from Ubuntu to Gentoo Reply with quote

Hi,

I'm trying to install Gentoo on an PCEngines APU1D4 currently running Debian of an SDD.

I can boot Debian fine, then follow the handbook and install Gentoo on the HDD in the box - and chroot into that and configure it to my likings /trying to migrate an x86-server I cuurently have to this little APU1D4)
I have kernel and kernel-config from the installed Debian (3.13.0-55-generic) - the Gentoo I'm trying to setup is 4.0.5-gentoo.

I've so far been unable to boot into the Gentoo-environment, though.

The Debian boots via this menuentry in grub.cfg
Code:
menuentry 'Ubuntu' --class ubuntu --class gnu-linux --class gnu --class os $menu
entry_id_option 'gnulinux-simple-9fd0b9a2-9219-4505-9034-156ae2247479' {
        recordfail
        load_video
        gfxmode $linux_gfx_mode
        insmod gzio
        insmod part_msdos
        insmod ext2
        set root='hd2,msdos1'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd2,msdos1 --hint-efi=hd2,msdos1 --hint-baremetal=ahci2,msdos1  9fd0b9a2-9219-4505-9034-156ae2247479
        else
          search --no-floppy --fs-uuid --set=root 9fd0b9a2-9219-4505-9034-156ae2247479
        fi
        linux   /boot/vmlinuz-3.13.0-55-generic root=UUID=9fd0b9a2-9219-4505-9034-156ae2247479 ro  splash quiet $vt_handoff
        initrd  /boot/initrd.img-3.13.0-55-generic
}


How do I figure out the hdd no. and partition no/name used in the set root line? (i.e I'm now trying to boot with / on the HDD instead of SDD)
(When booted into the Debian-linux - dmesg shows the SDD as sda and the HDD as sdb)

I've tried booting into the Gentoo-root both with the debian-kernel and with a chroot-compiled 4.0.5-gentoo kernel but it stops right after the grub-screen - probably because the set root is wrong....

I guess I could try to move the chroot environment to the SDD root (keeping the working /boot + grub.cfg)?


Last edited by freke on Wed Jul 29, 2015 6:38 pm; edited 2 times in total
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


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

PostPosted: Mon Jul 13, 2015 6:44 pm    Post subject: Reply with quote

freke,

Show us the output of
Code:
fdisk -l
and tell what each partition is for.
Ideally, you should keep all your boot files in the same place - a single /boot.
You don't have to but as you can only have one bootloader per drive, it will help your sanity.
_________________
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
bstaletic
Apprentice
Apprentice


Joined: 05 Apr 2014
Posts: 253

PostPosted: Mon Jul 13, 2015 6:45 pm    Post subject: Reply with quote

Grub counts drives starting at zero, and partitions starting at 1. So your "setroot='hd2,msdos1'" line is the same as /dev/sdc1 using mbd, not gpt.
Back to top
View user's profile Send private message
schorsch_76
Guru
Guru


Joined: 19 Jun 2012
Posts: 450

PostPosted: Mon Jul 13, 2015 6:47 pm    Post subject: Reply with quote

You are not alone with such a board running gentoo.

I use syslinux to boot the kernel.
This is my syslinux.cfg
Code:
SERIAL 0 115200
CONSOLE 0

default Router

ALLOWOPTIONS 0
TIMEOUT 600

LABEL Router
   KERNEL vmlinuz-3.18.9-hardened-router console=ttyS0,115200n8
   initrd initramfs-genkernel-x86_64-3.18.9-hardened-router
   append rootfstype=ext4 root=/dev/ram0 real_root=/dev/sdb2 net.ifnames=0 console=tty0,115200n8 console=ttyS0,115200n8


My kernel command line:
Code:
cat /proc/cmdline
rootfstype=ext4 root=/dev/ram0 real_root=/dev/sdb2 net.ifnames=0 console=tty0,115200n8 console=ttyS0,115200n8 initrd=initramfs-genkernel-x86_64-3.18.9-hardened-router BOOT_IMAGE=vmlinuz-3.18.9-hardened-router


My disk layout:
Code:
fdisk -l /dev/sdb

Disk /dev/sdb: 55.9 GiB, 60022480896 bytes, 117231408 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xde8a8de8

Device     Boot  Start       End   Sectors  Size Id Type
/dev/sdb1  *      2048    264191    262144  128M 83 Linux
/dev/sdb2       264192 117231407 116967216 55.8G 83 Linux



My kernel config

I guess when you get the serial line running you are much further! :D I hope my infos help you :)
_________________
// valid again: I forgot about the git access. Now 1.2GB big. Start: 2015-06-25
git daily portage tree
Web: https://github.com/schorsch1976/portage
git clone https://github.com/schorsch1976/portage
Back to top
View user's profile Send private message
DONAHUE
Watchman
Watchman


Joined: 09 Dec 2006
Posts: 7651
Location: Goose Creek SC

PostPosted: Mon Jul 13, 2015 6:54 pm    Post subject: Reply with quote

http://manpages.debian.org/cgi-bin/man.cgi?query=update-grub&apropos=0&sektion=0&manpath=sid&format=html&locale=en
in debian, (if necessary, install and ) run os-prober then update-grub. See if a gentoo entry appears in the grub.cfg you have been using.
if no, write your own gentoo entry. not a big deal.
hd2 working in debian suggests bios sees at least 3 disks?
is the gentoo disk GPT or MBR?
_________________
Defund the FCC.
Back to top
View user's profile Send private message
freke
l33t
l33t


Joined: 23 Jan 2003
Posts: 978
Location: Somewhere in Denmark

PostPosted: Tue Jul 14, 2015 1:11 am    Post subject: Reply with quote

Wow - thanks for the feedback :)
Dunno where my head was when I posted though - not actually Debian - but an Ubuntu install, don't know why I got that mixed up.....

Quote:
Show us the output of
Code:
fdisk -l
and tell what each partition is for.
Ideally, you should keep all your boot files in the same place - a single /boot.
You don't have to but as you can only have one bootloader per drive, it will help your sanity.

Code:
root@ubuntu / # fdisk -l

Disk /dev/sda: 14.9 GiB, 16013942784 bytes, 31277232 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x000b0514

Device     Boot    Start      End  Sectors Size Id Type
/dev/sda1  *        2048 22951935 22949888  11G 83 Linux
/dev/sda2       22953982 31277055  8323074   4G  5 Extended
/dev/sda5       22953984 31277055  8323072   4G 82 Linux swap / Solaris

Disk /dev/sdb: 298.1 GiB, 320072933376 bytes, 625142448 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x90909090

Device     Boot     Start       End   Sectors  Size Id Type
/dev/sdb1  *         2048 419432447 419430400  200G 83 Linux
/dev/sdb2  *    419432448 625142447 205710000 98.1G 83 Linux


/dev/sda is the SDD with Debian currently installed / on sda1 - swap on sda5
/dev/sdb is the HDD where I'm doing my Gentoo install - / on sdb1 - will planning to delete sdb2 and create 4GB swap and a partition for /var and /tmp - ultimatively removing the SDD from the box.

Quote:
Grub counts drives starting at zero, and partitions starting at 1. So your "setroot='hd2,msdos1'" line is the same as /dev/sdc1 using mbd, not gpt.

That's my understanding, too - which is why hd2 for /dev/sda puzzles me a bit - and can I expect /dev/sdb to be hd3 then?


schorsch_76: Thanks - I've previously tried getting syslinux to boot my board, but a (working :)) syslinux.cfg, .config and commandline may do the trick, might try it ;)

DONAHUE: I agree hd2 would suggest at least 3 disks - I originally installed Ubuntu (14.04 server amd64) from an usb-stick - so when I installed there would have been 3 disks.


Will try fidling around with the system again tomorrow after work :)
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


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

PostPosted: Tue Jul 14, 2015 1:04 pm    Post subject: Reply with quote

freke,

Set the BIOS to boot from the HDD.
Get back into the chroot and set up gentoos grub on the MBR of the HDD.
You may need to do this again when you remove the SSD as the drive numbering may change.
Edit /etc/fsfab to suit.

Once this works, you switch backwards and forwards by swapping boot drives.

You can use the gentoo boot loader to boot debian/whatever too to save messing about in the BIOS until you remove the SSD
_________________
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
freke
l33t
l33t


Joined: 23 Jan 2003
Posts: 978
Location: Somewhere in Denmark

PostPosted: Tue Jul 21, 2015 5:25 pm    Post subject: Reply with quote

Sorry for taking my time to report back - I blame work :S

I decided to continue with NeddySeagoon's approach (thx btw :)) - I also decided to try a genkernel (because I suspected my kernel-options might be causing trouble).
I installed grub2 on the hdd - made some changes to grub.cfg to enable serial-console (ie. copied quite a bit from the Ubuntu-created grub.cfg)

et voilà - I was able to boot directly into the Gentoo-system :D

Now my next step will be to migrate from the genkernel to a manual-configured; In theory I should be able to grab /proc/config.gz and then disabling the modules I don't need - maybe compile the modules I need/want into the kernel, right?

Will I need to recreate the initramfs?
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


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

PostPosted: Tue Jul 21, 2015 5:55 pm    Post subject: Reply with quote

freke,

genkernel gives you a fully modular kernel witn nothing built in. All the modules go into the initrd.

With a handbook install you only need an initrd if you need a userspace program to mount root. Such cases are root on raid, root on LVM, mounting root by filesystem UUID.
There may be others. The general idea is that if the kernel binary needs no outside help to mount root, then no initrd is required.
This mean you need the partition code, the SCSI code, your HDD chipset driver and your root filesystem built into the kernel.
_________________
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
cwr
Veteran
Veteran


Joined: 17 Dec 2005
Posts: 1969

PostPosted: Tue Jul 21, 2015 7:14 pm    Post subject: Reply with quote

I generally boot both Ubuntu and Gentoo off a Gentoo-installed grub, and I've noticed that Ubuntu
(which boots off the second drive using a UUID) generally reverses drives 0 and 1 (/dev/sda and sdb)
with respect to Gentoo. That may be adding to the confusion.

Will
Back to top
View user's profile Send private message
freke
l33t
l33t


Joined: 23 Jan 2003
Posts: 978
Location: Somewhere in Denmark

PostPosted: Wed Jul 29, 2015 6:36 pm    Post subject: Reply with quote

Just wanted to report back that I've now successfully (I think:D) migrated my dns-/dhcp-/mail-server from my standard PC x86 hardware to the amd64 PC-Engines APU 1D4.

Thanks for the feedback/pointers; I managed to boot using a genkernel, modify the grub.cfg with some additional info (ie. serial line settings) from the Ubuntu grub.cfg - later migrated to a handmade kernel 4.0.5 (http://codepad.org/vhb4A1ue) thanks to the kernel config provided here :)

So that's some 300-400 kWh of my yearly electricity-bill :) - power isn't free here in Denmark - so if the APU lives for a couple of years I'm satisfied :)

Now I'm debating with myself if I want to remove the SSD all together(currently everything is installed on the HDD (sdb1), or moving / (except /var, /tmp, /opt - any problems in doing so with eudev?) to the SDD...
Also with 4GB I expect I need swap for some packages... might keep that on SSD or is that plain dumb?

I also need to edit some of the /etc/grub.d/ to keep/get serial output during/after grub-boot - but for now I'm happy :D

[edit]
In case anyone should stumble across this looking for some grub2-configuration I figured out I needed:
Code:
GRUB_TERMINAL=serial
GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1"
GRUB_GFXPAYLOAD_LINUX=text

in /etc/default/grub - now grub2-mkconfig creates a working grub.cfg :D
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