chromiumos/platform/init.git
2 days agoinit: Run the OOBE code as part of embedded chromeos_startup. 57/51457/3 master
Darin Petkov [Thu, 16 May 2013 12:45:53 +0000 (14:45 +0200)]
init: Run the OOBE code as part of embedded chromeos_startup.

The code is identical to the one in regular startup. The slow down on
daisy-drm due to running dump_vpd_log seems to be less than 0.5
seconds.

BUG=chromium:241382
TEST=built and booted daisy-drm

Change-Id: Id6709147b9748eab10faf01355984558c927c7b4
Reviewed-on: https://gerrit.chromium.org/gerrit/51457
Commit-Queue: Darin Petkov <petkov@chromium.org>
Reviewed-by: Darin Petkov <petkov@chromium.org>
Tested-by: Darin Petkov <petkov@chromium.org>
3 days agoinit: Copy previously removed code from regular startup back into embedded. 41/51441/2
Darin Petkov [Thu, 16 May 2013 09:03:33 +0000 (11:03 +0200)]
init: Copy previously removed code from regular startup back into embedded.

This is a step towards eliminating the differences between regular and
embedded startup so that they can be unified. The code is copied from
init/chromeos_startup without any modifications.

BUG=chromium:221343
TEST=booted daisy-drm image, ensured chromeos_startup runs to
completion by checking for bootstat's post-startup stamp.

Change-Id: I5452182d41b50c951728fb89001c7ab73c3f77f2
Reviewed-on: https://gerrit.chromium.org/gerrit/51441
Tested-by: Darin Petkov <petkov@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Darin Petkov <petkov@chromium.org>

3 days agoinit: Mount debugfs with debugfs-access as group. 45/51445/3
Darin Petkov [Thu, 16 May 2013 11:06:58 +0000 (13:06 +0200)]
init: Mount debugfs with debugfs-access as group.

This was changed recently in the regular chromeos_startup (CL:45554),
so propagate the change in embedded.

BUG=chromium:221343
TEST=built and booted daisy-drm, checked that debugfs is mounted
correctly.

Change-Id: I836739a2583d4ed39c480c91a7e04bf1dcfaab60
Reviewed-on: https://gerrit.chromium.org/gerrit/51445
Tested-by: Darin Petkov <petkov@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Darin Petkov <petkov@chromium.org>

4 days agoinit: Run ureadahead as an upstart job. 19/51119/3
Darin Petkov [Tue, 14 May 2013 12:15:46 +0000 (14:15 +0200)]
init: Run ureadahead as an upstart job.

ureadahead is controlled by a separate upstart job now
(ureadahead.conf). Certain build targets (e.g., embedded) may choose
to not install the job to prevent ureadahead from running.

ureadahead.conf is added to chromeos-init rather than
ureadahead.ebuild (despite the comment in init/README) because it
depends on the "startup" job which is considered an internal
chromeos-init dependency.

Since only ureadahead and 'cros_installer postinst' (the latter
removes the old ureadahead pack files) need access to
/var/lib/ureadahead, changed its permissions from 0755 to 0700. Note
that the pack files are root-only accessible already anyway.

bootperf on lumpy, 10 cycles:

Before:

 time  s%     dt  s%  event
 1502  1%  +1502  1%  startup
 1873  2%   +371  7%  startup_done
 2693  2%   +820  4%  x_started
 2749  2%    +56 21%  chrome_exec
 3178  2%   +429 15%  chrome_main
 5006  1%  +1828  1%  login
 6971  1%  +1965  2%  network

After:

 time  s%     dt  s%  event
 1526  2%  +1526  2%  startup
 1920  3%   +394 13%  startup_done
 2734  2%   +814  5%  x_started
 2795  2%    +61 20%  chrome_exec
 3191  3%   +396 15%  chrome_main
 5020  2%  +1829  3%  login
 7622 20%  +2602 57%  network

BUG=chromium:240660
TEST=Tested manually on lumpy, looked at boot times before and after,
deleted /var/lib/ureadahead and checked that pack files were
regenerated on reboot. Built and booted daisy-drm image, checked that
/var/lib/ureadahead and /etc/init/ureadahead are not present.

Change-Id: I44abf395bf41ec25b697c1f373e633e18bc7891b
Reviewed-on: https://gerrit.chromium.org/gerrit/51119
Tested-by: Darin Petkov <petkov@chromium.org>
Reviewed-by: Richard Barnette <jrbarnette@chromium.org>
Commit-Queue: Darin Petkov <petkov@chromium.org>

4 days agoinit: Initialize kernel sysctl in chromeos_startup. 14/51114/3
Darin Petkov [Tue, 14 May 2013 10:30:51 +0000 (12:30 +0200)]
init: Initialize kernel sysctl in chromeos_startup.

This CL along with its dependent CL makes the following changes:

- Invoke 'sysctl -p' as part of chromeos_startup -- both regular and
  embedded. This guarantees that the new kernel settings will apply to
  all boot processes.

- Remove procps.conf from regular targets. This init script is not
  installed on embedded targets (but probably should have been).

- Remove explicit setting of /proc/sys/fs/suid_dumpable to 2 from
  chromeos_startup. This setting is now enforced by /etc/sysctl.conf
  which is installed by chromeos-base.ebuild (see dependent CL).

bootperf on lumpy, 10 cycles:

Before:

 time  s%     dt  s%  event
 1537  2%  +1537  2%  startup
 1910  2%   +373  6%  startup_done
 2746  2%   +836  4%  x_started
 2802  2%    +56 12%  chrome_exec
 3173  2%   +371  7%  chrome_main
 5040  1%  +1867  2%  login
 7041  1%  +2001  2%  network

After:

 time  s%     dt  s%  event
 1528  3%  +1528  3%  startup
 1935  6%   +407 19%  startup_done
 2765  7%   +830 10%  x_started
 2826  6%    +61 35%  chrome_exec
 3272  4%   +446 13%  chrome_main
 5127  3%  +1855  1%  login
 7112  5%  +1985 11%  network

BUG=chromium:240646
TEST=Tested manually on lumpy, cat /proc/sys/fs/suid_dumpable shows 2,
kill -SEGV dbus-daemon generates a crash dump. Built and booted
successfully a daisy-drm image, inspected /proc/sys/fs/suid_dumpable.

CQ-DEPEND=I753cd1e49860564e31984730b7b1be6f5df62b09

Change-Id: Ia2024cd0cfbe1e4b51b42225c3a22e1660067bc4
Reviewed-on: https://gerrit.chromium.org/gerrit/51114
Tested-by: Darin Petkov <petkov@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Richard Barnette <jrbarnette@chromium.org>
Commit-Queue: Darin Petkov <petkov@chromium.org>

5 days agoFix cron-lite to run jobs when requested, not every 5 minutes. 75/51175/4
J. Richard Barnette [Tue, 14 May 2013 20:57:57 +0000 (13:57 -0700)]
Fix cron-lite to run jobs when requested, not every 5 minutes.

BUG=chromium:240851
TEST=boot, wait to see that the unit didn't rotate logs every 5 minutes

Change-Id: Ic12ecd875b973edac823e64961834e1cd56fdaa7
Reviewed-on: https://gerrit.chromium.org/gerrit/51175
Commit-Queue: Richard Barnette <jrbarnette@chromium.org>
Reviewed-by: Richard Barnette <jrbarnette@chromium.org>
Tested-by: Richard Barnette <jrbarnette@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
6 days agocron-lite: fix bashism redirection 63/50863/2 factory-4128.B factory-spring-4131.B
Mike Frysinger [Fri, 10 May 2013 19:14:02 +0000 (15:14 -0400)]
cron-lite: fix bashism redirection

The "&>" operator is a bashism and doesn't work in dash.  Use the
portable form to silence stderr & stdout.

BUG=None
TEST=trybots

Change-Id: Id77fc3f65d2280bd4b3f83067a0f16295c9c6221
Reviewed-on: https://gerrit.chromium.org/gerrit/50863
Reviewed-by: Elly Jones <ellyjones@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
9 days agoavahi: prepend iptables rules instead of appending them 05/50705/2
David Zeuthen [Thu, 9 May 2013 21:32:58 +0000 (14:32 -0700)]
avahi: prepend iptables rules instead of appending them

... otherwise traffic is going to NFQUEUE because of this rule

  # Send incoming UDP traffic (which has not passed any other rules) to the
  # user-space filter to test whether it was a reply to outgoing DIAL protocol
  # traffic.
  iptables -A INPUT -p udp -j NFQUEUE --queue-num ${NETFILTER_INPUT_NFQUEUE}

recently added to /etc/init/iptables.conf.

BUG=None
TEST=Verified that incoming UDP packets for port 5353 are passed to avahi-daemon

Change-Id: Icd1c9db3b659d6f17a1f095df1d97ac3e1d1420f
Reviewed-on: https://gerrit.chromium.org/gerrit/50705
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: David Zeuthen <zeuthen@chromium.org>
Tested-by: David Zeuthen <zeuthen@chromium.org>
11 days agodrop +x bits on upstart init scripts 05/50405/2
Mike Frysinger [Sat, 26 Jan 2013 05:21:53 +0000 (00:21 -0500)]
drop +x bits on upstart init scripts

These files do not need to be +x to work.  The
emerge process installs them with 644 perms too.

BUG=None
TEST=None

Change-Id: Ie6a454e76d572870f02cd25b60ee6e8e01722f2f
Reviewed-on: https://gerrit.chromium.org/gerrit/50405
Reviewed-by: Richard Barnette <jrbarnette@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
12 days agoStart the warning collector daemon. 14/49514/3
Luigi Semenzato [Tue, 30 Apr 2013 20:43:08 +0000 (13:43 -0700)]
Start the warning collector daemon.

BUG=chromium:227080
TEST=manually tested
CQ-DEPEND=I6a4010acad0ffe20c702bb0fc455e3da7cdf3ac1
Change-Id: Iffdd7adec5ac8176f95162681bc1485773482a8e
Reviewed-on: https://gerrit.chromium.org/gerrit/49514
Tested-by: Luigi Semenzato <semenzato@chromium.org>
Reviewed-by: Richard Barnette <jrbarnette@chromium.org>
Commit-Queue: Luigi Semenzato <semenzato@chromium.org>

2 weeks agoAdd Upstart file for avahi 85/49685/6 release-R28-4100.B
David Zeuthen [Tue, 30 Apr 2013 23:42:25 +0000 (16:42 -0700)]
Add Upstart file for avahi

Note that this job is not started automatically on boot. Programs
using Avahi are expected to explicitly arrange for this to happen via
e.g. "start avahi".

BUG=chromium:234371
TEST=Checked that Avahi isn't started on boot and "start avahi" starts it

Change-Id: Ib699a7c59088939147cae31947ce287d72d20ff5
Reviewed-on: https://gerrit.chromium.org/gerrit/49685
Commit-Queue: David Zeuthen <zeuthen@chromium.org>
Reviewed-by: David Zeuthen <zeuthen@chromium.org>
Tested-by: David Zeuthen <zeuthen@chromium.org>
2 weeks agoinit: Diverting WiMAX manager log messages to /var/log/net.log 06/49706/2
Ben Chan [Wed, 1 May 2013 03:11:49 +0000 (20:11 -0700)]
init: Diverting WiMAX manager log messages to /var/log/net.log

BUG=chromium:237077
TEST=Verified that all log messages from wimax-manager are sent to
/var/log/net.log and only those severer than warnings are sent to
/var/log/messages.

