scp fails to copy files from sysfs

Bug #2069305 reported by Alfonso Sanchez-Beato
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
openssh (Ubuntu)
Triaged
Undecided
Unassigned

Bug Description

When I try to copy some files from sysfs directly using scp it fails. This can be reproduced locally with:

ubuntu@ubuntu:~$ scp ubuntu@localhost:/sys/firmware/efi/efivars/BootOrder-8be4df61-93ca-11d2-aa0d-00e098032b8c .
ubuntu@localhost's password:
BootOrder-8be4df61-93ca-11d2-aa0d-00e098032b8c 0% 0 0.0KB/s --:-- ETA
scp: read remote "/sys/firmware/efi/efivars/BootOrder-8be4df61-93ca-11d2-aa0d-00e098032b8c" : Failure

The file is readable:

ubuntu@ubuntu:~$ od -b /sys/firmware/efi/efivars/BootOrder-8be4df61-93ca-11d2-aa0d-00e098032b8c
0000000 007 000 000 000 002 000 003 000 000 000 004 000
0000014

And I see this in the journal:

Jun 13 13:30:49 ubuntu sftp-server[5115]: error: process_read: seek "/sys/firmware/efi/efivars/BootOrder-8be4df61-93ca-11d2-aa0d-00e098032b8c": Illegal seek

This was working fine in 22.04. Interestingly, using a scp 22.04 client with a 24.04 kernel works fine.

Revision history for this message
Mitchell Dzurick (mitchdz) wrote :

Thank you for taking the time to make this bug Alfonso!

I can reproduce this in a noble-vm very easily.

$ lxc launch ubuntu:noble n-vm --vm
$ lxc shell n-vm
# rm /etc/ssh/sshd_config.d/60-cloudimg-settings.conf
# sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
# echo "root:pass" | chpasswd
# systemctl restart ssh
# scp root@localhost:/sys/firmware/efi/efivars/BootOrder-8be4df61-93ca-11d2-aa0d-00e098032b8c .

However it's not just every file in /sys/, there are some files you can still scp. For example:

# scp root@localhost:/sys/firmware/efi/runtime .

You can also cp the efi variable file and then scp it fine.
# cp /sys/firmware/efi/efivars/BootOrder-8be4df61-93ca-11d2-aa0d-00e098032b8c ./
# scp root@localhost:/root/BootOrder-8be4df61-93ca-11d2-aa0d-00e098032b8c ./

Revision history for this message
Mitchell Dzurick (mitchdz) wrote :

Just for fun, I also tried the latest openssh-client that we have in Jammy and see it works too -

# wget https://launchpad.net/ubuntu/+archive/primary/+files/openssh-client_8.9p1-3ubuntu0.7_amd64.deb
# dpkg -i ./openssh-client_8.9p1-3ubuntu0.7_amd64.deb
# scp root@localhost:/sys/firmware/efi/efivars/BootOrder-8be4df61-93ca-11d2-aa0d-00e098032b8c .
root@localhost's password:
BootOrder-8be4df61-93ca-11d2-aa0d-00e098032b8c 100% 20 27.4KB/s 00:00

Revision history for this message
Mitchell Dzurick (mitchdz) wrote :

To be complete, I also tried openssh-server_9.3p1-1ubuntu3.3 and see this issue on noble.

Which leaves something changed between openssh-client 8.9 and 9.3 to cause this behavior.

Changed in openssh (Ubuntu):
status: New → Triaged
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.