Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[Solved] Moving a system to external USB drive
View unanswered posts
View posts from last 24 hours

Goto page 1, 2  Next  
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
creaker
l33t
l33t


Joined: 14 Jul 2012
Posts: 651

PostPosted: Sun Oct 05, 2014 5:47 pm    Post subject: [Solved] Moving a system to external USB drive Reply with quote

Hi!
Trying to move my current system to external USB drive.
System was packed in stage4 recently and now I've extracted it to external hdd.
The system itself is OK, I attached hdd to sata port directly and successfully booted.
The thing is I can't boot it over USB, when hdd sits in enclosure. During startup I'm getting it hanging for about a 9 seconds (at 2.3436) and it completely stops at this screen:
http://i.imgur.com/KFOW79R.jpg
What may cause a stop?

Thanks.


Last edited by creaker on Mon Oct 06, 2014 9:30 pm; edited 1 time in total
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 7132
Location: almost Mile High in the USA

PostPosted: Sun Oct 05, 2014 5:55 pm    Post subject: Reply with quote

Are you using initramfs?

Something similar happens to me when my initramfs didn't allow enough time to detect the USB disks which takes a while to enumerate, the mount fails, and it then drops to the emergency shell (so if you press enter you get the busybox prompt in initramfs).

I also have a similar external case that's eSATA+USB, the USB requires the root wait delay where the eSATA does not.
_________________
Intel Core i7 2700K@ 4.1GHz/HD3000 graphics/8GB DDR3/180GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
creaker
l33t
l33t


Joined: 14 Jul 2012
Posts: 651

PostPosted: Sun Oct 05, 2014 6:09 pm    Post subject: Reply with quote

Thanks for reply.
I do not use initramfs. Regarding a delay for root I'm aware of it. Grub menu has an rootwait option to wait for getting device ready:

Code:
menuentry 'Gentoo Linux-3.14.14-Live'  {
   load_video
   insmod gzio
   set root='hd0,msdos1'
   linux   /boot/kernel-3.14.14-gentoo-1 rootwait root=PARTUUID=4273a309-01 ro net.ifnames=0 vga=791
}


May be I have to activate some USB-related modules in kernel?
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


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

PostPosted: Sun Oct 05, 2014 8:15 pm    Post subject: Reply with quote

creaker,

You will need all the USB support for your USB hubs built in along with USB storage.
Its also in the initrd but that doesn't help as USB is not nornally started until after root is mounted.
_________________
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
creaker
l33t
l33t


Joined: 14 Jul 2012
Posts: 651

PostPosted: Sun Oct 05, 2014 9:09 pm    Post subject: Reply with quote

NeddySeagoon
OK, I'm going to build kernel with genkernel. Anyway this installation tends to be liveUSB, so it maybe a good reason to run genkernel.
Back to top
View user's profile Send private message
creaker
l33t
l33t


Joined: 14 Jul 2012
Posts: 651

PostPosted: Sun Oct 05, 2014 10:37 pm    Post subject: Reply with quote

Yes it helped, genkernel built kernel with tons of modules, on of them seems was missed. System boots with some minor issues: kernel refuses to mount root partition by UUID (though I have initramfs built as well) and invites me to type correct root device. Hitting "Enter" causes autodetection and mounting "real_root=/dev/sdc1". The rest of boot process going smoothly. I checked UUID twice.
How do I force mounting by UUID?
Back to top
View user's profile Send private message
DONAHUE
Watchman
Watchman


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

PostPosted: Mon Oct 06, 2014 2:39 am    Post subject: Reply with quote

try adding rootdelay=30 to the kernel commandline. 30 should be excessive, if it works you can reduce it, if it doesn't .....
the usb drive may need some time to "settle" before root can mount
_________________
Defund the FCC.
Back to top
View user's profile Send private message
creaker
l33t
l33t


Joined: 14 Jul 2012
Posts: 651

PostPosted: Mon Oct 06, 2014 7:10 am    Post subject: Reply with quote

Tried it, doesn't help. Replacing boot parameter to real_root doesn't help as well.
Seemes it's some kind of eudev issue. When boot stopped I went to shell to check /dev. ls doesn't show /dev/disk there. I think it should be there at that moment.
Back to top
View user's profile Send private message
DONAHUE
Watchman
Watchman


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

PostPosted: Mon Oct 06, 2014 7:17 am    Post subject: Reply with quote

maybe config_mount_devtmpfs in kernel?
_________________
Defund the FCC.
Back to top
View user's profile Send private message
creaker
l33t
l33t


Joined: 14 Jul 2012
Posts: 651

PostPosted: Mon Oct 06, 2014 8:00 am    Post subject: Reply with quote