Change-Id: Ie1c762fa29b1bbab642ad63257e8e8675d23a96e
Reviewed-on: https://gerrit.chromium.org/gerrit/49706
Commit-Queue: Ben Chan <benchan@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
Reviewed-by: Chris Masone <cmasone@chromium.org>
2 weeks agoinit: Update for power_supply_info and backlight_tool. 63/49663/2
Daniel Erat [Tue, 30 Apr 2013 18:36:52 +0000 (11:36 -0700)]
init: Update for power_supply_info and backlight_tool.

This updates references to power_supply_info and
backlight_tool; the binaries previously had hyphens in their
names rather than underscores.

BUG=chromium:236858
TEST=built an image and checked that backlight level is set
     correctly before boot splash screen is shown

Change-Id: I9c2a5722dd8fa740fca22b27d8c87ee3821aead8
Reviewed-on: https://gerrit.chromium.org/gerrit/49663
Commit-Queue: Daniel Erat <derat@chromium.org>
Tested-by: Daniel Erat <derat@chromium.org>
Reviewed-by: Chris Masone <cmasone@chromium.org>
3 weeks agoshill: Remove "--push" argument 04/48604/3 stabilize-4068.0.B
Paul Stewart [Fri, 19 Apr 2013 01:25:41 +0000 (18:25 -0700)]
shill: Remove "--push" argument

shill no longer requires the "--push" argument to be passed to it.
Remove the init script code to generate it.

CQ-DEPEND=CL:48605
BUG=chromium:231858
TEST=Manual: Restart shill while logged in and ensure shill still
has the user profile loaded.  Modified version of network_ShillInitScripts

Change-Id: I0a61c3ad2c756c5c4f0365b57760d3936bdc1d70
Reviewed-on: https://gerrit.chromium.org/gerrit/48604
Reviewed-by: Christopher Wiley <wiley@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>

5 weeks agoinit: shill.conf: load cfg80211 in pre-start 29/47829/6 stabilize-4008.0.B stabilize-4035.0.B
mukesh agrawal [Tue, 9 Apr 2013 22:31:06 +0000 (15:31 -0700)]
init: shill.conf: load cfg80211 in pre-start

As of CL:44770, shill will attempt to resolve the netlink message type for
"nl80211" in Daemon::Start. If that can't be resolved, shill will abort.

The "nl80211" message type is registered by cfg80211. So load cfg80211 in the
pre-start stanza of shill.conf. Note that after first boot, cfg80211 will
usually be loaded earlier, via preload-network.conf.

BUG=chromium:221118
TEST=manual

Manual testing
--------------
1. boot system
2. mount / -oremount,rw
3. edit /etc/init/shill.conf, adding
     lsmod > /home/root/lsmod-post-modprobe
   after
     modprobe cfg80211
4. rm /var/log/messages
5. rm /var/lib/preload-network-drivers
6. reboot
7. grep cfg80211 /home/root/lsmod-post-modprobe
   -> should match
8. grep "Received crash notification for shill" /var/log/messages
   -> should NOT match
9. reboot
10. grep cfg80211 /home/root/lsmod-post-modprobe
    -> should match
11. grep "Received crash notification for shill" /var/log/messages
    -> should NOT match
12. mount / -oremount,rw
13. mv /lib/modules/3.4.0/kernel/net/wireless/cfg80211.ko \
       /lib/modules/3.4.0/kernel/net/wireless/cfg80211-disabled.ko
14. reboot
15. grep cfg80211 /home/root/lsmod-post-modprobe
    -> should NOT match
16. grep "Received crash notification for shill" /var/log/messages
    -> should match
17. grep "Failed to load cfg80211" /var/log/messages
    -> should match

Change-Id: I9219cd8ce3613c2a1ddd89ca0379a44fdd1d253e
Reviewed-on: https://gerrit.chromium.org/gerrit/47829
Commit-Queue: mukesh agrawal <quiche@chromium.org>
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Tested-by: mukesh agrawal <quiche@chromium.org>
5 weeks agoAllow wpa_supplicant debug verbosity args 00/47800/5
Jason Abele [Wed, 10 Apr 2013 23:04:20 +0000 (16:04 -0700)]
Allow wpa_supplicant debug verbosity args

If extra verbose logging is enabled temporarily, and wpa_supplicant
crashes, the extra verbosity will be lost.  This change allows extra
verbose logging to be maintained across wpa_supplicant crashes via
environment args to upstart.

TEST=stop wpasupplicant; start wpasupplicant WPA_DEBUG="excessive";
wpa_debug; pkill -f wpa; wpa_debug
BUG=None
Change-Id: I2dd63ac06d04524174dbcf4294a2adddd66da72b
Signed-off-by: Jason Abele <jabele@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/47800
Reviewed-by: Scott James Remnant <keybuk@chromium.org>
7 weeks agoEnable zram by default. 02/46402/15
Luigi Semenzato [Mon, 25 Mar 2013 15:34:43 +0000 (08:34 -0700)]
Enable zram by default.

This change enables zram by default for all platforms.
It still allows manual control of zram from crosh.

Before this change, zram was not enabled if the file
/home/chronos/.swap_enabled was missing.  Now it is
enabled with default swap size if the file is missing
or empty.  It is disabled if the file indicates a
size of "0".  Otherwise the content of the file
specifies the size.

The default swap size is 1.5 x RAM size, but it
can be overridden by /etc/default/zram_size.sh.

Before this change goes in, we also need to either end
the zram field trial, or change it to behave correctly
with the new defaults.

BUG=chromium:218338
TEST=manually tested

Change-Id: If6a208e317864fb25e1e6181f57910d6b8e2593e
Reviewed-on: https://gerrit.chromium.org/gerrit/46402
Reviewed-by: Sonny Rao <sonnyrao@chromium.org>
Commit-Queue: Luigi Semenzato <semenzato@chromium.org>
Tested-by: Luigi Semenzato <semenzato@chromium.org>
7 weeks agoEnd zram field trial. 04/46404/5
Luigi Semenzato [Mon, 25 Mar 2013 16:25:48 +0000 (09:25 -0700)]
End zram field trial.

This ends the zram field trial and cleans up if needed.

BUG=chromium:218559
TEST=manually tested

Change-Id: I7a02cd580b63869b49a543f497f777ba738c13d0
Reviewed-on: https://gerrit.chromium.org/gerrit/46404
Commit-Queue: Luigi Semenzato <semenzato@chromium.org>
Reviewed-by: Luigi Semenzato <semenzato@chromium.org>
Tested-by: Luigi Semenzato <semenzato@chromium.org>
7 weeks agoinit : powerd.conf - Fix permissions for /proc/acpi/wakeup 65/46665/2
Benson Leung [Wed, 27 Mar 2013 20:04:30 +0000 (13:04 -0700)]
init : powerd.conf - Fix permissions for /proc/acpi/wakeup

This is used by touch-control to disable acpi wake for touch devices.

Signed-off-by: Benson Leung <bleung@chromium.org>
BUG=chromium:224396
TEST=Test on Pixel from a remote SSH session...
1. watch -n 0.1 cat /proc/acpi/wakeup
2. Close and open the lid while in guest mode.

Check that when the system suspends, this is the state of the wakeups:
TPAD      S3    *disabled  pnp:00:00
TSCR      S3    *disabled  pnp:00:01

Change-Id: If375d48063569dc8fa928e417773e75c8434c1ed
Reviewed-on: https://gerrit.chromium.org/gerrit/46665
Reviewed-by: Daniel Erat <derat@chromium.org>
Commit-Queue: Benson Leung <bleung@chromium.org>
Tested-by: Benson Leung <bleung@chromium.org>
7 weeks agoinit: shill: Determine push argument from profile dirs 59/46359/4
Paul Stewart [Sat, 23 Mar 2013 17:23:37 +0000 (10:23 -0700)]
init: shill: Determine push argument from profile dirs

Determine the arguments to the "--push" flag by enumerating
the user profile directory instead of using a hard-coded
"~chronos/shill".  This will allow pushing multiple user
profiles.

CQ-DEPEND=CL:46358
BUG=chromium:223106
TEST=Run network_ShillInitScripts autotest + Manual, restart
shill wihle logged in an noting (a) the --push argument is
passed to shill, and "list-profiles" lists the user profile
as loaded.   While logged in and shill is running, cd into
/var/run/shill/user_profiles.  Add a couple of profiles using
commands of the form "ln -s $(readlink chronos) user001".
After "restart shill", note that shill is running with a
"--push" argument that lists all the added profiles.  Confirm
using "list-profiles" that each of these profiles were
successfully loaded into shill.

Change-Id: I913f052ee6ba85a1a05c3db2c416c8205d8792a2
Reviewed-on: https://gerrit.chromium.org/gerrit/46359
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
7 weeks ago[init] mount debugfs with logs-access as group 54/45554/5
Elly Fong-Jones [Fri, 15 Mar 2013 13:56:22 +0000 (09:56 -0400)]
[init] mount debugfs with logs-access as group

CQ-DEPEND=I3c74ca9e33d4c14d74ad091e8250572d0c72557d
BUG=chromium-os:35122
TEST=adhoc
build, boot, ls -ald /sys/kernel/debug

Change-Id: I8f362ab9e6c2c39e597577abcc73c0c8f699b6e3
Signed-off-by: Elly Fong-Jones <ellyjones@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/45554

8 weeks agoinit: Add verbose logging for powerd backlight code. 65/45865/3
Daniel Erat [Tue, 26 Feb 2013 20:53:44 +0000 (12:53 -0800)]
init: Add verbose logging for powerd backlight code.

BUG=chromium-os:38922
TEST=manual: looked at logs
TBR=rharrison@chromium.org

Change-Id: Ib8ccd9d94ae2c45aea03b1dc1da654051bfb2f42
Reviewed-on: https://gerrit.chromium.org/gerrit/45865
Reviewed-by: Daniel Erat <derat@chromium.org>
Tested-by: Daniel Erat <derat@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Daniel Erat <derat@chromium.org>

8 weeks agoinit: fix typo in preload-network script 39/45939/2
mukesh agrawal [Tue, 19 Mar 2013 22:39:59 +0000 (15:39 -0700)]
init: fix typo in preload-network script

The previous version used inconsistent names for the variable
that tracked the module. This meant that the module name would
never be written to the cache file.

Note that I considered using shell features that cause errors
when using an uninitialized variable (i.e. ${foo:?ERROR}), but
I don't think that would accomplish much. (The code is run
from init, so no one would notice the error message anyway.)

BUG=chromium:221075
TEST=manual (see below)

Manual testing
--------------
 1. use a link, in dev mode
 2. rm /var/lib/preload-network-drivers
 3. reboot
 4. wait for login prompt
 5. connect to wifi
 6. cat /var/lib/preload-network-drivers
    -> this should say "ath9k_btcoex"
 7. reboot
 8. wait for login prompt
 9. connect to wifi
10. grep "phy0: ASPM" /var/log/messages | tail -2
    -> observe that the last line has a kernel timestamp
       approximately 2 seconds early than the first line.
       e.g.
       <syslog header> [    6.729392] ath: phy0: ASPM ...
       <syslog header> [    4.723810] ath: phy0: ASPM ...

