This is a minor issue, but still has me scratching my head.
The nano editor is working fine on my system, with no errors or warnings. However when I try to do lxc profile edit, which picks up nano by default, it has a problem:
root@nuc1:~# lxc profile edit br249
Error in /etc/nanorc on line 244: Error expanding /usr/share/nano/*.nanorc: No such file or directory
The editor does work as normal, but it leaves this error on the console, and also displays [ Mistakes in '/etc/nanorc' ] in red on the editor screen.
Line 244 of /etc/nanorc says:
include "/usr/share/nano/*.nanorc"
and the referenced files do exist:
root@nuc1:~# ls /usr/share/nano/*.nanorc | head -3
/usr/share/nano/asm.nanorc
/usr/share/nano/autoconf.nanorc
/usr/share/nano/awk.nanorc
Very strange… I wonder if it’s something to do with snap packaging?
I tried running it under strace:
strace -f lxc profile edit br249 2>strace.out
...
grep -3 nano[^s] strace.out
...
[pid 3483729] rt_sigaction(SIGTERM, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
[pid 3483729] rt_sigaction(SIGTERM, {sa_handler=SIG_DFL, sa_mask=~[RTMIN RT_1], sa_flags=SA_RESTORER, sa_restorer=0x7fb6a224f210}, NULL, 8) = 0
[pid 3483729] read(10, "#!/bin/sh\nrun_cmd() {\n CMD=\"$"..., 8192) = 1654
[pid 3483729] execve("/run/bin/nano", ["nano", "/tmp/lxd_editor_3443541145.yaml"], 0x55b031867ca8 /* 52 vars */) = -1 ENOENT (No such file or directory)
[pid 3483729] execve("/snap/lxd/22292/usr/sbin/nano", ["nano", "/tmp/lxd_editor_3443541145.yaml"], 0x55b031867ca8 /* 52 vars */) = -1 ENOENT (No such file or directory)
[pid 3483729] execve("/snap/lxd/22292/usr/bin/nano", ["nano", "/tmp/lxd_editor_3443541145.yaml"], 0x55b031867ca8 /* 52 vars */) = -1 ENOENT (No such file or directory)
[pid 3483729] execve("/snap/lxd/22292/sbin/nano", ["nano", "/tmp/lxd_editor_3443541145.yaml"], 0x55b031867ca8 /* 52 vars */) = -1 ENOENT (No such file or directory)
[pid 3483729] execve("/snap/lxd/22292/bin/nano", ["nano", "/tmp/lxd_editor_3443541145.yaml"], 0x55b031867ca8 /* 52 vars */) = 0
[pid 3483729] brk(NULL) = 0x55dcb34cd000
[pid 3483729] arch_prctl(0x3001 /* ARCH_??? */, 0x7ffe300973e0) = -1 EINVAL (Invalid argument)
[pid 3483729] mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f01efe15000
--
[pid 3483729] fstat(3, {st_mode=S_IFREG|0644, st_size=201272, ...}) = 0
[pid 3483729] mmap(NULL, 201272, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f01ef9fc000
[pid 3483729] close(3) = 0
[pid 3483729] access("/etc/nanorc", R_OK) = 0
[pid 3483729] stat("/etc/nanorc", {st_mode=S_IFREG|0644, st_size=10037, ...}) = 0
[pid 3483729] openat(AT_FDCWD, "/etc/nanorc", O_RDONLY) = 3
[pid 3483729] fstat(3, {st_mode=S_IFREG|0644, st_size=10037, ...}) = 0
[pid 3483729] read(3, "## Sample initialization file fo"..., 4096) = 4096
[pid 3483729] read(3, " Status-bar messages will disap"..., 4096) = 4096
[pid 3483729] read(3, "iles as follows:\n##\n## include"..., 4096) = 1845
[pid 3483729] openat(AT_FDCWD, "/usr/share/nano", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = -1 ENOENT (No such file or directory)
[pid 3483729] openat(AT_FDCWD, "/usr/share/locale/en_GB/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
[pid 3483729] openat(AT_FDCWD, "/usr/share/locale/en/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
[pid 3483729] openat(AT_FDCWD, "/usr/share/locale-langpack/en_GB/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
[pid 3483729] openat(AT_FDCWD, "/usr/share/locale-langpack/en/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
[pid 3483729] openat(AT_FDCWD, "/usr/share/locale/en_GB/LC_MESSAGES/nano.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
[pid 3483729] openat(AT_FDCWD, "/usr/share/locale/en/LC_MESSAGES/nano.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
[pid 3483729] openat(AT_FDCWD, "/usr/share/locale-langpack/en_GB/LC_MESSAGES/nano.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
[pid 3483729] openat(AT_FDCWD, "/usr/share/locale-langpack/en/LC_MESSAGES/nano.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
[pid 3483729] read(3, "", 4096) = 0
[pid 3483729] close(3) = 0
[pid 3483729] geteuid() = 0
--
[pid 3483729] fstat(3, {st_mode=S_IFREG|0644, st_size=2359, ...}) = 0
[pid 3483729] read(3, "root:x:0:0:root:/root:/bin/bash\n"..., 4096) = 2359
[pid 3483729] close(3) = 0
[pid 3483729] access("/root/.nanorc", R_OK) = -1 ENOENT (No such file or directory)
[pid 3483729] access("/root/.config/nano/nanorc", R_OK) = -1 ENOENT (No such file or directory)
[pid 3483729] stat("/root/.nano/", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
[pid 3483729] openat(AT_FDCWD, "/root/.nano/search_history", O_RDONLY) = -1 ENOENT (No such file or directory)
[pid 3483729] ioctl(1, TCGETS, {B38400 opost isig icanon echo ...}) = 0
[pid 3483729] stat("/root/snap/lxd/22292/.terminfo", 0x55dcb34dbb40) = -1 ENOENT (No such file or directory)
[pid 3483729] stat("/etc/terminfo", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
--
[pid 3483729] openat(AT_FDCWD, "/tmp/.lxd_editor_3443541145.yaml.swp", O_WRONLY|O_CREAT|O_EXCL|O_APPEND, 0666) = 3
[pid 3483729] fcntl(3, F_GETFL) = 0x8401 (flags O_WRONLY|O_APPEND|O_LARGEFILE)
[pid 3483729] fstat(3, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
[pid 3483729] write(3, "b0nano 4.8\0\0\0\0\0\0\0\0\0\0\0\0\0\0Q(5\0root"..., 1024) = 1024
[pid 3483729] close(3) = 0
[pid 3483729] getcwd("/root", 4097) = 6
[pid 3483729] stat("/tmp/lxd_editor_3443541145.yaml", {st_mode=S_IFREG|0600, st_size=661, ...}) = 0
--
[pid 3483729] poll([{fd=0, events=POLLIN}], 1, 0) = 0 (Timeout)
[pid 3483729] poll([{fd=0, events=POLLIN}], 1, 0) = 0 (Timeout)
[pid 3483729] write(1, "\33[H", 3) = 3
[pid 3483729] write(1, "\33(B\33[0;7m GNU nano 4.8 "..., 138) = 138
[pid 3483729] write(1, "\33(B\33[m", 6) = 6
[pid 3483729] rt_sigaction(SIGTSTP, {sa_handler=0x55dcb306c9f0, sa_mask=~[KILL STOP RTMIN RT_1], sa_flags=SA_RESTORER, sa_restorer=0x7f01efbf3210}, NULL, 8) = 0
[pid 3483729] write(1, "\7", 1) = 1
--
[pid 3483729] ioctl(0, TCGETS, {B38400 opost isig icanon echo ...}) = 0
[pid 3483729] ioctl(0, SNDCTL_TMR_START or TCSETS, {B38400 opost isig icanon echo ...}) = 0
[pid 3483729] ioctl(0, TCGETS, {B38400 opost isig icanon echo ...}) = 0
[pid 3483729] write(2, "Error in /etc/nanorc on line 244"..., 102Error in /etc/nanorc on line 244: Error expanding /usr/share/nano/*.nanorc: No such file or directory
) = 102
[pid 3483729] exit_group(0) = ?
[pid 3483729] +++ exited with 0 +++
This does seem that it’s using its a custom bundled version of nano (really?!) and therefore makes me wonder whether it’s chrooted or something.
Anyway, I just thought I’d report it, I don’t know if there’s anything I can do about this spurious error.
Platform info: Ubuntu 20.04, upgraded from 18.04:
root@nuc1:~# snap list
Name Version Rev Tracking Publisher Notes
core 16-2.54.2 12603 latest/stable canonical✓ core
core18 20211215 2284 latest/stable canonical✓ base
core20 20220114 1328 latest/stable canonical✓ base
lxd 4.22 22292 latest/stable canonical✓ -