How do I set CONFIG_DEVTMPFS_MOUNT? I tried to set it to "y", but genkernel just drops .config and starts with template that hasn't this option set.
In addition tried rootfstype boot option, tried to switch to real_root=/dev/sdc1, to real_root=LABEL=USB, but still no luck.
Have to try to build kernel with make.
Back to top
View user's profile Send private message
Roman_Gruber
Advocate
Advocate


Joined: 03 Oct 2006
Posts: 3806
Location: Austro Bavaria

PostPosted: Mon Oct 06, 2014 8:04 am    Post subject: Reply with quote

creaker wrote:
How do I set CONFIG_DEVTMPFS_MOUNT? I tried to set it to "y", but genkernel just drops .config and starts with template that hasn't this option set.
In addition tried rootfstype boot option, tried to switch to real_root=/dev/sdc1, to real_root=LABEL=USB, but still no luck.
Have to try to build kernel with make.


well you can create a kenrel config and pass it on to genkernel. I think those settings are hidden in the gentoo needed features introduced in gentoo-sources. WE have a new kernel setting near the top of the gentoo-sources which should set those.
Back to top
View user's profile Send private message
creaker
l33t
l33t


Joined: 14 Jul 2012
Posts: 651

PostPosted: Mon Oct 06, 2014 8:20 am    Post subject: Reply with quote

Built it with make.
Code:
localhost ~ # zcat /proc/config.gz | grep DEVTMPFS
CONFIG_DEVTMPFS=y
CONFIG_DEVTMPFS_MOUNT=y

Doesn't help much. DEVTMPFS isn't a causer.
When boot stops should /dev /dev/disk /dev/disk/by-label be presented already?
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


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

PostPosted: Mon Oct 06, 2014 4:56 pm    Post subject: Reply with quote

creaker,

Mounting by UUID works only if the kernel can see the HDD. None of /dev /dev/disk /dev/disk/by-label are required.
Think about it. /dev is on root so it cannot be accessed until after root is mounted.
I have a static /, so /dev/disk /dev/disk/by-label and so on never exist but mounting by UUID still works.

The USB HCD options and USB starage must be built in an root is normally mounted before USB is started.
Thats an issue for root on USB.
_________________
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
creaker
l33t
l33t


Joined: 14 Jul 2012
Posts: 651

PostPosted: Mon Oct 06, 2014 9:19 pm    Post subject: Reply with quote

NeddySeagoon

thanks for hint, it was really hcd issue, selected them both (ehci_hcd & xhci_hcd) as built-in, it solved a problem.
Back to top
View user's profile Send private message
creaker
l33t
l33t


Joined: 14 Jul 2012
Posts: 651

PostPosted: Tue Oct 07, 2014 2:36 am    Post subject: Reply with quote

Next step is getting it bootable on other machines.
Two questions:
1. Is it enough to remove -march=native option from make.conf (and rebuild system) to get code with generic instructions set only? In order to get it working with other CPUs (preventing "illegal instructions" error).
2. Is it enough to specify few video drivers (e.g. VIDEO_CARDS="nouveau radeon vesa via") on system rebuild? Will appropriate module being loaded/used depending on current video card? Or should it be selected/switched by script?
Back to top
View user's profile Send private message
Roman_Gruber
Advocate
Advocate


Joined: 03 Oct 2006
Posts: 3806
Location: Austro Bavaria

PostPosted: Tue Oct 07, 2014 5:20 pm    Post subject: Reply with quote

creaker wrote:
Next step is getting it bootable on other machines.
Two questions:
1. Is it enough to remove -march=native option from make.conf (and rebuild system) to get code with generic instructions set only? In order to get it working with other CPUs (preventing "illegal instructions" error).
2. Is it enough to specify few video drivers (e.g. VIDEO_CARDS="nouveau radeon vesa via") on system rebuild? Will appropriate module being loaded/used depending on current video card? Or should it be selected/switched by script?


i think there was an article on the gentoo wiki about the make.conf.

well if you build it for i686 it is generally for everything but I think thats for 32 bit.

core2 I think is for penryn and upwards but only for intel. you better check the gentoo wiki or there was a section in the handbook about it.

2) well i think you need to specify which video-cards in the make.conf. i never tried this but you may look on how the gentoo live-cd is build, this is a general load everywhere disk. you may find your answer there. sysrescuecd is also gentoo based. you maybe find a tutorial how to do that in particular than.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


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

PostPosted: Tue Oct 07, 2014 5:45 pm    Post subject: Reply with quote

creaker,

Use -mtune=generic and leave -march unset for 64bit.
Don't forget to rebuild the kernel too.

