顯示具有 ubuntu 標籤的文章。 顯示所有文章
顯示具有 ubuntu 標籤的文章。 顯示所有文章

2023年8月1日 星期二

Fix gitlab runner error after VM backup restore processes

Background

The gitlab runner service is unable to start after performing VM backup and restore process (for the sake of increasing storage size)


Problems

The error messages come as follows when I try to start the gitlab runner manually

prodev@storage:~$ sudo gitlab-runner run
Runtime platform                                    arch=amd64 os=linux pid=20037 revision=ac8e767a version=12.6.0
Starting multi-runner from/etc/gitlab-runner/config.toml...  builds=0
Running in system-mode.

Configuration loaded                                builds=0
listen_address not defined, metrics & debug endpoints disabled  builds=0
[session_server].listen_address not defined, session endpoints disabled  builds=0
ERROR: Checking for jobs... forbidden               runner=99ab6a69
ERROR: Checking for jobs... forbidden               runner=eac73045
ERROR: Checking for jobs... forbidden               runner=99ab6a69
ERROR: Checking for jobs... forbidden               runner=eac73045
ERROR: Checking for jobs... forbidden               runner=99ab6a69
ERROR: Runner https://repo.gitlab.dev.hkg.internal.p2mt.com99ab6a6972442b2a52ffe7358cbf8f is not healthy and will be disabled!
ERROR: Checking for jobs... forbidden               runner=eac73045
ERROR: Runner https://gitlab.com/eac73045875b618fea0464590a0fb2 is not healthy and will be disabled!


Solutions

1. Rename config.toml in /etc/gitlab-runner to config.toml.bk

2. Restart gitlab service by "gitlab-runner start"

3. Re-name config.toml.bk back to config.toml

4. Re-start the service again by "gitlab-runner restart"

2022年6月21日 星期二

Configure chrome remote desktop in Ubuntu 20.04 (Updated June 2025)

Problems

Chrome remote desktop creates a new session for remote session, which is not suit my needs, like Windows's remote, I need to "resume" the current session of the original desktop.

Solutions

1. In the host Ubuntu machine, install chrome remote desktop, using the deb provided by Google making use of the command sudo dpkg -i chrome-remote-desktop_current_amd64.deb

2. In the host machine, install chrome remote desktop application, perform the remote host setup following the instructions until you see the remote device appeared in the remote list.

You should see status "Online" in the device list, if it does not,













  • There are cases where "Loaded: masked (Reason: Unit chrome-remote-desktop.service is masked.)" error occurs, if so, run sudo rm /lib/systemd/system/your_app.service  to remove the systemd service of the chrome-remote-desktop and reload the systemd daemon by running sudo systemctl daemon-reload. Re-check the status of the chrome-remote-desktop and active status should be achieved
3.  Modify the file /opt/google/chrome-remote-desktop/chrome-remote-desktop,  change variable FIRST_X_DISPLAY_NUMBER to the output value of the command echo $DISPLAY.

4. Apply the differences manually for the remaining changes mentioned here. Do not use the patch command to patch the file as it may cause failure.

5. Create Xsession file under the config profile of chrome remote desktop using the following command. echo "1" > ~/.config/chrome-remote-desktop/Xsession, where "1" is the $DISPLAY value output mentioned in step #3. (value may vary depending on devices)

6. Restart the chrome remote desktop daemon with sudo systemctl daemon-reload followed by sudo /etc/init.d/chrome-remote-desktop restart. Re-check the chrome remote desktop status by sudo systemctl status chrome-remote-desktop.


Appendix
1. This method does not support wayland, only support Xorg, make sure wayland support is disabled. Edit file /etc/gdm3/custom.conf, make sure WaylandEnable parameter is configured to false

2. When activating through chrome remote desktop UI is not working (e.g.: Unknown error), try using headless enable, navigate to the chrome remote desktop in the remote client, in the left hand side menu, choose "configure through SSH", copy the command provided

DISPLAY= /opt/google/chrome-remote-desktop/start-host --code="4/0AdQt8qgifMrurEQn65gbwYJOA3VrpusSF64i8Fwxfl9Nn6uL7L2KLUdw75HXhpFqlfGG-w" --redirect-url="https://remotedesktop.google.com/_/oauthredirect" --name=$(hostname)

You may need to re-generate the key if the time is expired, copy and paste it to the remote host, follow the setup netvigation to complete the remote host setup