Change-Id: Ic2e99ec275aca3fb57b8933938e7d86ee8c7a0be
Reviewed-on: https://gerrit.chromium.org/gerrit/45939
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: mukesh agrawal <quiche@chromium.org>
Tested-by: mukesh agrawal <quiche@chromium.org>
2 months agoCreate chrome_renderers cgroups. 43/45443/3 stabilize-3881.0.B
Andrew Bresticker [Thu, 14 Mar 2013 17:47:46 +0000 (10:47 -0700)]
Create chrome_renderers cgroups.

After https://gerrit.chromium.org/gerrit/42025 cgroup mounting was
moved to cgroups.conf, but then nothing was actually creating the
chrome_renderers cgroups.  If these do not exist when Chrome starts,
it will assume that cgroups are disabled and there will be no
throttling of background tabs.

BUG=chromium:190796
TEST=Open multiple tabs, verify that chrome_renderers/foreground/tasks
and chrome_renderers/background/tasks are non-empty.

Change-Id: I62de5875f31bdc3e3918790a7c1017f8b0524976
Reviewed-on: https://gerrit.chromium.org/gerrit/45443
Reviewed-by: Richard Barnette <jrbarnette@chromium.org>
Reviewed-by: Chris Masone <cmasone@chromium.org>
Commit-Queue: Andrew Bresticker <abrestic@chromium.org>
Tested-by: Andrew Bresticker <abrestic@chromium.org>
2 months agodbus: regenerate machine-id on every boot 67/45167/4 factory-spring-3842.B
David Zeuthen [Tue, 12 Mar 2013 01:43:29 +0000 (18:43 -0700)]
dbus: regenerate machine-id on every boot

BUG=chromium-os:39749
TEST=Manually verified

Change-Id: I980db84dae69edae330044cb42eae6ebffea4235
Signed-off-by: David Zeuthen <zeuthen@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/45167
Reviewed-by: Jorge Lucangeli Obes <jorgelo@chromium.org>
Reviewed-by: Richard Barnette <jrbarnette@chromium.org>
2 months agoAdd embedded upstart job to emit login-prompt-visible 47/45347/3
Chris Masone [Wed, 13 Mar 2013 21:43:24 +0000 (14:43 -0700)]
Add embedded upstart job to emit login-prompt-visible

The login-prompt-visible upstart signal is normally emitted by the
browser when it's got the sign-in UI up on the screen.  Embedded
devices don't have the browser or, at least so far, the standard
sign-in UI.  Therefore, we need to emit this when the terminal is
ready to go instead.

BUG=chromium:189662
TEST=build_packages --board daisy-drm, check for /build/daisy-drm/etc/init/login-prompt-visible.conf

Change-Id: Iaa4ef079e33848445b0b4d8de7b13509fc07bdd1
Reviewed-on: https://gerrit.chromium.org/gerrit/45347
Tested-by: Chris Masone <cmasone@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Richard Barnette <jrbarnette@chromium.org>
Commit-Queue: Chris Masone <cmasone@chromium.org>

2 months agoMake power the owner of dark resume sysfs files 73/43873/3 firmware-spring-3833.B
Derek Basehore [Sat, 23 Feb 2013 00:30:09 +0000 (16:30 -0800)]
Make power the owner of dark resume sysfs files

Powerd needs to modify dark_resume_active and dark_resume_source files. To allow
powerd to do thise without any help from setuid, make these files owned by the
power group.

BUG=chromium-os:39284
TEST=Suspend system

Change-Id: I03e3fed29b157855310718508178c40303ab4ce0
Reviewed-on: https://gerrit.chromium.org/gerrit/43873
Reviewed-by: Daniel Erat <derat@chromium.org>
Commit-Queue: Derek Basehore <dbasehore@chromium.org>
Tested-by: Derek Basehore <dbasehore@chromium.org>
2 months agoembedded/udhcpc: fix dns not working 29/45029/2
Mandeep Singh Baines [Sun, 10 Mar 2013 00:51:39 +0000 (16:51 -0800)]
embedded/udhcpc: fix dns not working

We need to touch /var/run/resolv.conf or the realpath check
in the udcpc script will fail.

BUG=chromium-os:39223
TEST=ping www.google.com

Change-Id: I03a2b134a5dc66fee1ee7ca3a2bedda37ddc4be5
Reviewed-on: https://gerrit.chromium.org/gerrit/45029
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Mandeep Singh Baines <msb@chromium.org>
Tested-by: Mandeep Singh Baines <msb@chromium.org>
2 months agoRe-generate /tmp/machine-info on ui restart. 90/44090/4
Mattias Nissler [Fri, 22 Feb 2013 17:59:19 +0000 (18:59 +0100)]
Re-generate /tmp/machine-info on ui restart.

This is needed when the device doesn't have an owner yet, but the user
has started a guest session. After logging out, the device may still go
through enterprise enrollment, and that requires the serial number to be
available in /tmp/machine-info.

Bootperf on a Lumpy:

Before:

(on 50 cycles):
 time  s%     dt  s%  event
 1529  4%  +1529  4%  startup
 1955  5%   +426 21%  startup_done
 2849  4%   +894  8%  x_started
 2906  4%    +57 37%  chrome_exec
 3803  6%   +897 22%  chrome_main
 5435  3%  +1632  9%  login
 5867  2%   +432 36%  network

After:

(on 42 cycles):
 time  s%     dt  s%  event
 1459  2%  +1459  2%  startup
 1905  7%   +446 28%  startup_done
 2874  7%   +969 14%  x_started
 2927  7%    +53  8%  chrome_exec
 3719  4%   +792 24%  chrome_main
 5356  3%  +1637  9%  login
 5888  2%   +532 24%  network

BUG=chromium-os:26681
TEST=Enterprise-enrollment works after entering a guest session and coming back to the login screen.

Change-Id: Icb9af7a58e9fc09afbb01f424ad4930b839ae935
Reviewed-on: https://gerrit.chromium.org/gerrit/44090
Commit-Queue: Mattias Nissler <mnissler@chromium.org>
Reviewed-by: Mattias Nissler <mnissler@chromium.org>
Tested-by: Mattias Nissler <mnissler@chromium.org>
2 months ago[syslog] pre-create /var/log/tlsdate.log 47/44947/2 firmware-spring-3824.4.B firmware-spring-3824.B
Elly Fong-Jones [Fri, 8 Mar 2013 19:31:00 +0000 (14:31 -0500)]
[syslog] pre-create /var/log/tlsdate.log

BUG=chromium-os:39247
TEST=adhoc
stop syslog, merge this change, rm /var/log/tlsdate.log, start syslog
see that /var/log/tlsdate.log is now owned by syslog

Change-Id: I03108a56041a475378d00ec8e697a3eb6720ff18
Signed-off-by: Elly Fong-Jones <ellyjones@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/44947
Reviewed-by: Will Drewry <wad@chromium.org>
2 months agoAutotest: Stumpy autoreboot comments. 37/44537/3
Simran Basi [Mon, 4 Mar 2013 19:10:02 +0000 (11:10 -0800)]
Autotest: Stumpy autoreboot comments.

Added comments regarding the re-calling of autoreboot on the first
boot as a try job is ran.

BUG=chromium-os:39381
TEST=None

Change-Id: Id352bfd31c5993d9c72ac0ba0c63d47b74cc828f
Reviewed-on: https://gerrit.chromium.org/gerrit/44537
Reviewed-by: Richard Barnette <jrbarnette@chromium.org>
Commit-Queue: Simran Basi <sbasi@chromium.org>
Tested-by: Simran Basi <sbasi@chromium.org>
2 months agoRe-add stateful usage metric that was removed. 38/44738/3
Chris Sosa [Wed, 6 Mar 2013 19:21:38 +0000 (11:21 -0800)]
Re-add stateful usage metric that was removed.

This is a near copy of the original code which was unintentially
removed in https://codereview.chromium.org/6575030/diff/1/chromeos-cleanup-disk.

BUG=chromium-os:39467
TEST=Tested locally with dash and stateful set to another var. Testing on device.

Change-Id: I5bc6396dc568564dbbbf409bb474a7e5b2b5ea17
Reviewed-on: https://gerrit.chromium.org/gerrit/44738
Tested-by: Chris Sosa <sosa@chromium.org>
Reviewed-by: Kees Cook <keescook@chromium.org>
Commit-Queue: Chris Sosa <sosa@chromium.org>

2 months agoinit: update preload-network script for ath9k_btcoex 89/43989/3
mukesh agrawal [Tue, 26 Feb 2013 00:06:39 +0000 (16:06 -0800)]
init: update preload-network script for ath9k_btcoex

Previously, the logic for finding the module for a network
device assumed that the driver output by ethtool had the
same name as the module that provided it.

While this is normally the case, it is not true for ath9k_btcoex.
In that case, the driver name is "ath9k", but the module name
is "ath9k_btcoex".

Update the logic to use the /sys entry for the network device,
which provides the name of the module.

BUG=chromium-os:38958
TEST=manual (see below)

Manual testing
--------------
 1. use a link, in dev mode
 2. rm /var/lib/preload-network-drivers
 3. reboot
 4. wait for login prompt
 5. connect to wifi
 6. cat /var/lib/preload-network-drivers
    -> this should say "ath9k_btcoex"
 7. reboot
 8. wait for login prompt
 9. connect to wifi
10. grep "phy0: ASPM" /var/log/messages | tail -2
    -> observe that the last line has a kernel timestamp
       approximately 2 seconds early than the first line.
       e.g.
       <syslog header> [    6.729392] ath: phy0: ASPM ...
       <syslog header> [    4.723810] ath: phy0: ASPM ...

Change-Id: Ieeb86475ec24b12122cd1dbe7dcb3ec7e8d34614
Reviewed-on: https://gerrit.chromium.org/gerrit/43989
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: mukesh agrawal <quiche@chromium.org>
Tested-by: mukesh agrawal <quiche@chromium.org>
2 months ago[init] override tlsdated proxy as needed 06/44406/3
Elly Fong-Jones [Fri, 1 Mar 2013 19:34:06 +0000 (14:34 -0500)]
[init] override tlsdated proxy as needed

BUG=chromium-os:38801
TEST=adhoc
$ stop tlsdated
$ start tlsdated
Check /var/log/tlsdate.log for a successful connect
$ stop tlsdated
$ echo 'socks5://bad.host:12345' > /var/run/proxy
$ start tlsdated
Check /var/log/tlsdate.log for an unsuccessful connect

Change-Id: Ic01498e8d6cb18400cd4a20a00e5f3d528c460af
Signed-off-by: Elly Fong-Jones <ellyjones@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/44406
Reviewed-by: Will Drewry <wad@chromium.org>
2 months agocgroups: add a directory for managing the freezer hierarchy 54/44254/2
Mandeep Singh Baines [Thu, 28 Feb 2013 00:14:48 +0000 (16:14 -0800)]
cgroups: add a directory for managing the freezer hierarchy

We will be using freezer to quiesce the system on display off.

BUG=chromium-os:39330
TEST=Started top via ctrl-alt-t, froze it and thawed it.

localhost ~ # cd /sys/fs/cgroup/
localhost cgroup # ls
cpu  freezer
localhost freezer # mkdir mygroup
localhost freezer # cd mygroup/
localhost mygroup # ps -ef | grep top
chronos   3301  3206  1 16:10 pts/1    00:00:00 top -s
root      3331  2441  0 16:10 pts/0    00:00:00 grep --colour=auto top
localhost mygroup # echo 3301 > tasks
localhost mygroup # echo FROZEN > freezer.state
localhost mygroup # echo THAWED > freezer.state

