How do I apt-get -y dist-upgrade without a grub config prompt?

1

The update committed here: https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/978464 appears to have exposed a bug in either grub or apt that is breaking scripts based on the Amazon images from cloud.ubuntu.com.

See http://askubuntu.com/questions/146921/how-do-i-apt-get-y-dist-upgrade-without-a-grub-config-prompt

Specifically, dpkg is giving the upgraded config file prompt upon configuring grub-pc ("A new version of configuration file /etc/default/grub is available, but the version installed currently has been locally modified.")

However, the following does not work:
sudo apt-get update
sudo apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" dist-upgrade

Furthermore, dpkg -S /etc/default/grub doesn't appear to show this file as being owned by any package prior to upgrade. I'm not sure how this file is generated (or how dpkg determines who owns it), but it's currently breaking scripts and I can't figure out a...

0 0
2

I have a box with Ubuntu 12.04, and just did a apt-get upgrade. I'm presented with a dialogue to update my GRUB bootloader, but with the following message:

The GRUB boot loader was previously installed to a disk that is no longer present, or whose unique identifier has changed for some reason. It is important to make sure that the installed GRUB core image stays in sync with GRUB modules and grub.cfg. Please check again to make sure that GRUB is written to the appropriate boot devices. If you're unsure which drive is designated as boot drive by your BIOS, it is often a good idea to install GRUB to all of them. Note: it is possible to install GRUB to partition boot records as well, and some appropriate partitions are offered here. However, this forces GRUB to use the blocklist mechanism, which makes it less reliable, and therefore is not recommended. GRUB install devices: [ ] /dev/sda (3000592 MB; ST3000DM001-9YN166) [ ] /dev/sdb (3000592 MB; ST3000DM001-9YN166) [ ] /dev/md1...
0 0
3

One should consult the official Debian/Ubuntu documentation and ESPECIALLY your clould/vps hosting company's OS-instance update/upgrade/support policies and requirements.

SAFE: The "apt-get upgrade" command will normally only install updates (or fixes) to currently installed packages. This is the safest command for keeping the server's software, security patches, and minor changes current. The apt-get upgrade process will NOT generally install new releases, where major changes (including removal of packages or GRUB update is required). For example, when a new Linux kernel (linux-image-3.x.x-xx-generic, etc.) is available, the package will not get installed. A number of cloud hosting providers upgrade their servers automatically using this basic "upgrade" process.

SOME RISKS: The "apt-get dist-upgrade" command is for upgrading from one stable Debian/Ubuntu distribution to the next. It also upgrades packages and settings in a more complex and comprehensive way,...

0 0
4

by

nwaltham

Last Updated March 20, 2017 06:02 AM

There is a very similar question here "How do I apt-get -y dist-upgrade without a grub config prompt?" about updating grub without the prompt using apt-get.

However I would like to to know how to install grub2 with apt-get on a brand new image. I am preparing virtual machine disk images starting with debootstrap and going from there.

I would like to install the grub2 software on an image - but not configure it or install it on the boot sector at all ; a later script takes care of configuration and installation proper.

How can I do this?

Answers 1

Answering my own question - I have found I can do it like this:

echo "grub-pc grub-pc/install_devices_empty boolean true" | debconf-set-selections DEBIAN_FRONTEND=text apt-get -y install grub2

nwaltham
October 03, 2014 10:39...

0 0
5

LMDE 201403 Cinnamon 64 bit

I have a 'test' LMDE system on one partition of the only hard drive of a netbook. The netbook is not my primary PC. Other partitions contain Win 7 Starter which I hardly ever use and an LMDE system I use as my prime operating system when I'm travelling with the netbook. A Grub menu allows me to choose which partition to boot, and I chose the 'test' LMDE system today so as to upgrade it to LMDE2.

I am trying to follow the 'Upgrade from 'LMDE 1 to LMDE 2' tutorial. Step 1, OK, APT Source modified. Step 2, OK, APT Cache updated. Step 3, OK, packages installed. Step 4, I don't use a screensaver, so did nothing. Step 5, dist-upgrade In progress. I've taken the defaults whenever asked for input during this step. Now got to "Configuring grub-pc', the terminal has a text box describing what options are going to be available for use with grub-pc, and I hit Enter to continue, and nothing happens. BTW since the netbook already uses Grub to select...

0 0
6
Hello Guys,

