Skip to main content

Upgrading SSH in Ubuntu Server

######################################################
apt install build-essential zlib1g-dev libssl-dev
mkdir /var/lib/sshd
chmod -R 700 /var/lib/sshd/
chown -R root:sys /var/lib/sshd/
useradd -r -U -d /var/lib/sshd/ -c "sshd privsep" -s /bin/false sshd
wget -c https://cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-8.0p1.tar.gz
tar -xzf openssh-8.0p1.tar.gz
cd openssh-8.0p1/
apt install libpam0g-dev libselinux1-dev
./configure --with-md5-passwords --with-pam --with-selinux --with-privsep-path=/var/lib/sshd/ --sysconfdir=/etc/ssh


make
make install

######################################################

In some cases u will get broken packages when doing the install then you can do the below steps:

root@logserver:~# apt install build-essential zlib1g-dev libssl-dev 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
build-essential is already the newest version (12.4ubuntu1).
zlib1g-dev is already the newest version (1:1.2.11.dfsg-0ubuntu2).
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libssl-dev : Depends: libssl1.1 (= 1.1.1-1ubuntu2.1~18.04.4) but 1.1.1a-1 is to be installed

E: Unable to correct problems, you have held broken packages.

FIX:

sudo dpkg --list | grep zlib
sudo aptitude install libssl-dev zlib1g-dev=1:1.2.11.dfsg-0ubuntu2


root@appserver:~# sudo dpkg --list | grep zlib
ii  zlib1g:amd64                          1:1.2.11.dfsg-0ubuntu2              amd64        compression library - runtime
ii  zlib1g-dev:amd64                      1:1.2.11.dfsg-0ubuntu2              amd64        compression library - development
root@appserver:~#
root@appserver:~#
root@appserver:~#
root@appserver:~# sudo aptitude install libssl-dev zlib1g-dev=1:1.2.11.dfsg-0ubuntu2
zlib1g-dev is already installed at the requested version (1:1.2.11.dfsg-0ubuntu2)
zlib1g-dev is already installed at the requested version (1:1.2.11.dfsg-0ubuntu2)
The following NEW packages will be installed:
  libssl-dev{b}
0 packages upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 1,566 kB of archives. After unpacking 7,846 kB will be used.
The following packages have unmet dependencies:
 libssl-dev : Depends: libssl1.1 (= 1.1.1-1ubuntu2.1~18.04.4) but 1.1.1b-1 is installed
The following actions will resolve these dependencies:

     Keep the following packages at their current version:
1)     libssl-dev [Not Installed]                       



Accept this solution? [Y/n/q/?] n
The following actions will resolve these dependencies:

     Downgrade the following packages:                                     
1)     libssl1.1 [1.1.1b-1 (now) -> 1.1.1-1ubuntu2.1~18.04.4 (bionic-updates)]



Accept this solution? [Y/n/q/?] y
The following packages will be DOWNGRADED:
  libssl1.1
The following NEW packages will be installed:
  libssl-dev
0 packages upgraded, 1 newly installed, 1 downgraded, 0 to remove and 0 not upgraded.
Need to get 2,866 kB of archives. After unpacking 7,710 kB will be used.
Do you want to continue? [Y/n/?] y
Get: 1 http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libssl1.1 amd64 1.1.1-1ubuntu2.1~18.04.4 [1,300 kB]
Get: 2 http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libssl-dev amd64 1.1.1-1ubuntu2.1~18.04.4 [1,566 kB]
Fetched 2,866 kB in 0s (24.1 MB/s)
Preconfiguring packages ...
dpkg: warning: downgrading libssl1.1:amd64 from 1.1.1b-1 to 1.1.1-1ubuntu2.1~18.04.4
(Reading database ... 197960 files and directories currently installed.)
Preparing to unpack .../libssl1.1_1.1.1-1ubuntu2.1~18.04.4_amd64.deb ...
Unpacking libssl1.1:amd64 (1.1.1-1ubuntu2.1~18.04.4) over (1.1.1b-1) ...
Preparing to unpack .../libssl-dev_1.1.1-1ubuntu2.1~18.04.4_amd64.deb ...
Unpacking libssl-dev:amd64 (1.1.1-1ubuntu2.1~18.04.4) ...
Processing triggers for libc-bin (2.28-8) ...
Setting up libssl1.1:amd64 (1.1.1-1ubuntu2.1~18.04.4) ...
Setting up libssl-dev:amd64 (1.1.1-1ubuntu2.1~18.04.4) ...
Processing triggers for libc-bin (2.28-8) ...

                                       



https://unix.stackexchange.com/questions/389156/how-to-fix-held-broken-packages

Comments

Popular posts from this blog

K8s External Secrets integration between AWS EKS and Secrets Manager(SM) using IAM Role.

What is K8s External Secrets and how it will make your life easier? Before saying about External Secrets we will say about k8s secrets and how it will work. In k8s secrets we will create key value pairs of the secrets and set this as either pod env variables or mount them as volumes to pods. For more details about k8s secrets you can check my blog http://jinojoseph.blogspot.com/2020/08/k8s-secrets-explained.html   So in this case if developers wants to change the ENV variables , then we have to edit the k8s manifest yaml file, then we have to apply the new files to the deployment. This is a tiresome process and also chances of applying to the wrong context is high if you have multiple k8s clusters for dev / stage and Prod deployments. So in-order to make this easy , we can add all the secrets that is needed in the deployment, in the AWS Secret Manager and with the help of External secrets we can fetch and create those secrets in the k8s cluster. So what is K8s external Secret? It i...

Password reset too simplistic/systematic issue

Some time when we try to reset the password of our user in linux it will show as simple and systematic as below: BAD PASSWORD: it is too simplistic/systematic no matter how hard password you give it will show the same. Solution: ######### Check if your password is Ok with the below command, jino@ndz~$ echo 'D7y8HK#56r89lj&8*&^%&^%#56rlKJ!789l' | cracklib-check D7y8HK#56r89lj&8*&^%&^%#56rlKJ!789l: it is too simplistic/systematic Now Create a password with the below command : jino@ndz~$ echo $(tr -dc '[:graph:]' 7\xi%!W[y*S}g-H7W~gbEB4cv,9:E:K; You can see that this password will be ok with the cracklib-check. jino@ndz~$ echo '7\xi%!W[y*S}g-H7W~gbEB4cv,9:E:K;' | cracklib-check                 7\xi%!W[y*S}g-H7W~gbEB4cv,9:E:K;: OK Thats all, Thanks.

Setting /etc/hosts entries during the initial deployment of an Application using k8s yaml file

Some times we have to enter specific hosts file entries to the container running inside the POD of a kubernetes deployment during the initial deployment stage itself. If these entries are not in place, the application env variables mentioned in the yaml file , as hostnames , will not resolve to the IP address and the application will not start properly. So to make sure the /etc/hosts file entries are already there after the spin up of the POD you can add the below entries in your yaml file. cat > api-deployment.yaml apiVersion: apps/v1 kind: Deployment metadata: spec:   template:     metadata:     spec:       volumes:       containers:       - image: registryserver.jinojoseph.com:5000/jinojosephimage:v1.13         lifecycle:           postStart:             exec:               command:...