Change-Id: Ia86cf0ab1a94112cea5898e7e58d72120f7d89cd
Reviewed-on: https://gerrit.chromium.org/gerrit/44254
Reviewed-by: Elly Jones <ellyjones@chromium.org>
Tested-by: Mandeep Singh Baines <msb@chromium.org>
Reviewed-by: Sameer Nanda <snanda@chromium.org>
Commit-Queue: Mandeep Singh Baines <msb@chromium.org>

2 months agoinit: Start multicast netfilter queue 89/43789/6
Paul Stewart [Fri, 15 Feb 2013 22:24:07 +0000 (14:24 -0800)]
init: Start multicast netfilter queue

Start a service to allow incoming multicast replies to be accepted
for specific outgoing network traffic.

(Originally by pstew@chromium.org)

CQ-DEPEND=CL:43455,CL:44283
BUG=chromium-os:38605
TEST=Reboot; ensure "iptables --list" shows appropriate NFQUEUE endpoints.
Ensure "netfilter-queue-helper" task is running under minijail.

Change-Id: I21ba79fe1685a33d55b5023b059ef65516f43272
Reviewed-on: https://gerrit.chromium.org/gerrit/43789
Reviewed-by: Jorge Lucangeli Obes <jorgelo@chromium.org>
Tested-by: Jorge Lucangeli Obes <jorgelo@chromium.org>
Commit-Queue: Jorge Lucangeli Obes <jorgelo@chromium.org>

2 months agoembedded/udhcpc: add dhcp support 43/44143/7
Mandeep Singh Baines [Wed, 27 Feb 2013 00:28:59 +0000 (16:28 -0800)]
embedded/udhcpc: add dhcp support

To enable automated testing and remote development, we're
adding udhcpc support until shill is ready.

BUG=chromium-os:39223
TEST=I can now reboot and re-connect without physical access.

Change-Id: I47806aed08debaf503a0d908a11c0f3bca9acbd5
Reviewed-on: https://gerrit.chromium.org/gerrit/44143
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Mandeep Singh Baines <msb@chromium.org>
Tested-by: Mandeep Singh Baines <msb@chromium.org>
2 months ago[init] add tlsdate logging 45/44045/3
Elly Fong-Jones [Tue, 26 Feb 2013 15:50:04 +0000 (10:50 -0500)]
[init] add tlsdate logging

Logging from tlsdate now goes to a separate log file called
/var/log/tlsdate.log instead of into the ether.

CQ-DEPEND=Id762beeaa614372ef9ceba0e62522b4b02d151a4
BUG=chromium-os:39247
TEST=adhoc
restart tlsdated; you should see a bunch of tlsdate output in
/var/log/tlsdate.log
To test log rotation, run:
for x in `seq 1 256`; do logger -t tlsdate looooooooooooooooooooooooooooog; done
a few times; you should see a message in /var/log/messages about rotating logs,
and a file called /var/log/tlsdate.log.1 containing older logs.

Change-Id: I83629d0784dd983f47afc3307e81c48c3fdd274d
Reviewed-on: https://gerrit.chromium.org/gerrit/44045
Commit-Queue: Elly Jones <ellyjones@chromium.org>
Reviewed-by: Elly Jones <ellyjones@chromium.org>
Tested-by: Elly Jones <ellyjones@chromium.org>
2 months agoCreate a directory in which Chrome can store a reboot request 77/44077/3
Bartosz Fabianowski [Tue, 26 Feb 2013 20:31:58 +0000 (21:31 +0100)]
Create a directory in which Chrome can store a reboot request

When an automatic reboot is scheduled, Chrome needs to persist
the reboot request in a file so that if the Chrome process
crashes, the request is not lost. The file needs to reside in
a tmpfs so that once the reboot does occur, the file is
guaranteed to be destroyed and no reboot loop can occur.

BUG=chromium-os:36400
TEST=Manual; directory is created and has the right permissions

Change-Id: I9a251caaa5562b61d4564ed9f69385a65dea16c3
Reviewed-on: https://gerrit.chromium.org/gerrit/44077
Tested-by: Bartosz Fabianowski <bartfab@chromium.org>
Reviewed-by: Daniel Erat <derat@chromium.org>
Commit-Queue: Bartosz Fabianowski <bartfab@chromium.org>

2 months agoembedded/chromeos_startup: add dev image support 16/44016/3
Mandeep Singh Baines [Tue, 26 Feb 2013 05:25:02 +0000 (21:25 -0800)]
embedded/chromeos_startup: add dev image support

BUG=chromium-os:39191
TEST=/usr/local is now mounted correctly.

Change-Id: I92daffda7663b9f18fb741bf32a6dedb14b962db
Reviewed-on: https://gerrit.chromium.org/gerrit/44016
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Tested-by: Mandeep Singh Baines <msb@chromium.org>
Commit-Queue: Mandeep Singh Baines <msb@chromium.org>

2 months agoopenssh-server: also work if sshd is in /usr/local 15/44015/3
Mandeep Singh Baines [Tue, 26 Feb 2013 05:23:22 +0000 (21:23 -0800)]
openssh-server: also work if sshd is in /usr/local

openssh is not part of the base cros_embedded image.

BUG=chromium-os:39191
TEST=I can now ssh into a cros_embedded device.

Change-Id: Ia3aa88a6e472c08c63ba2b716cb2d00b6a7c956b
Reviewed-on: https://gerrit.chromium.org/gerrit/44015
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Tested-by: Mandeep Singh Baines <msb@chromium.org>
Commit-Queue: Mandeep Singh Baines <msb@chromium.org>

2 months agoinit: Clean up power manager directory permissions. 71/43971/2
Daniel Erat [Mon, 25 Feb 2013 22:47:16 +0000 (14:47 -0800)]
init: Clean up power manager directory permissions.

This removes the chronos user's ability to write to powerd's
preferences dir and removes some old code that deleted
powerd.LATEST in case it was still owned by the chronos
user.

Unrelatedly, it removes a deprecated --use_state_controller
flag that's now on by default.

BUG=chromium-os:38732,chromium:173849
TEST=manual: permissions are set correctly

Change-Id: I74ac291dc1bea92f9bf48e7f06f5b4f57fd0d049
Reviewed-on: https://gerrit.chromium.org/gerrit/43971
Tested-by: Daniel Erat <derat@chromium.org>
Reviewed-by: Jorge Lucangeli Obes <jorgelo@chromium.org>
Commit-Queue: Daniel Erat <derat@chromium.org>

2 months ago[init] tlsdate: use correct root cert set 91/43891/2
Elly Fong-Jones [Mon, 25 Feb 2013 14:45:53 +0000 (09:45 -0500)]
[init] tlsdate: use correct root cert set

We should use the Google root set (since we talk to Google), not the
whole-internet root set.

BUG=chromium-os:39140
TEST=platform_TLSDateActual

Change-Id: I8b19469b9cdb6c9b10a4d088503d281e7ed744eb
Signed-off-by: Elly Fong-Jones <ellyjones@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/43891
Reviewed-by: Will Drewry <wad@chromium.org>
2 months agoAdd embedded-init directory with embedded devices init scripts 56/43656/9
Anush Elangovan [Wed, 20 Feb 2013 23:32:11 +0000 (15:32 -0800)]
Add embedded-init directory with embedded devices init scripts

Add an embedded version of chromeos_startup and shutdown.
Also, add in an embedded-specific 'boot-services' upstart script

CQ-DEPEND=Ib4537239e6e171f00d4ec9a9c2c7f926b45ca476

BUG=chromium-os:38575, chromium-os:38576
TEST=build_packages and build_image for daisy-drm.  Boot, ctrl-alt-F2 and sign in at the shell prompt

Change-Id: I50ae921b92d50d664d4c4d980bdea7f45fc05414
Reviewed-on: https://gerrit.chromium.org/gerrit/43656
Tested-by: Chris Masone <cmasone@chromium.org>
Reviewed-by: Anush Elangovan <anush@google.com>
Commit-Queue: Chris Masone <cmasone@chromium.org>

2 months agoinit: Fix the wording on the developer transition screen 89/43489/3
Hung-Te Lin [Mon, 18 Feb 2013 04:53:20 +0000 (12:53 +0800)]
init: Fix the wording on the developer transition screen

To provide correct instruction for devices using virtual developer switch (also
known as keyboard-controlled recovery), we should determine developer switch
type before showing enter_dev message.

BUG=chromium-os:38884
TEST=manual: chromeos-boot-alert enter_dev /dev/tty
     # see enter_dev1 (data 'will' be cleared...) on ZGB,
     # enter_dev1_virtual (data 'has' been cleared...) on Link.

Change-Id: Ib20eee6cd02c92ce95eb51cf7b9e3fbcbe800389
Reviewed-on: https://gerrit.chromium.org/gerrit/43489
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Daniel Erat <derat@chromium.org>
Commit-Queue: Hung-Te Lin <hungte@chromium.org>

3 months agoRemove dead code relating to the legacy window manager from ui.conf 40/42840/2 stabilize-3701.30.0 stabilize-3701.30.0b stabilize-bluetooth-smart
J. Richard Barnette [Thu, 7 Feb 2013 02:19:48 +0000 (18:19 -0800)]
Remove dead code relating to the legacy window manager from ui.conf

BUG=None
TEST=boot and log in

Change-Id: I5fde1a1bec2982966ee20bce05ecd0905b9dea44
Reviewed-on: https://gerrit.chromium.org/gerrit/42840
Tested-by: Richard Barnette <jrbarnette@chromium.org>
Reviewed-by: Daniel Erat <derat@chromium.org>
Commit-Queue: Richard Barnette <jrbarnette@chromium.org>

3 months agochromeos_startup: mount debugfs with strict mode 53/42653/2
Kees Cook [Tue, 5 Feb 2013 21:40:36 +0000 (13:40 -0800)]
chromeos_startup: mount debugfs with strict mode

This changes the debugfs mount to be available only to the root user and
the debugd group. Anything running as chronos should be run through
debugd.

BUG=chromium-os:23758
TEST=link build, things appear to be working
CQ-DEPEND=I4a37f3bd13da0ced916bde8038de16ebc3504d5e,I2da4ace404216fb452f7eebd281c4289e3ec1ef9

Change-Id: I8a0c2049ed40d6e7b251218c5b403ecb61da9347
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/42653
Reviewed-by: Jorge Lucangeli Obes <jorgelo@chromium.org>
3 months agoinit: Remove references to window manager and screen locker. 21/42821/2
Daniel Erat [Thu, 7 Feb 2013 00:14:06 +0000 (16:14 -0800)]
init: Remove references to window manager and screen locker.

This removes references to processes that are no longer with
us.

BUG=none
TEST=manual: image still boots

Change-Id: I16c121d4620ea150f011b3f9b4e35e93c749ade4
Reviewed-on: https://gerrit.chromium.org/gerrit/42821
Commit-Queue: Daniel Erat <derat@chromium.org>
Tested-by: Daniel Erat <derat@chromium.org>
Reviewed-by: Chris Masone <cmasone@chromium.org>
3 months agoinit: Pass --use_state_controller to powerd. 05/42505/2
Daniel Erat [Sat, 2 Feb 2013 20:04:58 +0000 (12:04 -0800)]
init: Pass --use_state_controller to powerd.

This sets powerd's --use_state_controller flag to turn on
some new code.  It also uses --vmodule to enable verbose
logging from that code.

BUG=chromium-os:38281,chromium:173849
TEST=manual
CQ-DEPEND=I302f09017853cc2ef0d1210719c3f1fe1cf274c2

