Closed judsonmitchell closed 11 years ago
tl;dr: it's due to the chroot approach; there's nothing wrong with your install.
Details: There's a couple factors at play here. crouton does not start any SystemV or Upstart jobs when you enter the chroot. Additionally, the service
command uses Upstart, which is unfortunately designed in such a way that you can only have one instance per kernel (pid 1), and Chromium OS of course takes that. So when you run sudo service mysql start
, you're actually asking Chromium OS to start a mysql daemon, which it has no idea about, and instead just kind of stands there and looks at you like you're crazy. If it were a SystemV daemon (in /etc/init.d), you could just run the init.d script directly to do launch things. For Upstart, however, you have to read the conf file and figure out what you need to run.
For example, the equivalent script for mysql (without any checks to avoid starting it twice):
export HOME=/etc/mysql
umask 007
[ -d /var/run/mysqld ] || install -m 755 -o mysql -g root -d /var/run/mysqld
exec /usr/sbin/mysqld
I'm considering making crouton run the contents of /etc/rc.local when you enter the chroot for the first time, since people seem to be needing that for lamp stacks and whatnot. We can keep this bug open to track.
this is kind of what I want to do as well. I use very small devices to run lamp stacks (such as the seagate dockstar with 128mb ram/nand, running nginx, php5, sshd, mysql/mariadb, samba, etc. with systemd startups (arch linux arm) - looking to do the same with the chromebook, and willing to give up the gui of chrubuntu for more stability. Haven't been able to play with arch linux arm on the chromebook yet, the last images were a tad too big for my 8gb sd cards, but have 16gb cards coming thur. I use these as a portable low power mini-server for teaching linux and programming, and also keep a similar home server running 24x7 at super low watts. Looking for suggestions on the best distros to use in a crouton like environment, as the arm chromebook has nice hardware, low power, and a real keyboard and display!
crouton with the cli-extra
target installed to the internal SSD makes for a great personal server. Be sure to sudo stop powerd; sudo stop powerm; sudo iptables -P INPUT ACCEPT
to prevent the device from going to sleep or suspending when you close the lid and to allow incoming connections. If you disable rootfs verification you can launch the stack on boot-up, and prevent powerm and powerd from starting.
I run a server on the ARM Chromebook using this method, although I leave rootfs verification enabled and just run a script after reboot if I have to reboot the device (which I never do).
Thanks David, I will give this a try. I now have 16GB SD cards to try arch and other crouton targets like cli-extra, but I'm also spoiled by the speed of everything on the internal with crouton!
Yes, power mgmt was the first thing to bite me in crouton - went to get my son to show him how cool it was, hit the 4 keys, and just got a snowflake screensaver that took me 10 minutes to get rid of and disable!
The xfce linux is running some ~178 processes without samba, web server or php, or dev environment, while my pogo arch runs about 55 processes with all of the above running (but no gui), so I'm concerned that the overhead of chromeos on the linux is quite a learning curve since I haven't been active in following chromium development.
But I will check out other targets as well as arch. Thanks! Crouton is an incredible addition to the Chromebook!
Ted
On Wed, Mar 20, 2013 at 1:53 PM, David Schneider notifications@github.comwrote:
crouton with the cli-extra target installed to the internal SSD makes for a great personal server. Be sure to sudo stop powerd; sudo stop powerm; sudo iptables -P INPUT DROP to prevent the device from going to sleep or suspending when you close the lid and to allow incoming connections. If you disable rootfs verification you can launch the stack on boot-up, and prevent powerm and powerd from starting.
I run a server on the ARM Chromebook using this method, although I leave rootfs verification enabled and just run a script after reboot if I have to reboot the device (which I never do).
— Reply to this email directly or view it on GitHubhttps://github.com/dnschneid/crouton/issues/73#issuecomment-15202756 .
Yeah, if you use cli-extra instead of xfce, you'll just have a chroot console in crosh, and things will be waaay lighter-weight.
Thanks David, what command should I run, will I be upgrading, or replacing my existing crouton/chrubuntu xfce (either is fine, as there is no user data there), as I think you said "targets are cheap" ;) but I did spend 10 minutes customizing my wallpaper ;). I don't think it ever took the right theme (pixelmap), but runs fine, nonetheless, in crosh, I get these errors when starting sudo startxfce4:
Arch Arm on SD works fine, but no ability to switch to chromos, just runs from sd right now. Curious if anyone has run http://code.google.com/p/pbyte-unixbench/downloads on the Samsung ARM. I ran it on my pogo with dismal numbers, also the browser benchmarks (sunspider and octane) show js on the chromeos running about 1/3rd the speed of my desktop, and 2/3 the speed of my 2006 dell x86 1.6 coreduo, all with the latest chrome.
Thanks,
Ted
chronos@localhost / $ sudo startxfce4 /usr/bin/startxfce4: Starting X server
[dix] Could not init font path element /usr/share/fonts/X11/misc, removing from list! [dix] Could not init font path element /usr/share/fonts/X11/cyrillic, removing from list! [dix] Could not init font path element /usr/share/fonts/X11/100dpi/:unscaled, removing from list! [dix] Could not init font path element /usr/share/fonts/X11/75dpi/:unscaled, removing from list! [dix] Could not init font path element /usr/share/fonts/X11/Type1, removing from list! [dix] Could not init font path element /usr/share/fonts/X11/100dpi, removing from list! [dix] Could not init font path element /usr/share/fonts/X11/75dpi, removing from list! [dix] Could not init font path element /var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType, removing from list! /usr/bin/xinit: XFree86_VT property unexpectedly has 0 items instead of 1 Agent pid 3420
(xfce4-session:3426): Gtk-WARNING **: Unable to locate theme engine in module_path: "pixmap",
(xfsettingsd:3433): Gtk-WARNING **: Unable to locate theme engine in module_path: "pixmap",
(xfwm4:3431): Gtk-WARNING **: Unable to locate theme engine in module_path: "pixmap", xfdesktop[3444]: starting up
(xfdesktop:3444): Gtk-WARNING **: Unable to locate theme engine in module_path: "pixmap",
(xfce4-panel:3443): Gtk-WARNING **: Unable to locate theme engine in module_path: "pixmap", xfce4-settings-helper: Another instance is already running. Leaving...
(polkit-gnome-authentication-agent-1:3454): GLib-CRITICAL **: g_variant_new_string: assertion `string != NULL' failed
(polkit-gnome-authentication-agent-1:3454): polkit-gnome-1-WARNING **: Failed to register client: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.SessionManager was not provided by any .service files
(globaltime:3459): Gtk-WARNING **: Unable to locate theme engine in module_path: "pixmap",
(xfce4-terminal:3463): Gtk-WARNING **: Unable to locate theme engine in module_path: "pixmap",
(wrapper:3460): Gtk-WARNING **: Unable to locate theme engine in module_path: "pixmap",
On Wed, Mar 20, 2013 at 3:53 PM, David Schneider notifications@github.com wrote:
Yeah, if you use cli-extra instead of xfce, you'll just have a chroot console in crosh, and things will be waaay lighter-weight.
— Reply to this email directly or view it on GitHub.
You won't have a desktop if you stick with the cli-core
, so that's not an issue. I suggest making a new chroot to keep it small and get rid of the DE cruft. You can either delete the old one entirely, or make the new one alongside the old one using the -n
parameter to give it a unique name.
The pixmap errors can be safely ignored.
Thanks David,
From the dev consonle du shows that precise is only using ~15% of the internal, so I should be able to add more targets.
What is the syntax though? And should I d/l the latest crouton? I have it on another system, and since it's the combination sh and tarball, I can't really see if it's newer than say Saturday's crouton.
I sometimes get a temporary lockup in precise, usually when in chromos/crosh/shell dev terminal, but I think if I carefully exit out of root on the dev terminal, then ctrl-alt-<- then shift-ctrl-alt- -> I then get back into the live xfce precise desktop, once or twice I've had to restart it from crosh, but I think I killed something important.
So I'm ready to install more targets, but what is the syntax, and should I d/l a new crouton? Where are the targets visible, to see what core-extras vs core-xyz have?
The guy having language problems, might be getting his /etc/profile.d or .bashrc files mixed up when switching between root and user, or ChromeOS might be taking them? I've also noticed my char encoding is off when toggling between crosh, dev mode shell, and ubuntu, but I haven't yet set all my .bashrc settings, last env check, I didn't have my language settings in at all.
I'm documenting this for my son, and might write an e-book called "Hacking the Chromebook" !
If you could point me to the right command to install core or core-extras, I'll give that a shot tonight alongside the xfce version.
Thanks!
Ted
On Wed, Mar 20, 2013 at 5:35 PM, David Schneider notifications@github.comwrote:
You won't have a desktop if you stick with the cli-core, so that's not an issue. I suggest making a new chroot to keep it small and get rid of the DE cruft. You can either delete the old one entirely, or make the new one alongside the old one using the -n parameter to give it a unique name.
The pixmap errors can be safely ignored.
— Reply to this email directly or view it on GitHubhttps://github.com/dnschneid/crouton/issues/73#issuecomment-15213052 .
Am installing cli-extra now, found the targets list with -help ;) Decided to keep the xfce, but when I tried sudo sh -e ~/Downloads/crouton -t cli-extra it gave an error that /usr/local/chroots already has stuff in it!, and to delete, or specify a different name, or update.
So I used a different name: sudo sh -e ~/Downloads/crouton -t cli-extra -n cliextra
It's still installing, so I'll be intererested to see where it loads, if off of /usr/local
Should I generate some keys? I got a W: Cannot check Release signature; keyring file not availablue /usr/share/keyrings/ubuntu-archive-keyring.gpg ?
Thanks!
On Thu, Mar 21, 2013 at 7:49 PM, Ted Matsumura matsumura@gmail.com wrote:
Thanks David,
From the dev consonle du shows that precise is only using ~15% of the internal, so I should be able to add more targets.
What is the syntax though? And should I d/l the latest crouton? I have it on another system, and since it's the combination sh and tarball, I can't really see if it's newer than say Saturday's crouton.
I sometimes get a temporary lockup in precise, usually when in chromos/crosh/shell dev terminal, but I think if I carefully exit out of root on the dev terminal, then ctrl-alt-<- then shift-ctrl-alt- -> I then get back into the live xfce precise desktop, once or twice I've had to restart it from crosh, but I think I killed something important.
So I'm ready to install more targets, but what is the syntax, and should I d/l a new crouton? Where are the targets visible, to see what core-extras vs core-xyz have?
The guy having language problems, might be getting his /etc/profile.d or .bashrc files mixed up when switching between root and user, or ChromeOS might be taking them? I've also noticed my char encoding is off when toggling between crosh, dev mode shell, and ubuntu, but I haven't yet set all my .bashrc settings, last env check, I didn't have my language settings in at all.
I'm documenting this for my son, and might write an e-book called "Hacking the Chromebook" !
If you could point me to the right command to install core or core-extras, I'll give that a shot tonight alongside the xfce version.
Thanks!
Ted
On Wed, Mar 20, 2013 at 5:35 PM, David Schneider <notifications@github.com
wrote:
You won't have a desktop if you stick with the cli-core, so that's not an issue. I suggest making a new chroot to keep it small and get rid of the DE cruft. You can either delete the old one entirely, or make the new one alongside the old one using the -n parameter to give it a unique name.
The pixmap errors can be safely ignored.
— Reply to this email directly or view it on GitHubhttps://github.com/dnschneid/crouton/issues/73#issuecomment-15213052 .
By default it will end up in /usr/local/chroots/$name. If you wanted to update the existing chroot, the -u
parameter will do so. But by making it a separate chroot, if you find that cli-extra
has everything you need, you can delete the previous one and reclaim all of that space. Don't forget that you'll need to use -n when running enter-chroot
in order to specify the name of the chroot you want to enter (otherwise it will pick the first one alphabetically).
You do not need to generate any keys. That is just warning you that Chromium OS does not know the Ubuntu public keys, so you can't validate the origin of the packages.
Thanks David,
I installed cli-extra fine, and it looks like what I want (root@localhost) ! but now /usr/local/chroots has the precise (xfce) and the new cliextra that I just installed.
logging out of cli-extra unmounts me automatically, which is great, but I can't seem to delete precise, it is named startxfce4 in /user/local/chroots, but when I try to type (as root):
./delete-chroot startxfce4 it doesn't recognize startxfce4, so I tried ./delete-chroot precise, and also unmount it, but it says "Not unmounting /usr/local/chroots/precise as another instance is using it." running df shows some files and dirs in /precise that might be mounted, but umount doesn't work either.
I think I'll just go out of dev mode to OOB mode and back into dev mode, and just install cli-extras tomorrow.
One thing I noticed was that gcc wasn't there, finding the directories, running as root: find / -name gcc finds an arm-linux-gnueabihf dir in /usr/lib/gcc but just empty directories for 4.6 and 4.6.3, but I can probably find them with apt-get after I reinstall.
It looks great. I'll let you know how the clean install goes tomorrow, and if I can find or install gcc/g++ for arm. Thanks!
Ted
On Thu, Mar 21, 2013 at 10:32 PM, David Schneider notifications@github.comwrote:
By default it will end up in /usr/local/chroots/$name. If you wanted to update the existing chroot, the -u parameter will do so. But by making it a separate chroot, if you find that cli-extra has everything you need, you can delete the previous one and reclaim all of that space. Don't forget that you'll need to use -n when running enter-chroot in order to specify the name of the chroot you want to enter (otherwise it will pick the first one alphabetically).
You do not need to generate any keys. That is just warning you that Chromium OS does not know the Ubuntu public keys, so you can't validate the origin of the packages.
— Reply to this email directly or view it on GitHubhttps://github.com/dnschneid/crouton/issues/73#issuecomment-15281924 .
You may still have the precise chroot open on another tab, or in the background. In the worst case, a simple reboot should ensure that everything's closed so that you can delete the chroot.
gcc isn't installed by default, but a simple sudo apt-get install gcc
will bring it in.
Yes, rebooting allowed me to delete the precise chroot, and I was able to apt-get gcc and compile a test program.
Works very well, tomorrow I'll get the lamp stack and samba on it. resources are OK, but about 8x memory usage (with free-m) compared to a dockstar arm5 1.2Ghz Kirkwood with 128mb and arch for arm5, but I guess a lot of that is the chromeos (1 tab with crosh open), and the progress of the monitor, flexiblity and all ;)
I had a small quirk with nano and ctrl-o when saving my test c file, it wanted to open a chromeos window instead of write the nano file, but I'll test that out more tomorrow.
One last question for now, when I experiment with addl targets, should I include the dependencies, and specify them, or do dependencies get installed automatically? For example, I just specified cli-extra but assume I got core? and when I installed xfce, just specifying xfce, I assume I got it's dependencies?
Thanks!
Ted
On Thu, Mar 21, 2013 at 11:16 PM, David Schneider notifications@github.comwrote:
You may still have the precise chroot open on another tab, or in the background. In the worst case, a simple reboot should ensure that everything's closed so that you can delete the chroot.
gcc isn't installed by default, but a simple sudo apt-get install gccwill bring it in.
— Reply to this email directly or view it on GitHubhttps://github.com/dnschneid/crouton/issues/73#issuecomment-15282802 .
@tedm I'm not sure when but the latest versions of crouton now support a -V option which reports the version number so they can be easily compared now - just issue 'crouton -V'.
Thanks, I just downloaded version 0-20139313164594-master:4f56e509
I will probably download again tomorrow, and the day after, etc. Is there a way to put a version number in the crouton filename, to know if I already have the latest version?
@tedm - See my comment on the site - https://github.com/dnschneid/crouton/issues/73#issuecomment-15315104
On Fri, Mar 22, 2013 at 10:55 PM, tedm notifications@github.com wrote:
Thanks, I'm have just downloaded version 0-20139313164594-master:4f56e509
I will probably download again tomorrow, and the day after, etc. Is there a way to put a version number in the crouton filename, to know if I already have the latest version?
— Reply to this email directly or view it on GitHubhttps://github.com/dnschneid/crouton/issues/73#issuecomment-15330700 .
DennyL@GMail
It would probably be useful for crouton to store the version number in the chroot somewhere so you can query it, but right now, it does not.
Thanks Dennis, David - I don't mind d/l each time, version naming could be tedious, since an update may not have an effect on my specific target(s). I have been running cli-extra and it's running fairly well. nginx and php5-fpm are running, there was a bad gateway 502 error I had to dig into, but it may be an upgrade in php config settings since I last installed them. mysql-server 5.5 from apt-get as mentioned at the top here doesn't create a job, but I can manually bring it up. Perhaps your idea from 4 days ago would be worth trying?
I'm considering making crouton run the contents of /etc/rc.local when you enter the chroot for the first time, since people seem to be needing that for lamp stacks and whatnot. We can keep this bug open to track.
btw, one thing that might have changed is that you can't just open a crosh shell and run crouton, you have to go to a shell, and to see the fs, you have to go to a
Agreed--the version naming is more useful for bug reports than anything else...although it looks like we could leverage github's web interface to allow you to see a changelog since the version you have installed. If you grab the hex string at the end of the version number, you can drop it into a URL like so: https://github.com/dnschneid/crouton/compare/thehexstring...master and see everything that has changed since. Might be worth including.
Yes, you need to type shell
before you can run crouton, and df
is unable to query the mountpoints inside of the chroot (but if you say df /
explicitly, it will work).
Fixed in master. Update your chroot then play with the chroot's /etc/rc.local to launch whatever you need it to. It will only launch it once per mount (e.g. you can enter the chroot multiple times and it will only launch it once until all instances close).
Nice! This is what I was looking for. Would love documentation on this in the wiki.
Go for it!
Additionally, the service command uses Upstart, which is unfortunately designed in such a way that you can only have one instance per kernel (pid 1), and Chromium OS of course takes that. So when you run sudo service mysql start, you're actually asking Chromium OS to start a mysql daemon, which it has no idea about, and instead just kind of stands there and looks at you like you're crazy. If it were a SystemV daemon (in /etc/init.d), you could just run the init.d script directly to do launch things. For Upstart, however, you have to read the conf file and figure out what you need to run.
Well, that once again shows why classical Unix way is better than novelty hack-ups like Upstart. But if we've got to live with that - well, any patches and custom Upstart package for crouton which will kill not process 1, but the right one? If not, any Python script which will interpret Upstart .conf file and do the right thing? Because crouton works so nice, then imho it's worth to go for whatever hacks are needed to get remaining few bits work too.
I have in my never-ending todo list to port upstart-dummy to shell/awk (so that python is not required to be installed in the chroot) so that you could, in fact, handle daemons inside the chroot. PIDs would be tracked in /var/run/crouton-upstart, and initctl would be symlinked out using something like:
dpkg-divert --divert /sbin/host-initctl --local --rename --add /sbin/initctl
ln -s /usr/local/bin/crouton-initctl /sbin/initctl
Finally, host-* versions of start/stop/restart would be provided (symlink to host-initctl).
...but it's pretty far down my todo list. If you'd like to give it a stab, make a branch and open a new issue/pull request to track, and I'll help where I can.
Is there currently a way to automatically stop daemons (or executing some commands) before leaving the chroot? E.g., cupsd (started via /usr/sbin/cupsd
in /etc/rc.local
) stays running when I leave the chroot, hence I get the annoying
Sending SIGTERM to processes under /usr/local/chroots/raring...
message and have to wait for a few seconds. Not that it matters too much, but if easily possible I'd like to have this a bit cleaner.
Thanks!
Not really; SIGTERM is how Linux handles shutdown as well, for the most part. If you're running X11 and don't need to see the logspam in the crosh shell, you can get ultimate cleanness by adding the -b
parameter, which will silence the output and fork off into the background (you can even close the crosh shell at that point). Then it doesn't matter how long it takes to unmount :)
But really, think of unmounting the chroot as shutting down an OS, because that's pretty much what it's doing.
Okay, true. I guess once I have my setup a bit more polished the chroot stays open all the time anyway, so it will be a non-issue at some point.
Thanks!
I cant find the rc.local in my etc... could you explain the process to make the mysql work in crouton? I have apache, nginx, ruby, postgre, all good, but still no mysql
Look inside the chroot's /etc, not Chromium OS's. There's a wiki entry on setting stuff up.
Re. the comment from March 25, 2013, which states:
' the chroot's /etc/rc.local to launch whatever you need it to. It will only launch it once per mount (e.g. you can enter the chroot multiple times and it will only launch it once until all instances close).'
If I understand this correctly, it means that rc.local will only run once, when the first chroot is mounted, no matter how many targets exist, and are mounted and running simultaneously.
I other words, even though multiple targets may exist, and are mounted by name ( -n ), they are all seen as 'instances' , and so will not run rc.local per each, after the first mounted instance, which 'wins', because it gets to run rc.local, by virtue of being the 'early bird'.
If that is correct, then it explains why I am having trouble enabling an ssh server on each chroot, and opening ssh terminals between chroots. As it turns out, I can only ssh into the first chroot to be mounted.
No, each chroot is mounted separately and will have its own rc.local run on mount. But if you don't change the port of the SSH server, whichever one you start first will own the port. These aren't virtual machines.
OK, this is running now. After following the instructions here:
https://github.com/dnschneid/crouton/wiki/Running-servers-in-crouton
which explain how to open a port # (for iptables), and start sshd, it was found to be inadequate when using multiple chroots.
For example, IF you decide to use a non-standard port #, as is often recommended, and is required in this case, for each chroot to have a dedicated port #, then you also have to set the -p (port #) option when starting sshd:
/sbin/iptables -I INPUT -p tcp --dport 2222 -j ACCEPT
mkdir -p -m0755 /var/run/sshd
/usr/sbin/sshd -p 2222
making sure the port # opened in the iptables setting matches the selected port # for sshd, for each chroot
@dnschneid Did you ever port something like upstart-dummy?
Nope...
Thanks for this wonderful software! I'm running a LAMP stack on the cli-extra target and I'm encountering this problem: Every time I enter the chroot, I have to manually start mysqld and sshd. I notice that trying to start these as an upstart job (sudo service mysql start) returns "mysqld: unrecognized service" and I have to: sudo mysqld.
Is this just a botched install or does this have something to do with the chroot?