spectere.net

The Chatterbox => Computing => Topic started by: Bobbias on July 20, 2010, 10:00:46 PM

Title: Linux from an SD card?
Post by: Bobbias on July 20, 2010, 10:00:46 PM
So, I've been thinking about trying linux out on this thing. Of course, I still don't know if my wireless card is actually supported or not.

But Since my burner is useless, I was wondering if there was a way to install a distro from an SD card. I don't mean run a live distro, but actually boot the installer and install linux onto a partition from the card.

And while I'm at it, I'll ask which distro would be a good idea for me to check out, since every time I chose one, I end up screwed over, either by something with no real support because it's to new, or by something that is just stupidly unstable and unusable (oldschool fedora :<)
Title: Re: Linux from an SD card?
Post by: Spectere on July 21, 2010, 01:40:45 AM
As long as your system supports booting from your card reader (kind of hit or miss, really, though I think my 2005 Dell Inspiron 9300 can do it, so I imagine most newer ones should be able to do that) it should be similar to cramming an ISO onto an SD card.

Of course, LiveCD distros would be much more suited to doing something like that (and have the benefit of including LiveUSB scripts, for the most part), so for best results you'd have to find something that can be bootstrapped from within another system (Debian and Gentoo are the only two that come to mind, though I'm sure you can get Ubuntu to install like that without too much hassle).

Or, if you're patient, I could mail you a CD/DVD with your distro of choice on it.  Your call.

And while I'm at it, I'll ask which distro would be a good idea for me to check out, since every time I chose one, I end up screwed over, either by something with no real support because it's to new, or by something that is just stupidly unstable and unusable (oldschool fedora :<)

I've actually found Fedora 13 to be rather good, surprisingly.  I was vehemently anti-Fedora for the longest time due to the sheer number of issues that it had, but after installing Fedora 13 (I literally only installed it because I wanted a fully functional system to bootstrap Gentoo from that wasn't Ubuntu) I've actually found it to be extremely solid.  I'm far more impressed with F13 than any release of Ubuntu.

Of course, Gentoo is still muh tru bebbeh.  I can't say I'd recommend it for a laptop, though, due to the sheer amount of downloading and compiling you'll have to do to install, well, just about anything.  I used to recommend Debian on laptop, Gentoo on desktop, but I think now I'd rather use Fedora in any case where binary, desktop-oriented distributions are preferred.
Title: Re: Linux from an SD card?
Post by: Bobbias on July 21, 2010, 06:47:11 AM
I take it I'll need to reboot to check my bios to see if it supports running off the reader? (That doesn't happen often, since Hibernate is a thousand times more useful)

Well, I was almost thinking I might want to try my hands at gentoo. After having played around in busybox, and muddles my way through installing stuff by source using an unfamiliar package system, an SSH console, and all the rest, I thought it could be a good learning experience. Of course, I'd still need a good tutorial on compiling that beast, just in case.

I was looking at trying to do that with Ubuntu, after having looked at a couple different distros, but I thought I should ask since you've had a lot more experience with different distros.
Title: Re: Linux from an SD card?
Post by: Spectere on July 21, 2010, 04:55:51 PM
I take it I'll need to reboot to check my bios to see if it supports running off the reader? (That doesn't happen often, since Hibernate is a thousand times more useful)

Hibernate shuts down the computer entirely, so you can hibernate it, power it on, and go into the BIOS without losing your system state.  Bear in mind that you might need to have a device plugged in for it to actually show up on the boot list.

Well, I was almost thinking I might want to try my hands at gentoo. After having played around in busybox, and muddles my way through installing stuff by source using an unfamiliar package system, an SSH console, and all the rest, I thought it could be a good learning experience. Of course, I'd still need a good tutorial on compiling that beast, just in case.

Using Gentoo really isn't all that hard, but it does require patience.  Some particularly painful packages (i.e. Firefox, OpenOffice, etc) are available as binary packages assuming you use the x86-32 version of the distro.  Configuring the kernel is by far the most painful part, but there is a generic kernel available that works well in 99% of all cases, so even that's not really a necessity.

As far as package management goes, that's all done automagically through the Portage package manager.  You don't have to actually dig in and manually compile anything.  Installing X is as simple as typing "emerge xorg-x11".

Best of all, the entire installation process is explained in meticulous detail: http://www.gentoo.org/doc/en/handbook/index.xml (http://www.gentoo.org/doc/en/handbook/index.xml).  The directions are based on building Gentoo from the Gentoo LiveCD, but, really, the instructions are applicable to any environment.  Like I said, I bootstrapped my Gentoo system from Fedora without a problem.  All you need to do from your host environment is be able to do is create and mount partitions, download files, copy over the resolv.conf from your live system, extract bzipped TARs, and chroot into the environment (oh, and access the web so that you can view the handbook, if you don't have another system available ;)).

If you need a hand during or after the installation is complete, feel free to ask.  Gentoo is a meta-distribution and as such can be configured to do just about anything, so it's pretty easy to get overwhelmed.  I think I've built enough Gentoo systems that I can give you a lot of help with it.

I was looking at trying to do that with Ubuntu, after having looked at a couple different distros, but I thought I should ask since you've had a lot more experience with different distros.

Damn straight. 8)