Change-Id: I0a409b03b559866f8e8db2e871dd05cf99cb3d7e
Reviewed-on: https://gerrit.chromium.org/gerrit/42505
Reviewed-by: Simon Que <sque@chromium.org>
Commit-Queue: Daniel Erat <derat@chromium.org>
Tested-by: Daniel Erat <derat@chromium.org>
3 months agoinit: Create /var/spool/power_manager/root directory. 47/42547/2
Daniel Erat [Mon, 4 Feb 2013 17:16:08 +0000 (09:16 -0800)]
init: Create /var/spool/power_manager/root directory.

This creates a new directory for power-manager-related state
files written by root that must persist across reboots.

BUG=chromium-os:38484
TEST=manual: directory is created and owned by root

Change-Id: Ie15381391720ffdf5780b4cae85d15730b3fd811
Reviewed-on: https://gerrit.chromium.org/gerrit/42547
Tested-by: Daniel Erat <derat@chromium.org>
Reviewed-by: Doug Anderson <dianders@chromium.org>
Commit-Queue: Daniel Erat <derat@chromium.org>

3 months agoDivert VPN-related messages to /var/log/net.log. 89/42389/2 stabilize-3658.0.0
Darin Petkov [Thu, 31 Jan 2013 15:30:07 +0000 (16:30 +0100)]
Divert VPN-related messages to /var/log/net.log.

This patch adds log output from the following processes to net.log:

- openvpn
- openvpn-script
- l2tpipsec_vpn
- pppd
- nss-get-cert

BUG=chromium-os:38131
TEST=Connected to VPN, inspected /var/log/net.log for messages coming
from the 'openvpn' process.

Change-Id: Ie75f61904579399d9f8e1ed7ca5d180531ceb88d
Reviewed-on: https://gerrit.chromium.org/gerrit/42389
Tested-by: Darin Petkov <petkov@chromium.org>
Reviewed-by: Wade Guthrie <wdg@chromium.org>
Commit-Queue: Darin Petkov <petkov@chromium.org>

3 months ago[init] fix date_proxy early exit 90/39590/6
Elly Fong-Jones [Wed, 12 Dec 2012 17:04:12 +0000 (12:04 -0500)]
[init] fix date_proxy early exit

date_proxy was exiting early and in an unclean way, causing upstart to spawn it
again, which caused it to spawn new copies of its helper program, which would
then hang around forever. There are two causes of exits:

1. 'restart tlsdate' instead of 'restart tlsdated' causes us to exit because
this script is set +e, and
2. reading from the fifo returns eof when the writer end closes the fifo.

To solve 2, we have the writer end keep the fifo open for as long as it's
running by doing its logic in a subshell with stdout to the fifo.

BUG=chromium-os:36729
TEST=adhoc

Change-Id: I1275bee9f48aa342b669911e09f92c9eddd2e752
Signed-off-by: Elly Fong-Jones <ellyjones@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/39590
Reviewed-by: Kees Cook <keescook@chromium.org>
3 months agoStart swap-exp.conf earlier so Chrome can start trial 29/42029/3
Luigi Semenzato [Fri, 25 Jan 2013 19:28:28 +0000 (11:28 -0800)]
Start swap-exp.conf earlier so Chrome can start trial

Before this CL, swap-exp.conf runs after the Chrome code that
starts the field trial, so the experiment misses the first boot
session (which could be quite long).

The execution time of the script is small, and it is negligible
after the initial setup, so impact on boot time is acceptable.

BUG=chromium-os:37583
TEST=manual
BRANCH=none

Change-Id: I8f2fb3625389995f72eae01a1c31a78243b47145
Reviewed-on: https://gerrit.chromium.org/gerrit/42029
Tested-by: Luigi Semenzato <semenzato@chromium.org>
Reviewed-by: Richard Barnette <jrbarnette@chromium.org>
Commit-Queue: Luigi Semenzato <semenzato@chromium.org>

3 months ago[chromeos-init] mount debugfs no{dev,exec,suid} 44/41844/3
Elly Fong-Jones [Wed, 23 Jan 2013 19:55:42 +0000 (14:55 -0500)]
[chromeos-init] mount debugfs no{dev,exec,suid}

Autotest update at <https://gerrit.chromium.org/gerrit/#/c/41845>

BUG=chromium-os:32632
TEST=platform_FilePerms,adhoc
build, boot, 'mount | grep debugfs'

Change-Id: Icaf245fb319315020127a2529f42d73e7d9e5b1f
Signed-off-by: Elly Fong-Jones <ellyjones@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/41844

3 months agoMake swap-exp a task to eliminate races, + extra fix 79/41779/3
Luigi Semenzato [Tue, 22 Jan 2013 23:16:14 +0000 (15:16 -0800)]
Make swap-exp a task to eliminate races, + extra fix

When swap-exp.conf is not a task, it can execute in parallel with
swap.conf, leading to races.

In addition, remove the code that makes swap-exp run only when
NOT in developer mode.  I have observed hang situations that may
be attributed to crossystem, but they are hard to reproduce.
The UMA histogram site already filters out devices in dev mode,
so it is not necessary to do it here.

BUG=chromium-os:38112
TEST=manually tested
BRANCH=none

Change-Id: If4cb843f2e3889759608a2d65f44c4194d6d32d9
Reviewed-on: https://gerrit.chromium.org/gerrit/41779
Reviewed-by: Richard Barnette <jrbarnette@chromium.org>
Commit-Queue: Luigi Semenzato <semenzato@chromium.org>
Tested-by: Luigi Semenzato <semenzato@chromium.org>
3 months agoCreate an empty /var/run/user_policy when ui starts. 18/41718/2
Joao da Silva [Mon, 21 Jan 2013 14:17:49 +0000 (15:17 +0100)]
Create an empty /var/run/user_policy when ui starts.

BUG=chromium:163318
TEST=start ui; an empty /var/run/user_policy is created.

Change-Id: I34c96f3e5c9dc46b1ad1a053e7ba611b65e8c070
Reviewed-on: https://gerrit.chromium.org/gerrit/41718
Reviewed-by: Chris Masone <cmasone@chromium.org>
Commit-Queue: Joao da Silva <joaodasilva@chromium.org>
Tested-by: Joao da Silva <joaodasilva@chromium.org>
3 months agoinit: Remove powerm.conf. 77/41577/2
Daniel Erat [Thu, 17 Jan 2013 17:41:35 +0000 (09:41 -0800)]
init: Remove powerm.conf.

BUG=chromium-os:36804
TEST=manual: built an image
CQ-DEPEND=I41658fb2dc6f2abb82acb950894a21fee1505001
CQ-DEPEND=Ie4b92ea3817405f1b9aa7372bac08122ab30c486

Change-Id: I4640da16879af6d5b54ade0acf1957e112a78153
Reviewed-on: https://gerrit.chromium.org/gerrit/41577
Tested-by: Daniel Erat <derat@chromium.org>
Reviewed-by: Chris Masone <cmasone@chromium.org>
Commit-Queue: Daniel Erat <derat@chromium.org>

3 months agolockbox-cache.conf: add a task to emit a lockbox cache 38/41538/10
Will Drewry [Wed, 16 Jan 2013 22:07:38 +0000 (16:07 -0600)]
lockbox-cache.conf: add a task to emit a lockbox cache

In order to make the lockbox data accessible as early as possible,
we can verify using the NVRAM data collected by mount-encrypted staged
in /tmp/lockbox.nvram.  This task uses that file and generates a
file in /var/run/lockbox which contains a cache of the install_attributes.pb
iff the file validated against the boot-time nvram data.

In the cases of VMs or non-chrome firmware and there is no NVRAM file,
we just pretend that the lockbox is validated.

BUG=chromium-os:37367
TEST=emerges and runs lockbox-cache as soon as possible generating the
cache when it is legit, but adding a byte to the lockbox content shows
it doesn't regenerate.

Change-Id: I8616095b54b44ea392630dad00769d5fcc383119
Reviewed-on: https://gerrit.chromium.org/gerrit/41538
Reviewed-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Mattias Nissler <mnissler@chromium.org>
Reviewed-by: Richard Barnette <jrbarnette@chromium.org>
Commit-Queue: Will Drewry <wad@chromium.org>
Tested-by: Will Drewry <wad@chromium.org>
4 months agoinit: Don't set capabilities for powerd. 47/41247/2
Daniel Erat [Tue, 15 Jan 2013 00:24:48 +0000 (16:24 -0800)]
init: Don't set capabilities for powerd.

Setting the CAP_SYS_TTY_CONFIG capability on powerd via
minijail0 prevents powerd_setuid_helper from being able to
call setuid(0) later.  VT-locking will instead be moved from
powerd to powerd_setuid_helper.

BUG=chromium-os:36804
TEST=manual: powerd_setuid_helper no longer fails on
     setuid(0)
CQ-DEPEND=I41b95799d71e63b7e4967b7faf0b2f34b7cadbfb

Change-Id: Icc0e88fd6fdd40176c0ac4d933365cc498347ab8
Reviewed-on: https://gerrit.chromium.org/gerrit/41247
Tested-by: Daniel Erat <derat@chromium.org>
Reviewed-by: Jorge Lucangeli Obes <jorgelo@chromium.org>
Commit-Queue: Daniel Erat <derat@chromium.org>

4 months agoReland "init: Minor changes needed to move suspending..." 12/41212/2
Daniel Erat [Mon, 14 Jan 2013 16:09:40 +0000 (08:09 -0800)]
Reland "init: Minor changes needed to move suspending..."

This reverts commit d847af62, relanding de883380:

powerd needs to be able to open /dev/tty0 with WR_ONLY at
startup.  This is permitted with the existing udev
configuration, but udev needs to be triggered earlier.

This change also grants the CAP_SYS_TTY_CONFIG capability to
powerd so it can make VT_LOCKSWITCH and VT_UNLOCKSWITCH
ioctls.

It also creates a /var/run/power_manager/root directory for
power-management-related processes running as root to use.

BUG=chromium-os:36804
TEST=powerd is able to suspend the system
CQ-DEPEND=I9bbd56002d830f897e6ae72f225f729c781c0817

Change-Id: Icf950099f6cd24faf06d9e5611389c8cfcb37a2d
Reviewed-on: https://gerrit.chromium.org/gerrit/41212
Commit-Queue: Daniel Erat <derat@chromium.org>
Reviewed-by: Daniel Erat <derat@chromium.org>
Tested-by: Daniel Erat <derat@chromium.org>
4 months agoRevert "init: Minor changes needed to move suspending to powerd." 95/41195/2
Brian Harring [Mon, 14 Jan 2013 05:29:00 +0000 (21:29 -0800)]
Revert "init: Minor changes needed to move suspending to powerd."

This reverts commit de883380b7c876e67b6e73bfb723a3e05cde94e9

Specifically reverts CL:40417.

Pulling this since it's part of the CQ cycle for CL:40573, which is exposing new paths in autotest (which are broke, but the fixed code would still fail this test best I can tell).

BUG=chromium-os:37843, chromium-os:36804
TEST=n/a

Change-Id: Idefb0d02d7454139c41ef2e31819bb50dd1a8113
Reviewed-on: https://gerrit.chromium.org/gerrit/41195
Reviewed-by: Brian Harring <ferringb@chromium.org>
Tested-by: Brian Harring <ferringb@chromium.org>
4 months agoinit: Minor changes needed to move suspending to powerd. 17/40417/6
Daniel Erat [Thu, 3 Jan 2013 01:27:23 +0000 (17:27 -0800)]
init: Minor changes needed to move suspending to powerd.