32 bit is a bit more difficult and it depends how far back you want to go anu if you need the toolchian to work on the old hardware.

eg. a K6-2 is i586, so to get back there on a i686 install, you need -march=pentium.
However your CHOST, which is used to build the toolchain will still be i686, so it won't run on anything less.
You can change the CHOST on a 32 bit install but thun you are doing a stage1.
Again, don't forget 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
creaker
l33t
l33t


Joined: 14 Jul 2012
Posts: 651

PostPosted: Tue Oct 07, 2014 6:43 pm    Post subject: Reply with quote

Well, I've booted Gentoo LiveDVD, CFLAGS and CXXFLAGS are set to "-O2 -pipe" there. Seemingly it will be correct to have
Code:
CFLAGS="-mtune=generic -O2 -pipe"
CXXFLAGS="${CFLAGS}"
CHOST="x86_64-pc-linux-gnu"

I do not plan to use it at old machines, almost all of them at least has basic 64bit instructions set.

However I didn't see how do I instruct genkernel to use these options. I see only --makeopts available as command line parameters for genkernel. Will genkernel pick CFLAGS e.t.c. from make.conf when building kernel or have I to specify these flags separately? If so how do I do it? I just do not see any options in genkernel help message.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


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

PostPosted: Tue Oct 07, 2014 7:21 pm    Post subject: Reply with quote

creaker,

Look in make menuconf. I think genkernel always uses generic in the CPU selection.
--menuconf is a genkernel command line option so you can look before the build starts.

There may only be a single - there. Try genkernel --help
_________________
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
creaker
l33t
l33t


Joined: 14 Jul 2012
Posts: 651

PostPosted: Tue Oct 07, 2014 7:53 pm    Post subject: Reply with quote

make menuconfig upon .config that was created by genkernel shows "Generic-x86-64" for "Processor type and family" option:
Code:
CONFIG_GENERIC_CPU:                                                               
   Generic x86-64 CPU.                                                                                                   
   Run equally well on all x86-64 CPUs.                                                                   
   Symbol: GENERIC_CPU [=y]                                                                                             
   Type  : boolean                                                                                                       
   Prompt: Generic-x86-64
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


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

PostPosted: Tue Oct 07, 2014 8:26 pm    Post subject: Reply with quote

creaker,

The kernel is already generic then.
_________________
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
creaker
l33t
l33t


Joined: 14 Jul 2012
Posts: 651

PostPosted: Tue Oct 07, 2014 8:33 pm    Post subject: Reply with quote

Yes, I can boot with it till login, but failed to log in due to illegal instructions error. Have to rebuild entire the system (excluding kernel), but emerge refuses to do it.
Code:
emerge --pretend --update --deep --with-bdeps=y --newuse @world
These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild     U  ] sys-libs/timezone-data-2014f [2014d] USE="-right_timezone%"
[ebuild     U  ] dev-perl/Text-CharWidth-0.40.0-r1 [0.40.0]
[ebuild     U  ] dev-perl/Text-WrapI18N-0.60.0-r1 [0.60.0]
[ebuild     U  ] app-portage/genlop-0.30.9-r1 [0.30.8-r2]
[ebuild     U  ] app-shells/bash-4.2_p52 [4.2_p45]
[ebuild     U  ] sys-apps/less-458 [457]
[ebuild   R    ] app-emulation/emul-linux-x86-qtlibs-20140508-r1  USE="(-mng%)"
[ebuild     U  ] app-office/libreoffice-l10n-4.2.6.3-r1 [4.2.5.2]
[ebuild   R   ~] games-strategy/0ad-0.0.16_alpha-r2  USE="-sound*"
[ebuild     U  ] sys-devel/make-4.0-r1 [3.82-r4] USE="-guile%"
[ebuild     U  ] dev-libs/libgpg-error-1.13 [1.12] ABI_X86="(64%*) (-32) (-x32)"
[ebuild     U  ] dev-perl/Locale-gettext-1.50.0-r1 [1.50.0]
[ebuild     U  ] sys-boot/grub-2.02_beta2-r2 [2.02_beta2] GRUB_PLATFORMS="-loongson%"
[ebuild     U  ] app-text/po4a-0.45 [0.42]
[ebuild     U  ] sys-apps/dbus-1.8.8 [1.8.6]
[ebuild     U  ] sys-fs/eudev-1.10-r2 [1.9-r2]
[ebuild     U  ] net-print/cups-1.7.5 [1.7.3]
[ebuild     U  ] app-crypt/gnupg-2.0.26 [2.0.25]
[ebuild     U  ] dev-vcs/git-2.0.4 [1.8.5.5]
[ebuild     U  ] app-office/libreoffice-bin-4.2.6.3 [4.2.5.2]
[ebuild     U  ] www-plugins/adobe-flash-11.2.202.406 [11.2.202.400]
[ebuild  N     ] kde-base/kactivities-4.12.5  USE="(-aqua) -semantic-desktop"