I have an issue with boot: I am going to EFI shell prompt when booting with
no escape to my Linux Mint 15 installed. I am stuck.
Let me give you the background:

I am using a PC with UEFI booting, the installation of Linux Mint 15 from scratch was done a few weeks ago
without problem on my SSD drive located in /dev/sda
They are 2 partitions: sda1 for the /boot/efi, and sda2 for Kernel. GPT partition on sda.
All was done smoothly without user intervention, all automaticaly.

The issue came when I decided to upgrade my Linux with "apt-get dist-upgrade" ,
I had some dependencies issue, and thought it could be a good idea at that time,
I realised then it was actually installing a new kernel, yeah dist-upgrade I realized ... the French MANUAL was not clear enough for me,
I was prompted to choose the place for Grub, I have had chosen /dev/sda.
After that I am falling to EFI prompt shell at every boot.
As I did...

0 0
7

Boot from a linux live cd and create your chroot environment ( step 1,2 and 3)

Edit your sources.list comment the backports entry then update your system.

Get the list of the backported package and save it :

dpkg -l |awk '/^ii/ && $3 ~ /bpo[6-8]/ {print $2}' > backports.txt

To keep the current kernel version , edit the backports.txt and remove the kernel package entry e,g:

linux-headers-4.7.0-0.bpo.1-amd64 linux-headers-4.7.0-0.bpo.1-common linux-image-4.7.0-0.bpo.1-amd64

Purge the packported packages:

sudo apt-get purge $(cat backports.txt)

Enable backport entry from your sources.list , then run ;

sudo apt-get update sudo apt-get upgrade sudo apt-get install $(cat backports.txt)

Maybe you will get a held package , run sudo apt-get -f install

Exit the chroot ( step 6) and reboot your...

0 0
8

I am using Ubuntu 12.04.2 LTS (“precise”). I am trying to upgrade all packages using kernel via apt-get upgrade method. But, I am getting the following message:


apt-get upgrade
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following packages have been kept back:
linux-headers-virtual linux-image-virtual mysql-client-5.5 mysql-server-5.5
mysql-server-core-5.5
The following packages will be upgraded:
base-files dosfstools linux-libc-dev linux-libc-dev:i386
4 upgraded, 0 newly installed, 0 to remove and 5 not upgraded.
Need to get 1,847 kB of archives.
After this operation, 2,048 B of additional disk space will be used.
Do you want to continue [Y/n]?

How do I fix this issue and install linux-headers-virtual linux-image-virtual packages which have been kept back in Ubuntu Linux LTS version...

0 0
9

I installed LINUX (Ubuntu 9.10) on my Dell Optiplex R&D PC just for curiosity & feel how good are the looks and in this process also fiddled with the partitions on the hard disk too. It was somewhat usable but soon I got fed up with driver & other issues so decided to get rid of it.

I thought restoring Windows 7 image from my WHS would be just a cakewalk, and relatively the process was very easy using Home Computer restore CD & the system showed everything restored and asked for reboot. As I rebooted the system to my surprise it gave me this

GRUB Loading.

error: unknown filesystem

grub rescue>

then I rebooted again & nothing else happened but the same error. I tried to figure it out by using all the commands people have suggested everywhere on internet and wasted about 4 hrs in search of a solution. The system remained unbootable with some data in windows partition but I was aware that I haven’t touched that partition but was still anxious...

0 0
10

Upgrading Ubuntu from one version to the next has always been amazingly reliable; yet, sometimes, things happen. How do you recover when your upgrade is interrupted and you can’t boot the system in the usual way?

First step is to boot the machine to a shell that you can use to recover. This can be done in the standard system by using the Recovery Mode. Press the left shift key as the system boots up and choose a recovery mode kernel from the menu that appears – it will be labeled with “(recovery mode)” on the end. The recovery mode kernel will present you with the option to use a recovery shell.

You could use the rescue mode by booting with an Ubuntu install CDROM and entering “rescue” at the boot prompt, but then you must remember to mount all of your partitions and to perform a chroot to /target where the root partition is mounted.

After the system has booted to the menu, select the item that says “Drop to root shell prompt with networking”. This provides you...

0 0
11

Code:

Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

Code:

