Re: Set environment variable globally

2017-04-06 Thread Andrew Martin
- Original Message -
> From: "J Fernyhough" 
> To: "amartin" 
> Cc: "ubuntu-devel-discuss" 
> Sent: Thursday, April 6, 2017 12:42:05 PM
> Subject: Re: Set environment variable globally

> On 06/04/17 16:36, Andrew Martin wrote:
>> 
>> It seems like that would have some performance impact. Setting TZ in the
>> /etc/environment file doesn't appear to be used by upstart or systemd, and
>> therefore apache2 doesn't use it either. How can I make it be used for 
>> services
>> started by either init system?
>> 
> 
> Not sure about upstart, but systemd should be straightforward enough.
> You can add environment variables through editing the unit file
> directly, or possibly better by:
> 
> 1) Adding a conf file, e.g. in
> /etc/systemd/system/apache2.service.d/tz.conf:
> 
> [Service]
> Environment="TZ=:/etc/localtime"
> 
> 2) globally for all units in /etc/systemd/system.conf, or e.g.
> /etc/systemd/system.conf.d/tz.conf:
> 
> [Manager]
> DefaultEnvironment="TZ=:/etc/localtime"
> 
> 
> You'll need to do a daemon-reload and a service restart to pick up the
> changes, but it should be there. Terrible, hacky, one-liner to check:
> 
> for p in $(pgrep -d" " apache2); do echo -e "$p:\n$(cat
> /proc/$p/environ)\n"; done
> 
> J

Thanks, this looks like it should work well. I can over most cases with
the following:

add this to /etc/systemd/system.conf.d/tz.conf for services:
[Manager]
DefaultEnvironment="TZ=:/etc/localtime"

add this to /etc/profile.d/tz.sh for login shells:
export TZ=:/etc/localtime

add this to /etc/bash.bashrc for interactive non-login shells:
export TZ=:/etc/localtime

add this to /etc/environment as a catch-all:
TZ=:/etc/localtime

Andrew

-- 
Ubuntu-devel-discuss mailing list
Ubuntu-devel-discuss@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/ubuntu-devel-discuss


Re: Set environment variable globally

2017-04-06 Thread Andrew Martin
- Original Message -
> From: "J Fernyhough" 
> To: "ubuntu-devel-discuss" 
> Sent: Wednesday, April 5, 2017 2:01:26 PM
> Subject: Re: Set environment variable globally

> On 24/03/17 21:19, Andrew Martin wrote:
>> Hello,
>> 
>> I recently saw this blog post regarding performance when the TZ environment
>> variable is not set:
>> https://blog.packagecloud.io/eng/2017/02/21/set-environment-variable-save-thousands-of-system-calls/
>> 
> 
> There's also a good deal of discussion on the HN thread:
> https://news.ycombinator.com/item?id=13697555

Thanks, I had not seen this!

> 
>> I tried defining TZ in /etc/environment and in /etc/profile.d/test.sh, but I
>> cannot get this environment variable to be available in all cases (e.g. if I
>> just execute bash without --login or if I run the sample c program provided 
>> in
>> the above article). How can I make the TZ environment variable defined
>> completely system-wide?
> 
> Before you go too far with that, is there a specific reason you want to
> do this? For example, there's not generally a lot of advantage unless
> you have a process that does a lot of timezone-based processing.
> 
> However, all you should need in /etc/environment is:
> 
> TZ=:/etc/localtime
> 
> or an equivalent TZ value, e.g.:
> 
> TZ=:Europe/London
> 

I've noticed apache2 reading /etc/localtime a lot when running; this is also
mentioned in the HN thread:
http://mail-archives.apache.org/mod_mbox/httpd-dev/20.mbox/%3CCAMDeyhzRAZ4eyz%3D%2BstA%3DwoTibM-W6QL8TqT%2BaPio07UddCz7Tg%40mail.gmail.com%3E

It seems like that would have some performance impact. Setting TZ in the
/etc/environment file doesn't appear to be used by upstart or systemd, and
therefore apache2 doesn't use it either. How can I make it be used for services
started by either init system?

Thanks,

Andrew

-- 
Ubuntu-devel-discuss mailing list
Ubuntu-devel-discuss@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/ubuntu-devel-discuss


Re: Set environment variable globally

2017-04-05 Thread Andrew Martin
- Original Message -
> From: "Gérard BIGOT" 
> To: "amartin" 
> Cc: "ubuntu-devel-discuss" 
> Sent: Friday, March 31, 2017 8:41:36 AM
> Subject: Re: Set environment variable globally

> Hi,
> 
> I added this line in /etc/environment since a long time :
> 
> TZ="Europe/Paris"
> 
> It gives me satisfaction.
> 
> With this line, upon reboot, I have :
> 
> ~$ echo $TZ
> Europe/Paris
> 
> Without TZ doesn't exist.
> 
Gérard,

