Tech/OSS/Debian

From lathama
< Tech‎ | OSS
Jump to navigation Jump to search

An operating system distribution often running a Linux Kernel with the Tech/OSS/APT packaging system.

CLI apt-get vs apt

The new-ish user interface is apt how ever it is not meant for scripting so I will often use apt-get in my work so that I am working at a common tool. Always read the manpages.

Why -qq

If you read the manpage you will find that -qq will both answer yes but will also be quiet. This is handy from time to time.

Upgrade Debian Buster (10) to Debian Bullseye (11)

Much the same as before, update, upgrade, distupgrade, cleanup for reboot

apt-get -qq update && apt-get -qq upgrade && apt-get -qq dist-upgrade && apt-get -qq clean && apt-get -qq autoremove

Full restart

systemctl reboot

Edit the APT sources

sed -i "s/buster/bullseye/" /etc/apt/sources.list

Stop and review repos, the legacy security repos have changed.

deb http://security.debian.org/debian-security bullseye/updates main contrib non-free
deb-src http://security.debian.org/debian-security bullseye/updates main contrib non-free

change to:

deb http://security.debian.org/ bullseye-security main contrib non-free
deb-src http://security.debian.org/ bullseye-security main contrib non-free

My example sources

cat sources.list
deb http://deb.debian.org/debian/ bullseye main non-free contrib
deb-src http://deb.debian.org/debian/ bullseye main non-free contrib
deb http://security.debian.org/ bullseye-security main contrib non-free
deb-src http://security.debian.org/ bullseye-security main contrib non-free
deb http://deb.debian.org/debian/ bullseye-updates main contrib non-free
deb-src http://deb.debian.org/debian/ bullseye-updates main contrib non-free

Now we can start the upgrade. Note the -y instead of -qq because we want to see any issues.

apt-get update && apt-get -y upgrade && apt-get -y dist-upgrade

Full restart

systemctl reboot

Do the upgrade

apt-get -qq update && apt-get -qq upgrade && apt-get -qq clean
apt-get autoremove

Clean up configured but uninstalled packages. You should understand what this does before blindly running.

aptitude purge '~c'

Mopping up

ssh_config
VerifyHostKeyDNS yes


Upgrade Debian Stretch (9) to Debian Buster (10)

Note that the apt tool has user progress output and apt-get is better for scripted use. The -qq option is quiet and yes at the same time.

apt-get update && apt-get -qq upgrade && apt-get -qq dist-upgrade && apt-get clean

restart if there were any updates like the Linux Kernel. Then you need to update your sources. You can use *stable* instead of *buster* if desired.

sed -i "s/stretch/buster/" /etc/apt/sources.list
apt-get update && apt-get -y upgrade && apt-get -y dist-upgrade

restart

apt-get update && apt-get -qq upgrade

optionally

apt-get autoremove
aptitude purge '~c'

Upgrade Debian Jessie (8) to Debian Stretch (9)

apt-get update && apt-get -y upgrade && apt-get -y dist-upgrade && apt-get clean

restart if there were any updates like kernel and stuffs

sed -i "s/jessie/stretch/" /etc/apt/sources.list
apt-get update && apt-get -u upgrade && apt-get -y dist-upgrade

restart

apt-get update && apt-get -y upgrade

optionally

apt-get autoremove
aptitude purge '~c'

Use Python3 as standard Python in path

apt install python-is-python3

Installer with non-free firmware packages

http://cdimage.debian.org/cdimage/unofficial/non-free/cd-including-firmware/


Adding files to USB installer

The Debian installer like netinstall.iso can be put on a USB to use in installing Debian. Often there is spare space on the USB memory stick to store things like firmware or preseed files. What follows is a how-to add a partition for storing more files on the USB installer device.

Note for this example my USB stick is SDB or /dev/sdb
Note the red warning is related to the hacky nature of the boot-on-anything format the Debian installer uses
Note that parted does not handle the format so fdisk or maybe cfdisk must be used instead

root@lappy:~# fdisk --wipe=never -t dos /dev/sdb

Welcome to fdisk (util-linux 2.36.1).                                                                                                                                                                            
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

The device contains 'iso9660' signature and it may remain on the device. It is recommended to wipe the device with wipefs(8) or fdisk --wipe, in order to avoid possible collisions.

Command (m for help): p

Disk /dev/sdb: 7.24 GiB, 7775191040 bytes, 15185920 sectors
Disk model: USB Flash Drive 
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x630cc161

Device     Boot Start     End Sectors  Size Id Type
/dev/sdb1  *        0 1378303 1378304  673M  0 Empty
/dev/sdb2        4488   13383    8896  4.3M ef EFI (FAT-12/16/32)

Command (m for help): n
Partition type
   p   primary (2 primary, 0 extended, 2 free)
   e   extended (container for logical partitions)
Select (default p): p
Partition number (3,4, default 3): 
First sector (1378304-15185919, default 1378304): 
Last sector, +/-sectors or +/-size{K,M,G,T,P} (1378304-15185919, default 15185919): 

Created a new partition 3 of type 'Linux' and of size 6.6 GiB.

Command (m for help): p
Disk /dev/sdb: 7.24 GiB, 7775191040 bytes, 15185920 sectors
Disk model: USB Flash Drive 
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x630cc161

Device     Boot   Start      End  Sectors  Size Id Type
/dev/sdb1  *          0  1378303  1378304  673M  0 Empty
/dev/sdb2          4488    13383     8896  4.3M ef EFI (FAT-12/16/32)
/dev/sdb3       1378304 15185919 13807616  6.6G 83 Linux

Command (m for help): t
Partition number (1-3, default 3): 
Hex code or alias (type L to list all): 06

Changed type of partition 'Linux' to 'FAT16'.

Command (m for help): p
Disk /dev/sdb: 7.24 GiB, 7775191040 bytes, 15185920 sectors
Disk model: USB Flash Drive 
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x630cc161

Device     Boot   Start      End  Sectors  Size Id Type
/dev/sdb1  *          0  1378303  1378304  673M  0 Empty
/dev/sdb2          4488    13383     8896  4.3M ef EFI (FAT-12/16/32)
/dev/sdb3       1378304 15185919 13807616  6.6G  6 FAT16

Command (m for help): w
The partition table has been altered.
Syncing disks.
Then format as FAT
root@lappy:~# mkfs.fat /dev/sdb3 
mkfs.fat 4.2 (2021-01-31)
root@lappy:~# 

Resources