Updated: 4/6/2024

As of chrome remote desktop version v121+,

1. Download the patch file

2. Remove the first 4 lines of the patch file

3. Navigate to /opt/google/chrome-remote-desktop, apply the patch by "sudo patch -Np1 -i /path/to/use_existing_session.patch", update the FIRST_X_DISPLAY_NUMBER variable to the one output using "echo $DISPLAY", and also update value of ~/.config/chrome-remote-desktop/Xsession to the DISPLAY value

4. Update the XSession to disable wayland, set WaylandEnable to false, run "sudo systemctl restart gdm3" to take effect.

5. Re-login Ubuntu (re-configure the chrome remote desktop where possible) "DISPLAY= /opt/google/chrome-remote-desktop/start-host --code="4/0AdLIrYeNopk9TMNaSyMPAXCr25kRpDPi5oUt9w7IJkC5ALTp75JlaKajanli3b3XQ_RDlw" --redirect-url="https://remotedesktop.google.com/_/oauthredirect" --name=$(hostname)"

Patch file backup


Updated: 30/6/2025

As of latest "Ubuntu chrome remote" current session solution, just follow the guide to apply the update of file "/opt/google/chrome-remote-desktop", following the instruction marked here , (backup as following)

rm ~/.config/chrome-remote-desktop/Xsession
echo $DISPLAY | tr -d ':' >> ~/.config/chrome-remote-desktop/Xsession && cd /opt/google/chrome-remote-desktop
sudo cp chrome-remote-desktop chrome-remote-desktop_bak
sudo wget -qO- "https://gist.githubusercontent.com/nightuser/2ec1b91a66ec33ef0a0a67b6c570eb40/raw/b09250dcc9a28f09de93192a948dffb4963c2aca/use_existing_session.patch" | tail -n +5 > ~/use_existing_session.patch
sudo patch -Np1 -i ~/use_existing_session.patch
rm ~/use_existing_session.patch
systemctl restart chrome-remote-desktop@$USER.service
systemctl enable chrome-remote-desktop@${USER}.service
systemctl status chrome-remote-desktop@$USER.service

Path file

References

  1. Use existing session chrome remote desktop patch (Note: the .patch file cannot applied directly to the origin "/opt/google/chrome-remote-desktop/chrome-remote-desktop" , manual applying the differences is necessary.)
  2. How to Install chrome-remote-desktop on Arch
  3. systemd: How to unmask a service whose unit file is empty
  4. Disable wayland support
  5. Sample configuration files

2022年3月23日 星期三

Enable remote control to work even before logging in Ubuntu

Problems

Login to remote PC is not working anymore after rebooting Ubuntu 20.04 remote machine


Solutions

1. SSH to the remote machine
2. Edit file "/etc/gdm3/custom.conf"
3. Add the line "WaylandEnable=false"
4. Restart the gdm with "sudo systemctl restart gdm3"
5. Re-login teamviewer

References

2020年1月9日 星期四

[System] Revive Folder Cannot Open Problem in Ubuntu

Problems
Ubuntu OS has been started for 80 days, and many problems occurs, one annoying issue is unable to open any folders and even more serious unable to use the desktop (unresponsive)


Reasons and Solutions
Seems the daemon / program handling the UI stuffs crashes (nautilus), so seemly kill and restart them solves the issue

ps -A | grep nautilus // gather target pid
sudo kill -9 pid  // kill the program by pid gathered from previous cmd

And that's it ! All desktop functions and folders can be functioned properly again, saving me from restarting the whole system and re-initialize all my programs

References

2018年8月10日 星期五

[Ubuntu] Fix Microsoft Mouse Scroll Distance

Background
When using Microsoft mouse in Ubuntu 16, I found the scrolling distance is too large to adapt to, the following helps to fix it to normal

Solution
1. Run xinput list
2. Then run xinput list-props x | grep 'Scrolling Distance' where x is the id of your input device
3. Run xinput set-prop x 'Evdev Scrolling Distance' 10, 10, 10 to save the desired value
4. Add the command to .profile file if you want to save the settings permenantly

2015年1月23日 星期五

Dual/Multiple OS Installation

We often need to install multiple OS in one system, for example
  1. Windows 8 & Ubuntu 12
  2. Ubuntu 12 & Ubuntu 14
  3. Windows 8 & Ubuntu 12 & Ubuntu 14...
