[conspire] /etc, /etc/debian_version, /etc/motd, /etc/issue, Debian, ...
Michael Paoli
Michael.Paoli at cal.berkeley.edu
Thu Jun 28 08:35:35 PDT 2018
And ... to further confuse(?) with additional facts ;-) ...
> Date: Wed, 20 Jun 2018 23:32:36 -0700
> From: Rick Moen <rick at linuxmafia.com>
> Message-ID: <20180621063236.GH32401 at linuxmafia.com>
> Subject: Re: [conspire] How to update packages when Deb is behind?
> Look at the contents of /etc/issue, for starters. It's an ASCII text
> file, and, on Debian, should tell you a lot about what development
> branch the system thinks it is. Also check /etc/debian_version,
> which'll probably say the same thing as /etc/issue, whatever those
> contents are.
> Anyway, _after_ you have checked /etc/issue and /etc/debian_version to
> see what your system thinks it is, you should perhaps consider fixing
Well, sort of kind of. Let's mostly knock the simpler and more
authoritative out of the way first.
Zeroth of all: /etc ... Filesystem Hierarchy Standard (FHS)
http://www.pathname.com/fhs/
https://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard
Essentially, under /etc, are configuration files. That doesn't mean one
should necessarily willy-nilly muck about arbitrarily changing stuff
there - system may (and does!) track various critical configuration
information there. But there certainly do exist files under /etc that
one can quite configure ... via relevant system tools, or in some cases
quite simple editing of text contents thereof. See also: intro(5)
First of all, and mostly quite Debian specific:
/etc/debian_version
$ dpkg -S /etc/debian_version
base-files: /etc/debian_version
In the land of Debian, /etc/debian_version is provided by the package
base-files. And, one shouldn't be mucking about with manually changing
/etc/debian_version - in normal operation, when the base-files package
is updated, it will update /etc/debian_version. Most notably not only
major releases, but point releases, will update the base-files package,
notably including updating at least /etc/debian_version. So, if one is
properly and at least semi-regularly doing something like:
# apt-get update
# apt-get -y upgrade
on a Debian system, /etc/debian_version will reflect the current point
release installed. And, Debian, and (at least what I'm calling) "point
releases" - those correspond to new stable updates (of which, security
updates are periodically rolled up into) and (generally very shortly
following that) new ISO images. For non-ancient Debian, e.g. currently
on stable:
Debian GNU/Linux 9.4 (stretch)
That would be the .4 bit, where the 9. portion would be the major
release/version number portion. (Historically the numbering hasn't
always been like this, e.g there's also been A.B.C, where A.B number
parts were major portion, and .C part minor "point release" portion).
So, e.g. what do I currently have in /etc/debian_version?
$ cat /etc/debian_version
9.4
Pretty simple. Note, however, derivatives of Debian may or may not
have /etc/debian_version and/or may use it in a different manner. Also,
many Linux distributions have some specific file(s) in /etc, typically
something(s) matching:
/etc/*version*
and/or
/etc/*release*
that will typically track the distribution's release number/version, but
not necessarily all distributions do this. Also, for those
distributions using Linux Standard Base (LSB)
https://refspecs.linuxfoundation.org/lsb.shtml
https://en.wikipedia.org/wiki/Linux_Standard_Base
or in some cases even only (continuing) to support certain portions
thereof (Debian has dropped support of LSB :-/ ... but does continue to
support lsb_release),
$ lsb_release -d
can be quite useful, mine shows:
Description: Debian GNU/Linux 9.4 (stretch)
Also, uname -m can be quite useful:
$ uname -m
x86_64
I'll typically use lsb_release -d (at least where lsb_release is
installed), along with uname -m, to give a pretty good concise
description of what (Linux) operating system is installed. Also,
uname can provide additional information - such as specific kernel -
though that can generally be determined in other ways too.
So ... don't muck with /etc/debian_version and if one isn't running a
FrankenDebian
https://wiki.debian.org/DontBreakDebian#Don.27t_make_a_FrankenDebian
or such or worse, then /etc/debian_version should well reflect what
Debian one has installed.
/etc/issue ... well, before covering that, let's (also) cover /etc/motd.
/etc/motd is the "Message Of The Day" file. It's typical (at least
historic) use, is to inform logged in users, upon logging in, of
generally topical stuff they ought be aware of. E.g. it might have
stuff roughly like:
STUDENT ACCOUNTS DELETED OVER SUMMER, DATA NOT SAVED!!!
GOT TAPE? (BACKUPS)
End of academic year comes soon. As of 1981-06-15, student accounts and
their data will be deleted - and we do not save that data.
If you wish to save your data, e.g. to restore next academic year, or
take with you elsewhere, buy a tape! Go to the student computer office,
and purchase a 1200' tape for $8.00, or 2400' for $10.00. Your tape
will be given an identifier. You can then hand the tape over at the
computer operator window, and you can use the tmount and tar commands to
backup your data, and tumount to unmount your tape, and, with your
tape's identifier, you can request your tape at the computer operator
window.
And would periodically (often even daily or sometimes more frequently)
be updated.
See also: motd(5)
In (common) practice, folks wouldn't necessarily update /etc/motd very
frequently ... though some might have a crontab job and use of fortune
to update it daily - at least if they didn't have anything more exciting
to announce (and so it at least changed regularly and folks would find
it sufficiently interesting to get in the habit of actually reading it).
But, there's still nothing that prevents one from manually changing
/etc/motd as may be desired. And, ... in the land of Debian (and often
similar for other distributions, and Unix, etc.), if one does absolutely
nothing with /etc/motd, it may by default contain something provided by
the operating system - Debian does in fact do this. Even if there's
zero data there, operating system will generally at least create the file
with the proper ownerships/permissions. So, ... if one has not manually
changed /etc/motd, on Debian it will contain something there ... let's
see, on host under my fingertips at present:
$ cat /etc/motd
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
... there 'ya go ... does inform one it is (or claims to be) a Debian
system. Derivatives of Debian may claim same - particularly if they
don't explicitly do something different with /etc/motd by default.
And, in the land of Debian, /etc/motd is "just" a configuration file.
And with major version upgrades, if you've changed it from its default,
at least depending upon the priority level of questions you have the
upgrade asking you, Debian will notice this, and ask you if you want to
keep your version, upgrade to the new version supplied by package
maintainer, or background the upgrade and manually examine the situation
(e.g. to deal with it). I think there may also be a diff option. If
one hasn't altered it at all from the default, it just gets updated to
the newer version provided by the maintainer of the package. Package?
$ dpkg -S /etc/motd
dpkg-query: no path found matching pattern /etc/motd
So, no package specifically directly provides it ... it's probably
created/updated by some script in a package (e.g. at installation), or
by some other means.
See also: pam_motd(8)
/etc/issue - historically came along later than /etc/motd. But,
distinct from /etc/motd, /etc/issue is displayed *before* login, rather
than after. At least by *most* login programs by default. Note,
however, for sshd, this may be a configurable option as to whether or
not it's displayed, and I believe OpenSSH defaults to *not* displaying
the /etc/issue file.
So, /etc/issue on Debian ... if by default one makes no explicit changes
to it ...
$ dpkg -S /etc/issue
base-files: /etc/issue
It's provided by the base-files package. For system under my
fingertips, at present it has:
$ cat /etc/issue
Debian GNU/Linux 9 \n \l
One may notice the \n and \l bits. Many, but not necessarily all,
login-like programs will interpret certain escape sequences or the like,
e.g. under getty/agetty(8), I see on not logged in virtual terminal on
the hardware console, that \n has been replaced with the system
hostname, and \l with the tty line device basename.
So, in short, if one has done nothing to manually alter /etc/motd and
/etc/issue, they may well have information about one's installed
operating system / distribution - but they're also just quite simple files
of arbitrary text, and one can alter the content as may be desired.
/etc/debian_version on the other hand, shouldn't be manually mucked
with, and is maintained by the base-files package, and will maintain
Debian version information - at least for a pure Debian non-FrankenDebian
or such, installation, and where nobody/nothing has otherwise mucked
about altering the /etc/debian_version file.
More information about the conspire
mailing list