Showing posts with label Debian Linux. Show all posts
Showing posts with label Debian Linux. Show all posts

Monday, August 30, 2021

Updating Debian Linux Release

I have a Debian Linux system that I haven't kept update-to-date for a while. When I tried to update it, and I got the following error,


$ sudo apt-get update
Get:1 http://security.debian.org/debian-security buster/updates InRelease [65.4 kB]
Get:2 http://deb.debian.org/debian buster InRelease [122 kB]
Get:3 http://deb.debian.org/debian buster-updates InRelease [51.9 kB]
Hit:4 https://download.docker.com/linux/debian buster InRelease
Reading package lists... Done
E: Repository 'http://security.debian.org/debian-security buster/updates InRelease' changed its 'Suite' value from 'stable' to 'oldstable'
N: This must be accepted explicitly before updates for this repository can be applied. See apt-secure(8) manpage for details.
N: Repository 'http://deb.debian.org/debian buster InRelease' changed its 'Version' value from '10.6' to '10.10'
E: Repository 'http://deb.debian.org/debian buster InRelease' changed its 'Suite' value from 'stable' to 'oldstable'
N: This must be accepted explicitly before updates for this repository can be applied. See apt-secure(8) manpage for details.
E: Repository 'http://deb.debian.org/debian buster-updates InRelease' changed its 'Suite' value from 'stable-updates' to 'oldstable-updates'
N: This must be accepted explicitly before updates for this repository can be applied. See apt-secure(8) manpage for details.

This is the result that Debian 10 has updated the release repo from 10.6 to 10.10. To resolve this issue, we can run the following command.


sudo apt-get update --allow-releaseinfo-change

The only interesting part here is that I had to run the command twice to confirm the problem went away. To see this, we can take a look at the transcript showing I ran the command


$ sudo apt-get update --allow-releaseinfo-change
Get:1 http://deb.debian.org/debian buster InRelease [122 kB]
Get:2 http://security.debian.org/debian-security buster/updates InRelease [65.4 kB]
Get:3 http://deb.debian.org/debian buster-updates InRelease [51.9 kB]
Hit:4 https://download.docker.com/linux/debian buster InRelease
Get:5 http://deb.debian.org/debian buster/main Sources [7,836 kB]
Get:6 http://security.debian.org/debian-security buster/updates/main Sources [199 kB]
Get:7 http://security.debian.org/debian-security buster/updates/main amd64 Packages [302 kB]
Get:8 http://security.debian.org/debian-security buster/updates/main Translation-en [159 kB]
Get:9 http://deb.debian.org/debian buster-updates/main Sources.diff/Index [7,624 B]
Ign:9 http://deb.debian.org/debian buster-updates/main Sources.diff/Index
Get:10 http://deb.debian.org/debian buster-updates/main amd64 Packages.diff/Index [7,624 B]
Get:11 http://deb.debian.org/debian buster-updates/main Translation-en.diff/Index [5,164 B]
Get:12 http://deb.debian.org/debian buster-updates/main amd64 Packages 2020-10-24-2001.35.pdiff [286 B]
Get:13 http://deb.debian.org/debian buster-updates/main amd64 Packages 2020-12-24-1401.30.pdiff [286 B]
Get:14 http://deb.debian.org/debian buster-updates/main amd64 Packages 2021-01-29-2000.47.pdiff [408 B]
Get:15 http://deb.debian.org/debian buster-updates/main amd64 Packages 2021-02-07-1359.56.pdiff [2,302 B]
Get:16 http://deb.debian.org/debian buster-updates/main amd64 Packages 2021-04-22-1401.14.pdiff [1,996 B]
Get:17 http://deb.debian.org/debian buster-updates/main amd64 Packages 2021-04-23-1401.02.pdiff [1,127 B]
Get:18 http://deb.debian.org/debian buster-updates/main amd64 Packages 2021-06-21-1401.46.pdiff [656 B]
Get:19 http://deb.debian.org/debian buster-updates/main amd64 Packages 2021-06-23-1401.37.pdiff [4,999 B]
Get:19 http://deb.debian.org/debian buster-updates/main amd64 Packages 2021-06-23-1401.37.pdiff [4,999 B]
Get:20 http://deb.debian.org/debian buster-updates/main Translation-en 2021-02-07-1359.56.pdiff [1,506 B]
Get:21 http://deb.debian.org/debian buster-updates/main Translation-en 2021-04-22-1401.14.pdiff [1,408 B]
Get:22 http://deb.debian.org/debian buster-updates/main Translation-en 2021-06-21-1401.46.pdiff [719 B]
Get:23 http://deb.debian.org/debian buster-updates/main Translation-en 2021-06-23-1401.37.pdiff [6,585 B]
Get:23 http://deb.debian.org/debian buster-updates/main Translation-en 2021-06-23-1401.37.pdiff [6,585 B]
Get:24 http://deb.debian.org/debian buster/main amd64 Packages [7,907 kB]
Get:25 http://deb.debian.org/debian buster/main Translation-en [5,968 kB]
Get:26 http://deb.debian.org/debian buster-updates/main Sources [16.6 kB]
Fetched 22.4 MB in 12s (1,806 kB/s)
Reading package lists... Done
N: Repository 'http://deb.debian.org/debian buster InRelease' changed its 'Version' value from '10.6' to '10.10'
N: Repository 'http://deb.debian.org/debian buster InRelease' changed its 'Suite' value from 'stable' to 'oldstable'
N: Repository 'http://security.debian.org/debian-security buster/updates InRelease' changed its 'Suite' value from 'stable' to 'oldstable'
N: Repository 'http://deb.debian.org/debian buster-updates InRelease' changed its 'Suite' value from 'stable-updates' to 'oldstable-updates'
$ sudo apt-get update --allow-releaseinfo-change
Hit:1 http://deb.debian.org/debian buster InRelease
Hit:2 http://security.debian.org/debian-security buster/updates InRelease
Hit:3 http://deb.debian.org/debian buster-updates InRelease
Hit:4 https://download.docker.com/linux/debian buster InRelease
$ sudo apt-get update
Hit:1 https://download.docker.com/linux/debian buster InRelease
Hit:2 http://deb.debian.org/debian buster InRelease
Hit:3 http://deb.debian.org/debian buster-updates InRelease
Hit:4 http://security.debian.org/debian-security buster/updates InRelease
Reading package lists... Done
$

