My /etc/fstab without the newline at the end:
Code: Select all
/dev/disk/by-id/nvme-WDS250G3X0C-00SJG0_185250422455-part3 /efi
With the newline:
Code: Select all
/dev/disk/by-id/nvme-WDS250G3X0C-00SJG0_185250422455-part3 /efi
Code: Select all
/dev/disk/by-id/nvme-WDS250G3X0C-00SJG0_185250422455-part3 /efi
Code: Select all
/dev/disk/by-id/nvme-WDS250G3X0C-00SJG0_185250422455-part3 /efi
Code: Select all
[..]
static int mnt_table_parse_next(struct libmnt_parser *pa,
struct libmnt_table *tb,
struct libmnt_fs *fs)
{
char *s;
int rc;
assert(tb);
assert(pa);
assert(fs);
/* read the next non-blank non-comment line */
next_line:
do {
if (getline(&pa->buf, &pa->bufsiz, pa->f) < 0)
return -EINVAL;
pa->line++;
s = strchr(pa->buf, '\n');
if (!s) {
DBG(TAB, ul_debugobj(tb, "%s:%zu: no final newline",
pa->filename, pa->line));
/* Missing final newline? Otherwise an extremely */
/* long line - assume file was corrupted */
if (feof(pa->f))
s = memchr(pa->buf, '\0', pa->bufsiz);
/* comments parser */
} [..]
if (!s)
goto err;
[..]
Why the newline at the end of in /etc/fstab file is required