powerd needs to be able to open /dev/tty0 with WR_ONLY at
startup.  This is permitted with the existing udev
configuration, but udev needs to be triggered earlier.

This change also grants the CAP_SYS_TTY_CONFIG capability to
powerd so it can make VT_LOCKSWITCH and VT_UNLOCKSWITCH
ioctls.

It also creates a /var/run/power_manager/root directory for
power-management-related processes running as root to use.

BUG=chromium-os:36804
TEST=powerd is able to suspend the system
CQ-DEPEND=I8b889cddb21cbadd2515ca028169077a47b7dc80

Change-Id: I8e921d6721947b64aac30110dbd86364ede52122
Reviewed-on: https://gerrit.chromium.org/gerrit/40417
Commit-Queue: Daniel Erat <derat@chromium.org>
Reviewed-by: Daniel Erat <derat@chromium.org>
Tested-by: Daniel Erat <derat@chromium.org>
4 months agoDisable launching 'date-proxy-watcher' automatically. 30/41130/2
Jorge Lucangeli Obes [Fri, 11 Jan 2013 18:12:27 +0000 (10:12 -0800)]
Disable launching 'date-proxy-watcher' automatically.

BUG=chromium-os:37780
TEST=gmerge chromeos-init, reboot, no zombie minijail0 processes.

Change-Id: I1df47812f0339698fbff4388a9b52f03dc6887fa
Reviewed-on: https://gerrit.chromium.org/gerrit/41130
Tested-by: Jorge Lucangeli Obes <jorgelo@chromium.org>
Reviewed-by: Elly Jones <ellyjones@chromium.org>
Commit-Queue: Jorge Lucangeli Obes <jorgelo@chromium.org>

4 months agoinit: Run laptop_mode after resuming. 42/41042/2 factory-3536.B
Daniel Erat [Thu, 10 Jan 2013 05:43:01 +0000 (21:43 -0800)]
init: Run laptop_mode after resuming.

This creates a "laptop-mode-resume" job that runs
"laptop_mode auto" in response to system-resumed, a new
signal that will be emitted by the powerd_suspend script.
It also renames the existing "power" job to
"laptop-mode-boot".

BUG=chromium-os:36804
TEST=manual: verified from /var/log/messages that
     laptop_mode runs at boot and when system-resumed is
     emitted

Change-Id: I7101891851cae88338e5a6b76b7676cc3de95dc1
Reviewed-on: https://gerrit.chromium.org/gerrit/41042
Tested-by: Daniel Erat <derat@chromium.org>
Reviewed-by: Jorge Lucangeli Obes <jorgelo@chromium.org>
Reviewed-by: Sameer Nanda <snanda@chromium.org>
Commit-Queue: Daniel Erat <derat@chromium.org>

4 months agoAdd zram field trial (/etc/init) with correct file owners 99/40999/2
Luigi Semenzato [Thu, 10 Jan 2013 04:45:19 +0000 (20:45 -0800)]
Add zram field trial (/etc/init) with correct file owners

This adds the zram (compressed swap) field trial (experiment).
It consists of three CLs: this one, one CL in crosh (to opt-out
of the experiment when manually enabling zram), and one CL in
Chrome to set up the UMA stuff.

The experiment groups are selected by hashing the MAC address
of the wifi adapter on the device.  Ideally we would assign
users to groups, because we believe that the presence of compressed
swap may change the usage pattern.  Unfortunately it is difficult
to turn swap off without rebooting, so we settle for device-based
groups as an approximation.

This replaces #40354, which had to be reverted because it
created files owned by root in /home/chronos.

BUG=chromium-os:37583
TEST=manual testing for a number of combinations (not all)

Change-Id: I618a4726b6b8f2e7dfe681a7516b480d1f10f177
Reviewed-on: https://gerrit.chromium.org/gerrit/40999
Tested-by: Luigi Semenzato <semenzato@chromium.org>
Reviewed-by: Sonny Rao <sonnyrao@chromium.org>
Commit-Queue: Luigi Semenzato <semenzato@chromium.org>

4 months agoRevert "Add zram field trial (/etc/init)." 94/40994/2
Daniel Kurtz [Thu, 10 Jan 2013 03:53:03 +0000 (11:53 +0800)]
Revert "Add zram field trial (/etc/init)."

This reverts commit 10faa157595454d1cd946b5aadb5b2bc39310ebf.

Unfortunately, it broke all canaries.

security_ProfilePermissions.login            [ FAILED ]
security_ProfilePermissions.login              FAIL: Bad permissions found on cryptohome files
security_ProfilePermissions.BWSI             [ FAILED ]
security_ProfilePermissions.BWSI               FAIL: Bad permissions found on cryptohome files

BUG=chromium-os:37747
TEST=security_ProfilePermissions

Change-Id: I30109c642bbc4da0633fb91a19c7b4f1dac5c104
Reviewed-on: https://gerrit.chromium.org/gerrit/40994
Reviewed-by: David James <davidjames@chromium.org>
Commit-Queue: Daniel Kurtz <djkurtz@chromium.org>
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
Tested-by: Daniel Kurtz <djkurtz@chromium.org>
4 months agoinit: Diverting modem manager log messages to /var/log/net.log 75/40975/2
Ben Chan [Wed, 9 Jan 2013 23:18:36 +0000 (15:18 -0800)]
init: Diverting modem manager log messages to /var/log/net.log

BUG=chromium-os:37740
TEST=Verified that all log messages from cromo and ModemManager are sent
to /var/log/net.log and only those severer than warnings are sent to
/var/log/messages.

Change-Id: Ibd88205507227a822508856bce154cf5b0778f09
Reviewed-on: https://gerrit.chromium.org/gerrit/40975
Reviewed-by: Wade Guthrie <wdg@chromium.org>
Commit-Queue: Ben Chan <benchan@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
4 months agoAdd zram field trial (/etc/init). 54/40354/10
Luigi Semenzato [Thu, 3 Jan 2013 00:56:37 +0000 (16:56 -0800)]
Add zram field trial (/etc/init).

This adds the zram (compressed swap) field trial (experiment).
It consists of three CLs: this one, one CL in crosh (to opt-out
of the experiment when manually enabling zram), and one CL in
Chrome to set up the UMA stuff.

The experiment groups are selected by hashing the MAC address
of the wifi adapter on the device.  Ideally we would assign
users to groups, because we believe that the presence of compressed
swap may change the usage pattern.  Unfortunately it is difficult
to turn swap off without rebooting, so we settle for device-based
groups as an approximation.

More details in the code.

BUG=chromium-os:37583
TEST=manual testing for a number of combinations (not all)

Change-Id: I457601a3b96464c2bc4e2fdbd305ca2e9bec1fbb
Reviewed-on: https://gerrit.chromium.org/gerrit/40354
Tested-by: Luigi Semenzato <semenzato@chromium.org>
Commit-Queue: Luigi Semenzato <semenzato@chromium.org>
Reviewed-by: Luigi Semenzato <semenzato@chromium.org>
4 months agoPowerwash: Collect Stats 71/39971/7
Simran Basi [Wed, 19 Dec 2012 20:42:42 +0000 (12:42 -0800)]
Powerwash: Collect Stats

When the device is powerwashed, keep track of how many times it's been
powerwashed sequentially (i.e. in between complete recoveries of the
device and inbetween switching to/from dev mode.).

After every powerwash send to metrics the number of times it's been done
on this device.

BUG=chromium-os:37110
TEST=Tested on stumpy and verified the stats end up in about:histograms
     and the count increases on each powerwash.

Change-Id: I92344fb7e70ac2a6190a0954b6298849d4608897
Reviewed-on: https://gerrit.chromium.org/gerrit/39971
Reviewed-by: Darin Petkov <petkov@chromium.org>
Commit-Queue: Simran Basi <sbasi@chromium.org>
Reviewed-by: Simran Basi <sbasi@chromium.org>
Tested-by: Simran Basi <sbasi@chromium.org>
4 months agoinit: Let "power" user access wakeup files under /sys. 69/40269/3
Daniel Erat [Wed, 26 Dec 2012 18:59:27 +0000 (10:59 -0800)]
init: Let "power" user access wakeup files under /sys.

This is needed for moving this code from powerm to powerd.
It also cleans up the old sysfs permissions-updating code to
make it easier to add new files in the future.

BUG=chromium-os:36804
TEST=manual: ownership of files is as expected

Change-Id: I5cff5686d9ba40cb2549ec7a11a6669c7a7452e6
Reviewed-on: https://gerrit.chromium.org/gerrit/40269
Reviewed-by: Jorge Lucangeli Obes <jorgelo@chromium.org>
Tested-by: Daniel Erat <derat@chromium.org>
Commit-Queue: Daniel Erat <derat@chromium.org>

4 months agoinit: Set ownership of backlight devices to "power" user. 50/40150/3
Daniel Erat [Fri, 21 Dec 2012 00:25:24 +0000 (16:25 -0800)]
init: Set ownership of backlight devices to "power" user.

This restores some old code to change the ownership of the
sysfs backlight files and /sys/power/state so that powerd
can write to them.  I'm moving this functionality from
powerm (running as root) to powerd in a separate change.

BUG=chromium-os:36804
TEST=manually tested in conjunction with power manager change

Change-Id: Id0e5d63789edb3d38daa47df1c4af3cb4f9307a0
Reviewed-on: https://gerrit.chromium.org/gerrit/40150
Reviewed-by: Jorge Lucangeli Obes <jorgelo@chromium.org>
Commit-Queue: Daniel Erat <derat@chromium.org>
Tested-by: Daniel Erat <derat@chromium.org>
4 months agoConvert the send_boot_metrics script to an upstart job. 25/40025/3
Richard Barnette [Thu, 20 Dec 2012 19:42:46 +0000 (11:42 -0800)]
Convert the send_boot_metrics script to an upstart job.

The send_boot_metrics script was invoked in the background from the
boot-complete job.  There was no reason for the script's privileged
position other than the momentum of history, so the script is moving
to be a regular upstart job depending on 'system-services' instead.

BUG=None
TEST=Boot system, check chrome://histograms for relevant metrics

Change-Id: Iee3f11fb8b6e24dfcd76aab884c505e59be39c99
Reviewed-on: https://gerrit.chromium.org/gerrit/40025
Tested-by: Richard Barnette <jrbarnette@chromium.org>
Reviewed-by: Luigi Semenzato <semenzato@chromium.org>
Commit-Queue: Richard Barnette <jrbarnette@chromium.org>

4 months agoinit: Add clear-framebuffer job. 27/39927/3
Daniel Erat [Wed, 19 Dec 2012 01:21:56 +0000 (17:21 -0800)]
init: Add clear-framebuffer job.

This job runs ply-image --clear after X has started.  This
was previously run in the background by the
session_manager_setup.sh script, which resulted in a zombie
process.

BUG=chromium-os:11285
TEST=manual: framebuffer is black when shutting down; no
     ply-image zombie
CQ-DEPEND=Ibba36ac9a78adc4713bd4530d53db477659c66ad

Change-Id: Ic31e8c0a32ed7d7fe686dde8937bd4bdec7f1f96
Reviewed-on: https://gerrit.chromium.org/gerrit/39927
Reviewed-by: Richard Barnette <jrbarnette@chromium.org>
Commit-Queue: Daniel Erat <derat@chromium.org>
Tested-by: Daniel Erat <derat@chromium.org>
4 months agoFix SMART disk error metrics upload. 98/39998/3
Richard Barnette [Thu, 20 Dec 2012 00:34:26 +0000 (16:34 -0800)]
Fix SMART disk error metrics upload.

