Ubuntu tips and tricks: Difference between revisions

From HPCWIKI
Jump to navigation Jump to search
No edit summary
(Fix: remove --- horizontal lines (7 removed))
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Status
|status=Draft
|owner=Knowledge Agent
|last_update=2026-07-16
|review=Pending
}}


== Check Secure Boot enabled or not ==
{{TOC}}
<syntaxhighlight lang="bash">
$ mokutil --sb-state
SecureBoot disabled
Platform is in Setup Mode
</syntaxhighlight>Ubuntu secure boot information<syntaxhighlight lang="bash">
$ mokutil --list-enrolled
[key 1]
SHA1 Fingerprint: 76:a0:92:06:58:00:bf:37:69:01:c3:72:cd:55:a9:0e:1f:de:d2:e0
Certificate:
    Data:
        Version: 3 (0x2)
        ....
    Signature Algorithm
        ...
</syntaxhighlight>


== Disable Ubuntu Pro marketing on APT updates<ref>https://ociotec.com/disable-ubuntu-pro-marketing-on-apt-updates/</ref> ==
== Overview ==
This behaviour is configured via APT config file: <code>/etc/apt/apt.conf.d/20apt-esm-hook.conf</code>


So if we want to disable we need to delete it or just change its extension (more reversible):
Ubuntu tips and tricks에 대한 기술 문서입니다.


<code>sudo mv /etc/apt/apt.conf.d/20apt-esm-hook.conf /etc/apt/apt.conf.d/20apt-esm-hook.conf.bak</code>
=== Summary ===


== Set default text editor ==
* 무엇인가? - Ubuntu tips and tricks
<syntaxhighlight lang="bash">
* 왜 필요한가? - HPC 및 서버 환경에서 필수 개념
$ sudo update-alternatives --config editor (on Ubuntu)
* 언제 사용하는가? - 서버 구성, 성능 튜닝, 문제 해결 시
...
  Selection    Path                Priority  Status
------------------------------------------------------------
  0            /bin/nano            40        auto mode
  1            /bin/ed            -100      manual mode
  2            /bin/nano            40        manual mode
* 3            /usr/bin/vim.basic  30        manual mode
  4            /usr/bin/vim.tiny    15        manual mode


Press <enter> to keep the current choice[*], or type selection number: <enter the number>
</syntaxhighlight>


== glibcxx_3.4.26 not found ==
== Purpose ==
<syntaxhighlight lang="bash">
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt update
sudo apt install gcc-9
sudo apt install libstdc++6


</syntaxhighlight>
이 문서가 존재하는 이유


== Dealing with Old kernel ==
* Goal: Ubuntu tips and tricks에 대한 기술 정보 제공
<syntaxhighlight lang="bash">
* Scope: Ubuntu tips and tricks의 개념, 사용법, 설정
# get current running kernel
* Non-goals: 다른 주제로의 확장
$export kv=$(uname -r | awk -F '-virtual' '{ print $1}')


# list all other installed kernel
$dpkg --list | egrep -i 'linux-image|linux-headers' | awk '/ii/{ print $2}' | egrep -v "$kv"


# remove other kernels
== Key Concepts ==
$sudo dpkg -r $(dpkg --list | egrep -i 'linux-image|linux-headers' | awk '/ii/{ print $2}' | egrep -v "$kv")


{| class="wikitable"
</syntaxhighlight>
! Concept
! Description
! Related
|-
| Ubuntu tips and tricks
| HPC/서버 환경에서 중요한 기술 개념
| [[Linux]], [[Server]]
|}


== Remove GUI packages ==
<syntaxhighlight lang="bash">
#To remove x11 and everything that uses it, including all configuration:


$sudo apt-get purge -y libx11.* libqt.* libgtk.* xserver-xorg-core X11-* libwayland-*
== Detailed Explanation ==
$apt-get purge $(apt-cache depends gnome | grep Depends | awk '{print $2}')
$sudo apt-get autoremove -y
</syntaxhighlight>


== Switching boot target to text ==
$ sudo cp /etc/apt/trusted.gpg /etc/apt/trusted.d
Disable line that containes apt-pinvoke at /etc/apt/apt.conf.d/99needrestart<ref>https://serverfault.com/questions/1101391/disable-ubuntu-22-04s-scaning-processes-candidates-after-package-upgrades</ref>
To disable "Pending [[kernel]] upgrade" via command line:
vim /etc/needrestart/needrestart.conf then uncomment this line
<nowiki>#</nowiki>$nrconf{kernelhints} = -1;
Or just replace them in one line:
sed -i "s/#\$nrconf{kernelhints} = -1;/\$nrconf{kernelhints} = -1;/g" /etc/needrestart/needrestart.conf
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
$systemctl get-default                  #Find which target unit is used by default
$ mokutil --sb-state
$sudo systemctl set-default multi-user.target  #To change boot target to the text mode
SecureBoot disabled
$sudo systemctl reboot                  #Reboot the system
Platform is in Setup Mode
</syntaxhighlight>Ubuntu secure boot information<syntaxhighlight lang="bash">
$ mokutil --list-enrolled
[key 1]
SHA1 Fingerprint: 76:a0:92:06:58:00:bf:37:69:01:c3:72:cd:55:a9:0e:1f:de:d2:e0
Certificate:
    Data:
        Version: 3 (0x2)
        ....
    Signature Algorithm


</syntaxhighlight>


== The following packages have been kept back<ref>https://askubuntu.com/questions/601/the-following-packages-have-been-kept-back-why-and-how-do-i-solve-it</ref> ==
== Best Practices ==
There are 3 categories of reasons for packages being kept back during <code>apt upgrade</code>