I can't seem to get this to work on 16.04. Which shell are you using?
Have you customized your /etc/bash.bashrc or /etc/profile to source
/etc/environment? I don't see any mention of /etc/environment in the
bash manpage, so it seems like this file isn't being used. Also, how
can I make this environment variable available to all processes started
by upstart (14.04) and systemd (16.04)? I am concerned not only about
interactive processes but also scripts (e.g. started via cron) and
services (started via upstart or systemd).

Thanks,

Andrew

-- 
Ubuntu-devel-discuss mailing list
Ubuntu-devel-discuss@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/ubuntu-devel-discuss


Set environment variable globally

2017-03-24 Thread Andrew Martin
Hello,

I recently saw this blog post regarding performance when the TZ environment
variable is not set:
https://blog.packagecloud.io/eng/2017/02/21/set-environment-variable-save-thousands-of-system-calls/

I have noticed this problem when stracing running daemons on my systems and
would like to fix it. I reviewed the official Ubuntu documentation for where to
define environment variables:
https://help.ubuntu.com/community/EnvironmentVariables

I tried defining TZ in /etc/environment and in /etc/profile.d/test.sh, but I
cannot get this environment variable to be available in all cases (e.g. if I
just execute bash without --login or if I run the sample c program provided in
the above article). How can I make the TZ environment variable defined
completely system-wide?

Thanks,

Andrew

-- 
Ubuntu-devel-discuss mailing list
Ubuntu-devel-discuss@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/ubuntu-devel-discuss


Re: kGraft/kPatch support in Ubuntu 15.10 or 16.04?

2015-08-24 Thread Andrew Martin
- Original Message -
> From: "Andrew Martin" 
> To: ubuntu-devel-discuss@lists.ubuntu.com
> Sent: Friday, August 14, 2015 11:13:27 AM
> Subject: kGraft/kPatch support in Ubuntu 15.10 or 16.04?
> 
> Hello,
> 
> I was very excited to see live kernel patching get accepted into the mainline
> kernel in 4.0. For server environments where uptime is crucial and rebooting
> servers to install kernel security fixes is very disruptive, the ability to
> live
> patch security fixes into the running kernel is a very desirable feature. Are
> there any plans to add support for the kGraft/kPatch support available in 4.x
> series kernels in Ubuntu Server 15.10 or 16.04? This would be a fantastic
> feature
> for the next LTS release!
> 
> Thanks,
> 
> Andrew Martin

Is there really no information about kGraft or kPatch support in Ubuntu?

-- 
Ubuntu-devel-discuss mailing list
Ubuntu-devel-discuss@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/ubuntu-devel-discuss


kGraft/kPatch support in Ubuntu 15.10 or 16.04?

2015-08-14 Thread Andrew Martin
Hello,

I was very excited to see live kernel patching get accepted into the mainline
kernel in 4.0. For server environments where uptime is crucial and rebooting
servers to install kernel security fixes is very disruptive, the ability to live
patch security fixes into the running kernel is a very desirable feature. Are
there any plans to add support for the kGraft/kPatch support available in 4.x
series kernels in Ubuntu Server 15.10 or 16.04? This would be a fantastic 
feature
for the next LTS release!

Thanks,

Andrew Martin

-- 
Ubuntu-devel-discuss mailing list
Ubuntu-devel-discuss@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/ubuntu-devel-discuss


Re: Kernel releases