Only 22 packages to rebuild though I made a CFLAGS changes. It's pretty wrong that only these 22 uses extended CPU instructions.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


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

PostPosted: Tue Oct 07, 2014 9:01 pm    Post subject: Reply with quote

creaker,

You need to do the build on a system that understands the illegal instructions.
You can't move the HDD to another system, then do the build. Well, it might work, it might not.
_________________
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
creaker
l33t
l33t


Joined: 14 Jul 2012
Posts: 651

PostPosted: Tue Oct 07, 2014 9:58 pm    Post subject: Reply with quote

NeddySeagoon wrote:
creaker,

You need to do the build on a system that understands the illegal instructions.
You can't move the HDD to another system, then do the build. Well, it might work, it might not.


Yes, I tried to rebuild a USB-HDD system at the parent-box that was used as a donor of the system (through chroot).
I think I have to build it from scratch with new make.conf.

I can't rebuild system on other machine even if I've wanted to do it - it's impossible because I even can't to log in there.
Back to top
View user's profile Send private message
creaker
l33t
l33t


Joined: 14 Jul 2012
Posts: 651

PostPosted: Sun Oct 12, 2014 5:02 am    Post subject: Reply with quote

Well, I rebuilt a system wth generic CPU options and tested it for a few day at different machines (core i3 3210, core i3 2120, core i5 650, core 2 duo E8500, amd Phenom FX 9650, Athlon 64 X2 4200). All seems good.
Right now I have this setup at usb HDD. But I'd like to be able to put it to any occasional usb pen drive. In fact system works at any pen drive, but the speed is extremely low. Starting firefox takes half of minute, dolphin starts in 15 secs and so on. It isn't a pen drive issue, I tried few stick with read performance at range 17-20 Mb/sec. One of these sticks hosted remastered Debain in past that was amazingly fast. So I decided to put /usr into RAM disk, but failed - ran out of memory. I stripped /usr as much as I can (down to 1,9Gb), but still can't fit it to 4Gb of RAM. The last attempt I did was a putting only /usr/lib into RAM. I can fit into 4Gb, but can't understand why 1,0Gb of /usr/lib occupies 3Gb of RAM?
Code:
UsbGen cr # free
             total       used       free     shared    buffers     cached
Mem:       4045136     508896    3536240       8680      53448     224392
-/+ buffers/cache:     231056    3814080
Swap:            0          0          0
UsbGen cr # mount none -t tmpfs /mnt/ramdisk/
UsbGen cr # cp -a /usr/lib/* /mnt/ramdisk/
UsbGen cr # mount -o bind /mnt/ramdisk/ /usr/lib/
UsbGen cr # free
             total       used       free     shared    buffers     cached
Mem:       4045136    3520528     524608    1154576     402680    2765996
-/+ buffers/cache:     351852    3693284
Swap:            0          0          0

Moving /usr/lib to RAM makes a system WOW fast, all the apps including firefox starts in less then 1 sec, however I can't to run this system at boxes with RAM less of 4Gb.
I remember that remastered Debian stick was happy with 2Gb of RAM though.
Any thought on how to reduce a RAM usage?

P.S.
I have /usr, /home, /lib32, /lib64 squashed and mounting them at boot stage, if this info is a matters.
Code:
UsbGen cr # df -h
Filesystem         Size         Used  Free         Used% Mounted
/dev/sdb1          4,7G         2,4G  2,1G           54% /
udev                10M         4,0K   10M            1% /dev
tmpfs              396M         440K  395M            1% /run
shm                2,0G          22M  2,0G            2% /dev/shm
cgroup_root         10M            0   10M            0% /sys/fs/cgroup
/dev/loop0         2,0G          22M  2,0G            2% /lib32
lib32Aufs          2,0G          22M  2,0G            2% /lib32
/dev/loop1         2,0G          22M  2,0G            2% /lib64
lib64Aufs          2,0G          22M  2,0G            2% /lib64
/dev/loop2         2,0G          22M  2,0G            2% /usr
usrAufs            2,0G          22M  2,0G            2% /usr
/dev/loop3         2,0G          22M  2,0G            2% /home
homeAufs           2,0G          22M  2,0G            2% /home
/mnt/ramdisk       2,0G         1,1G  857M           57% /usr/lib64
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
Goto page 1, 2  Next
Page 1 of 2

 
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