The send_boot_metrics script has suffered from rot of some sort, in
that the code to upload metrics out of 'smartctl' weren't working,
because 'rootdev' wasn't returning the expected output.

This fixes the 'rootdev' call, and generally cleans up the code
for style consistency, and to try and improve readability.

BUG=chromium-os:37408
TEST=Boot, navigate to chrome://histograms

Change-Id: Ia6b3a5d7dc85293f3969c7eaf989bd8012532506
Reviewed-on: https://gerrit.chromium.org/gerrit/39998
Tested-by: Richard Barnette <jrbarnette@chromium.org>
Reviewed-by: Luigi Semenzato <semenzato@chromium.org>
Commit-Queue: Richard Barnette <jrbarnette@chromium.org>

5 months ago[init] expect tlsdated in /usr/bin 70/39870/2 toolchain-3428.65.B
Elly Fong-Jones [Tue, 18 Dec 2012 20:20:50 +0000 (15:20 -0500)]
[init] expect tlsdated in /usr/bin

CQ-DEPEND=CL:39867
BUG=None
TEST=adhoc
ps aux | grep tlsdated shows tlsdated running

Change-Id: If6ac93bf9e6717450579992fabf66c4a7851a499
Signed-off-by: Elly Fong-Jones <ellyjones@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/39870
Reviewed-by: Mike Frysinger <vapier@chromium.org>
5 months agoshill: Don't remove run-dir on startup 03/39503/3
Paul Stewart [Mon, 10 Dec 2012 21:05:56 +0000 (13:05 -0800)]
shill: Don't remove run-dir on startup

The run directory contains a pointer to the logged-in user's
profile.  Do not remove this on startup, or else a shill restart
while a user is logged in won't restore the user's profile.

BUG=chromium-os:37121
TEST=Repro steps of bug

Change-Id: Idebbd0bdeb80ab8448223eb1b8b3ca78f6fc5f7b
Reviewed-on: https://gerrit.chromium.org/gerrit/39503
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Ready: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
5 months agoinit: Log powerd and powerm's stdout/stderr to /var/log. 48/39348/2 stabilize2
Daniel Erat [Thu, 6 Dec 2012 17:24:11 +0000 (09:24 -0800)]
init: Log powerd and powerm's stdout/stderr to /var/log.

We were previously writing to files within
/var/log/power_manager.

BUG=chromium-os:36888
TEST=observe that output goes to /var/log/power[dm].out
CQ-DEPEND=I0891c8e9f3d3593b7f084bae40ff5e40c39516e9

Change-Id: I5788f32cc7f4e2f021315e6d7b86fccaaacc7c63
Reviewed-on: https://gerrit.chromium.org/gerrit/39348
Tested-by: Daniel Erat <derat@chromium.org>
Reviewed-by: Jorge Lucangeli Obes <jorgelo@chromium.org>
Commit-Ready: Daniel Erat <derat@chromium.org>

5 months ago[init] tlsdated: log verbosely 39/39339/2
Elly Fong-Jones [Thu, 6 Dec 2012 23:23:27 +0000 (18:23 -0500)]
[init] tlsdated: log verbosely

While tlsdated is new, we want as much information in syslog as possible, so
turn on the daemon's verbose mode.

BUG=chromium:162060
TEST=adhoc
grep 'tlsdate' /var/log/messages; there should be lots of messages about child
exit statuses and such.

Change-Id: Ia52c766d1a9a49716d818edd89374421eb0f2093
Signed-off-by: Elly Fong-Jones <ellyjones@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/39339
Reviewed-by: Will Drewry <wad@chromium.org>
5 months agoinit: Make powerd run as the "power" user. 94/39294/5
Daniel Erat [Fri, 30 Nov 2012 01:31:58 +0000 (17:31 -0800)]
init: Make powerd run as the "power" user.

This makes powerd run as the "power" user instead of as
chronos.  The ownership of various files and directories is
updated accordingly.  I'm also removing the chown-ing of
backlight-related files under /sys, as those files are only
written by powerm now.

BUG=chromium-os:36510
TEST=see corresponding power_manager change
CQ-DEPEND=I6149d4de368fe17d4ed3b64672777df0cd361179

Change-Id: I376dd49be17ea81b080e0fbcbfa917d5d17c72f8
Reviewed-on: https://gerrit.chromium.org/gerrit/39294
Reviewed-by: Daniel Erat <derat@chromium.org>
Tested-by: Daniel Erat <derat@chromium.org>
Commit-Ready: Daniel Erat <derat@chromium.org>

5 months ago[init] rewrite date-proxy-watcher 54/38854/7
Elly Fong-Jones [Wed, 28 Nov 2012 22:23:33 +0000 (17:23 -0500)]
[init] rewrite date-proxy-watcher

date-proxy-watcher had a severe race condition, of this form:
1) request info
2) wait for response signal

Unfortunately if the response signal comes between 1 and 2 we hang forever. The
solution is to use a method of waiting that will buffer for us - i.e., a fifo.
Now this code uses three cooperating processes:

1) A process that waits for shill PropertyChange events, and fires off a request
for proxy info (1 above)
2) A process that waits for proxy info responses, and writes the info to a fifo
called "proxy-fifo" (2 above)
3) A process that blocks reading the fifo, figures out whether the proxy
actually changed, and notifies the parent process as needed.

BUG=chromium-os:31505
TEST=none yet

Change-Id: I47d11dbc1cc32c35dba34bbe1dd5d4973e1672ab
Signed-off-by: Elly Fong-Jones <ellyjones@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/38854
Reviewed-by: Richard Barnette <jrbarnette@chromium.org>
5 months agoModify update-engine to create a sub-directory of cgroups for its own use. 85/38885/5
Chris Sosa [Thu, 29 Nov 2012 05:04:38 +0000 (21:04 -0800)]
Modify update-engine to create a sub-directory of cgroups for its own use.

This adds a cgroup for update-engine under the cgroup hierarchy
stored at /sys/fs/cgroup. The update engine modifies the priority of its
process dynamically.

BUG=chromium-os:36229
TEST=Tested on device with/without.
CQ-DEPEND=Iec4df8a5120f

Change-Id: I6a0e56073e7281268e0550919c9ec9202b18db26
Reviewed-on: https://gerrit.chromium.org/gerrit/38885
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Ready: Chris Sosa <sosa@chromium.org>
Tested-by: Chris Sosa <sosa@chromium.org>
5 months ago[init] add cgroups startup job 93/38993/3
Elly Fong-Jones [Fri, 30 Nov 2012 16:33:15 +0000 (11:33 -0500)]
[init] add cgroups startup job

Mount /sys/fs/cgroup at startup for later use by Chrome.

BUG=chromium:132605,chromium-os:32633
TEST=adhoc
boot, ls -l /sys/fs/cgroup; you should see a 'cpu' directory.

Change-Id: Iec4df8a5120fb3755519c29b728c2a1348182ec8
Signed-off-by: Elly Fong-Jones <ellyjones@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/38993
Reviewed-by: Chris Sosa <sosa@chromium.org>
Reviewed-by: Richard Barnette <jrbarnette@chromium.org>
5 months ago[init] tlsdate: skip forward if needed 07/39107/3
Elly Fong-Jones [Mon, 3 Dec 2012 19:41:56 +0000 (14:41 -0500)]
[init] tlsdate: skip forward if needed

On November 13, we rolled a build image; 8 days later, the certificate for
clients3.google.com was replaced, and machines with that image on them (which
were defaulting to November 13) ceased to be able to fetch time. This is going
to happen basically whenever someone tries to use a sufficiently old build, and
to make matters worse, the certs on clients3.google.com are short-lived, so this
will bite us over and over.

Fortunately, there's a solution: 'leap mode'. In this mode, tlsdate will treat
the current time as though it was the start time on the received certificate
_if_ the start time passes normal time sanity checks and is after the current
time.

BUG=chromium-os:36738
TEST=adhoc
Run tlsdated without a cached time, check that the tlsdate subprocess runs with
-l using 'ps aux | grep tlsdate'.

Change-Id: Ib927cbe7370486f2cf104d4387df7f4a59d83542
Signed-off-by: Elly Fong-Jones <ellyjones@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/39107
Reviewed-by: Will Drewry <wad@chromium.org>
5 months agoinit: Move cryptohomed pre-stop script to separate upstart job. 75/38875/2
Thieu Le [Thu, 29 Nov 2012 01:29:55 +0000 (17:29 -0800)]
init: Move cryptohomed pre-stop script to separate upstart job.

Workaround a bug in upstart: https://bugs.launchpad.net/upstart/+bug/568288

BUG=chrome-os-partner:15913
TEST=Manually start/stop cryptohomed, system shutdown

Change-Id: I3cca11d6259f85f0760c303d769ffcd2c29b68e9
Reviewed-on: https://gerrit.chromium.org/gerrit/38875
Reviewed-by: Richard Barnette <jrbarnette@chromium.org>
Reviewed-by: Scott James Remnant <keybuk@chromium.org>
Reviewed-by: Elly Jones <ellyjones@chromium.org>
Commit-Ready: Thieu Le <thieule@chromium.org>
Tested-by: Thieu Le <thieule@chromium.org>
5 months agoinit: Diverting networking messages to /var/log/net. 36/38136/2
Wade Guthrie [Wed, 14 Nov 2012 21:21:38 +0000 (13:21 -0800)]
init: Diverting networking messages to /var/log/net.

To reduce the noise in /var/log/messages, this change sends all shill, dhcp,
and supplicant messages to /var/log/net.log (all 'error' and higher severity
messages from these still go into .../messages).  .../net.log gets rotated in
the exact same was that .../messages does.

BUG=chromium-os:36269
TEST=Manual.  Installed these files, inspected .../messages and
.../net.log to verify that messages got sent to the right place.
Changed the frequency of the rotation cron job and verified that
messages, net.log, etc. got rotated properly.

Change-Id: I28bbb3c9514b02ee898b03b261c42437fed73f3e
Reviewed-on: https://gerrit.chromium.org/gerrit/38136
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Reviewed-by: Elly Jones <ellyjones@chromium.org>
Commit-Ready: Wade Guthrie <wdg@chromium.org>
Tested-by: Wade Guthrie <wdg@chromium.org>
5 months ago[init] Use new is_developer_end_user tool 44/38244/3
Chris Masone [Fri, 16 Nov 2012 22:52:02 +0000 (14:52 -0800)]
[init] Use new is_developer_end_user tool

Instead of duplicating logic from login_manager/xstart.sh, use
tool that implements that logic.

BUG=None
TEST=install on a device; All sysrq keys should be available for devs.
TEST=install base image on a device; only alt-F10-x should do anything.

CQ-DEPEND=Ief1aa40a187ecac34bb222cac4b6d4ebc4880ee1

Change-Id: I752fc55e27c353fa1de91e4104504cc0be2cab53
Reviewed-on: https://gerrit.chromium.org/gerrit/38244
Tested-by: Chris Masone <cmasone@chromium.org>
Reviewed-by: Richard Barnette <jrbarnette@chromium.org>
Commit-Ready: Chris Masone <cmasone@chromium.org>

6 months agopstore: mount with nodev,nosuid,noexec 54/38054/3
Kees Cook [Wed, 14 Nov 2012 21:30:54 +0000 (13:30 -0800)]
pstore: mount with nodev,nosuid,noexec

