Mauro Morales

software developer

Tag: openSUSE

  • Revived my Dell XPS 9350

    My work laptop has been giving me some trouble since I first installed openSUSE Tumbleweed. At first, it was just small annoyances, like not properly syncing the time. But installing the OS again is a bit of a hassle, as much as I enjoy doing it, so I found a workaround to reset it whenever it broke. However, last week it started freezing multiple times during the day, the workaround was to hard shut down the machine, which was very annoying, but I was hoping would get fixed in a next upgrade. Tumbleweed has weekly upgrades, so waiting wasn’t that big of a deal. But with the latest update, my Docker setup stopped working with Earthly, which is my bread and butter for Kairos, so I decided to try a different distro.

    Switching distros can be a big deal, and I didn’t want to learn a new package manager and special configurations, so I went with something I’ve already used before, Ubuntu 23.04. But even then, I first waned to give it a try, just in case there was any red flag. So, I dusted off my personal Dell XPS 9350, an 8-year-old laptop, to test it out. So far, everything seems to be working well, much slower than the workstation but still good enough and way more portable, so I’m probably going to start leaving my workstation at the desk.

  • Installing openSUSE Tumbleweed On the Dell XPS 13

    This post will show you how install openSUSE’s rolling release, Tumbleweed, on the Dell XPS 13 9350 FHD.

    Update 2016–06–30: Bios 1.4.4 is out.

    Update 2016–06–22: The kernel flag is not needed anymore since kernel 4.6 which was introduced around Tumbleweed version 20160612.

    Update 2016–05–04: Added a section to fix the sound issues when using headphones.

    PREPARATION

    1. Create a recovery USB in case you want return the machine to it’s original state.
    2. Get yourself a copy of openSUSE Tumbleweed.
    3. Create a bootable USB. There are instructions for the Linux, Windows and OS X.

    UPDATE THE BIOS

    Warning: Do not reboot the machine when the BIOS update is running!

    1. Download the latest BIOS update (1.3.3 at the time of writing).
    2. Save it under /boot/EFI.
    3. Reboot the machine.
    4. Press F12 and select BIOS update.

    INSTALLATION

    1. Reboot the machine.
    2. Press F12 and configure to use Legacy BIOS and reboot.
    3. Boot from the Tumbleweed USB key and follow the installer instructions until you get to the partitioning stage.
    4. Remove all partitions and create an MSDOS partition table.
    5. Add your desired partitions inside the just created partition table. In my case I have a root, a swap and a home partition.
    6. Finish the installation process.

    FIXING THE FLICKERING DISPLAY

    Note: This issue was fixed on kernel 4.6, here is the bugzilla link.

    There is a reported issue that causes your screen to flicker. Until the fix gets merged into the kernel you can do this hack:

    1. Inside /etc/default/grub add the kernel flag i915.enable_rc6=0
    2. grub2-mkconfig -o /boot/grub2/grub.cfg
    3. Restart your machine.

    FIXING THE SOUND WHEN USING HEADPHONES

    When using headphones you will notice a high pitch when no sound is being played and a loud cracking sound when starting/stopping sound from an application.

    First fix the issue with the high pitch by setting the microphone boost volume.

    amixer -c 0 cset 'numid=10' 1

    To fix the problem with the cracking sound the only fix that I’ve found so far is to disable the SOUND_POWER_SAVE_ON_BAT option on tlp.

    augtool set /files/etc/default/tlp/SOUND_POWER_SAVE_ON_BAT 0

    You will need to reapply the battery settings for changes to take effect and set it up to be started at boot time.

    systemctl enable tpl.service --now

    Have a lot of fun…

  • Running Multiple Redis Instances

    This article will teach you how to run one or more Redis instances on a Linux server using systemd to spawn copies of a service.

    INSTALLING REDIS

    The easiest way to install Redis in Linux is with your distributions package manager. Here is how you would do it on openSUSE:

    sudo zypper install redis

    In case your distribution doesn’t provide a Redis package, you can always follow the upstream instructions to compile it from scratch.

    CONFIGURING A REDIS INSTANCE

    1. Make a copy of the example/default file that is provided by the packagecd /etc/redis/ cp default.conf.example my_app.conf Use a name that will help you recognize the purpose of the instance. For example if each instance will be mapped to a different application give it the name of the application. If each instance will be mapped to the same application use the port in which it will be running.
    2. Change the ownership of the newly created configuration file to user “root” and group “redis”chown root.redis my_app.conf
    3. ConfigurationAdd a “pidfile”, a “logfile” and a “dir” to the .conf file.pidfile /var/run/redis/my_app.pid logfile /var/log/redis/my_app.log dir /var/lib/redis/my_app/ Each of these attributes has to match with the name of the configuration file without the extension.Make sure the “daemonize” option is set to “no” (this is the default value). If you set this option to yes Redis and systemd will interfere with each other when spawning the processes.daemonize no Define a “port” number and remember that each instance should be running on a different port.port 6379
    4. Create the database directory at the location given in the configuration fileinstall -d -o redis -g redis -m 0750 /var/lib/redis/my_app The database directory has to be owned by user “redis” and group “redis” and with permissions 750.

    Repeat these steps for every instance you want to set up. In my case I set up a second instance called “my_other_app”

    .
    ├── default.conf.example
    ├── my_app.conf
    └── my_other_app.conf

    ADDING UNITS TO SYSTEMD FOR THE REDIS SERVICE

    In order for systemd to know how to enable and start each instance individually you will need to add a service unit inside the system configuration directory located at /etc/systemd/system. For convenience you might also want to start/stop all instances at once. For that you will need to add a target unit.

    In case you installed Redis on openSUSE these two files will be already provided for you under the system unit directory /usr/lib/systemd/system.

    1. Create the service unit file “redis@.service” with the following contents:[Unit] Description=Redis After=network.target PartOf=redis.target[Service] Type=simple User=redis Group=redis PrivateTmp=true PIDFile=/var/run/redis/%i.pid ExecStart=/usr/sbin/redis-server /etc/redis/%i.conf Restart=on-failure[Install] WantedBy=multi-user.target redis.target The unit file is separated in sections. Each section consists of variables and the value assigned to them. In this example:
      • After: when the Redis instance is enabled it will get started only after the network has been started.
      • PartOf: this instance belongs to the redis.target and will get started/stopped as part of that group.
      • Type: simple means the service process doesn’t fork.
      • %i: a specifier that is expanded by systemd to the “my_app” instance.
    2. Create the target unit file “redis.target” with the following contents:[Unit] Description=Redis target allowing to start/stop all redis@.service instances at once

    INTERACTING WITH REDIS

    If everything went as expected you should be able to interact with the individual instances:

    systemctl start redis@my_app
    systemctl enable redis@my_other_app

    And also with all the instances at the same time:

    systemctl restart redis.target
    systemctl stop redis.target

    TROUBLESHOOTING

    If things didn’t go as expected and you cannot start the instance make sure to check the instance’s status:

    systemctl status redis@my_app

    If the issue doesn’t show up there then check systemd’s journal:

    journalctl -u redis@my_app

    For example if you forgot to give the right permissions to the configuration file you’d see something like this inside the journal:

    Apr 23 10:02:53 mxps redis-server[26966]: 26966:C 23 Apr 10:02:53.917
    # Fatal error, can’t open config file ‘/etc/redis/my_app.conf’

    ACKNOWLEDGMENTS

    • Thanks to the openSUSE Redis package maintainers for creating such a nice package that you can learn from it.
    • The book How Linux Works provided the details on how systemd instances work.
  • Running openSUSE 13.2 on Linode

    Linode is one of my favorite VPS providers out there. One of the reasons why I like them is because they make it extremely easy to run openSUSE. This post is a quick tutorial on how to get you started.

    The first time you log in you will be presented with the different Linode plans. And the Location where your server will reside.

    I’ll choose the smallest plan

    Once you see your Linode listed, click on it’s name

    Now click on “Deploy an image”

    In there we will select openSUSE 13.2, the amount of space in disk. You can leave the defaults which will choose for the full disk size with a 256MB swap partition. Choose your password and click Deploy.

    This will take a bit but as soon as it’s done you will be able to Boot your machine.

    Finally click on the “Remote Access” tab so you can see different options to log into your machine.

    I personally like to ssh in from my favorite terminal app

    ssh root@10.0.0.10

    You will be welcomed by openSUSE with the following message:

    Have a lot of fun...
    linux:~ #

    Now you can play with your new openSUSE 13.2 box. Enjoy!