We often follow the below instructions to achieve (assuming you have ONE Windows pre-installed and ONE Ubuntu pre-installed and you want to install the third OS, also Ubuntu)

  1. Navigate to the BIOS, set the USB Ubuntu stick as the booting machine
  2. Turn off the security boot to prevent the laptop not loading the USB (subjected to change on different BIOS)
  3. Turn off the EUFI boot specifically for Windows 8 to avoid always booting to Windows instead of Ubuntu
  4. Boot overriding the USB drive (subjected to change on different BIOS), if no boot overriding exists, just follow the old school boot priority function
  5. Make a new partition for your Ubuntu, remember if you lack disk space, you will need to do partition resizing and  be-careful not to override the Windows partition or you may not be able to boot into Windows again!! Before installing the new OS, make sure you which partition which OS refers to.
  6. After adding/resizing the partition, format it with ext4
  7. You will need to provide the mounting point (I usually pick "/") and create a very small bootloader partition called "Reserved BIOS Boot Area" for GRUB's code, this is VERY IMPORTANT, grub provides a boot menu for you to navigate to different OS, we need to provide it with some space (normally as small as 1MB), after creating both partitions, you are okay to proceed to the installation processes.
  8. Follow the Ubuntu install guide to finish the installation. 
  9. In the final step, Ubuntu will ask you to restart the machine, just do so.
  10. Luckily you will find a Linux boot menu listing all the partitions included (e.g. /dev/sda1,sda2.... etc.) but we will miss our newly installed OS partition, we need to update the grub file to reflect the changes (OS addition)
  11. Boot into the pre-installed Ubuntu (the one before our third OS installation), navigate to /etc/default/grub and use text editior to edit it.
  12. We only interest in GRUB_DEFAULT, this controls which OS the default OS should boot in, choose the one you want and save the setting
  13. Remember after updating the file, you will need to UPDATE by sudo update-grub , if not the newly installed OS will not appear in the grub menu
  14. Reboot the machine and you will see the newly installed OS appeared.
Reference:
  1. http://askubuntu.com/questions/16042/how-to-get-to-the-grub-menu-at-boot-time
  2. http://askubuntu.com/questions/343268/how-to-use-manual-partitioning-during-installation 
 

2015年1月7日 星期三

[Ubuntu] Installing Symantec Endpoint Protection for Linux (SEPFL)

Although there is only a very few chance for us to install SEP in Ubuntu, but I have chance to do this, so I share my experience here.

Steps
SEPFL does not support 32 bit Ubuntu, therefore you may need to recompile the auto protection module.
  • Decompress the source code from the following directory
    ./yourSEPFLFileDir/src/ap-kernelmodule.tar.bz2
  • Recompile the Symantec Endpoint to support 32 bit Ubuntu
    sudo ./build.sh --kernel-dir /lib/modules/$(uname -r)/build
  • Once success, the auto protection of SEPFL should work as follows
References

2014年12月29日 星期一

[Ubuntu] Recommended package for arp-scan

arp-scan is a good tool to perform arp-scanning which can

  1. Do troubleshooting for IP confliction
  2. IP<>MAC mapping
  3. Get production manufacturer
Just install with: sudo apt-get install arp-scan

Common cmd used:
  • Specify a list of IP addresses as arguments: sudo arp-scan -I eth0 192.168.1.1 192.168.1.2 192.168.1.3
  • Specify network/bits: sudo arp-scan -I eth0 192.168.1.0/24
  • Specify network:netmask: sudo arp-scan -I eth0 192.168.1.0:255.255.255.0
  • Specify address range: sudo arp-scan -I eth0 192.168.1.3-192.168.1.27
  • Read a list of IP addresses from a file: sudo arp-scan -I eth0 --file=ip-address-list.txt

2014年12月15日 星期一

Customize unity sidebar using shell command in Ubuntu

Environment
OS: Ubuntu 12.04.5 (32 bit edition)


Steps
1) Navigate to /usr/share/applications, it shows all the *.desktop files

**Make a .desktop file with the following format if you want to add your custom scripts / softwares to sidebar**

[Desktop Entry]
Type=Application
Terminal=true
Name=unmount-mount
Icon=/path/to/icon/icon.svg
Exec=/path/to/file/mount-unmount.sh

2) Add/remove the designated desktop files to reflect the unity sidebar

3) Run setsid unity to refresh the UI for sidebar changes