Reading package lists... Done Building dependency tree Reading state information... Done Calculating upgrade... Done The following NEW packages will be installed: pve-kernel-2.6.24-9-pve The following packages will be upgraded: apache2 apache2-mpm-prefork apache2-utils apache2.2-common libgd2-noxpm libgnutls26 pve-kernel pve-manager 8 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. Need to get 2002kB/41.0MB of archives. After this operation, 262kB of additional disk space will be used. Do you want to continue [Y/n]? y Get:1 [URL="http://security.debian.org/"]http://security.debian.org[/URL] lenny/updates/main libgnutls26 2.4.2-6+lenny2 [507kB] Get:2 [URL="http://security.debian.org/"]http://security.debian.org[/URL] lenny/updates/main apache2-utils 2.2.9-10+lenny6 [145kB] Get:3 [URL="http://security.debian.org/"]http://security.debian.org[/URL]...
0 0
12

At this point, you have probably already executed either 'apt-get dist-upgrade' or 'aptitude safe-upgrade' already, and your current Ubuntu 10.04 LTS Cloud Server (First Generation or Next Generation) will not boot up.

Notes:

You will not see the issue until you have rebooted after 'apt-get dist-upgrade' or 'aptitude safe-upgrade', so these could have been executed months ago.

This is not the only thing that would cause an Ubuntu Cloud Server not to boot, but is a good possibility that is the issue.

Purging and re-creating the Grub configuration can fix a list of things causing an Ubuntu Cloud Server not to boot. Please note that by doing this, the "Connect Via Terminal" option will not be available until you manually modify the 'kernel' line in the /boot/grub/menu.lst file to contain 'console=hvc0'. This defines that the Primary console that should be used is the one that Xen (the hypervisor) provides.

Why these commands break the boot...

0 0
13

Use promo code DOCS10 for $10 credit on a new account.

Compiling your own Linux kernel is useful if you need to enable or disable certain kernel features that are not available in Linode-supplied or distribution-supplied kernels. For example, some users desire SELinux support, which is not enabled in stock Linode kernels, and may not be enabled in some distribution-supplied kernels.

If you’d rather run a distribution-supplied kernel instead, please follow our guide for Running a Distribution-Supplied Kernel.

Prior to these instructions, follow the steps outlined in our Getting Started guide. Then, log in to your Linode as the root user.

Prepare the System

Update your package repositories and installed packages, and install additional packages needed for compiling and running your kernel:

apt-get update && apt-get upgrade apt-get install -y build-essential libncurses5-dev gcc libssl-dev grub2 bc

When installing GRUB, you’ll be asked...

0 0
14

Name

apt-get - APT package handling utility - command-line interface

Synopsis

apt-get [options] [-o config=string] [-c=cfgfile] command [pkg]

Description

apt-get

is the command-line tool for handling packages, and may be considered the user's "back-end" to other tools using the APT library. Several "front-end" interfaces exist, such as synaptic and aptitude.

Commands

Unless the

-h

, or

--help

option is given, one of the commands below must be present.

update Used to re-synchronize the package index files from their sources. The indexes of available packages are fetched from the location(s) specified in /etc/apt/sources.list(5). An update should always be performed before an upgrade or dist-upgrade. upgrade Used to install the newest versions of all packages currently installed on the system from the sources enumerated in /etc/apt/sources.list(5). Packages currently installed with new versions available are retrieved and...
0 0
15
https://bugs.busybox.net/show_bug.cgi?id=9581

Bug ID: 9581
Summary: VagrantFile provisioning step fails due to issue with
grub-pc update
Product: buildroot
Version: 2016.11
Hardware: All
OS: Mac OS
Status: NEW
Severity: normal
Priority: P5
Component: Other
Assignee: [hidden email]
Reporter: [hidden email]
CC: [hidden email]
Target Milestone: ---

Created attachment 6851
--> https://bugs.busybox.net/attachment.cgi?id=6851&action=edit
Patch to correct provisioning step in Vagrantfile

If you follow the steps in the manual to launch vagrant (download VagrantFile,
run vagrant up) then the resulting VirtualBox VM hangs during the provisioning
because the grub-pc update is asking a question but there is no interactive
context in which the user can answer it.

The solution...

0 0
16

How to repair Grub Boot Loader on Ubuntu or restore or reinstall Grub on Ubuntu. Install Boot-Repair application than can be used to repair Grub on Ubuntu Linux. Boot-Repair is a simple tool to repair frequent boot issues you may encounter in Ubuntu like when GRUB is not displayed anymore, some upgrade breaks GRUB, etc.