While it is currently not possible to write files to the pstore
filesystem, we might as well mount with all the security restrictions,
just to avoid future vulnerabilities.

BUG=chromium-os:32630
TEST=parrot build, manual testing

Change-Id: I55ae9dfd0a69a8d3d83618ff383570fd1a473cdf
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/38054
Reviewed-by: Jorge Lucangeli Obes <jorgelo@chromium.org>
6 months agoRemoves the code to create and remove allow-vt-switching flag file. 16/37816/3
Yoshiki Iguchi [Mon, 12 Nov 2012 09:53:53 +0000 (18:53 +0900)]
Removes the code to create and remove allow-vt-switching flag file.

This CL also adds the comment about use of the duplicated logic.

BUG=chromium:153961, chromium-os:35606
TEST=none

Change-Id: I557b2074424a9cfac8d43bb071dece796760a0a5
Reviewed-on: https://gerrit.chromium.org/gerrit/37816
Tested-by: Yoshiki IGUCHI <yoshiki@chromium.org>
Reviewed-by: Richard Barnette <jrbarnette@chromium.org>
Commit-Ready: Yoshiki IGUCHI <yoshiki@chromium.org>

6 months ago[tlsdated] create /var/cache/tlsdated if needed 31/37931/2
Elly Fong-Jones [Tue, 13 Nov 2012 20:35:03 +0000 (15:35 -0500)]
[tlsdated] create /var/cache/tlsdated if needed

Without this dir, we can't save timestamps across reboots. Oops!

BUG=chromium-os:31505
TEST=adhoc
rm -rf /var/cache/tlsdated; stop tlsdated; start tlsdated; ls -l
/var/cache/tlsdated

Change-Id: I10e2a16a025b19fe2505ee9979ec4bbda739a65a
Signed-off-by: Elly Fong-Jones <ellyjones@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/37931
Reviewed-by: Kees Cook <keescook@chromium.org>
6 months agoAutotest: Cleanup Autoreboot on Power Failure Init Script 20/36920/4
Simran Basi [Tue, 30 Oct 2012 18:09:12 +0000 (11:09 -0700)]
Autotest: Cleanup Autoreboot on Power Failure Init Script

Cleaned up the autoreboot.conf script to now run on started and
to automatically detect the device does not have a battery and is
an intel-based device.

BUG=chromium-os:34820
TEST=Tested on Stumpy

Change-Id: I7c52981d622d498b643f3476698fdfe3c53bfb18
Reviewed-on: https://gerrit.chromium.org/gerrit/36920
Reviewed-by: Richard Barnette <jrbarnette@chromium.org>
Commit-Ready: Simran Basi <sbasi@chromium.org>
Reviewed-by: Simran Basi <sbasi@chromium.org>
Tested-by: Simran Basi <sbasi@chromium.org>
6 months agoshill: No need to use /var/run/flimflam anymore, switch to shill.
Darin Petkov [Tue, 30 Oct 2012 15:03:07 +0000 (16:03 +0100)]
shill: No need to use /var/run/flimflam anymore, switch to shill.

This patch needs to go together with the dependent patch.

BUG=chromium-os:34707
TEST=build image, tested connectivity
CQ-DEPEND=I1a87b9a54e9420a083ff8687670bda5ee906ddc1

Change-Id: Ieeba03517cbb507c93c93b1cfa54ccae2db8e2ce
Reviewed-on: https://gerrit.chromium.org/gerrit/37010
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Ready: Darin Petkov <petkov@chromium.org>
Tested-by: Darin Petkov <petkov@chromium.org>
6 months ago[init] tlsdated: don't error out for invalid proxy
Elly Fong-Jones [Thu, 1 Nov 2012 17:14:24 +0000 (13:14 -0400)]
[init] tlsdated: don't error out for invalid proxy

This script runs with 'set -e', so it'll bail if valid_proxy fails and isn't in
a conditional like this.

Also, fix the validation logic - it was inverted (!) and hence would always fail
(!) on valid proxies. Oops!

BUG=chromium-os:35726
TEST=adhoc
write a bogus proxy into /var/run/proxy, stop tlsdated, start tlsdated

Change-Id: Ia187b80c85c7cdd64cdb2f1d7befb8b40e7a663d
Signed-off-by: Elly Fong-Jones <ellyjones@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/37119
Reviewed-by: Will Drewry <wad@chromium.org>
6 months ago[init] handle proxy changes at runtime
Elly Fong-Jones [Wed, 17 Oct 2012 21:28:21 +0000 (17:28 -0400)]
[init] handle proxy changes at runtime

Look up the proxy at startup and then listen for proxy changes at runtime,
writing them to a file (/var/run/proxy currently) whenever a proxy is enabled or
disabled.

BUG=chromium-os:31505
TEST=adhoc

Change-Id: Id0d0da3899179d4d37458ae637e0cfd0c2f56757
Signed-off-by: Elly Fong-Jones <ellyjones@chromium.org>
(cherry picked from commit 7beb009a03805cdaec4085bd15d74ce1e1a1f348)
Reviewed-on: https://gerrit.chromium.org/gerrit/35947
Reviewed-by: Will Drewry <wad@chromium.org>
6 months ago[syslog] set ownership of other log files
Elly Fong-Jones [Tue, 30 Oct 2012 21:26:43 +0000 (17:26 -0400)]
[syslog] set ownership of other log files

BUG=chromium-os:35279
TEST=adhoc
Build, boot, ls -l /var/log/{secure,boot.log,laptopmode.log}

Change-Id: I86b3e4f90dd396cb13540e7c42cce93140ba6dc4
Signed-off-by: Elly Fong-Jones <ellyjones@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/36948
Reviewed-by: Will Drewry <wad@chromium.org>
6 months agoinit: Make boot-splash job set backlight to 40% brightness.
Daniel Erat [Tue, 30 Oct 2012 23:13:17 +0000 (16:13 -0700)]
init: Make boot-splash job set backlight to 40% brightness.

This makes us use the power manager's backlight-tool program
to set the backlight to 40% of its maximum level (in nits)
before displaying the boot splash screen.  At least in the
case of i915, the kernel appears to initialize the backlight
to 100%, which can be painful in a dark room.

If the transition ends up looking flickery (despite
happening while a black screen is displayed) outside of dev
mode, we may need to move the 40% setting to the kernel.
There's still one more brightness transition after X has
started, when powerd starts and gets its first reading from
the ambient light sensor.

I didn't observe any increases to the timestamp in
/tmp/uptime-x-started with this change.  (Actually, I see
pretty-consistent-looking 100-to-200-ms-lower timestamps
with this change, which is madness.)

BUG=chromium-os:31795
TEST=manual: boot in a dark room; vision is retained
CQ-DEPEND=I3a0611d8ffebe96fa4fdca6677ca61564656cbed

Change-Id: Ie8e5f4d606462eecfb50d56f7d6fb9f39317b49f
Reviewed-on: https://gerrit.chromium.org/gerrit/36972
Commit-Ready: Daniel Erat <derat@chromium.org>
Reviewed-by: Daniel Erat <derat@chromium.org>
Tested-by: Daniel Erat <derat@chromium.org>
6 months agoshill: Use shill login script
Paul Stewart [Mon, 24 Sep 2012 18:04:45 +0000 (11:04 -0700)]
shill: Use shill login script

Instead of doing login and logout tasks on behalf of shill, call
shill-owned scripts for doing these task.

CQ-DEPEND=Ifb7d1cca21a9223e39f8030a80b0d1cba5b3a555
BUG=chromium-os:34665
TEST=Login in the following scenarios:
 - Cryptohome profile does not exist
   + No "old" profile directory
   + No "old" profile
   + "Old" profile owned by "chronos"
   + "Old" profile owned by "root"
   + "Old" profile is a symlink to a non-existent file
   + "Old" profile is a symlink to a file that exists
   + "Old" profile is a named pipe
   + "Old" profile is a device file
 - Cryptohome profile already exists
   + "Old" profile owned by "root"
 - Cryptohome profile directory exists but actual profile does not
   + "Old" profile owned by "root"
New autotest to verify correctness: https://gerrit.chromium.org/gerrit/35875
Updated a machine from R21 using shill.
Updated a machine from R21 using flimflam (with shill profile removed).

Change-Id: I47474d708b43827b8cbd008eedd6450fb58ba548
Reviewed-on: https://gerrit.chromium.org/gerrit/33914
Commit-Ready: Paul Stewart <pstew@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
6 months agoinit: shill: Remove user profile directory first
Paul Stewart [Tue, 30 Oct 2012 15:54:45 +0000 (08:54 -0700)]
init: shill: Remove user profile directory first

After convincing jrbarnette during code-review that making this
directory was safe without pre-emptively removing it first, it
turns out that due to a sneaky symlink above it was really necessary.
Fix that.

BUG=chromium-os:35868
TEST=Test on afflicted host

Change-Id: I6a829ae789a05c9a199169412a88faf9e37a9418
Reviewed-on: https://gerrit.chromium.org/gerrit/36902
Reviewed-by: Chris Wolfe <cwolfe@chromium.org>
Commit-Ready: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
6 months agoshill: Link to new shill profile directory
Paul Stewart [Tue, 25 Sep 2012 14:42:12 +0000 (07:42 -0700)]
shill: Link to new shill profile directory

shill will change to using a different profile directory.
Temporarily make a symlink to the old directory from the
new in order to assure a smooth transition.

BUG=chromium-os:34703
TEST=Start a shill instance using the new pathname

Change-Id: I3c88ddb746bfc3f732bf00c03313971e41546ea9
Reviewed-on: https://gerrit.chromium.org/gerrit/33992
Reviewed-by: Richard Barnette <jrbarnette@chromium.org>
Commit-Ready: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
6 months agoshill: Switch to init files named "shill"
Paul Stewart [Mon, 24 Sep 2012 16:14:15 +0000 (09:14 -0700)]
shill: Switch to init files named "shill"

Perform following cleanups:

 - Rename "flimflam" init files to "shill"
 - Ignore and remove old "disable shill" sentinel files
 - Never start flimflam
 - Remove udev interface trigger (not needed by shill)

BUG=chromium-os:34703
TEST=Boot machine, ensure shill starts and successfully configures
(dhcp runs correctly).  Ensure profile pushes and pops with login
and logout.  If no profile directory exists a new one is created.
Run "killall shill" in a 400ms loop, and ensure that after respawn
is suspended due to too many restarts, shill is again started after
60 seconds.  After CL upload, trybots will be run.
CQ-DEPEND=I3c530687e458e54f2b41d2305569b84fb2da2217

Change-Id: I516f6e8cf102253fc5e86b9021f87e17342dee26
Reviewed-on: https://gerrit.chromium.org/gerrit/33895
Reviewed-by: Darin Petkov <petkov@chromium.org>
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Reviewed-by: Richard Barnette <jrbarnette@chromium.org>
Commit-Ready: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
6 months ago[init] use tlsdate instead of htpdate
Elly Fong-Jones [Mon, 1 Oct 2012 22:00:07 +0000 (18:00 -0400)]
[init] use tlsdate instead of htpdate

BUG=chromium-os:31505
TEST=trybot

Change-Id: I5c3e3602586e531ab7c7e6847a2c2210856aeea5
Signed-off-by: Elly Fong-Jones <ellyjones@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/34385
Reviewed-by: Will Drewry <wad@chromium.org>