Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove hostname dependency for Archlinux #547

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

alimirjamali
Copy link
Contributor

@alimirjamali alimirjamali force-pushed the issue-9710-hostname-on-arch branch from 8fb5147 to a7ebc6d Compare January 14, 2025 17:50
Copy link

codecov bot commented Jan 14, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 70.57%. Comparing base (74d07bb) to head (d0cab32).
Report is 6 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #547   +/-   ##
=======================================
  Coverage   70.57%   70.57%           
=======================================
  Files           3        3           
  Lines         469      469           
=======================================
  Hits          331      331           
  Misses        138      138           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@qubesos-bot
Copy link

qubesos-bot commented Jan 17, 2025

OpenQA test summary

Complete test suite and dependencies: https://openqa.qubes-os.org/tests/overview?distri=qubesos&version=4.3&build=2025012310-4.3&flavor=pull-requests

Test run included the following:

New failures, excluding unstable

Compared to: https://openqa.qubes-os.org/tests/overview?distri=qubesos&version=4.3&build=2024111705-4.3&flavor=update

  • system_tests_network_updates

    • TC_11_QvmTemplateMgmtVM_whonix-gateway-17: test_010_template_install (failure)
      qvm-template: error: Template 'debian-12-minimal' not found.
  • system_tests_dispvm

    • TC_20_DispVM_fedora-41-xfce: test_100_open_in_dispvm (failure)
      AssertionError: './open-file test.txt' failed with ./open-file test...
  • system_tests_kde_gui_interactive

    • gui_keyboard_layout: wait_serial (wait serial expected)
      # wait_serial expected: "echo -e '[Layout]\nLayoutList=us,de' | sud...
  • system_tests_guivm_vnc_gui_interactive

    • gui_filecopy: unnamed test (unknown)
    • gui_filecopy: Failed (test died)
      # Test died: no candidate needle with tag(s) 'file-copy-prompt' mat...
  • system_tests_basic_vm_qrexec_gui_ext4

  • system_tests_guivm_gui_interactive

    • clipboard_and_web: unnamed test (unknown)
    • clipboard_and_web: Failed (test died)
      # Test died: no candidate needle with tag(s) 'clipboard-copy-notifi...

Failed tests

10 failures
  • system_tests_network_updates

    • TC_11_QvmTemplateMgmtVM_whonix-gateway-17: test_010_template_install (failure)
      qvm-template: error: Template 'debian-12-minimal' not found.
  • system_tests_dispvm

    • TC_20_DispVM_fedora-41-xfce: test_100_open_in_dispvm (failure)
      AssertionError: './open-file test.txt' failed with ./open-file test...
  • system_tests_kde_gui_interactive

    • gui_keyboard_layout: wait_serial (wait serial expected)
      # wait_serial expected: "echo -e '[Layout]\nLayoutList=us,de' | sud...

    • gui_keyboard_layout: Failed (test died)
      # Test died: command 'test "$(cd ~user;ls e1*)" = "$(qvm-run -p wor...

  • system_tests_basic_vm_qrexec_gui_zfs

    • switch_pool: Failed (test died)
      # Test died: command 'qubes-dom0-update -y zfs' failed at /usr/lib/...
  • system_tests_guivm_vnc_gui_interactive

    • gui_filecopy: unnamed test (unknown)
    • gui_filecopy: Failed (test died)
      # Test died: no candidate needle with tag(s) 'file-copy-prompt' mat...
  • system_tests_basic_vm_qrexec_gui_ext4

  • system_tests_guivm_gui_interactive

    • clipboard_and_web: unnamed test (unknown)
    • clipboard_and_web: Failed (test died)
      # Test died: no candidate needle with tag(s) 'clipboard-copy-notifi...

Fixed failures

Compared to: https://openqa.qubes-os.org/tests/119126#dependencies

2 fixed
  • system_tests_extra

    • TC_00_QVCTest_whonix-gateway-17: test_010_screenshare (failure)
      ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^... AssertionError: 0 == 0
  • system_tests_audio@hw1