Boot-Repair repair MBR-locked OEM computer boot if the original bootsector has been saved by Clean-Ubiquity. It can also repair the boot when you have the “GRUB Recovery” error message. Boot-Repair also has advanced options to back up table partitions, back up bootsectors, create a Boot-Info (to get help by email or forum), or change the default repair parameters: configure GRUB, add kernel options (acpi=off …), purge GRUB, change the default OS, restore a Windows-compatible MBR, repair a broken filesystem, specify the disk where GRUB should be installed, etc.

Install Boot Repair

RUn the following commands in terminal to install Boot...

0 0
17

by

Ofer Velich

Last Updated August 08, 2015 21:00 PM

I'm running ubuntu 14.04 on an EC2

After running apt-get upgrade

I'm prompted with a screen that asks me to reinstall GRUB boot loader

The GRUB boot loader was previously installed to a disk that is no longer present, or whose unique identifier has changed for some reason. It is important to make sure that the installed GRUB core image stays in sync with GRUB modules and grub.cfg. Please check again to make sure that GRUB is written to the appropriate boot devices.

How do i know which device should i select ?

What if i have mounted on my machine some additional EBS, should i select them as well ?

Can I avoid this prompt, during the upgrade or supply some defaults to the command ?

The following prompt is

A new version of /boot/grub/menu.lst is available, but the version installed currently has been locally modified.

install the package...
0 0
18
...
0 0
19

I just encountered this exact issue myself with chef+vagrant and found the following worked for me:

sudo dpkg-reconfigure -plow grub-pc

This allows you to reconfigure grub-pc and select the device (if any) you want grub installed on. Setting a device as default here should allow an upgrade that includes grub to not prompt for a device selection. At this point you could create a new vagrant box and use that as your default.

or

To run an apt-get upgrade/dist-upgrade without being prompted you could use:

sudo DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" dist-upgrade DEBIAN_FRONTEND=noninteractive uses the default answer to any prompt. Dpkg::Options::="--force-confdef" ensures dpkg only overwrites config files you haven't modified Dpkg::Options::="--force-confold" ensures the current config file is not overwritten. New config files are created with .dpkg-dist...
0 0
20

I have been using Ubuntu for some time now and obviously I've been a bit blase.