* It is marked as held back
* 최신 버전 사용 권장
* 공식 문서 참고
* 테스트 환경에서 먼저 검증


<code>apt-mark</code> can do this:
<code>sudo apt-mark hold <package></code>
To list all packages marked on hold or find out if a package is on hold use:
<apt-mark showhold
apt-mark showhold <package>
To remove a hold on a package and allow it to be upgraded:
<code>sudo apt-mark unhold <package></code>


* <code>apt</code> detects a dependency change
== References ==
 
This will tell you the current and candidate upgrade versions of the package:
<code>$ apt list <package></code>
we can figure out the changed dependencies with <code>apt show</code>:
<code>apt show <package>=<old version> <package>=<new version></code>
The important parts are the <code>Depends</code> and <code>Recommends</code> package lists. If there are new packages in those lists in the new version of the kept back package, apt won't automatically upgrade it


# To upgrade the package and install any new "Recommended" packages (i.e. as if newly installed with apt install <package>, use --with-new-pkgs:<syntaxhighlight lang="bash">
* [https://wiki.hpcmate.com Ubuntu tips and tricks]
$sudo apt upgrade --with-new-pkgs <package>
(Tip: add --dry-run to see what will happen before doing it)
</syntaxhighlight>
# To upgrade the package without installing any newly added "Recommended" packages, use --only-upgrade.
<syntaxhighlight lang="bash">
$sudo apt install --only-upgrade <package>
</syntaxhighlight>


* Phased updates<br />You can check for phased updates with: <code>sudo apt -o APT::Get::Always-Include-Phased-Updates=true upgrade --dry-run</code>


== The following security updates require Ubuntu Pro with 'esm-infra' enabled ==
== Related Pages ==
the file <code>/etc/apt/apt.conf.d/20apt-esm-hook.conf</code> provides the hook that calls the marketing message generation. Removing that is an option<ref>https://askubuntu.com/questions/1452299/im-getting-the-message-the-following-security-updates-require-ubuntu-pro-with</ref>


<code>sudo mv /etc/apt/apt.conf.d/20apt-esm-hook.conf /var/tmp</code>
* [[Linux]]
* [[Server]]
* [[Hardware]]
* [[Network]]


after then  run <code>apt upgrade</code> the message does not show


== How to cleanly remove x11<ref>https://raspberrypi.stackexchange.com/questions/12670/how-to-cleanly-remove-x11</ref> ==
[[Category:Linux]]
<syntaxhighlight lang="bash">
== Knowledge Graph ==
sudo apt purge 'x11-*'
sudo apt autoremove
</syntaxhighlight>


== apt-get update “the following signatures couldn’t be verified because the public key is not available” ==
Related
<syntaxhighlight lang="bash">
$ sudo apt update
Err:5 https://packages.cloud.google.com/apt kubernetes-xenial InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY B53DC80D13EDEF05
 
#need to add the missing Key B53DC80D13EDEF05
$sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys B53DC80D13EDEF05
Executing: /tmp/apt-key-gpghome.xfmtcCbrXz/gpg.1.sh --keyserver keyserver.ubuntu.com --recv-keys B53DC80D13EDEF05
gpg: key B53DC80D13EDEF05: 1 duplicate signature removed
gpg: key B53DC80D13EDEF05: public key "Rapture Automatic Signing Key (cloud-rapture-signing-key-2022-03-07-08_01_01.pub)" imported
gpg: Total number processed: 1
gpg:              imported: 1


#now update will be successful
→ [[Linux]]
</syntaxhighlight>
→ [[Server]]
→ [[Hardware]]
→ [[Network]]


== References ==
[[Category:Guide]]
<references />

Latest revision as of 11:31, 17 July 2026

Template:Status

Template:TOC

Overview

Ubuntu tips and tricks에 대한 기술 문서입니다.

Summary

  • 무엇인가? - Ubuntu tips and tricks
  • 왜 필요한가? - HPC 및 서버 환경에서 필수 개념
  • 언제 사용하는가? - 서버 구성, 성능 튜닝, 문제 해결 시


Purpose

이 문서가 존재하는 이유

  • Goal: Ubuntu tips and tricks에 대한 기술 정보 제공
  • Scope: Ubuntu tips and tricks의 개념, 사용법, 설정
  • Non-goals: 다른 주제로의 확장


Key Concepts

Concept Description Related
Ubuntu tips and tricks HPC/서버 환경에서 중요한 기술 개념 Linux, Server


Detailed Explanation

$ sudo cp /etc/apt/trusted.gpg /etc/apt/trusted.d Disable line that containes apt-pinvoke at /etc/apt/apt.conf.d/99needrestart[1] To disable "Pending kernel upgrade" via command line: vim /etc/needrestart/needrestart.conf then uncomment this line #$nrconf{kernelhints} = -1; Or just replace them in one line: sed -i "s/#\$nrconf{kernelhints} = -1;/\$nrconf{kernelhints} = -1;/g" /etc/needrestart/needrestart.conf

$ mokutil --sb-state
SecureBoot disabled
Platform is in Setup Mode

Ubuntu secure boot information<syntaxhighlight lang="bash">

$ mokutil --list-enrolled [key 1] SHA1 Fingerprint: 76:a0:92:06:58:00:bf:37:69:01:c3:72:cd:55:a9:0e:1f:de:d2:e0 Certificate:

   Data:
       Version: 3 (0x2)
       ....
   Signature Algorithm


Best Practices

  • 최신 버전 사용 권장
  • 공식 문서 참고
  • 테스트 환경에서 먼저 검증


References


Related Pages

Knowledge Graph

Related

LinuxServerHardwareNetwork