Unstable tests

@marmarek
Copy link
Member

There is more: hostname is also set on the VM startup: https://github.com/QubesOS/qubes-core-agent-linux/blob/main/vm-systemd/qubes-early-vm-config.sh#L22

@alimirjamali
Copy link
Contributor Author

alimirjamali commented Jan 20, 2025

There is more: hostname is also set on the VM startup: https://github.com/QubesOS/qubes-core-agent-linux/blob/main/vm-systemd/qubes-early-vm-config.sh#L22

This one uses the SET NAME feature of hostname command. I will modify the bash script to check for the existence of /usr/bin/hostname and revert to hostnamectl if it does not exist to use hostnamectl as it is only applicable for systemd. I will also change cat /etc/hostname to hostnamectl hostname in the original PR as suggested by @Justasic

@alimirjamali alimirjamali force-pushed the issue-9710-hostname-on-arch branch from a7ebc6d to 2056606 Compare January 20, 2025 20:08
@marmarek
Copy link
Member

Now setting hostname is broken on Fedora (at least): https://openqa.qubes-os.org/tests/126217#step/screenlocker_idle_watch/10 (see that hostname remained "fedora", should be "work).

@marmarek
Copy link
Member

Logs say:

[2025-01-21 05:39:58] [    4.550584] hostnamectl[512]: �[0;1;31mFailed to connect to system scope bus via local transport: No such file or directory�[0m

I guess it's too early for hostnamed service...

@alimirjamali
Copy link
Contributor Author

I guess it's too early for hostnamed service...

Maybe $(echo "$name" > /etc/hostname) could work but it is a little bit ugly.

@marmarek
Copy link
Member

But will that be enough? Something needs to actually make the sethostname syscall...
Maybe writing to /proc/sys/kernel/hostname will be enough?

@alimirjamali
Copy link
Contributor Author

But will that be enough? Something needs to actually make the sethostname syscall... Maybe writing to /proc/sys/kernel/hostname will be enough?

Does not work with root. I get Permission denied on echo something > /proc/sys/kernel/hostname.

@alimirjamali alimirjamali force-pushed the issue-9710-hostname-on-arch branch from 2056606 to 748b48e Compare January 21, 2025 12:54
@alimirjamali
Copy link
Contributor Author

I modified it a little bit (only try alternative solution if hostname binary does not exist). And trying to write $nameto/etc/hostname`, hoping systemd would pick it up on archlinux

@marmarek
Copy link
Member

Does not work with root. I get Permission denied on echo something > /proc/sys/kernel/hostname.

You sure you haven't done the classic sudo echo pitfall? Writing there does work for me...

@marmarek
Copy link
Member

marmarek commented Jan 21, 2025

Anyway, I guess /etc/hostname needs to be written to too (if exists)

fixes: QubesOS/qubes-issues#9710

`hostname` is replaced with `hostnamectl` on Archlinux
@alimirjamali alimirjamali force-pushed the issue-9710-hostname-on-arch branch from 748b48e to d0cab32 Compare January 21, 2025 13:20
@alimirjamali
Copy link
Contributor Author

Anyway, I guess /etc/hostname needs to be written to too (if exists)

I amended the PR to write to both. Hope it works well this time.

@marmarek
Copy link
Member

What should happen if /etc/hostname is missing? For example I don't see this file on Fedora. But hostnamectl hostname something does create it, so maybe the current version is fine?

@alimirjamali
Copy link
Contributor Author

What should happen if /etc/hostname is missing? For example I don't see this file on Fedora. But hostnamectl hostname something does create it, so maybe the current version is fine?

The way I modified the script (my last commit), it uses hostname if it exists (on Fedora & Debian machines). So nothing has really changed on Fedora & Debian. On Archlinux, it should create /etc/hostname and update /proc/sys/kernel/hostname to be on the safe side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

qubes-vm-core Archlinux package uses hostname (from inetutils) which is not available
3 participants