2015-07-31 Thread Andrew Martin
- Original Message -
> From: "Christopher Carlson" 
> To: "Paul Smith" 
> Cc: ubuntu-devel-discuss@lists.ubuntu.com
> Sent: Thursday, July 30, 2015 1:49:37 PM
> Subject: Re: Kernel releases
> 
> Thank you for your reply, Paul.
> 
> BTW, I'm running 14.04.2 LTS.x86_64.
> 
> I also don't always restart, but I presume the only reason we got a kernel
> update is because of a bug or security, which encourages me to restart. It
> nags at me (not the system, but my concern that there's a problem lurking).
> 
> My whining is brought on by my strong dislike of Microsoft, and I get
> irritated that I have to reboot my Windows 7 machine every week. To think
> that Ubuntu is following in their footsteps concerns me.
> 
> Yes, I could scan the release notes to see if I really need this update, and
> thanks for the link. I've only got 57 of them on my system. Ugh. I have to
> clean up my /boot directory every couple of months or so to keep it
> reasonable.
> 
> Anyway, I appreciate the time you took to respond to me.
> 
> Sincerely,
> Chris Carlson
> 

Chris,

Linux kernel 4.0 supports live-patching of the kernel, so perhaps we will see
this integrated into a future Ubuntu release, which would mean you wouldn't
have to reboot to install kernel security fixes:
https://lkml.org/lkml/2015/4/12/178

Andrew

-- 
Ubuntu-devel-discuss mailing list
Ubuntu-devel-discuss@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/ubuntu-devel-discuss


Re: Backport latest stable virtualization packages to LTS

2015-05-29 Thread Andrew Martin
- Original Message -
> From: "Robie Basak" 
> To: ubuntu-devel-discuss@lists.ubuntu.com
> Sent: Friday, May 29, 2015 3:36:05 PM
> Subject: Re: Backport latest stable virtualization packages to LTS
> 
> On Fri, May 29, 2015 at 03:27:33PM -0500, Andrew Martin wrote:
> > Thanks for the clarification; I am glad to hear that the Cloud Archive
> > PPA is fully supported for non-OpenStack deployments too.
> 
> I'm not sure this is true. I have asked a colleague.

Thanks, I would appreciate clarification on this point.

> On Fri, May 29, 2015 at 01:42:34PM -0500, Andrew Martin wrote:
>>  ...however some major bugs 
>> have
>> been found that I think satisfy one of the "When" conditions. For example, I 
>> discovered a bug that would cause the on-disk XML for a VM defined by libvirt
>> to not be updated when a snapshot is taken:
>> https://www.redhat.com/archives/libvirt-users/2015-April/msg00078.html
>
> Are there bugs in Launchpad for this? If not, then developers can assume
> that nobody is affected, and so they may not get fixed as there is
> presumably no upside and only the risk of regression.

This bug is very similar, except I can reproduce the problem on precise too:
https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/1403841

>From Eric Blake's commentsin the libvirt-users thread above, it sounds like 
>there
were a number of improvements in several newer libvirt releases to address
problems where the active config was not being flushed to disk. It looks like 
the
particular code path in 1403841 has been fixed, however others seem to exist. 
I'm
not sure how feasible it would be to cherry-pick all fixes for this problem from
newer libvirt releases verses supporting a backport of newer stable libvirt.

Thanks,

Andrew

-- 
Ubuntu-devel-discuss mailing list
Ubuntu-devel-discuss@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/ubuntu-devel-discuss


Re: Backport latest stable virtualization packages to LTS

2015-05-29 Thread Andrew Martin
- Original Message -
> From: "Martinx - ジェームズ" 
> To: "Andrew Martin" , 
> ubuntu-devel-discuss@lists.ubuntu.com
> Sent: Friday, May 29, 2015 1:46:25 PM
> Subject: Re: Backport latest stable virtualization packages to LTS
> 
> Hey Andrew,
> 
> Both new QEmu and new Libvirt are available to Ubuntu Trusty, fully
> supported.
> 
> Just install your Trusty and run the following commands:
> 
> add-apt-repository cloud-archive:kilo
> apt-get update
> apt-get dist-upgrade
> 
> or
> 
> apt-get install ubuntu-virt-server
> 
> That's it!
> 

Hi Martinx,

Thanks for the clarification; I am glad to hear that the Cloud Archive
PPA is fully supported for non-OpenStack deployments too. It looks like
the Kilo release is only going to be supported for 18 months, not the
full 5-year period of the trusty LTS:
https://wiki.ubuntu.com/ServerTeam/CloudArchive

Because of this, should I be switching to the cloud-archive:m ppa
once it is made available? Is this the recommended path for updated
support of libvirt and qemu through the whole LTS lifecycle?

Thanks,

Andrew

-- 
Ubuntu-devel-discuss mailing list
Ubuntu-devel-discuss@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/ubuntu-devel-discuss


Backport latest stable virtualization packages to LTS

2015-05-29 Thread Andrew Martin
Hello,

I actively use the qemu-kvm and libvirt virtualization stack on the latest
Ubuntu server LTS release in a number of production systems. This
virtualization stack is stable, mature, and provides a great base on which to
host VMs. However, it seems that these packages are not updated once an LTS is
released, aside from security updates. I know that this is due to the Ubuntu
SRU (https://wiki.ubuntu.com/StableReleaseUpdates), however some major bugs have
been found that I think satisfy one of the "When" conditions. For example, I 
discovered a bug that would cause the on-disk XML for a VM defined by libvirt
to not be updated when a snapshot is taken:
https://www.redhat.com/archives/libvirt-users/2015-April/msg00078.html

The result would be that if the host is rebooted or the VM is shutdown, the
next time it starts up, it would use the previous snapshot, thus either failing
to start or invalidating the data on the current snapshot. I believe this
satisfies the "Bugs which may, under realistic circumstances, directly cause a 
loss of user data" bullet point on the SRU page.

I would really like to run a stable virtualization system on top of the latest
LTS, but it is hard when new stable releases are not available. Would it be 
possible for Ubuntu to actively support backporting the stable virtualization 
stack, e.g in a PPA? I see that the Ubuntu Virtualization Team exists on 
Launchpad, but does not appear to be active:
https://launchpad.net/~ubuntu-virt/+archive/ubuntu/ppa

Thanks,

Andrew Martin

-- 
Ubuntu-devel-discuss mailing list
Ubuntu-devel-discuss@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/ubuntu-devel-discuss