I really don't recommend Ubuntu for much of anything nowadays.  About the only advantage that I see in it is that the user community is overflowing.  Like I said elsewhere, I had issues simply assigning my computer a static IP address, only to have 1501495834[/tweet]]someone tell me that it's not something that novices normally do (http://[tweet).  Huh.  As good of an excuse as any, I suppose.
Title: Re: Linux from an SD card?
Post by: Bobbias on July 21, 2010, 05:05:48 PM
Alright, I'll try that whenever I feel like getting that ball rolling. I learned a lot by sshing into busybox, so I'm a lot more at ease with the command prompt now :P
Title: Re: Linux from an SD card?
Post by: Bobbias on July 22, 2010, 02:01:28 AM
So, I updated my BIOS. Still no option to boot from the SD card reader... I noticed though that the card reader shows up as a USB device... Would setting my system to boot from USB work, if that's the case?

Edit: How do I get the contents of the ISO onto the SD card properly for this? I know you can just extract files from an ISO, but would it still be bootable if I did that?

Edit2: Ok, so I downloaded UNetbootin, and I'm gonna see if I can get that working. I'm in class right now, so I haven't had time to test it yet, but maybe I'll get lucky and my card reader will show up as USB bootable. It showed up as a USB device in UNetbootin.

Yet Another Edit: Looks like it doesn't detect the card as bootable or something. I'm gonna try using the 2008.0 one that UNetbootin is apparently compatible with, and see if that actually works. But it looks like I'm gonna be stuck here, if things don't start working.

Edit: A New Hope:
Well, I'm online in the basic "Live CD". I ended up buying a $3 memory stick (1GB) and it installed fine on it. Of course, now I need to figure out how to resize my windows install, and how to dual boot this thing without blowing it up. Any suggestions there? (Also, this edit was performed in Links in text mode running off that flash drive install :P)
Title: Re: Linux from an SD card?
Post by: Spectere on July 22, 2010, 08:20:12 PM
Many SD card readers are connected via an internal USB header, so that might be why it came up like that.  Odd that it didn't let you boot from it, though.  That stuff is all pretty standard.  It might be an issue with the particular card that you were using...hard to say.  I was able to successfully boot my I9300 using a Sandisk microSD card in an adapter before.  Either way, it's kind of a moot point if you have a memory stick now. :p

I'd probably go with something a bit better than the standard LiveCD.  You could resize the NTFS partition using parted, but...uh, no, you really don't want to do that.  It pretty much puts the risk back into the resize process because it's pretty much all manual.

You'll probably be best off prepping the drive with the gparted (http://gparted.sourceforge.net/livecd.php) live environment.  It'll give you the ability to resize your NTFS partition in a somewhat safe manner (there's always risks, of course, but I've never had gparted eat a partition of mine yet, and I've resized a partition on a RAID 1+0 array, which is probably the most dangerous thing that you can do in Linux due to its abysmal support of fakeraid configurations that have anything to do with RAID 1).  I'm not sure if that particular LiveCD has any networking support, but if it does you should be able to do your bootstrapping in there.

Another option would be putting together a Slax (http://www.slax.org/) build on your memory stick with support for your hardware (if it doesn't support it out of the box) with gparted.  That would still yield a fairly light download, but would give you an environment that you could do everything in.

Finally, if you don't mind downloading something OMG HUEG (OMG HUEG meaning a 688.55 MB ISO via either a well seeded torrent or FTP), you can always go with Knoppix (http://www.knoppix.net/).  Knoppix has everything including the kitchen sink, so if you can't resize the partition and bootstrap Gentoo with that you'll never be able to do it. :)
Title: Re: Linux from an SD card?
Post by: Bobbias on July 22, 2010, 08:36:31 PM
Lol, well, for now I'm trying to do it all from my memory stick gentoo. And It wasn't actually the Live CD, is was the minimal CD. I just downloaded the Stage3 and just finished extracting it before I posted this. Now it's time to install portage, and configure my compiling optimizations. I'm gonna be so happy when I can get something more than a terminal environment. I forgot how much the internet SUCKS in text mode.

EDIT: Not good, I'm getting errors trying to extract the portage package.

It's saying: Cannot change ownership to uid 250, gid 250. Operation not permitted.

That happens whether or not I have the j option when extracting. The hell is going on? I've got nearly 8 GB on that card, and it'd be damn nice to be able to use that along side the 1GB of this flash drive.
Title: Re: Linux from an SD card?
Post by: Bobbias on July 22, 2010, 08:48:41 PM
Not cool, apparently I've run out of space on the flash drive... Really not cool. I think I'm gonna have to try to see if I can use the sd card to hold some of this, lol.

Also: how do I get linux to not read out huge help listings without pausing to let me read the stuff at the top? I know you can do that in dos, but I don't know how to do it in linux :/
Title: Re: Linux from an SD card?
Post by: Spectere on July 22, 2010, 10:06:12 PM
You have to extract the stage3 package and portage snapshot onto the hard drive, not the flash drive.  Remember, Gentoo is a source-based release, so you have to keep the toolchain on the system at all times.  Additionally, compiling other packages (especially big, bad X environments) is going to take a ton of space.

So yeah, you'll have to use gparted to pare down your NTFS partition a bit and install it to the hard drive.  The LiveUSB should only be used to bootstrap the system if you intend to use Gentoo.
Title: Re: Linux from an SD card?
Post by: Bobbias on July 22, 2010, 10:25:08 PM
:/ can I get binaries of gparted? As it stands, I don't think I have a working environment to build anything from source.
Title: Re: Linux from an SD card?
Post by: Bobbias on July 22, 2010, 10:40:24 PM
Ok, this is retarded. I need development utilities to build gparted, but I need to have already set up a partition for gentoo before I have the fucking development utilities, from what I can gather.

This is why I do not like shit that just tells you what to do, and doesn't give you a chance to do things differently... Why doesn't the gentoo manual have a section on "if you need to resize partitions, before you install it, do this" or some similar section? I'm beginning to consider just tossing knoppix on that flash drive...
Title: Re: Linux from an SD card?
Post by: Spectere on July 22, 2010, 11:02:23 PM
Uh, that's why I gave you a direct link to the gparted LiveCD... :/

And there's a damn good reason the Gentoo docs don't tell you how to resize partitions: from a terminal it's incredibly dangerous.  If you download the LiveDVD, gparted is included for that very reason.
Title: Re: Linux from an SD card?
Post by: Bobbias on July 23, 2010, 12:58:30 AM
Ok, this is fucking retarded. Even Gparted isn't working.

Every time it tries to start up x window system, it either hangs (if I try to manually set stuff) or simply complains that no screens are found.
Title: Re: Linux from an SD card?
Post by: Spectere on July 23, 2010, 09:26:01 AM
Okay then, give Knoppix a shot.  Sounds like the Gparted LiveCD doesn't have workable X drivers for your video hardware (which is odd, since most recovery disks will happily use vesa if nothing suitable can be found, and all three of the major video card chipsets support vesa very well).

Knoppix, on the other hand, is based on Debian and I've had a lot of luck with Debian's hardware autodetection (not to mention that last time I tried Knoppix it was able to pick up my laptop's wireless card, which was a very new chip at the time that I tried it).  If your memory stick is large enough, the Gentoo LiveDVD might also be something to consider.  Gentoo's hardware detection is stellar.
Title: Re: Linux from an SD card?
Post by: Bobbias on July 23, 2010, 11:54:47 AM
Yeah, gentoo seemed to have no problems with my computer. Also, apparently the Gparted live CD is also based on debian.

I might try knoppix a bit later today, after my class.
Title: Re: Linux from an SD card?
Post by: Spectere on July 23, 2010, 05:20:36 PM
If Gentoo picked everything up without a hitch, it might be best to just bite the bullet and download the LiveDVD.

That said, I know that the driver support in Gparted's LiveCD isn't all that great.  I know it has absolutely zero support for any RAID configuration and its SATA support was surprisingly limited.  I kinda figured that it would have improved in the past, oh, two years, though.
Title: Re: Linux from an SD card?
Post by: Bobbias on July 23, 2010, 05:24:46 PM
I'm in the middle of (Re-)downloading Knoppix.

The fucking thing downloaded to nearly complete (said 0 seconds left, 689/689mb) and then sat there and never finished. I checked my md5, and it was the same, but when I booted it, it crashed, saying something was broken.

Also, why does it take fucking FOREVER to shut vista down? I don't even have all that many things running.

EDIT: So I'm running knoppix fine right now. Just blasted the 2 partitions that toshiba used to "build" my windows install when I first turned the laptop on. They really weren't useful any more anyway. So I get a linux install, without really having to deal with resizing my main partition. I'm gonna install gentoo from here, since everything works, and I actually have a nice graphical environment :P (Compiz Fusion kicks ass!)

EDIT:
The plot thickens... I apparently can't chroot, because knoppix is x86 and my target environment is amd64 :/
Also, the reason I never tried the live DVD is: I can't burn DVDs, and a DVD is larger than 1 GB. That kinda poses a problem.
Title: Re: Linux from an SD card?
Post by: Spectere on July 24, 2010, 06:13:26 PM
Yeah, you can't chroot into a 64-bit environment using a 32-bit kernel with Linux.  Literally, the only platform that I know of that supports that is OS X, and it no doubt took them quite a bit of trickery to pull that off.

Besides, Gentoo is much easier to make heads or tails of if you don't mess with multilib.  Drop x64 and just get x32.

And the reason I suggested the LiveDVD was to put on your USB drive, not to burn...
Title: Re: Linux from an SD card?
Post by: Bobbias on July 24, 2010, 06:47:58 PM
The problem being that if the LiveDVD is larger than 1 GB, I couldn't do that anyway.

But yeah, I'm trying to get 64bit gentoo on here because for once in my life I'd like to have a functioning 64bit OS on a computer with a 64bit processor. Every time I've had a computer with a 64bit processor, I've been stuck in a 32bit OS, and it's depressing, knowing that my computer could run better, if I had a 64 bit OS.

Since I couldn't chroot into it from knoppix, I switched back to the minimal gentoo CD, because I'd done what I needed gentoo for anyway (resizing partitions so I could actually get gentoo on the computer).

I'm in the middle of emerge --sync right now.

Why is multilib so bad, anyway?

Also, I can't seem to find a list of USE variables anywhere. The handbook doesn't have a list any more, and it tells me to 
Code: [Select]
less //usr/portage/profiles/use.desc but the file doesn't exist.
Title: Re: Linux from an SD card?
Post by: Spectere on July 24, 2010, 11:11:15 PM
The problem is simply that Linux's multilib support isn't nearly as refined as Windows and OS X's system.  As long as your userland is 64-bit you're good as gold, but right when you start mixing the two and having to deal with proprietary, binary plugins and such, things get incredibly annoying.

In my 64-bit Fedora installation, Flash will simply never be stable no matter what I do.  The 64-bit version of 10.0 is unstable and breaks with certain web sides, and the 32-bit version (run with the help of nspluginwrapper) likes to crash the browser from time to time.  The fact that most package managers make it difficult or non-obvious to cross-compile (i.e. use a 32-bit browser in an otherwise 64-bit userland) doesn't help.  I've never had good luck with 64-bit Linux because there's always been the proverbial spanner stuck in the gears at some level.

For managing use flags, I recommend emerging ufed.  Just try to keep your list down as much as possible.  There are a ton of available flags, but many of them only cover specific programs.
Title: Re: Linux from an SD card?
Post by: Bobbias on July 25, 2010, 12:24:40 AM
Ok, so I've successfully chrooted into the gentoo install, manually configured and built a kernel, created a dualboot with vista and linux, and booted my kernel.

Except that since I didn't just chroot into it like usual, I've got very little functionality in the new kernel. when I ls /dev I get a HUGE list of a million different things that I don't have. And I seem to be missing eth and wlan devices entirely. The hell is going on here?
Title: Re: Linux from an SD card?
Post by: Alice on July 25, 2010, 12:40:43 AM
This is how I'm running xubuntu off of my netbook (from an SD card).  I've had no issues with it yet.  I installed it from a disc using an external DVD drive, treating the SD card as if it was a normal hard drive.  It's pretty great, and before I decided to get a new hard drive for storage, it was nice having the netbook be that extra bit lighter.
Title: Re: Linux from an SD card?
Post by: Bobbias on July 25, 2010, 01:29:39 AM
Nice. My system seems to not want to boot from an SD card, so I'm actually booting off a USB flash drive at the moment. I'm posting on the gentoo forums asking for help, because my kernel boots, but is basically useless for now. But hey, I managed to figure pretty much all of this out on my own, and I havent blown the computer up yet.
Title: Re: Linux from an SD card?
Post by: Spectere on July 25, 2010, 02:49:40 AM
Except that since I didn't just chroot into it like usual, I've got very little functionality in the new kernel. when I ls /dev I get a HUGE list of a million different things that I don't have. And I seem to be missing eth and wlan devices entirely. The hell is going on here?

dev isn't populated by the kernel anymore, it's done by udev, so it's automatically populated based on what you have in your system and how your system is configured.  Most likely, the odd things that you're seeing are things like raw devices and stuff like that.  The only thing that's really important to the user is that the input devices and block devices are showing up properly.  The rest of it is pretty much all internal stuff.

If you're missing eth and wlan devices altogether, you probably don't have the correct Ethernet/wireless drivers enabled in the kernel.  It can be a little confusing, because a single manufacturer can put out a single model that can potentially use multiple chipsets (the Linksys LNE100TX series is a perfect example; it changed chipsets multiple times throughout its life).  As far as wireless support goes, it usually not enough to just select the package.  You have to emerge a proprietary, binary firmware blob for the device before you can make it sing.

If you want to have a functional system ASAP, your best bet would be to get genkernel set up and work on building your own kernel later.  Configuring a kernel can take a few attempts to really get right, so that will at least get your system fully functional so that you can play around with it more later.

Then you can work on becoming as much of a sad bastard as I am (I know my hardware so well that it took me less than 10 minutes to configure my kernel last time...yikes).
Title: Re: Linux from an SD card?
Post by: Bobbias on July 25, 2010, 03:00:14 AM
Haha, wow.

I have no /udev...

but yeah, I know I have an Atheros AR5007EN wireless... You say that I may need some proprietary module, but wouldn't that mean that I would need that even in a minimal LiveCD environment, or in Knoppix? If I could figure out what module the LiveCD environment uses, I could potentially get online. When setting up my kernel, I selected everything that looked remotely relevant to what I needed when it came to networking (wired and wireless).

I have a post on the gentoo forums, but it may take them a while to sort everything out. I might make a genkernel and let you know if it works any better than my custom ones.

Also, could you point me to something that explains how modules work and such? My lack of knowledge on the inner workings of linux is really catching up to me. I can navigate my way around the environment well enough, and I can pick stuff up quick enough, but not knowing how things actually work makes it way more confusing than it should be.
Title: Re: Linux from an SD card?
Post by: Spectere on July 25, 2010, 03:43:23 PM
No, the devices aren't populated in /udev, they are populated in /dev by the udev daemon.

The LiveCD provides the proprietary firmware blobs for the various cards.  They aren't provided in a stock Gentoo system for a few reasons.  First of all, the base system is pretty much all FOSS-compliant.  That way you don't get the Richard Stallmans of the world flipping out because the base distribution has non-free components.  They aren't included in the kernel for that reason as well.  Second, the point of Gentoo is to keep a lean and mean system (hence compiling everything with only the options you want), so including the firmware blobs would kind of run against that goal.

Modules are sort of like Windows drivers.  They can be loaded into and (sometimes) unloaded from the kernel at will and can add all sorts of new features to the system, such as additional filesystem support, support for hardware devices, etc.  Most of the drivers in the kernel can be compiled as modules and inserted at startup.  In fact, with the clever use of modules, you can add features to your kernel without rebooting the system (for instance, if you want to add kernel NFS client support, you can compile the NFS components as a module, insert them, and use them right away).

When I build Gentoo on desktop systems, I usually build all of the hardware drivers for removable components (i.e. sound cards, video cards, etc) as modules, that way I can swap out hardware without having to do a complete kernel replacement.  I do the same thing with optional filesystems (note: you can't compile your root filesystem as a module for obvious reasons unless you plan to use an initramfs image).  With laptops, I generally compile all hardware into the kernel to speed up boot times a bit (and, simply, because non-generic laptop hardware -- as in anything but hard drives, CD-ROM drives, etc -- can't be easily changed).

In Gentoo, the /etc/modules.autoload.d/kernel-2.6 file specifies which modules automatically load on boot.  You don't always need to populate this file, since udev does a pretty good job detecting what hardware you have and loading the appropriate modules (for example, after I installed ati-drivers, the kernel module was automatically loaded on boot despite it not being in that file).  I don't think you really have to depend on that file much anymore.
Title: Re: Linux from an SD card?
Post by: Bobbias on July 25, 2010, 03:50:33 PM
Well, I just built a genkernel. udev still didn't seem to play nice, and update my /dev properly.

I am a bit closer to what I wanted though, since I took the opertunity when I was building the genkernel to emerge wireless-tools.

Are there any other packages like that that are basically essential? The base system seems practically crippled as it stands.
Title: Re: Linux from an SD card?
Post by: Spectere on July 25, 2010, 04:22:12 PM
The base system really isn't crippled, it's just the absolute bare minimum.  When I'm building a server I definitely don't need a DHCP client and when I'm running ext4 I don't need the XFS filesystem tools.  Best of all, Gentoo doesn't force you to have a fucking mail daemon on your system like many other distros seem to do.

First of all, I'm going to assume if you followed the guide that you already have everything you need to connect to a wired network (i.e. either a DHCP client or a statically configured interface).

It appears that you're in luck with wireless.  The Atheros 5xxx series has an open-source driver in the kernel.  It seems like Atheros is a bit more cooperative than Intel and company when it comes to Linux drivers.  Just make sure that the ath5k driver is built, build any encryption modules that you'll need (i.e. TKIP, AES, etc), and you should be good to go.  As far as configuring the wireless, wpa_supplicant is my tool of choice.  There is a guide here on Gentoo Wiki, but it's not too great:

http://en.gentoo-wiki.com/wiki/Wireless/Configuration (http://en.gentoo-wiki.com/wiki/Wireless/Configuration)

It gives some decent information, but the samples given are very situational and, IMO, fairly useless.  What's worse is that some of the info that they'll make you believe that you need in your conf.d/net is actually outdated.  I'll summarize what you'll have to do below:

Basically, you'll want to emerge wireless-tools and wpa_supplicant.  Use iwconfig to make sure that the interface is there, then edit /etc/wpa_supplicant/wpa_supplicant.conf.  The following configuration file will automatically connect to your preferred network (assuming it uses WPA encryption) and, if that fails, will connect to any open network:

Code: [Select]
# This is a network block that connects to a specific unsecured access point.
# We give it a higher priority.
network={
ssid="YOUR_ACCESS_POINT_NAME"
key_mgmt=WPA-PSK
psk="your_passphrase"
priority=5
}

# This is a network block that connects to any unsecured access point.
# We give it a low priority so any defined blocks are preferred.
network={
key_mgmt=NONE
priority=-9999999
}

If you use WEP, the following block would apply to your network:

Code: [Select]
network={
ssid="YOUR_ACCESS_POINT_NAME"
key_mgmt=NONE
wep_key0=Hexidecimal WEP key goes here
}

In your /etc/conf.d/net file, add the following line:

Code: [Select]
modules=( "wpa_supplicant" )
This tells the system to run wpa_supplicant when it initializes the network.

Finally, you'll need to add a link to your init.d so that the device can start up.  Go into your /etc/init.d directory and do the following:

Code: [Select]
ln -s net.lo net.DEVICE
Replace DEVICE with whatever iwconfig calls your wireless device (it's usually wlan0, but sometimes that'll change depending on the driver).  Afterwards, bring up the interface with /etc/init.d/net.DEVICE start, cross your fingers, and pull the network cable.  Try to ping something and, if it works, make sure that the system brings up the interface at boot:

Code: [Select]
rc-update add default net.DEVICE
If your wireless is working nicely, you'll want to make sure that the system doesn't drag on startup while it tries to find an address for your wired network card.  You can simply disable the service that tries to start it, but there's a much more elegant method: netplug.

netplug immediately backgrounds net.eth0 so that it doesn't block the boot process unnecessarily.  Additionally, it will also handle calling your DHCP client the moment you plug a cable in and disabling the interface when you unplug it again.  Best of all, it couldn't be any easier to get up and running.  Just emerge netplug and that's it.  The init scripts will automatically pick it up and use it.

After that, your next step will probably be to install X.  Here's the guide on Gentoo.org:

http://www.gentoo.org/doc/en/xorg-config.xml (http://www.gentoo.org/doc/en/xorg-config.xml)

That gives you a minimal X setup.  After you're done with that, you'll probably want to install drivers for your graphics card:

ATI:http://www.gentoo.org/doc/en/ati-faq.xml (http://www.gentoo.org/doc/en/ati-faq.xml)
nVIDIA: http://www.gentoo.org/doc/en/nvidia-guide.xml (http://www.gentoo.org/doc/en/nvidia-guide.xml)

And finally, you'll want to install a desktop environment:

KDE: http://www.gentoo.org/proj/en/desktop/kde/kde4-guide.xml (http://www.gentoo.org/proj/en/desktop/kde/kde4-guide.xml)
Gnome: http://www.gentoo.org/doc/en/gnome-config.xml (http://www.gentoo.org/doc/en/gnome-config.xml)
Fluxbox: http://www.gentoo.org/doc/en/fluxbox-config.xml (http://www.gentoo.org/doc/en/fluxbox-config.xml)
Xfce: http://www.gentoo.org/doc/en/xfce-config.xml (http://www.gentoo.org/doc/en/xfce-config.xml)
Openbox: http://www.gentoo.org/doc/en/openbox.xml (http://www.gentoo.org/doc/en/openbox.xml)
LXDE: http://www.gentoo.org/doc/en/lxde-howto.xml (http://www.gentoo.org/doc/en/lxde-howto.xml)

KDE and Gnome are the easiest to get up and running, but take the longest (by far) to compile.  Xfce is pretty nice and light-weight.  I haven't used LXDE, but it looks nice and is supposed to be pretty light.  Fluxbox and Openbox are very fast to compile (I'm actually using Fluxbox on my Gentoo system right now as a staging area and as a light-weight X environment for root; I think it took one whole minute to get compiled and installed) but require a lot of digging to get them configured.  Additionally, they're probably the only environments that'll still work on a 486, so they're lightning fast. :)

Most Linux users use either KDE or Gnome.
Title: Re: Linux from an SD card?
Post by: Bobbias on July 25, 2010, 05:17:36 PM
so I got up to the rc-update line. When I type rc-update add net.wlan0 defauly it complains that net.wlan isn't executable.

in bash, net.lo is green, and net.wlan0 is simply grey. Also, net.eth0 already exists, and I never did anything for that, and it is teal...

Also, I'm using EasyBCD to create my dual boot system. I've got it set up to use BCD to load Vista or Grub2, and I use Grub2 to load gentoo. I'd like to give Grub2 a menu so I don't have to manually type all the junk to boot gentoo, but I can't seem to figure out where it stuck Grub.
Title: Re: Linux from an SD card?
Post by: Spectere on July 25, 2010, 05:56:23 PM
If it's grey, you made a copy of net.lo rather than a symbolic link.  Symlinks inherit the permissions of their parent and should be teal.  net.eth0 is there by default, so your net.wlan0 should look exactly like that.

Make sure to use ln -s net.lo net.wlan0, exactly like that, to create the link.

Grub generally installs itself to /boot/grub.  I use the original version of grub, but I'm sure grub2 still uses /boot/grub/menu.lst (or something similar) as its configuration file.

By default, Gentoo doesn't mount /boot.  In order to do so, type mount /boot as root.  You should be able to see the grub directory from in there.
Title: Re: Linux from an SD card?
Post by: Bobbias on July 25, 2010, 07:04:17 PM
well /boot is on the same partition as the rest of my filesystem. My point was that because I was using a nonstandard boot setup, I have no idea where EasyBCD stuck it's copy of Grub2. I mean, typing all that stuff out isn't that hard, but it is kinda annoying.

Oh yeah, and netplug doesn't seem to be doing much of anything.

But yeah, how do I manually force my computer to use DHCP to get an IP address. Because it does seem like wlan0 works. The driver is loaded, it's just a matter of figuring out how to get it to do the rest of what's needed.
Title: Re: Linux from an SD card?
Post by: Bobbias on July 25, 2010, 10:02:10 PM
You know how you told me to delete the net.wlan0 and remake it? Yeah, well, it worked. Of course, that was after i installed hdcpcd as well, so that might have helped out a bit too. I am now posting from my fully antonomous (sp?) linux install. Hopefully I won't have to go back to the livecd again.

Quick question: The livecd terminal was running at a higher resolution than this one. Everything on this one is much larger.. How do I made the text smaller so I can fit more on the screen (which is kinda important in a completely text based environment...)?
Title: Re: Linux from an SD card?
Post by: Spectere on July 26, 2010, 12:00:41 AM
You can get a higher resolution console by installing the appropriate framebuffer driver.  Honestly, I don't recommend it.  Framebuffer consoles are slow as piss (and if you use video acceleration on them you generally lose the ability to accelerate X), so it'll pretty much slow down everything, including compilation (since it draws every single line, you'll wind up waiting for the screen to scroll, doubling compilation times, or worse).

Your best bet is to do the bare minimum to get X up and running on your system, then working from an xterm.  Alternatively, you could go back to chrooting until everything is installed.  I generally do the former.
Title: Re: Linux from an SD card?
Post by: Bobbias on July 26, 2010, 01:31:10 AM
I'm working on getting X going. Unfortunately, X doesn't want to cooperate.

startx tells me that it can't find any of the modules. Including the ati drivers, which I know I have :/

Xorg -config actually causes a segmentation fault.
Title: Re: Linux from an SD card?
Post by: Spectere on July 26, 2010, 02:48:17 AM
Which ATI chipset do you have?  There are about three different proprietary drivers, depending on the age of the card (the newest ones only work with R600 chipsets and up, which I believe means the HD 3000 series and better).  If your laptop's GPU is one of those, read on.

X doesn't automatically pick up any proprietary drivers, be it NVIDIA or ATI.  Similarly, Xorg -config will only detect the drivers that it knows about (meaning, anything that comes with X).  If you configure X so that only the proprietary drivers are enabled, Xorg -config won't be able to find any "valid" video card drivers and will segfault.  If you were to set your VIDEO_CARDS variable to "ati vesa", for instance, it would actually work and use the vesa driver.  Not that you'd want this.  VESA is supported by everything but is unaccelerated, so getting it to work will be incredibly easy, but your performance will be mindnumbingly terrible.

Fortunately, NVIDIA and ATI both have utilities that will make generating the custom Xorg.conf fairly simple.  If you can load the kernel driver (type modprobe fglrx to load it -- it'll complain if it's already loaded -- then type lsmod and make sure that it appears on that list), odds are you're in the clear and don't have to mask anything off.  To generate the X configuration file, just type aticonfig --initial, then try starting X.  If it seems to initialize the video (flashes the screen, yadda yadda) but dumps you back to the console, complaining that it can't find some files, type emerge twm xterm to give yourself a basic window manager and shell.  After those are installed, jump back into X.

Now you'll want to make sure that your 3D acceleration is working.  emerge mesa-progs to get some of the test utilities.  When those are installed, type glxinfo | grep direct.  You should see "direct rendering: Yes" if everything is kosher.  Finally, type glxgears to make sure that OpenGL is working.  If you can't get OpenGL or direct rendering to work (or if it still fails to start X), jump back to the shell and make sure that ATI's OpenGL module is active by typing eselect opengl set ati.

If you can get it working in twm, you're ready to install your environment of choice.
Title: Re: Linux from an SD card?
Post by: Bobbias on July 26, 2010, 10:41:46 AM
Awesome, trying that ASAP. And yeah, I've got the Radeon Mobility HD 3100.
Title: Re: Linux from an SD card?
Post by: Bobbias on July 26, 2010, 06:06:49 PM
Ok, so I just tried the aticonfig... It complained about missing some opengl .so file (as far as I can tell, I can't remember the exact error). I then tried to emerge ati-tools, and saw a couple more errors about missing opengl, so I'm emerging opengl now, lol.

installing stuff out of order like that shouldn't pose too much of a problem should it? what's the syntax for reinstalling something through emerge?

glxinfo says: Error: couldn't open display. :< However, startx works. Links looks so much nicer when the text isn't fucking massive.
Title: Re: Linux from an SD card?
Post by: Spectere on July 26, 2010, 09:33:36 PM
OpenGL support is actually included in ati-drivers.  emerge ati-drivers again if it's complaining about a missing OpenGL .so.  Emerging OpenGL isn't going to do a whole lot for you.  If anything, it's only a software rendered "solution."

Installing stuff out of order doesn't cause problems because dependencies are always resolved properly.  If you tried to emerge ati-drivers without X being installed, it would emerge everything that you'd need in order to use it.  Since it's an X module, that would involve emerging X.  If something caused files to be deleted, then you might have to reemerge the package.

Reinstalling is extremely simple -- just emerge it again.

If you still have problems after emerging ati-drivers again, post your /var/log/Xorg.0.log and /etc/X11/xorg.conf files to Pastebin (http://pastebin.com/) and I'll have a look-see.
Title: Re: Linux from an SD card?
Post by: Bobbias on July 26, 2010, 09:48:25 PM
Actually right now I have x working fine. I'm in TWM right now. Somewhere along the line of installing twm and all the other stuff I did things automagically began working. Of course, with the number of times i emerge --deep --newuse world, it could have been fixed in one of those, lol.
Title: Re: Linux from an SD card?
Post by: Spectere on July 26, 2010, 09:52:52 PM
Coolies.

FYI, you don't have to do an emerge --deep --newuse world for every single USE flag.  You'll want to change all of your USE flags and run a single emerge --deep --newuse world (or emerge -uDN world for short).  It'll rebuild all of the affected packages at once that way, hopefully preserving most of your remaining sanity.
Title: Re: Linux from an SD card?
Post by: Bobbias on July 26, 2010, 10:07:35 PM
I would have done that if it said "your gonna need all these new uses" instead of giving me one at a time. Regardless, I've learned from that, lol.

Also, would you have any idea where I should start looking to figure out how to control the sound volume with my laptop's volume thingie. It's a rotating dial on the front of the laptop, but, like usual with non-standard stuff, it's not immediately supported in gentoo. I have no fucking clue where I might want to start looking, and I was wondering if you've ever had to enable something like that. I'd really like to be able to control my volume with it, since manually going into a mixer and changing it by hand is kinda a pain in the ass.
Title: Re: Linux from an SD card?
Post by: Spectere on July 26, 2010, 10:32:42 PM
Usually, if you're given USE flags one at a time the ramifications of selecting them are either being explained or they are optional (or situational, whichever the case may be).  I typically skim through the documentation before I begin for that reason alone.

Luckily, I learned to do that before I built Gentoo on a Pentium III 933MHz.  A high-end P3 is surprisingly fast at compiling code, but it's still better to make your mistakes on a decent P4 or better. :x
Title: Re: Linux from an SD card?
Post by: Bobbias on July 26, 2010, 11:21:32 PM
Usually, if you're given USE flags one at a time the ramifications of selecting them are either being explained or they are optional (or situational, whichever the case may be). I typically skim through the documentation before I begin for that reason alone.

The Gnome Configuration HOWTO that you linked me to said nothing about all those otehr use flags. It just mentions -qt4 -kde x dbus gtk gnome hal. I didnt use any of the - ones, but I doubt that had much to do with it. And the only "explanation" I got was that package xyz needed that use flag because no version of that package would build with what I had currently. emerge just ended after that.

Also, while I'm at it, I've got a bash scripting question. Say I wanted to output df onto the screen, and print out a warning if disk usage was 80% or higher, how would I do that? I know a bit about pipes, but I'm not sure how I would both print the df output, and process the output with (say) grep in an if statement as well. Also, how would I format my grep statement to look at my main partition, and warn me if the usage percentage was over 80%? regex's sound like they'd be a fucking PAIN to set up for that. Also, where could I learn about regex's? I haven't seen any real concrete explanations of the syntax of a regex, just vague discussions on them.
Title: Re: Linux from an SD card?
Post by: Spectere on July 27, 2010, 12:41:43 AM
Yeah, I don't remember what the Gnome HOWTO said specifically.  I haven't read it in a while (since I really really dislike Gnome).  That's just usually the case.

df shows the percentage in the standard view, so you can kinda kludge something together if you parse its output with awk and sed (you can probably do everything with one or the other, but this is the easiest way that I know off the top of my head).  For instance, if I wanted to return just the percentage free on /dev/sda1, I could use the following (since with df's output, the percentage field is the 5th one):

Code: [Select]
df /dev/sda1 | awk '{ getline; print $5 }' | sed 's/\%//'
Basically, df /dev/sda1 returns the disk space free for only the specified drive, as follows:

Code: [Select]
spectere@obsidian:~$ df /dev/sda1
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sda1            488369088 350973792 137395296  72% /storage
spectere@obsidian:~$

Now, we pipe that output to awk.  Awk is a programming language that's designed around parsing text.  We're basically feeding what df is giving us into awk's input.  Let's look at the awk script, line-by-line:

Code: [Select]
getline
print $5

getline just returns the first line and drops it from the input.  This is my way of getting rid of df's header.

print $5 simply returns the fifth field of the line.  Since awk seperates fields by spaces (like df does) it returns the percentage, as follows:

Code: [Select]
spectere@obsidian:~$ df /dev/sda1 | awk '{ getline; print $5 }'
72%
spectere@obsidian:~$

Since we want just the number, we'll use sed to substitute the percentage for black space with the following script: sed 's/\%//'.  This takes what is given to sed (the output of awk, which is the processed output from df) and replaces any percentage sign that it sees with nothingness.  If you were to have a string that said "hello%world", this script would give you "helloworld".  The end result of this is pretty obvious:

Code: [Select]
spectere@obsidian:~$ df /dev/sda1 | awk '{ getline; print $5 }' | sed 's/\%//'
72
spectere@obsidian:~$

Looks like the shared storage drive on my server is 72% full.  Oh snap.  Now, let's cook up a quick bash script to use the output from our little one-liner and put it to use.  I'll start off by simply showing what I came up with:

Code: [Select]
#!/bin/bash
export percent=`df /dev/sda1 | awk '{ getline; print $5 }' | sed 's/\%//'`

if [ "$percent" -gt "80" ]; then
        echo "omg ur disks r filing up :o";
else
        echo "kk looks liek ur gud 4 nao";
fi;

Save that to a file (I called it zomgdisk.sh) and make it executable with chmod u+x zomgdisk.sh.

The first line tells the interpreter what to use to parse the script.  Since we definitely want bash to handle it, we tell it to use /bin/bash.  This is optional, but recommended.  If this is not included, the active shell will interpret the script, which might not be what you want.

The next line should look mostly familiar.  In short, it's setting the output of our one-liner to the percent variable.  The backticks (``) execute the command contained within and pastes its output directly onto the line.  Essentially, in the context of the script, when it's run on my server, it's seeing this:

Code: [Select]
export percent=72
Next, we go down to a fairly straight-forward if statement.  If our variable is greater than 80, it will display the "omg ur disks r filing up" message, otherwise it'll tell us that it "looks liek ur gud".  Note the square brackets for the condition and the odd semicolon usage.  I assure you, that will bite you on the ass repeatedly in the future until you've written several scripts from scratch (and after you've set aside the black arts of bash scripting for a few months and jump back to it, it'll trip you up again...grr).

Let's give it a whirl, shall we?  Since my server's SATA drive is only 72% full, we should see the second message.

Code: [Select]
spectere@obsidian:~$ ./zomgdisk.sh
kk looks liek ur gud 4 nao
spectere@obsidian:~$

Perfect!  Now, to make sure that our conditions are working right, let's set the warning percentage to 70%:

Code: [Select]
if [ "$percent" -gt "70" ]; then
Okay, let's give this another go:

Code: [Select]
spectere@obsidian:~$ ./zomgdisk.sh
omg ur disks r filing up :o
spectere@obsidian:~$

oh noes!!!!!1

So, there you have it.  A script that will happily warn you when your drive is getting full. ;D  As you can see, no complex regex tomfoolery was required.
Title: Re: Linux from an SD card?
Post by: Bobbias on July 27, 2010, 01:10:34 AM
Awesome, I didn't know about awk and sed, so that's why I mentioned grepping the output from df. I did some quick googling before asking, but from what I saw, I wasn't likely to find much useful info without spending a long time digging through the garbage to get it.

Bash scripting is definitely a useful thing to know, and it gives me an excuse to "program" some stuff once in a while to satify my occasional code craving, lol. I figured I'd run something like that while running some large emerges, like gnome, just in case I'm getting close to full. I don't have a huge partition to play with in linux at the moment. I'm already nearing the 50% mark :/

EDIT: Correction, nearing the 70% mark :S by the time gnome is installed it's gonn be full :< (well, that, and when wesnoth is finished)
Title: Re: Linux from an SD card?
Post by: Bobbias on July 27, 2010, 02:59:33 AM
I'd edit the last post, but links doesn't want to let me. It brings up the "you've already posted this" error on the forum.

Anyway, it seems that wesnoth doesn't like me, and doesn't want me to be able to play with sound. mplayer works fine. I'm using alsa. I've had mplayer streaming music, and alsamixer for my mixer, and that worked perfectly, but wesnoth just says no available audio device, whether or not mplayer is running. google has failed me :/

Gnome works. Except that my Applications menu is completely empty... And Movie Player is lame and didnt notice that I am definitely capable of playing mp3s, considering the fact that I am currently streaming mp3 off di in mplayer.