glenn harm's picture

Why does cron-apt run /usr/sbin/update-grub? 

I've installed turnkey-mysql in one partition and a debian linux64 in another partition. These two share a common /boot partition. I've manually modified /boot/grub/grub.cfg to suit my needs. 

Last night, apt-get ran update-grub and has fundamentally undone the customization I did for grub.cfg and perhaps more annoyingly has set the timeout value to -1, which requires one to actually hit enter on a boot entry to boot. 

Why would cron-apt need to do this, and how can I make it never do that again? 

Thanks!

Forum: 
Jeremy Davis's picture

And it surprises me that it does. The only thing that I can think is that perhaps an auto installed security update did it? (Perhaps a security update to grub or something?)

I have never run TKL dual boot (only as a VM - mostly on my PVE hypervisor) so I can't say I've ever run across that. Assuming that this is the cause (and I can't see any other reason why grub-update would run) then disabling auto security updates is probably the only (easy) way around it.

glenn harm's picture

I can't see that grub was updated, but it certainly ran update-grub

 

Apr 3 10:47:02 mysql001 cron-apt: Running postinst hook script /usr/sbin/update-grub.

Apr 3 10:47:02 mysql001 cron-apt: Generating grub.cfg ...

 

===full log below===

grep cron-apt user.log Apr 3 10:22:51 mysql001 cron-apt: CRON-APT RUN [/etc/cron-apt/config]: Tue Apr 3 10:03:01 UTC 2012 Apr 3 10:22:51 mysql001 cron-apt: CRON-APT SLEEP: 1107, Tue Apr 3 10:21:28 UTC 2012 Apr 3 10:22:51 mysql001 cron-apt: CRON-APT ACTION: 5-install Apr 3 10:22:51 mysql001 cron-apt: CRON-APT LINE: /usr/bin/apt-get autoclean -q -y Apr 3 10:22:51 mysql001 cron-apt: Reading package lists... Apr 3 10:22:51 mysql001 cron-apt: Building dependency tree... Apr 3 10:22:51 mysql001 cron-apt: Reading state information... Apr 3 10:22:51 mysql001 cron-apt: Del linux-libc-dev 2.6.32-39.86 [836kB] Apr 3 10:22:51 mysql001 cron-apt: Del linux-image-generic 2.6.32.39.46 [4814B] Apr 3 10:22:51 mysql001 cron-apt: Del libpng12-0 1.2.42-1ubuntu2.3 [177kB] Apr 3 10:47:02 mysql001 cron-apt: CRON-APT LINE: /usr/bin/apt-get dist-upgrade -q -y -o APT::Get::Show-Upgraded=true -o Dir::Etc::sourcelist=/etc/apt/sources.list.d/security.sources.list -o Dir::Etc::sourceparts=nonexistent -o DPkg::Options::=--force-confdef -o DPkg::Options::=--force-confold Apr 3 10:47:02 mysql001 cron-apt: Reading package lists... Apr 3 10:47:02 mysql001 cron-apt: Building dependency tree... Apr 3 10:47:02 mysql001 cron-apt: Reading state information... Apr 3 10:47:02 mysql001 cron-apt: The following NEW packages will be installed: Apr 3 10:47:02 mysql001 cron-apt: linux-image-2.6.32-40-generic Apr 3 10:47:02 mysql001 cron-apt: The following packages will be upgraded: Apr 3 10:47:02 mysql001 cron-apt: cpp-4.4 gcc-4.4-base libfreetype6 libgcc1 libpng12-0 libstdc++6 Apr 3 10:47:02 mysql001 cron-apt: linux-image-generic linux-libc-dev Apr 3 10:47:02 mysql001 cron-apt: 8 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. Apr 3 10:47:02 mysql001 cron-apt: Need to get 37.3MB of archives. Apr 3 10:47:02 mysql001 cron-apt: After this operation, 99.4MB of additional disk space will be used. Apr 3 10:47:02 mysql001 cron-apt: Get:1 http://us.archive.ubuntu.com/ubuntu/ lucid-security/main linux-image-2.6.32-40-generic 2.6.32-40.87 [31.6MB] Apr 3 10:47:02 mysql001 cron-apt: Get:2 http://us.archive.ubuntu.com/ubuntu/ lucid-security/main gcc-4.4-base 4.4.3-4ubuntu5.1 [118kB] Apr 3 10:47:02 mysql001 cron-apt: Get:3 http://us.archive.ubuntu.com/ubuntu/ lucid-security/main libstdc++6 4.4.3-4ubuntu5.1 [348kB] Apr 3 10:47:02 mysql001 cron-apt: Get:4 http://us.archive.ubuntu.com/ubuntu/ lucid-security/main cpp-4.4 4.4.3-4ubuntu5.1 [3759kB] Apr 3 10:47:02 mysql001 cron-apt: Get:5 http://us.archive.ubuntu.com/ubuntu/ lucid-security/main libgcc1 1:4.4.3-4ubuntu5.1 [55.3kB] Apr 3 10:47:02 mysql001 cron-apt: Get:6 http://us.archive.ubuntu.com/ubuntu/ lucid-security/main libfreetype6 2.3.11-1ubuntu2.6 [420kB] Apr 3 10:47:02 mysql001 cron-apt: Get:7 http://us.archive.ubuntu.com/ubuntu/ lucid-security/main libpng12-0 1.2.42-1ubuntu2.4 [177kB] Apr 3 10:47:02 mysql001 cron-apt: Get:8 http://us.archive.ubuntu.com/ubuntu/ lucid-security/main linux-image-generic 2.6.32.40.47 [4828B] Apr 3 10:47:02 mysql001 cron-apt: Get:9 http://us.archive.ubuntu.com/ubuntu/ lucid-security/main linux-libc-dev 2.6.32-40.87 [837kB] Apr 3 10:47:02 mysql001 cron-apt: [master 0afe2eb] saving uncommitted changes in /etc prior to apt run Apr 3 10:47:02 mysql001 cron-apt: 15 files changed, 666 insertions(+), 3 deletions(-) Apr 3 10:47:02 mysql001 cron-apt: debconf: delaying package configuration, since apt-utils is not installed Apr 3 10:47:02 mysql001 cron-apt: Fetched 37.3MB in 23min 46s (26.2kB/s) Apr 3 10:47:02 mysql001 cron-apt: Selecting previously deselected package linux-image-2.6.32-40-generic. Apr 3 10:47:02 mysql001 cron-apt: (Reading database ... 28307 files and directories currently installed.) Apr 3 10:47:02 mysql001 cron-apt: Unpacking linux-image-2.6.32-40-generic (from .../linux-image-2.6.32-40-generic_2.6.32-40.87_i386.deb) ... Apr 3 10:47:02 mysql001 cron-apt: Done. Apr 3 10:47:02 mysql001 cron-apt: Preparing to replace gcc-4.4-base 4.4.3-4ubuntu5 (using .../gcc-4.4-base_4.4.3-4ubuntu5.1_i386.deb) ... Apr 3 10:47:02 mysql001 cron-apt: Unpacking replacement gcc-4.4-base ... Apr 3 10:47:02 mysql001 cron-apt: Setting up gcc-4.4-base (4.4.3-4ubuntu5.1) ... Apr 3 10:47:02 mysql001 cron-apt: (Reading database ... 31819 files and directories currently installed.) Apr 3 10:47:02 mysql001 cron-apt: Preparing to replace libstdc++6 4.4.3-4ubuntu5 (using .../libstdc++6_4.4.3-4ubuntu5.1_i386.deb) ... Apr 3 10:47:02 mysql001 cron-apt: Unpacking replacement libstdc++6 ... Apr 3 10:47:02 mysql001 cron-apt: Setting up libstdc++6 (4.4.3-4ubuntu5.1) ... Apr 3 10:47:02 mysql001 cron-apt: Apr 3 10:47:02 mysql001 cron-apt: Processing triggers for libc-bin ... Apr 3 10:47:02 mysql001 cron-apt: ldconfig deferred processing now taking place Apr 3 10:47:02 mysql001 cron-apt: (Reading database ... 31819 files and directories currently installed.) Apr 3 10:47:02 mysql001 cron-apt: Preparing to replace cpp-4.4 4.4.3-4ubuntu5 (using .../cpp-4.4_4.4.3-4ubuntu5.1_i386.deb) ... Apr 3 10:47:02 mysql001 cron-apt: Unpacking replacement cpp-4.4 ... Apr 3 10:47:02 mysql001 cron-apt: Preparing to replace libgcc1 1:4.4.3-4ubuntu5 (using .../libgcc1_1%3a4.4.3-4ubuntu5.1_i386.deb) ... Apr 3 10:47:02 mysql001 cron-apt: Unpacking replacement libgcc1 ... Apr 3 10:47:02 mysql001 cron-apt: Processing triggers for man-db ... Apr 3 10:47:02 mysql001 cron-apt: Setting up libgcc1 (1:4.4.3-4ubuntu5.1) ... Apr 3 10:47:02 mysql001 cron-apt: Apr 3 10:47:02 mysql001 cron-apt: Processing triggers for libc-bin ... Apr 3 10:47:02 mysql001 cron-apt: ldconfig deferred processing now taking place Apr 3 10:47:02 mysql001 cron-apt: (Reading database ... 31819 files and directories currently installed.) Apr 3 10:47:02 mysql001 cron-apt: Preparing to replace libfreetype6 2.3.11-1ubuntu2.5 (using .../libfreetype6_2.3.11-1ubuntu2.6_i386.deb) ... Apr 3 10:47:02 mysql001 cron-apt: Unpacking replacement libfreetype6 ... Apr 3 10:47:02 mysql001 cron-apt: Preparing to replace libpng12-0 1.2.42-1ubuntu2.3 (using .../libpng12-0_1.2.42-1ubuntu2.4_i386.deb) ... Apr 3 10:47:02 mysql001 cron-apt: Unpacking replacement libpng12-0 ... Apr 3 10:47:02 mysql001 cron-apt: Preparing to replace linux-image-generic 2.6.32.39.46 (using .../linux-image-generic_2.6.32.40.47_i386.deb) ... Apr 3 10:47:02 mysql001 cron-apt: Unpacking replacement linux-image-generic ... Apr 3 10:47:02 mysql001 cron-apt: Preparing to replace linux-libc-dev 2.6.32-39.86 (using .../linux-libc-dev_2.6.32-40.87_i386.deb) ... Apr 3 10:47:02 mysql001 cron-apt: Unpacking replacement linux-libc-dev ... Apr 3 10:47:02 mysql001 cron-apt: Setting up linux-image-2.6.32-40-generic (2.6.32-40.87) ... Apr 3 10:47:02 mysql001 cron-apt: Running depmod. Apr 3 10:47:02 mysql001 cron-apt: update-initramfs: Generating /boot/initrd.img-2.6.32-40-generic Apr 3 10:47:02 mysql001 cron-apt: .: 13: Can't open /scripts/casper-functions Apr 3 10:47:02 mysql001 cron-apt: .: 6: Can't open /scripts/casper-functions Apr 3 10:47:02 mysql001 cron-apt: .: 6: Can't open /scripts/casper-functions Apr 3 10:47:02 mysql001 cron-apt: Running postinst hook script /usr/sbin/update-grub. Apr 3 10:47:02 mysql001 cron-apt: Generating grub.cfg ... Apr 3 10:47:02 mysql001 cron-apt: Found linux image: /boot/vmlinuz-2.6.32-40-generic Apr 3 10:47:02 mysql001 cron-apt: Found initrd image: /boot/initrd.img-2.6.32-40-generic Apr 3 10:47:02 mysql001 cron-apt: Found linux image: /boot/vmlinuz-2.6.32-39-generic Apr 3 10:47:02 mysql001 cron-apt: Found initrd image: /boot/initrd.img-2.6.32-39-generic Apr 3 10:47:02 mysql001 cron-apt: Found linux image: /boot/vmlinuz-2.6.32-36-generic Apr 3 10:47:02 mysql001 cron-apt: Found initrd image: /boot/initrd.img-2.6.32-36-generic Apr 3 10:47:02 mysql001 cron-apt: Found linux image: /boot/vmlinuz-2.6.32-5-amd64 Apr 3 10:47:02 mysql001 cron-apt: Found initrd image: /boot/initrd.img-2.6.32-5-amd64 Apr 3 10:47:02 mysql001 cron-apt: Found Debian GNU/Linux (6.0.4) on /dev/sda6 Apr 3 10:47:02 mysql001 cron-apt: done Apr 3 10:47:02 mysql001 cron-apt: Apr 3 10:47:02 mysql001 cron-apt: Setting up cpp-4.4 (4.4.3-4ubuntu5.1) ... Apr 3 10:47:02 mysql001 cron-apt: Setting up libfreetype6 (2.3.11-1ubuntu2.6) ... Apr 3 10:47:02 mysql001 cron-apt: Apr 3 10:47:02 mysql001 cron-apt: Setting up libpng12-0 (1.2.42-1ubuntu2.4) ... Apr 3 10:47:02 mysql001 cron-apt: Apr 3 10:47:02 mysql001 cron-apt: Setting up linux-image-generic (2.6.32.40.47) ... Apr 3 10:47:02 mysql001 cron-apt: Setting up linux-libc-dev (2.6.32-40.87) ... Apr 3 10:47:02 mysql001 cron-apt: Processing triggers for libc-bin ... Apr 3 10:47:02 mysql001 cron-apt: ldconfig deferred processing now taking place

Jeremy Davis's picture

Having a look at your log it looks like the auto security updates installed a new kernel:

Apr 3 10:47:02 mysql001 cron-apt: The following NEW packages will be installed:
Apr 3 10:47:02 mysql001 cron-apt: linux-image-2.6.32-40-generic
...
Apr 3 10:47:02 mysql001 cron-apt: Preparing to replace linux-image-generic 2.6.32.39.46 (using .../linux-image-generic_2.6.32.40.47_i386.deb) ...
Apr 3 10:47:02 mysql001 cron-apt: Unpacking replacement linux-image-generic ...
...
Apr 3 10:47:02 mysql001 cron-apt: Setting up linux-image-2.6.32-40-generic (2.6.32-40.87) ...
Apr 3 10:47:02 mysql001 cron-apt: Running depmod.
Apr 3 10:47:02 mysql001 cron-apt: update-initramfs: Generating /boot/initrd.img-2.6.32-40-generic 

Hence the need to run grub-update.

Thinking on this a little further, you shouldn't really be editing grub.cfg anyway. That's why the default grub.cfg file has this as the header:

# DO NOT EDIT THIS FILE
#
# It is automatically generated by /usr/sbin/grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub

So you can disable TKL auto security updates and continue to customise your grub.cfg directly (and still loose these changes anytime the kernel or grub are updated), or do your customisations the 'proper' way and edit /etc/default/grub and/or files in /etc/grub.d/

There are plenty of tutorials available online, here's a couple of links:
http://www.gnu.org/software/grub/manual/grub.html
http://www.dedoimedo.com/computers/grub-2.html
http://ubuntuforums.org/showthread.php?t=1195275

Add new comment