I have recently installed the Maverick backport kernel (2.6.35 - from the lucid-updates/main repo) and while I was at it I also manually (through synaptic) got rid of some old kernels. I made sure that I kept the current Lucid kernel though (that was working fine). All seemed well (although I didn't actually check - just no errors) so I rebooted.

On reboot I have lost all my Ubuntu kernel options!

I rebooted with a live cd, mounted, etc and ran
sudo update-grub but it doesn't seem to find any kernels!

I have searched and tried everything I can think of and finding no answers.
Things I've tried

Reinstalling GRUB:
grub-install --recheck --root-directory=/media/mnt /dev/sda
Checked /boot to see if the kernels are there:

jed@lightning:/boot$ ls
abi-2.6.32-31-generic memtest86+.bin
abi-2.6.32-32-generic ...

0 0
21
H

ow do I run custom command after ‘

apt-get upgrade

‘ or ‘

apt-get dist-upgrade

‘ on a Debian or Ubuntu Linux based system? How do I hook a script to apt-get command on my Ubuntu Linux server?


You can configure the

apt-get command

using /etc/apt/apt.conf file or place configuration in a special directory at /etc/apt/apt.conf.d/. The following two options allows you to run shell commands or script before/after invoking dpkg/apt-get tools:

DPkg::Post-Invoke

The syntax is:

# This is a list of shell commands to run after invoking dpkg/apt-get # DPkg::Post-Invoke {"command";}; DPkg::Post-Invoke {"/path/to/sbin/command";}; DPkg::Post-Invoke {"/path/to/script";};

DPkg::Pre-Invoke

The syntax is:

# This is a list of shell commands to run before invoking dpkg/apt-get # DPkg::Pre-Invoke {"command";}; DPkg::Pre-Invoke {"/path/to/sbin/command";}; DPkg::Pre-Invoke {"/path/to/script";};

Like options this must be...

0 0
22

One can use the '&&' operator to execute command 'cmd2' if and only if 'cmd1' has been executed without errors:

(cmd1 && cmd2)

But this only works in bash directly, without 'sudo' in front.

So, in order to work as expected, we can use the following command:

sudo /bin/sh -c "apt-get update && apt-get dist-upgrade && apt-get autoremove && apt-get autoclean"

Note that the answer proposed by amra does not the same as the above command: Commands separated by ";" are executed in sequence without taking the exit code of the previous command into account. When using "&&" to separate the commands, the exit code is taken into account. Thus, if we have "cmd1 && cmd2", cmd2 is only executed if the exit code of cmd1 was 0 (i.e. cmd1 did not...

0 0
23

So I started out with a 250GB HDD, the stock drive from an EeePC 1015pem that I am trying to turn into a MintBook. The drive is physically operable, but all data has been nuked, including the old OS. Given this, I attached the HDD to my desktop and installed Linux Mint 16 Xfce from a live USB created through Unetbootin-585. Set aside 10GB for swap and 240GB for ext4 and /.

The drive now refuses to boot for either the desktop or netbook. Both motherboards are sounding the correct sequence of beeps, so they seem healthy, and I can successfully access the BIOS on both systems. However, the only thing that comes up after starting the computer is a nonresponsive command-line. There is no error message, no grub or grub-rescue, nothing.

Is there anything I can try besides reformatting and starting over? How would I go about installing a boot loader that can boot my...

0 0
24

The recommended way to upgrade a Server Edition installation is to use the do-release-upgrade utility. Part of the update-manager-core package, it does not have any graphical dependencies and is installed by default.

Debian based systems can also be upgraded by using apt dist-upgrade. However, using do-release-upgrade is recommended because it has the ability to handle system configuration changes sometimes needed between releases.

To upgrade to a newer release, from a terminal prompt enter:

It is also possible to use do-release-upgrade to upgrade to a development version of Ubuntu. To accomplish this use the -d switch:

Upgrading to a development release is not recommended for production environments.

For further stability of a LTS release there is a slight change in behaviour if you are currently running a LTS version. LTS systems are only automatically considered for an upgrade to the next LTS via do-release-upgrade with the...

0 0
25

Ubuntu has a lot of GUI-based methods for installing applications, but they take some time to search and find. Since the keyboard is usually faster than the mouse, managing your software via the command-line can be a real time-saver.

APT

Linux manages software through packages, individual units of software that contain user interfaces, modules, and libraries. Most applications link several co-dependent packages together, and still others allow you to choose which packages to install and which to leave out at your own discretion. This can get confusing, so there’s a package manager at your disposal to help

Each Linux distribution has its own package management system. For our own near and dear Ubuntu, it’s the Advanced Packaging Tool. It has a family of commands that allows you to add repositories; search for, install, and remove packages; and even simulate upgrades and such. The commands are fairly easy to remember and use, so you’ll be managing your...

0 0
26

The mdadm utility can be used to view the status of an array, add disks to an array, remove disks, etc:

To view the status of an array, from a terminal prompt enter:

The -D tells mdadm to display detailed information about the /dev/md0 device. Replace /dev/md0 with the appropriate RAID device.

To view the status of a disk in an array:

The output if very similar to the mdadm -D command, adjust /dev/sda1 for each disk.

If a disk fails and needs to be removed from an array enter:

sudo mdadm --remove /dev/md0 /dev/sda1

Change /dev/md0 and /dev/sda1 to the appropriate RAID device and disk.

Similarly, to add a new disk:

sudo mdadm --add /dev/md0 /dev/sda1

Sometimes a disk can change to a faulty state even though there is nothing physically wrong with the drive. It is usually worthwhile to remove the...

0 0
27

This post will, quickly, run through how to create a Minimal Server Install using Ubuntu 16.04. It also only takes a short time, taking between 7 to 20 minutes to install depending on your hardware and the number of times you have run through it. I find it an ideal way to try out and learn how to install Ubuntu in various configurations. I also use a virtual machine running on Virtualbox as this allows me to throw it away without messing about with real hardware.

The virtualbox configuration I will be using is:

Type: Linux Version: Ubuntu (64-bit) Memory Size: 1Gb Hard disk: 8Gb Dynamic Processor: 2 Network: Bridged Adaptor Boot Source: ubuntu-16.06-server-amd.iso

I use a minimal Server Install as the basis of nearly all my guides as that is what I start out with use when creating new machines.

we will then have a known starting place and a good foundation when playing around with different installation types. It is generally simple to add extra functionality...

0 0