Saturday, September 19, 2020

How not to install suggested packages on Debian or Ubuntu Linux using apt-get?

When we use apt-get to install a package, apt-get also installs a list of suggested package. Sometimes we want to have more control, and don't wish to install the suggested packages. To do this, we simply include an additional command line option, i.e., --no-install-recommends, as in,

  sudo apt-get install --no-install-recommends PACKAGE_NAME
  

For example, we want to install python3-pip package, we issue

  sudo apt-get install --no-install-recommends python3-pip
  

Thursday, May 28, 2020

Enabling Serial Console on Debian Linux

I wanted to enable the serial console on a Linux system. The system is a Debian Linux release 10 (a.k.a., "buster"). The official documentation has the following description about the serial console

"
If you are booting with a serial console, generally the kernel will autodetect this. If you have a videocard (framebuffer) and a keyboard also attached to the computer which you wish to boot via serial console, you may have to pass the console=device argument to the kernel, where device is your serial device, which is usually something like ttyS0

You may need to specify parameters for the serial port, such as speed and parity, for instance console=ttyS0,9600n8; other typical speeds may be 57600 or 115200. Be sure to specify this option after ---, so that it is copied into the bootloader configuration for the installed system (if supported by the installer for the bootloader). 

In order to ensure the terminal type used by the installer matches your terminal emulator, the parameter TERM=type can be added. Note that the installer only supports the following terminal types: linux, bterm, ansi, vt102 and dumb. The default for serial console in debian-installer is vt102. If you are using an IPMI console, or a virtualization tool which does not provide conversion into such terminals types itself, e.g. QEMU/KVM, you can start it inside a screen session. That will indeed perform translation into the screen terminal type, which is very close to vt102.

"

It also states,

"
Those used to change inittab to enable/disable virtual or serial consoles will notice that that file is gone from clean installs. This is all managed through systemd directly now. For example, you can enable a serial console on COM1 with: 

systemctl enable serial-getty@ttyS0.service
systemctl start serial-getty@ttyS0.service
 

However, it is generally preferable to add console=ttyS0 on the kernel commandline, since this also enables kernel output on reboots. This is done by adding the following to /etc/default/grub
 
GRUB_CMDLINE_LINUX="console=ttyS0"
 
... and running update-grub. This will take effect only on the next reboot, however.

"

It is clearly that the documentation offers two solutions, using the systemd service or using the boot parameter. Perhaps, the former has the shortcoming that the serial console may not start if the systemd does not get a chance to run because we happen to have a boot problem. The preferred method, as suggested is to pass a boot parameter to the kernel. Since I have the grub boot loader installed, this becomes a simple two step approach,

  1. Edit /etc/default/grub file. In my case, replace
    
    GRUB_CMDLINE_LINUX_DEFAULT="quiet"
    

    by
    
    GRUB_CMDLINE_LINUX_DEFAULT="console=ttyS0 console=tty0"
    

  2. Update the grub.cfg file
    
    update-grub -o /boot/grub/grub.cfg
    

I happened to back up the old grub.cfg file. By comparing the old and new grub.cfg file, we can easily see the difference between the two files,

$ diff /boot/grub/grub.cfg /boot/grub/grub.cfg.bu01
diff /boot/grub/grub.cfg /boot/grub/grub.cfg.bu01
119c119
<       linux   /boot/vmlinuz-4.19.0-8-686 root=UUID=123456789 ro  console=ttyS0 console=tty0
---
>       linux   /boot/vmlinuz-4.19.0-8-686 root=UUID=123456789 ro  quiet
137c137
<               linux   /boot/vmlinuz-4.19.0-8-686 root=UUID=123456789 ro  console=ttyS0 console=tty0
---
>               linux   /boot/vmlinuz-4.19.0-8-686 root=UUID=123456789 ro  quiet
$

Friday, March 13, 2020

Setting up New Ethernet Interfaces on Debian Linux

I am running Debian Linux on Oracle VirtualBox virtual machines. The Linux system has only the command line interface, and has no GUI installed.  Below are the steps to add Ethernet interfaces to the Linux virtual machine and to get IP addresses via DHCP.
  1. Shut down  the Linux virtual machine
  2. Add and enable Ethernet interfaces to the virtual machine
  3. Boot the Linux virtual machine
  4. On the Linux virtual machine, view the Internet addresses
    
    ip address show
    
  5. Assume that we added two Ethernet adapters and the output of the command above shows that they are enp0s8 and enp0s9, we add the following lines to /etc/network/interfaces,
    
    allow-hotplug enp0s8
    iface enp0s8 inet dhcp
    
    allow-hotplug enp0s9
    iface enp0s9 inet dhcp
     
  6. Restart the networking service by running the following as root (or via sudo)
    
    systemctl restart networking
     
  7. Complete IP setting including assigning IP addresses via DHCP by running the following as root (or via sudo)
    
    dhclient